| | |
| | | } catch (Exception e) {
|
| | | }
|
| | | final String name = nickName;
|
| | | // LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
|
| | | LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
|
| | |
|
| | | // 获取渠道ID与会员ID
|
| | | if ("share".equalsIgnoreCase(source)) {
|
| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | |
|
| | | public static final int SALES_ASC = 1;
|
| | | public static final int SALES_DESC = 2;
|
| | |
|
| | |
| | | public static final int TKRATE_ASC = 5;
|
| | | public static final int TKRATE_DESC = 6;
|
| | |
|
| | | |
| | | public static final int PROPOR_ASC = 7;
|
| | | public static final int PROPOR_DESC = 8;
|
| | |
|
| | |
|
| | | /**
|
| | | * 保存修改精品库商品关联信息
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request, PrintWriter out) {
|
| | | public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | |
| | | public void removeGoods(String callback, String ids, PrintWriter out) {
|
| | | try {
|
| | | Gson gson = new Gson();
|
| | | List<Long> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (goodsIds == null || goodsIds.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未检测到移除商品数据")));
|
| | |
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | |
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | |
|
| | | |
| | | Long id = taoBaoGoodsBrief.getId();
|
| | | idBuf.append(id + ",");
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | for (QualityFactory selectionGoods : selectionList) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | |
|
| | | // 设置图片大小
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize220Img(taoBaoGoodsBrief.getPictUrl()));
|
| | |
|
| | | String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
|
| | | if (auctionUrl != null && auctionUrl.trim().length() > 0 && auctionUrl.contains("id=null")) {
|
| | |
| | |
|
| | | map.put("goodsSource", reslutSource);
|
| | |
|
| | | |
| | | map.put("selectionGoods", selectionGoods);
|
| | |
|
| | | /* 商品销售状态: 0 在售 1停售 */
|
| | |
| | | }
|
| | |
|
| | | map.put("saleStae", saleStae);
|
| | | |
| | |
|
| | | /* 1 定向计划 2 营销返利 、高佣 3 普佣 */
|
| | | Integer includeDxjh = taoBaoGoodsBrief.getIncludeDxjh();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | map.put("couponPrice", couponPrice);
|
| | |
| | | // 预计收益
|
| | | map.put("estimateProfit", estimateProfit);
|
| | |
|
| | | |
| | | BigDecimal couponAmount = taoBaoGoodsBrief.getCouponAmount();
|
| | | if (couponAmount != null && zkPrice != null) {
|
| | | BigDecimal propors = couponAmount.divide(zkPrice ,10 ,BigDecimal.ROUND_HALF_DOWN);
|
| | |
| | | } else {
|
| | | map.put("propor", 0);
|
| | | }
|
| | | |
| | |
|
| | | /* 商品标签列表 */
|
| | | Long id = taoBaoGoodsBrief.getId();
|
| | |
| | | * 获取商品信息 以及对应标签列表;此商品标签候选项
|
| | | *
|
| | | * @param callback
|
| | | * @param id 精选id
|
| | | * @param id
|
| | | * 精选id
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 单个商品贴上标签
|
| | | *
|
| | |
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
|
| | | // out.print(JsonUtil.loadJSONP(callback,
|
| | | // JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
|
| | | // return;
|
| | | // }
|
| | |
|
| | |
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | //
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
|
| | | // out.print(JsonUtil.loadJSONP(callback,
|
| | | // JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
|
| | | // return;
|
| | | // }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | } catch (QualityFactoryException e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping(value = "queryMyLabels")
|
| | | public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, |
| | | String ids, HttpServletRequest request, PrintWriter out) {
|
| | | public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, String ids,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:103")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Long id = idList.get(0);
|
| | |
|
| | |
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | // 商品标签列表
|
| | | List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, |
| | | pageSize, id);
|
| | | List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, pageSize, id);
|
| | |
|
| | | if (labelList == null || labelList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无标签"));
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryLabel")
|
| | | public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, |
| | | String ids, HttpServletRequest request, PrintWriter out) {
|
| | | public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, String ids,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
|
| | | return;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addBatchcGoodsLabel")
|
| | | public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request, PrintWriter out) {
|
| | | public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(labIds)) {
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 批量添加标签 --- 精品库(随机权重)
|
| | | * |
| | | * @param callback
|
| | | * @param request
|
| | | * @param out @param 权重范围 大值
|
| | | * @param 佣金范围 小值
|
| | | * @param out
|
| | | * @param 权重范围
|
| | | * 大值
|
| | | * @param 佣金范围
|
| | | * 小值
|
| | | */
|
| | | @RequestMapping(value = "setWeightBatch")
|
| | | public void setWeightBatch(String callback,String ids, Integer weight,Integer weightSmall, |
| | | Integer weightLarge, HttpServletRequest request, PrintWriter out) {
|
| | | public void setWeightBatch(String callback, String ids, Integer weight, Integer weightSmall, Integer weightLarge,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需操作的商品")));
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | |
| | | import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | @Resource
|
| | | private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | |
|
| | | /**
|
| | | * 首页配置信息
|
| | |
| | | floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1);
|
| | | }
|
| | | } else {
|
| | | UserTaoLiJinOrigin userTaoLiJin = uerTaoLiJinOriginService.getByUidAndOrigin(uid, TaoLiJinOriginEnum.newbiesWin.name());
|
| | | UserTaoLiJinOrigin userTaoLiJin = uerTaoLiJinOriginService.getByUidAndOrigin(uid,
|
| | | TaoLiJinOriginEnum.newbiesWin.name());
|
| | | if (userTaoLiJin == null) {
|
| | | floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1);
|
| | | }
|
| | |
| | | data.put("htmlLink", configService.get("index_html_link_android"));
|
| | | }
|
| | |
|
| | | // 判断新老用户
|
| | | UserActiveLog da = null;
|
| | | if (uid != null)
|
| | | da = userActiveLogService.getFirstActiveInfo(uid);
|
| | | // 新人
|
| | | if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) {
|
| | | data.put("userTimeType", 0);
|
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | data.put("hotFuctionLink", configService.get("hot_function_url"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 消息中心弹框
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST)
|
| | | public void getTaoBaoCartConfig(AcceptData acceptData, String position, Long uid, PrintWriter out) {
|
| | |
| | | GoodsClass goodsClass = goodsClassService.getGoodsClassCache(gcid);
|
| | | if (goodsClass == null) {
|
| | | out.print(JsonUtil.loadFalseResult("不存在该分类"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (page < 1)
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | |
| | | @Resource
|
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | |
|
| | | private void doTaoLiJinBuy(Long uid, Long auctionId, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | TaoBaoLink taoBaoLink;
|
| | | try {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuyWithOutFanLi(uid, auctionId);
|
| | | } catch (ShareGoodsException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | return;
|
| | | }
|
| | | data.put("native", true);
|
| | | JSONObject link = new JSONObject();
|
| | | link.put("clickUrl", taoBaoLink.getClickUrl());
|
| | | link.put("couponUrl", taoBaoLink.getCouponLink());
|
| | | data.put("type", 1);
|
| | | data.put("link", link);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取淘宝的分享链接
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if ("taolijin_buy".equalsIgnoreCase(source)) {
|
| | | doTaoLiJinBuy(uid, auctionId, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | boolean isNative = false;
|
| | | String pid = null;
|
| | |
| | | pidType = PidUser.TYPE_FANLI_IOS;
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = null;
|
| | |
|
| | | // 是返利商品库的商品
|
| | | if (specialConvert) {
|
| | | if (!StringUtil.isNullOrEmpty(specialId)) {
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | // 判定为老用户:
|
| | | // 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord == 0) {
|
| | | taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId);
|
| | |
| | | businessEmergent110Service.buyTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 是否在参与推广
|
| | |
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | 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.entity.taobao.TaoBaoSearchResult;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSpecialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.HomeRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.DeviceSexService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | |
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
|
| | | import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.tlj.SpreadHongBao;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @Resource
|
| | | private HomeRecommendGoodsService homeRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | // 获取浏览记录
|
| | | @RequestMapping(value = "getscanhistory", method = RequestMethod.POST)
|
| | | public void getScanHistory(AcceptData acceptData, String uid, int page, Integer source, PrintWriter out) {
|
| | | public void getScanHistory(AcceptData acceptData, String uid, int page, PrintWriter out) {
|
| | | if (page < 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "page不小于0"));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "不存在该系统"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<ScanHistoryV2> list = scanHistoryV2Service.getScanHistoryByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20, source);
|
| | | |
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20);
|
| | | long count = scanHistoryV2Service.getCountByDeviceOrUid(
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), source);
|
| | | |
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice());
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | JSONArray array = new JSONArray();
|
| | |
| | | * 防止请求频率过高
|
| | | *
|
| | | */
|
| | | if (Constant.IS_OUTNET) {
|
| | | // if (Constant.IS_OUTNET) {
|
| | | String key = "linkParse-" + acceptData.getDevice() + "-" + id;
|
| | |
|
| | | String value = redisManager.getCommonString(key);
|
| | |
| | | return;
|
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 5);// 5s间隔
|
| | | }
|
| | | // }
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | if (Constant.IS_TEST) {
|
| | | List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
|
| | | imei, idfa, page);
|
| | |
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, rate + "", null);
|
| | | if (page < 3)
|
| | | extra.setRecommend(true);
|
| | |
|
| | | try {
|
| | | array.add(gson.toJson(extra));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | System.out.println(new Gson().toJson(goods));
|
| | | }
|
| | | }
|
| | |
|
| | | if (page == 1) {
|
| | | List<TLJBuyGoods> list = tljBuyGoodsService
|
| | | .listByDay(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | if (list.size() >= 3)
|
| | | list = list.subList(0, 3);
|
| | | if (list.size() > 0)
|
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | TLJBuyGoods goods = list.get(i);
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE + "", null);
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | | TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
|
| | | vo.setLeft(goods.getLeftHongBaoCount());
|
| | | vo.setMoney(hongBao);
|
| | | vo.setTagName("付款立减 " + hongBao);
|
| | | vo.setTip("");
|
| | | vo.setTotal(goods.getTotalHongBaoCount());
|
| | | extra.setTljBuyHongBao(vo);
|
| | | extra.setPictureTag(new ClientTextStyleVO("立减TOP" + (i + 1), "#E5005C", "#FCE431", null));
|
| | | extra.setRecommend(true);
|
| | | extra.setSpreadMoney(vo.getTagName());
|
| | | array.add(0, gson.toJson(extra));
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", array);
|
| | | data.put("count", 1000);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 从推荐来
|
| | | if (page <= 1) {
|
| | | array.clear();
|
| | |
| | |
|
| | | // filter
|
| | | try {
|
| | |
|
| | | gList = daTaoKeGoodsDetailService.filterTaoBaoGoods(gList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | |
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | |
| | |
|
| | | data.put("listTip", listText);
|
| | | }
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效。");
|
| | | spreadHongBao.setTip("当日领取,当日内使用,过期失效");
|
| | | goodsJson.put("spreadHongBao", spreadHongBao);
|
| | |
|
| | | // 用户剩余可以淘礼金验证
|
| | |
| | | goodsJson.put("tljNum", tljNum);
|
| | | }
|
| | |
|
| | | } else if (from != null && from.equals("taolijin_buy")) {
|
| | | noRebateHelpLink=configService.get("zigoulijian_nofanli_help");
|
| | | // 查询分享库
|
| | | TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(goods.getAuctionId(),
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | if (buyGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "自购立减红包过期"));
|
| | | return;
|
| | | }
|
| | |
|
| | | fanliValid = true;
|
| | | goodsJson.put("shareValid", false);
|
| | | String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString();
|
| | | TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
|
| | | vo.setLeft(buyGoods.getLeftHongBaoCount());
|
| | | vo.setMoney(tljHongBao);
|
| | | vo.setTagName("付款立减 ¥" + tljHongBao);
|
| | | vo.setTip("当日领取,当日内使用,过期失效");
|
| | | vo.setTotal(buyGoods.getTotalHongBaoCount());
|
| | | goodsJson.put("tljBuyHongBao", vo);
|
| | | moneyType = 2;
|
| | | }
|
| | |
|
| | | goodsJson.put("moneyType", moneyType);
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.SMSException;
|
| | | import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
|
| | |
| | | @Resource
|
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | |
|
| | |
|
| | | // 获取商品分享链接
|
| | | @RequestMapping(value = "getGoodsShareUrl")
|
| | | public void getGoodsShareUrl(AcceptData acceptData, long id, PrintWriter out) {
|
| | |
| | | && extraInfo.getRelationValid() == true)
|
| | | relationId = extraInfo.getRelationId();
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(relationId)) {
|
| | | out.print(JsonUtil.loadFalseResult(3, "淘宝未授权,请前往\"我的\"绑定淘宝账号"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | createTaoLijin(uid, auctionId, totalNum, relationId, request, out);
|
| | | return;
|
| | |
| | | String shareText = "";
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | |
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 淘礼金创建分享
|
| | | * |
| | | * @param uid
|
| | | * @param auctionId
|
| | | * @param totalNum
|
| | |
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request, PrintWriter out) {
|
| | | public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoLiJinLinkForShare(uid, auctionId, relationId);
|
| | |
|
| | |
| | | }
|
| | | data.put("clickUrl", url);
|
| | |
|
| | | |
| | | // 创建淘口令
|
| | | if (!StringUtil.isNullOrEmpty(taoLiJinLink)) {// 通过立即推广方式获取淘口令成功
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), taoLiJinLink);
|
| | |
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | } else if (!StringUtil.isNullOrEmpty(taoBaoLink.getClickUrl())) {
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), taoBaoLink.getClickUrl());
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
|
| | | taoBaoLink.getClickUrl());
|
| | | if (!StringUtil.isNullOrEmpty(quanToken)) {
|
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | }
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | |
|
| | | data.put("rule", "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("rule",
|
| | | "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | |
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享记录统计列表
|
| | |
| | |
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | |
|
| | | |
| | | // 查询是否有分享
|
| | | UserShareGoodsHistory userShareHistory = shareGoodsService.getShareGoodsHistory(uid, goods.getAuctionId());
|
| | | String token = "";
|
| | |
| | | return template;
|
| | | }
|
| | |
|
| | | |
| | | } else {
|
| | | String template = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | |
| | | title += textStyleVO.getContent();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if(StringUtil.isNullOrEmpty(title)) {
|
| | | title = "给你推荐精选好物优惠券,购物前先领券,别错过优惠哦~";
|
| | |
| | | List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
|
| | | count = msgOrderDetailService.countMsgOrderDetail(uid);
|
| | | if (detailList != null)
|
| | | for (MsgOrderDetail detail : detailList)
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | for (MsgOrderDetail detail : detailList) {
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("orderNo", detail.getOrderId());
|
| | | list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"),
|
| | | params));
|
| | | }
|
| | | break;
|
| | | case MSG_TYPE_MONEY:
|
| | | userMsgReadStateService.readMoneyMsg(uid);
|
| | |
| | | List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
|
| | | if (detailList != null && detailList.size() > 0) {
|
| | | for (MsgOrderDetail detail : detailList) {
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("orderNo", detail.getOrderId());
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail,
|
| | | jumpDetailV2Service.getByTypeCache("order_search"), params);
|
| | | userMsgVO.setType(MSG_TYPE_ORDER);
|
| | | list.add(userMsgVO);
|
| | | }
|
| | |
| | | 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.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.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.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
|
| | | 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.UserTaoLiJinDetailService;
|
| | |
| | | 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.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
|
| | | import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
|
| | | import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
|
| | |
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | /**
|
| | | * 获取淘礼金分享记录
|
| | |
| | | page = 1;
|
| | | }
|
| | |
|
| | | |
| | | 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>();
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 统计淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | } else {
|
| | | tlj = new BigDecimal(0);
|
| | | }
|
| | | |
| | |
|
| | | // 今日分享个数
|
| | | long countShare = userTaoLiJinRecordService.countTodayNum(uid);
|
| | |
| | | data.put("thisMonthUse", thisMonthUse.setScale(2).toString().replaceAll("-", ""));
|
| | | data.put("lastMonthUse", lastMonthUse.setScale(2).toString().replaceAll("-", ""));
|
| | |
|
| | | |
| | | // IOS 分享个数
|
| | | ClientTextStyleVO textVo1 = new ClientTextStyleVO();
|
| | | textVo1.setContent("今日创建分享");
|
| | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取淘礼金明细详情
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | |
| | | |
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 红包领取详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param type
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 登录用户
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | listHot = new ArrayList<ShareHotGoods>();
|
| | | }
|
| | |
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
| | | isNewUser = false;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(),
|
| | | null);
|
| | | // 去掉标签
|
| | | extra.setLabels(null);
|
| | |
|
| | |
| | | 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) {
|
| | | 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"));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listPreGoods", method = RequestMethod.GET)
|
| | | public void listPreGoods(String callback, AcceptData acceptData, String kw, PrintWriter out) {
|
| | | public void listPreGoods(String callback, AcceptData acceptData, String kw, Integer page, PrintWriter out) {
|
| | | // 大淘客数据,更新
|
| | | List<TaoBaoGoodsBrief> list = shareHotGoodsService.listPreGoods();
|
| | | List<TaoBaoGoodsBrief> list = shareHotGoodsService.listPreGoods(page);
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = new Gson();
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | |
| | |
|
| | | // 最多30个商品
|
| | | List<ShareHotGoods> listGoods = shareHotGoodsService.listByDay(day, 30);
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | JSONArray array = new JSONArray();
|
| | | for (ShareHotGoods sh : listGoods) {
|
| | | TaoBaoGoodsBriefExtra item = TaoBaoUtil.getTaoBaoGoodsBriefExtra(sh.getGoods(), rate + "", null);
|
| | | TaoBaoGoodsBriefExtra item = TaoBaoUtil.getTaoBaoGoodsBriefExtra(sh.getGoods(), 100 + "", null);
|
| | | if (!StringUtil.isNullOrEmpty(item.getPictUrlWhite()))
|
| | | item.setPictUrl(item.getPictUrlWhite());
|
| | | item.setAuctionUrl(sh.getId());
|
| | | array.add(item);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.web;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | 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.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | 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.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/web/v1/tljBuyGoods")
|
| | | public class TLJBuyGoodsController {
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | /**
|
| | | * 拉取备选商品
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param kw
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listPreGoods", method = RequestMethod.GET)
|
| | | public void listPreGoods(String callback, AcceptData acceptData, String kw, Integer page, PrintWriter out) {
|
| | | // 大淘客数据,更新
|
| | | List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(page);
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = new Gson();
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | array.add(gson.toJson(
|
| | | TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE + "", null)));
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 设置分享商品
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param ids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setShareGoods", method = RequestMethod.GET)
|
| | | public void setShareGoods(String callback, AcceptData acceptData, String ids, String day, PrintWriter out) {
|
| | | // 大淘客数据,更新
|
| | | JSONArray array = JSONArray.fromObject(ids);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(day)) {
|
| | | day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | }
|
| | | int count = 0;
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | // 获取商品详情
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(array.optLong(i));
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (goods != null && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
|
| | |
|
| | | if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
|
| | | .compareTo(new BigDecimal("143")) >= 0) {
|
| | | count++;
|
| | | goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
|
| | | int totalHongBaoCount = 200 + (int) (Math.random() * 800);
|
| | | int leftHongBaoCount = 20 + (int) (Math.random() * 200);
|
| | | tljBuyGoodsService.addTLJBuyGoods(
|
| | | new TLJBuyGoods(null, day, new Date(), goods, totalHongBaoCount, leftHongBaoCount));
|
| | | }
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("设置成功:" + count)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取已经选择的商品
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param day
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listSelectedGoods", method = RequestMethod.GET)
|
| | | public void listSelectedGoods(String callback, AcceptData acceptData, String day, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(day)) {
|
| | | day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
|
| | | }
|
| | |
|
| | | // 最多30个商品
|
| | | List<TLJBuyGoods> listGoods = tljBuyGoodsService.listByDay(day, 30);
|
| | | JSONArray array = new JSONArray();
|
| | | for (TLJBuyGoods sh : listGoods) {
|
| | | TaoBaoGoodsBriefExtra item = TaoBaoUtil.getTaoBaoGoodsBriefExtra(sh.getGoods(), TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE + "", null);
|
| | | if (!StringUtil.isNullOrEmpty(item.getPictUrlWhite()))
|
| | | item.setPictUrl(item.getPictUrlWhite());
|
| | | item.setAuctionUrl(sh.getId());
|
| | | array.add(item);
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除选择的商品
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param ids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deleteSelectedGoods", method = RequestMethod.GET)
|
| | | public void deleteSelectedGoods(String callback, AcceptData acceptData, String ids, PrintWriter out) {
|
| | | JSONArray array = JSONArray.fromObject(ids);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String id = array.optString(i);
|
| | | tljBuyGoodsService.deleteById(id);
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (old != null) {// 更新
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("id").is(v2.getId()));
|
| | | Field[] fields = v2.getClass().getFields();
|
| | | Field[] fields = DaTaoKeDetailV2.class.getDeclaredFields();
|
| | |
|
| | | Update update = new Update();
|
| | | for (Field f : fields) {
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int count, String sortName) {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("commission").gt(734));
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, sortName));
|
| | | query.with(new Sort(orders));
|
| | | query.with(new Sort(orders)).skip(start);
|
| | | query.limit(count);
|
| | | return mongoTemplate.find(query, getEntityClass());
|
| | | }
|
| | |
| | | |
| | | /** |
| | | * 根据来源和交易ID获取订单详情 |
| | | * |
| | | * @param sourceType |
| | | * @param tradeId |
| | | * @return |
| | |
| | | |
| | | CommonOrder selectBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); |
| | | |
| | | /** |
| | | * 根据来源和交易ID获取订单列表 |
| | | * |
| | | * @param sourceType |
| | | * @param tradeId |
| | | * @return |
| | | */ |
| | | List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.OrderRepairHistory; |
| | | |
| | | public interface OrderRepairHistoryMapper extends BaseMapper<OrderRepairHistory> { |
| | | |
| | | } |
| | |
| | | |
| | | DeviceActive selectByDeviceToeknMd5AndPlatform(@Param("deviceTokenMd5") String deviceTokenMd5, |
| | | @Param("platform") int platform); |
| | | |
| | | DeviceActive selectFirst(String device); |
| | | |
| | | } |
| | |
| | | UserActiveLog selectByPrimaryKey(Long id); |
| | | |
| | | UserActiveLog selectLatestByUid(Long uid); |
| | | |
| | | UserActiveLog selectFirstActiveInfo(Long uid); |
| | | |
| | | int updateByPrimaryKeySelective(UserActiveLog record); |
| | | |
| | |
| | | return mongoTemplate.find(query, ShareHotGoods.class);
|
| | | }
|
| | |
|
| | | |
| | | public void deleteByGoodsId(Long goodsId) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("goods.auctionId").is(goodsId);
|
| | |
| | | mongoTemplate.remove(shareHotGoods);
|
| | | }
|
| | | }
|
| | |
|
| | | public List<ShareHotGoods> listByAuctionId(Long auctionid) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("goods.auctionId").is(auctionid);
|
| | | query.addCriteria(ca);
|
| | | return mongoTemplate.find(query, ShareHotGoods.class);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.taobao;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | |
|
| | | @Repository
|
| | | public class TLJBuyGoodsDao extends MongodbBaseDao<TLJBuyGoods> {
|
| | |
|
| | | public List<TLJBuyGoods> listByDayOrderByUpdateTime(String day, int page, int pageSize) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("day").is(day);
|
| | | query.addCriteria(ca);
|
| | | query.limit(pageSize);
|
| | | query.skip((page - 1) * pageSize).with(new Sort(Sort.Direction.DESC, "updateTime"));
|
| | | return mongoTemplate.find(query, TLJBuyGoods.class);
|
| | | }
|
| | |
|
| | | public void deleteByGoodsId(Long goodsId) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("goods.auctionId").is(goodsId);
|
| | | query.addCriteria(ca);
|
| | |
|
| | | List<TLJBuyGoods> list = mongoTemplate.find(query, TLJBuyGoods.class);
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | for (TLJBuyGoods TLJBuyGoods : list) {
|
| | | mongoTemplate.remove(TLJBuyGoods);
|
| | | }
|
| | | }
|
| | |
|
| | | public List<TLJBuyGoods> listByAuctionId(Long auctionid) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("goods.auctionId").is(auctionid);
|
| | | query.addCriteria(ca);
|
| | | return mongoTemplate.find(query, TLJBuyGoods.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 减红包个数
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void subHongBaoCount(String id, int count) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("id").is(id).andOperator(Criteria.where("leftHongBaoCount").gt(count - 1)));
|
| | | org.springframework.data.mongodb.core.query.Update update = new org.springframework.data.mongodb.core.query.Update();
|
| | | update = update.inc("leftHongBaoCount", 0 - count);
|
| | | mongoTemplate.updateFirst(query, update, TLJBuyGoods.class);
|
| | | }
|
| | |
|
| | | public TLJBuyGoods selectByAuctionIdAndDay(Long auctionId, String day) {
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("goods.auctionId").is(auctionId).and("day").is(day);
|
| | | query.addCriteria(ca);
|
| | | return mongoTemplate.findOne(query, TLJBuyGoods.class);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.taobao;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | |
|
| | | @Repository
|
| | | public class UserTLJBuyHistoryDao extends MongodbBaseDao<UserTLJBuyHistory> {
|
| | |
|
| | | public List<UserTLJBuyHistory> listByDayAndUidAndAuctionId(Long uid, Long auctionId, String day) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("uid").is(uid).andOperator(Criteria.where("auctionId").is(auctionId),
|
| | | Criteria.where("day").is(day)));
|
| | | return mongoTemplate.find(query, UserTLJBuyHistory.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | home("首页"), coupon("优惠券页"), invite("邀请有奖页"), activity("动态"), goodsDetail("详情过度页"), mine("我的"), money(
|
| | | "资金"), accountDetail("账户明细"), extract("提现"), orderFanli("返利订单"), orderTiCheng("提成订单"), orderTaoBao(
|
| | | "淘宝订单"), coollect("收藏"), scanHistory("足迹"), team("队员"), kefu("联系客服"), taoBaoShoppingCart(
|
| | | "淘宝购物车"), orderFind("订单申诉"), msgCenter(
|
| | | "消息中心"), newOrder("订单"), shareHistory("分享记录"), goodsStorage("选品库");
|
| | | "淘宝购物车"), orderFind("订单申诉"), msgCenter("消息中心"), newOrder("订单"), shareHistory(
|
| | | "分享记录"), goodsStorage(
|
| | | "选品库"), tlj("分享爆款详情"), tlj_buy("自购立减详情"), hongbao_balance("红包余额");
|
| | | private final String desc;
|
| | |
|
| | | private AppPageNotificationTypeEnum(String desc) {
|
| | |
| | | "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), weiQuan("售后订单扣款", "http://img.flqapp.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), systemEqualize("系统补齐", "http://img.flqapp.com/resource/money_detail/icon_system.png", ""), scoreConvert("积分兑换", "http://img.flqapp.com/resource/money_detail/icon_score.png",
|
| | | ""), hongbao("官方红包", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png", ""), hongbaoDeduct("红包退款", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png",
|
| | | ""), buyScore("购买积分", "http://img.flqapp.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png",
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励","http://img.flqapp.com/resource/money_detail/icon_order_reward.png","");
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png","");
|
| | | private final String desc;
|
| | | private final String picture;
|
| | | private final String helpUrl;
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_order_repair_history")
|
| | | public class OrderRepairHistory {
|
| | | @Column(name = "id")
|
| | | private Long id;
|
| | | @Column(name = "before_get_money")
|
| | | private BigDecimal beforeGetMoney;
|
| | | @Column(name = "after_get_money")
|
| | | private BigDecimal afterGetMoney;
|
| | | @Column(name = "uid")
|
| | | private Long uid;
|
| | | @Column(name = "order_id")
|
| | | private String orderId;
|
| | | @Column(name = "create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public BigDecimal getBeforeGetMoney() {
|
| | | return beforeGetMoney;
|
| | | }
|
| | |
|
| | | public void setBeforeGetMoney(BigDecimal beforeGetMoney) {
|
| | | this.beforeGetMoney = beforeGetMoney;
|
| | | }
|
| | |
|
| | | public BigDecimal getAfterGetMoney() {
|
| | | return afterGetMoney;
|
| | | }
|
| | |
|
| | | public void setAfterGetMoney(BigDecimal afterGetMoney) {
|
| | | this.afterGetMoney = afterGetMoney;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | |
| | | *
|
| | | */
|
| | | @Document(collection = "shareHotGoods")
|
| | | public class ShareHotGoods {
|
| | | public class ShareHotGoods implements Serializable{
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | @Id
|
| | | private String id;
|
| | | @Field
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | /**
|
| | | * 自购立减
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "tljBuyGoods")
|
| | | public class TLJBuyGoods implements Serializable {
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | @Id
|
| | | private String id;
|
| | | @Field
|
| | | private String day;
|
| | | @Field
|
| | | private Date updateTime;
|
| | | @Field
|
| | | private TaoBaoGoodsBrief goods;
|
| | | @Field
|
| | | private Integer totalHongBaoCount;// 总红包个数
|
| | | @Field
|
| | | private Integer leftHongBaoCount;// 剩余红包个数
|
| | |
|
| | | public Integer getTotalHongBaoCount() {
|
| | | return totalHongBaoCount;
|
| | | }
|
| | |
|
| | | public void setTotalHongBaoCount(Integer totalHongBaoCount) {
|
| | | this.totalHongBaoCount = totalHongBaoCount;
|
| | | }
|
| | |
|
| | | public Integer getLeftHongBaoCount() {
|
| | | return leftHongBaoCount;
|
| | | }
|
| | |
|
| | | public void setLeftHongBaoCount(Integer leftHongBaoCount) {
|
| | | this.leftHongBaoCount = leftHongBaoCount;
|
| | | }
|
| | |
|
| | | public TLJBuyGoods(String id, String day, Date updateTime, TaoBaoGoodsBrief goods, int totalHongBaoCount,
|
| | | int leftHongBaoCount) {
|
| | | this.id = id;
|
| | | this.day = day;
|
| | | this.updateTime = updateTime;
|
| | | this.goods = goods;
|
| | | this.totalHongBaoCount = totalHongBaoCount;
|
| | | this.leftHongBaoCount = leftHongBaoCount;
|
| | | }
|
| | |
|
| | | public TLJBuyGoods() {
|
| | |
|
| | | }
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(TaoBaoGoodsBrief goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | public class TaoBaoGoodsBriefExtra extends TaoBaoGoodsBrief {
|
| | |
| | | @Expose
|
| | | private String spreadMoney;// 推广红包
|
| | |
|
| | | @Expose
|
| | | private TLJBuyHongBaoVO tljBuyHongBao;
|
| | | |
| | | @Expose
|
| | | private ClientTextStyleVO pictureTag;
|
| | | |
| | |
|
| | | public ClientTextStyleVO getPictureTag() {
|
| | | return pictureTag;
|
| | | }
|
| | |
|
| | | public void setPictureTag(ClientTextStyleVO pictureTag) {
|
| | | this.pictureTag = pictureTag;
|
| | | }
|
| | |
|
| | | public TLJBuyHongBaoVO getTljBuyHongBao() {
|
| | | return tljBuyHongBao;
|
| | | }
|
| | |
|
| | | public void setTljBuyHongBao(TLJBuyHongBaoVO tljBuyHongBao) {
|
| | | this.tljBuyHongBao = tljBuyHongBao;
|
| | | }
|
| | |
|
| | | public int getMoneyType() {
|
| | | return moneyType;
|
| | |
| | | public class TaoKeAppInfo {
|
| | | private String appKey;
|
| | | private String appSecret;
|
| | |
|
| | | public TaoKeAppInfo(String appKey, String appSecret) {
|
| | | this.appKey = appKey;
|
| | | this.appSecret = appSecret;
|
| | | }
|
| | |
|
| | | public TaoKeAppInfo(String appKey, String appSecret, String pid) {
|
| | | this.appKey = appKey;
|
| | | this.appSecret = appSecret;
|
| | | this.pid = pid;
|
| | | }
|
| | |
|
| | | public TaoKeAppInfo() {
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | /**
|
| | | * 淘礼金自购领取记录
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "userTLJBuyHistory")
|
| | | public class UserTLJBuyHistory {
|
| | | @Id
|
| | | @Field
|
| | | private String id;
|
| | | @Field
|
| | | @Indexed
|
| | | private Long uid;
|
| | | @Field
|
| | | @Indexed
|
| | | private Long auctionId;
|
| | | @Field
|
| | | @Indexed
|
| | | private String day;// 如:2019-01-01
|
| | | @Field
|
| | | private Date createTime;// 创建时间
|
| | |
|
| | | @Field
|
| | | private String rightsId;
|
| | |
|
| | | public String getRightsId() {
|
| | | return rightsId;
|
| | | }
|
| | |
|
| | | public void setRightsId(String rightsId) {
|
| | | this.rightsId = rightsId;
|
| | | }
|
| | |
|
| | | public UserTLJBuyHistory(String id, Long uid, Long auctionId, String day, String rightsId, Date createTime) {
|
| | | this.id = id;
|
| | | this.uid = uid;
|
| | | this.auctionId = auctionId;
|
| | | this.day = day;
|
| | | this.createTime = createTime;
|
| | | this.rightsId = rightsId;
|
| | | }
|
| | |
|
| | | public UserTLJBuyHistory() {
|
| | |
|
| | | }
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Long getAuctionId() {
|
| | | return auctionId;
|
| | | }
|
| | |
|
| | | public void setAuctionId(Long auctionId) {
|
| | | this.auctionId = auctionId;
|
| | | }
|
| | |
|
| | | public String getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.entity.taobao.dataoke;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | |
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | @Document(collection = "daTaoKeGoods")
|
| | | public class DaTaoKeDetailV2 {
|
| | | public class DaTaoKeDetailV2 implements Serializable{
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | @Id
|
| | | private Long id;// 商品ID
|
| | | @Field
|
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Component
|
| | | public class TaoLiJinJob {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinReportService userTaoLiJinReportService;
|
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | /**
|
| | | * 更新报告
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨过5分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 5 0 * * ?")
|
| | | public void updateShareTLJGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("验证爆款商品库商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<ShareHotGoods> list = shareHotGoodsService.listByDay(day, 15);
|
| | | int count = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (count >= 10)
|
| | | break;
|
| | | boolean success = shareHotGoodsService.verifyCanCreateTLJ(list.get(i).getGoods().getAuctionId(),
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨过3分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 3 0 * * ?")
|
| | | public void updateBuyTLJGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("验证自购立减商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<TLJBuyGoods> list = tljBuyGoodsService.listByDay(day, 15);
|
| | | int count = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (count >= 10)
|
| | | break;
|
| | | boolean success = shareHotGoodsService.verifyCanCreateTLJ(list.get(i).getGoods().getAuctionId(),
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // 每天的8点,11点,19点,23点执行一次
|
| | | @Scheduled(cron = "0 0 8,11,19,23 * * ? ")
|
| | | public void doUpdateInfoJobNew() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | try {
|
| | | new Thread(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | daTaoKeGoodsDetailV2Service.updateData();
|
| | | }
|
| | | }).start();
|
| | |
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每天凌晨过5分钟验证
|
| | | */
|
| | | @Scheduled(cron = "0 5 0 * * ?")
|
| | | public void update618() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("验证爆款商品库商品");
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<ShareHotGoods> list = shareHotGoodsService.listByDay(day, 15);
|
| | | int count = 0;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (count >= 10)
|
| | | break;
|
| | | boolean success = shareHotGoodsService.verifyCanCreateTLJ(list.get(i).getGoods().getAuctionId());
|
| | | if (success) {
|
| | | count++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | co_trade_id=#{tradeId} limit 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * |
| | | FROM |
| | | yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and |
| | | co_trade_id=#{tradeId} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.order.OrderRepairHistoryMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.OrderRepairHistory"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="before_get_money" property="beforeGetMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="after_get_money" property="afterGetMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="order_id" property="orderId" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,before_get_money,after_get_money,uid,order_id,create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_repair_history where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_order_repair_history where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.OrderRepairHistory" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_order_repair_history |
| | | (id,before_get_money,after_get_money,uid,order_id,create_time) values |
| | | (#{id,jdbcType=BIGINT},#{beforeGetMoney,jdbcType=DECIMAL},#{afterGetMoney,jdbcType=DECIMAL},#{uid,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.OrderRepairHistory" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_order_repair_history |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="beforeGetMoney != null">before_get_money,</if> |
| | | <if test="afterGetMoney != null">after_get_money,</if> |
| | | <if test="uid != null">uid,</if> |
| | | <if test="orderId != null">order_id,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="beforeGetMoney != null">#{beforeGetMoney,jdbcType=DECIMAL},</if> |
| | | <if test="afterGetMoney != null">#{afterGetMoney,jdbcType=DECIMAL},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.OrderRepairHistory">update |
| | | yeshi_ec_order_repair_history set before_get_money = |
| | | #{beforeGetMoney,jdbcType=DECIMAL},after_get_money = |
| | | #{afterGetMoney,jdbcType=DECIMAL},uid = |
| | | #{uid,jdbcType=BIGINT},order_id = |
| | | #{orderId,jdbcType=VARCHAR},create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.OrderRepairHistory"> |
| | | update yeshi_ec_order_repair_history |
| | | <set> |
| | | <if test="beforeGetMoney != null">before_get_money=#{beforeGetMoney,jdbcType=DECIMAL},</if> |
| | | <if test="afterGetMoney != null">after_get_money=#{afterGetMoney,jdbcType=DECIMAL},</if> |
| | | <if test="uid != null">uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderId != null">order_id=#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | from yeshi_ec_device_active where da_device_token_md5 = |
| | | #{deviceTokenMd5} and da_platform=#{platform} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectFirst" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_device = |
| | | #{0} order by da_id limit 1 |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT} |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id desc limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstActiveInfo" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id limit 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT} |
| | |
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserShareGoodsHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.share.PidUserMapper;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.UserTLJBuyHistoryService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserTLJBuyHistoryService userTLJBuyHistoryService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Override
|
| | | public void addShareGoodsHistory(UserShareGoodsHistory history) {
|
| | |
| | | return taoBaoLink;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserShareGoodsHistory getShareGoodsHistory(Long uid, Long auctionId) {
|
| | | return userShareGoodsHistoryMapper.selectByUidAndAuctionId(uid, auctionId);
|
| | |
| | | return tbLink;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, String specialId, Long auctionId) throws ShareGoodsException {
|
| | | if (uid == null || uid <= 0) {
|
| | |
| | | if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
|
| | | throw new ShareGoodsException(101, "红包余额不足");
|
| | | }
|
| | | |
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | |
| | | throw new ShareGoodsException(e.getCode(), e.getMsg());
|
| | | }
|
| | |
|
| | | |
| | | TaoBaoLink taoBaoLink = new TaoBaoLink();
|
| | | taoBaoLink.setAuctionId(auctionId);
|
| | | taoBaoLink.setClickUrl(goods.getAuctionUrl());
|
| | |
| | |
|
| | | return taoBaoLink;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public TaoBaoLink getTaoLiJinLinkForShare(Long uid, Long auctionId, String relationId) throws ShareGoodsException {
|
| | |
| | | goods.setCouponLink(goods.getCouponLink() + "&relationId=" + relationId);
|
| | | }
|
| | |
|
| | |
|
| | | // 创建淘口令
|
| | | TaoBaoLink tbLink = new TaoBaoLink();
|
| | | tbLink.setAuctionId(goods.getAuctionId());
|
| | |
| | |
|
| | | return tbLink;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoLink getTaoLiJinLinkForBuyWithOutFanLi(Long uid, Long auctionId) throws ShareGoodsException {
|
| | | if (uid == null || uid <= 0) {
|
| | | throw new ShareGoodsException(1, "用户ID不能为空");
|
| | | }
|
| | |
|
| | | if (auctionId == null || auctionId <= 0) {
|
| | | throw new ShareGoodsException(2, "商品ID不能为空");
|
| | | }
|
| | |
|
| | | boolean canBuy = userTLJBuyHistoryService.canBuy(uid, auctionId);
|
| | | if (!canBuy) {
|
| | | throw new ShareGoodsException(3, "同一商品每日只能领取三次");
|
| | | }
|
| | |
|
| | | long currentTime = System.currentTimeMillis();
|
| | | Date sendEndTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(currentTime + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | TaoBaoGoodsBrief goods = null;
|
| | | try {
|
| | | goods = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | throw new ShareGoodsException(4, "商品已下架");
|
| | | }
|
| | |
|
| | | BigDecimal perface = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70));
|
| | | TaoKeAppInfo app = TaoBaoConstant.ownBuyApp;
|
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "自购立减", perface, 1, new Date(currentTime), sendEndTime,
|
| | | new Date(currentTime), sendEndTime, app);
|
| | | } catch (TaoKeApiException e) {
|
| | | throw new ShareGoodsException(5, "生成推广链接失败");
|
| | | }
|
| | | if (taoLiJinDTO == null)
|
| | | throw new ShareGoodsException(5, "生成推广链接失败");
|
| | |
|
| | | // 减去剩余个数(随机减去8到10个)
|
| | | tljBuyGoodsService.subHongBaoLeftCount(auctionId, TimeUtil.getGernalTime(currentTime, "yyyy-MM-dd"),
|
| | | 8 + (int) (3 * Math.random()));
|
| | |
|
| | | // 插入记录
|
| | | try {
|
| | | userTLJBuyHistoryService.addHistory(new UserTLJBuyHistory(null, uid, auctionId,
|
| | | TimeUtil.getGernalTime(currentTime, "yyyy-MM-dd"), taoLiJinDTO.getRightsId(), new Date()));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | TaoBaoLink taoBaoLink = new TaoBaoLink();
|
| | | taoBaoLink.setAuctionId(auctionId);
|
| | | taoBaoLink.setClickUrl(goods.getAuctionUrl());
|
| | | taoBaoLink.setCouponLink(taoLiJinDTO.getSendUrl());
|
| | | taoBaoLink.setGoods(goods);
|
| | | return taoBaoLink;
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | return TaoBaoUtil.getShareGoodsHongBaoInfo(goods, rate);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | taoBaoGoodsBriefMapper.deleteByPrimaryKey(id);
|
| | |
| | | taoBaoGoodsBriefMapper.deleteBatchByGoodsId(list);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> queryByAuctionId(Long auctionId) {
|
| | | return taoBaoGoodsBriefMapper.queryByAuctionId(auctionId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<Long> listExistById(List<Long> list) {
|
| | |
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public int insertBatch(List<TaoBaoGoodsBrief> list) {
|
| | |
| | | return taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listByShopId(long start, int count, Long shopId) {
|
| | | return taoBaoGoodsBriefMapper.listByShopId(start, count, shopId);
|
| | |
| | | return taoBaoGoodsBriefMapper.countByShopId(shopId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterOffLineGoods(List<TaoBaoGoodsBrief> goodsList) {
|
| | | int page = goodsList.size() % 40 == 0 ? goodsList.size() / 40 -1 : goodsList.size() / 40;
|
| | | List<TaoBaoGoodsBrief> flist = new ArrayList<>();
|
| | | for (int i = 0; i <= page; i++) {
|
| | | List<TaoBaoGoodsBrief> list = goodsList.subList(i * 40,
|
| | | i * 40 + 40 > goodsList.size() ?goodsList.size(): i * 40 + 40 );
|
| | | String ids = "";
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | ids += goods.getAuctionId() + ",";
|
| | | }
|
| | | ids = ids.endsWith(",") ? ids.substring(0, ids.length() - 1) : ids;
|
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = new HashMap<>();
|
| | | try {
|
| | | List<TaoBaoGoodsBrief> finalList = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | if (finalList != null)
|
| | | for (TaoBaoGoodsBrief ggods : finalList)
|
| | | goodsMap.put(ggods.getAuctionId(), ggods);
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | if (goodsMap.get(list.get(j).getAuctionId()) == null) {
|
| | | list.remove(j);
|
| | | j--;
|
| | | }
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | flist.addAll(list);
|
| | | }
|
| | | return flist;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.goods.recommend;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.Cache;
|
| | | import org.springframework.cache.Cache.ValueWrapper;
|
| | | import org.springframework.cache.ehcache.EhCacheCacheManager;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.HomeRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class HomeRecommendGoodsServiceImpl implements HomeRecommendGoodsService {
|
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listGoodsByPage(Long uid, String device, String imei, String idfa, int page) {
|
| | | List<TaoBaoGoodsBrief> finalList = new ArrayList<>();
|
| | | if (page == 1) {
|
| | | List<TaoBaoGoodsBrief> tempList = listDTKTimeRankGoods(device, StringUtil.Md5(device));
|
| | | if (tempList != null && tempList.size() > 0)
|
| | | finalList.addAll(tempList);
|
| | | tempList = guessDeviceLike(device, imei, idfa);
|
| | | if (tempList != null && tempList.size() > 0)
|
| | | finalList.addAll(tempList);
|
| | | tempList = listDTKHotRankGoods(device, StringUtil.Md5(device));
|
| | | if (tempList != null && tempList.size() > 0)
|
| | | finalList.addAll(tempList);
|
| | | } else if (page == 2) {
|
| | | List<TaoBaoGoodsBrief> tempList = listDTKDayRankGoods(device);
|
| | | if (tempList != null && tempList.size() > 0)
|
| | | finalList.addAll(tempList);
|
| | | } else if (page >= 3) {
|
| | | List<TaoBaoGoodsBrief> tempList = taoKeGoodsCouponList(page - 2);
|
| | | if (tempList != null && tempList.size() > 0)
|
| | | finalList.addAll(tempList);
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | |
|
| | | // 大淘客实时热销
|
| | | public List<TaoBaoGoodsBrief> listDTKTimeRankGoods(String device, String deviceMd5) {
|
| | | String name = "recommendUserCache";
|
| | | String key = "listDTKTimeRankGoods-" + StringUtil.Md5(device);
|
| | | List<TaoBaoGoodsBrief> fList = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | | List<TaoBaoGoodsBrief> list = listRankGoods(DaTaoKeApiUtil.RANK_TYPE_TIME);
|
| | | list = recommendGoodsDeleteHistoryService.filterGoods(device, list);
|
| | | List<TaoBaoGoodsBrief> randomList = new ArrayList<>();
|
| | | randomList.addAll(list);
|
| | | Collections.shuffle(randomList);
|
| | | fList = randomList.size() < 5 ? randomList : randomList.subList(0, 5);
|
| | | if (fList != null && fList.size() > 0)
|
| | | saveObjList(fList, name, key);
|
| | | return fList;
|
| | | }
|
| | |
|
| | | // 大淘客热推榜
|
| | | public List<TaoBaoGoodsBrief> listDTKHotRankGoods(String device, String deviceMd5) {
|
| | | String name = "recommendUserCache";
|
| | | String key = "listDTKHotRankGoods-" + StringUtil.Md5(device);
|
| | | List<TaoBaoGoodsBrief> fList = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | | List<TaoBaoGoodsBrief> list = listRankGoods(DaTaoKeApiUtil.RANK_TYPE_HOT);
|
| | | list = recommendGoodsDeleteHistoryService.filterGoods(device, list);
|
| | | List<TaoBaoGoodsBrief> randomList = new ArrayList<>();
|
| | | randomList.addAll(list);
|
| | | Collections.shuffle(randomList);
|
| | | fList = randomList.size() < 5 ? randomList : randomList.subList(0, 5);
|
| | | if (fList != null && fList.size() > 0)
|
| | | saveObjList(fList, name, key);
|
| | | return fList;
|
| | | }
|
| | |
|
| | | // 大淘客全天热榜
|
| | | public List<TaoBaoGoodsBrief> listDTKDayRankGoods(String device) {
|
| | | String name = "recommendUserCache";
|
| | | String key = "listDTKDayRankGoods-" + StringUtil.Md5(device);
|
| | | List<TaoBaoGoodsBrief> fList = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | |
|
| | | List<TaoBaoGoodsBrief> list = listRankGoods(DaTaoKeApiUtil.RANK_TYPE_DAY);
|
| | | list = recommendGoodsDeleteHistoryService.filterGoods(device, list);
|
| | | List<TaoBaoGoodsBrief> randomList = new ArrayList<>();
|
| | | randomList.addAll(list);
|
| | | Collections.shuffle(randomList);
|
| | | fList = randomList.size() < 20 ? randomList : randomList.subList(0, 20);
|
| | | if (fList != null && fList.size() > 0)
|
| | | saveObjList(fList, name, key);
|
| | | return fList;
|
| | | }
|
| | |
|
| | | // 设备猜你喜欢
|
| | | public List<TaoBaoGoodsBrief> guessDeviceLike(String device, String imei, String idfa) {
|
| | |
|
| | | String name = "recommendUserCache";
|
| | | String key = "guessDeviceLike-" + StringUtil.Md5(device);
|
| | | List<TaoBaoGoodsBrief> fList = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa);
|
| | | List<TaoBaoGoodsBrief> finalList = new ArrayList<>();
|
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | List<TaoBaoGoodsBrief> list = result.getTaoBaoGoodsBriefs();
|
| | | // 设备推荐
|
| | | if (list != null)
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0 && goods.getBiz30day() > 1000
|
| | | && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | | finalList.add(goods);
|
| | | }
|
| | | }
|
| | | }
|
| | | finalList = recommendGoodsDeleteHistoryService.filterGoods(device, finalList);
|
| | | Collections.shuffle(finalList);
|
| | | fList = finalList.size() < 5 ? finalList : finalList.subList(0, 5);
|
| | | if (fList != null && fList.size() > 0)
|
| | | saveObjList(fList, name, key);
|
| | | return fList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取大淘客的商品厂库
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listRankGoods(int type) {
|
| | |
|
| | | String name = "recommendLibraryCache";
|
| | | String key = "listRankGoods-" + type;
|
| | | List<TaoBaoGoodsBrief> fList = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(type);
|
| | | List<DaTaoKeDetailV2> list = result.getGoodsList();
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null)
|
| | | for (DaTaoKeDetailV2 v2 : list)
|
| | | goodsList.add(TaoBaoUtil.convert(v2));
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | if (1 / 0 > 0)
|
| | | return null;
|
| | | }
|
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | saveObjList(goodsList, name, key);
|
| | |
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘客好券直播
|
| | | * |
| | | * @param page
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> taoKeGoodsCouponList(int page) {
|
| | | String name = "recommendLibraryCache";
|
| | | String key = "taoKeGoodsCouponList-" + page;
|
| | | List<TaoBaoGoodsBrief> list = getCacheObjList(name, key, TaoBaoGoodsBrief.class);
|
| | | if (list != null && list.size() > 0)
|
| | | return list;
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(3756, page, Constant.PAGE_SIZE);
|
| | | if (result != null) {
|
| | | list = daTaoKeGoodsDetailService.filterTaoBaoGoods(result.getTaoBaoGoodsBriefs());
|
| | | saveObjList(list, name, key);
|
| | | return list;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | private <T> List<T> getCacheObjList(String name, String key, Class<T> clazz) {
|
| | | Cache cache = ehCacheCacheManager.getCache(name);
|
| | | ValueWrapper vw = cache.get(key);
|
| | | if (vw != null)
|
| | | return (List<T>) vw.get();
|
| | | return null;
|
| | | }
|
| | |
|
| | | private <T> T saveObjList(List<T> clazzList, String name, String key) {
|
| | | if (clazzList == null)
|
| | | return null;
|
| | | List<T> tList = new ArrayList<>();
|
| | | for (T t : clazzList)
|
| | | tList.add(t);
|
| | | Cache cache = ehCacheCacheManager.getCache(name);
|
| | | cache.put(key, tList);
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.Cache;
|
| | | import org.springframework.cache.ehcache.EhCacheCacheManager;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.qcloud.cos.model.ListMultipartUploadsRequest;
|
| | | import com.yeshi.fanli.dao.mybatis.goods.recommend.RecommendGoodsDeleteHistoryMapper;
|
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryMapper recommendGoodsDeleteHistoryMapper;
|
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Override
|
| | | public void addRecommendGoodsDeleteHistory(RecommendGoodsDeleteHistory history) {
|
| | |
| | | if (history.getCreateTime() == null)
|
| | | history.setCreateTime(new Date());
|
| | | recommendGoodsDeleteHistoryMapper.insertSelective(history);
|
| | | try {
|
| | | // 清除个人推荐的缓存
|
| | | Cache cache = ehCacheCacheManager.getCache("recommendUserCache");
|
| | | cache.clear();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setPayMoney(detail.getPayMoney());
|
| | | if (detail.getState().intValue() != msg.getState()) {
|
| | | update.setState(detail.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | // update.setUpdateTime(new Date());
|
| | | if (needNotify)
|
| | | userMsgReadStateService.addOrderMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
| | | return commonOrder;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | return oldCommonOrder;
|
| | | }
|
| | | // 交易ID一致才修改
|
| | |
| | | return commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteErrorCommonOrder(Long coId) {
|
| | | // 查询是否返利到账
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(coId);
|
| | | if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU)
|
| | | return;
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Service.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | boolean canDelete = true;
|
| | | for (HongBaoV2 child : hongBaoList)
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU) {
|
| | | canDelete = false;
|
| | | break;
|
| | | }
|
| | | // 不能删除
|
| | | if (!canDelete)
|
| | | return;
|
| | |
|
| | | // 删除child
|
| | | for (HongBaoV2 child : hongBaoList)
|
| | | hongBaoV2Service.deleteByPrimaryKey(child.getId());
|
| | | // 删除主红包
|
| | | hongBaoV2Service.deleteByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
|
| | | // 删除hongbaoOrder
|
| | | hongBaoOrderService.deleteByPrimaryKey(hongBaoOrder.getId());
|
| | | // 删除CommonOrder
|
| | | commonOrderMapper.deleteByPrimaryKey(hongBaoOrder.getCommonOrder().getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndTradeId(int sourceType, String tradeId) {
|
| | | return commonOrderMapper.listBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderRepairHistoryMapper;
|
| | | import com.yeshi.fanli.entity.order.OrderRepairHistory;
|
| | | import com.yeshi.fanli.service.inter.order.OrderRepairHistoryService;
|
| | |
|
| | | @Service
|
| | | public class OrderRepairHistoryServiceImpl implements OrderRepairHistoryService {
|
| | |
|
| | | @Resource
|
| | | private OrderRepairHistoryMapper orderRepairHistoryMapper;
|
| | |
|
| | | @Override
|
| | | public void addOrderRepairHistory(OrderRepairHistory history) {
|
| | | if (history.getCreateTime() == null)
|
| | | history.setCreateTime(new Date());
|
| | | orderRepairHistoryMapper.insertSelective(history);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.OrderRepairHistory;
|
| | | import com.yeshi.fanli.entity.order.ShareGoodsActivityOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderRepairHistoryService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderRepairService;
|
| | | import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class OrderRepairServiceImpl implements OrderRepairService {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderGoodsMapper commonOrderGoodsMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | | @Resource
|
| | | private ShareGoodsActivityOrderService shareGoodsActivityOrderService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderMapper commonOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderTradeIdMapMapper commonOrderTradeIdMapMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private OrderRepairHistoryService orderRepairHistoryService;
|
| | |
|
| | | @Override
|
| | | public void repairOrder(String orderId) {
|
| | | // 比较CommonOrder与TaoBaoOrder的预估收益
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | // 统计
|
| | | BigDecimal sumMoney = new BigDecimal("0");
|
| | | for (TaoBaoOrder order : orderList) {
|
| | | BigDecimal money = order.geteIncome().add(order.getSubsidy());
|
| | | sumMoney = sumMoney.add(money);
|
| | | if (order.getOrderState().equalsIgnoreCase("订单付款") || order.getOrderState().equalsIgnoreCase("订单成功"))
|
| | | return;
|
| | | }
|
| | |
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | BigDecimal commonSumMoney = new BigDecimal("0");
|
| | | for (CommonOrder commonOrder : commonOrderList) {
|
| | | commonSumMoney = commonSumMoney.add(commonOrder.geteIncome());
|
| | | }
|
| | |
|
| | | try {
|
| | | processLessFanOrder(orderId);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // if (sumMoney.compareTo(commonSumMoney) > 0) {
|
| | | // // 少返了
|
| | | //
|
| | | // } else {
|
| | | //
|
| | | // }
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void processLessFanOrder(String orderId) throws Exception {
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | // 确定是自购还是分享赚
|
| | | if (commonOrderList.size() <= 0)
|
| | | return;
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(commonOrderList.get(0).getId());
|
| | | // 统计原来的上下级关系及返利的资金
|
| | | Map<Long, BigDecimal> oldMoney = new HashMap<>();
|
| | | Long firstUid = null;
|
| | | Long secondUid = null;
|
| | | Long mainUid = null;
|
| | | // 统计返利的资金
|
| | | for (CommonOrder co : commonOrderList) {
|
| | | hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(co.getId());
|
| | | mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
|
| | | if (oldMoney.get(mainUid) == null)
|
| | | oldMoney.put(mainUid, new BigDecimal(0));
|
| | | if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU)
|
| | | oldMoney.put(mainUid, oldMoney.get(mainUid).add(hongBaoOrder.getHongBaoV2().getMoney()));
|
| | | // 查询是否有下级
|
| | | List<HongBaoV2> childrenList = hongBaoV2Service.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | for (HongBaoV2 child : childrenList) {
|
| | | if (child.getType() == HongBaoV2.TYPE_YIJI || child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
|
| | | firstUid = child.getUserInfo().getId();
|
| | | if (oldMoney.get(firstUid) == null)
|
| | | oldMoney.put(firstUid, new BigDecimal(0));
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | oldMoney.put(firstUid, oldMoney.get(firstUid).add(child.getMoney()));
|
| | |
|
| | | } else if (child.getType() == HongBaoV2.TYPE_ERJI || child.getType() == HongBaoV2.TYPE_SHARE_ERJI) {
|
| | | secondUid = child.getUserInfo().getId();
|
| | | if (oldMoney.get(secondUid) == null)
|
| | | oldMoney.put(secondUid, new BigDecimal(0));
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | oldMoney.put(firstUid, oldMoney.get(secondUid).add(child.getMoney()));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | List<TaoBaoOrder> taoBaoOrderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | |
|
| | | // 根据交易ID查询
|
| | | // 先删除所有信息
|
| | | List<CommonOrder> commonOrderOldList = commonOrderMapper.listBySourceTypeAndOrderNo(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | if (commonOrderOldList != null)
|
| | | for (CommonOrder co : commonOrderOldList) {
|
| | | deleteByCommonOrderId(co.getId());
|
| | | }
|
| | |
|
| | | // 然后再增加
|
| | |
|
| | | int invalidCount = 0;
|
| | | for (TaoBaoOrder tb : taoBaoOrderList) {
|
| | | if ("订单失效".equalsIgnoreCase(tb.getOrderState())) {
|
| | | invalidCount++;
|
| | | }
|
| | | }
|
| | |
|
| | | // 获取整体订单的状态
|
| | | int wholeOrderState = 0;
|
| | | if (taoBaoOrderList.size() == invalidCount)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_SHIXIAO;
|
| | | else if (invalidCount == 0)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_YOUXIAO;
|
| | | else
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
|
| | |
|
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrderList) {
|
| | | CommonOrder commonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | commonOrder.setStateWholeOrder(wholeOrderState);
|
| | | commonOrder.setCommonOrderGoods(getCommonOrderGoods(taoBaoOrder.getAuctionId()));
|
| | | commonOrder.setUserInfo(new UserInfo(mainUid));
|
| | | addOrder(commonOrder, hongBaoOrder.getHongBaoV2().getType(), firstUid, secondUid);
|
| | | // } else {// 删除旧的,添加新的
|
| | | // Long commonOrderId = oldCommonOrder.getId();
|
| | | // List<CommonOrder> list =
|
| | | // commonOrderService.listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | // tradeId);
|
| | | // if (list.size() > 1)// 删除多余的tradeId
|
| | | // {
|
| | | // for (CommonOrder co : list) {
|
| | | // if (co.getId().longValue() != commonOrderId)
|
| | | // deleteByCommonOrderId(co.getId());
|
| | | // }
|
| | | // }
|
| | | // // 修改原来的信息
|
| | | // updateOrderInfo(taoBaoOrder, commonOrderId);
|
| | | // }
|
| | | }
|
| | |
|
| | | // 统计修改后的资金
|
| | | List<CommonOrder> newCommonOrderList = commonOrderMapper.listBySourceTypeAndOrderNo(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | Map<Long, BigDecimal> newMap = new HashMap<>();
|
| | | if (newCommonOrderList != null)
|
| | | for (CommonOrder co : newCommonOrderList) {
|
| | | HongBaoOrder newHongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(co.getId());
|
| | | HongBaoV2 hongBao = newHongBaoOrder.getHongBaoV2();
|
| | | if (hongBao.getState() == HongBaoV2.STATE_YILINGQU) {
|
| | | Long uid = hongBao.getUserInfo().getId();
|
| | | if (newMap.get(uid) == null)
|
| | | newMap.put(uid, new BigDecimal(0));
|
| | | newMap.put(uid, newMap.get(uid).add(hongBao.getMoney()));
|
| | | }
|
| | | List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBao.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children) {
|
| | | if (newMap.get(child.getUserInfo().getId()) == null)
|
| | | newMap.put(child.getUserInfo().getId(), new BigDecimal(0));
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | newMap.put(child.getUserInfo().getId(),
|
| | | newMap.get(child.getUserInfo().getId()).add(child.getMoney()));
|
| | | }
|
| | | }
|
| | |
|
| | | for (Iterator<Long> its = newMap.keySet().iterator(); its.hasNext();) {
|
| | | Long uid = its.next();
|
| | | BigDecimal beforeGetMoney = oldMoney.get(uid);
|
| | | BigDecimal afterGetMoney = newMap.get(uid);
|
| | | OrderRepairHistory history = new OrderRepairHistory();
|
| | | history.setAfterGetMoney(afterGetMoney);
|
| | | history.setBeforeGetMoney(beforeGetMoney);
|
| | | history.setOrderId(orderId);
|
| | | history.setUid(uid);
|
| | | orderRepairHistoryService.addOrderRepairHistory(history);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private CommonOrderGoods getCommonOrderGoods(Long auctionId) {
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(auctionId + "",
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | CommonOrderGoods cog = null;
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + auctionId, "");
|
| | | try {
|
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(auctionId);
|
| | | } catch (Exception e1) {
|
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(auctionId,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | if (commonGoods != null)
|
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods);
|
| | | }
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | cog = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | cog.setCreateTime(new Date());
|
| | | cog.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(cog);
|
| | |
|
| | | return cog;
|
| | | } else
|
| | | return commonGoodsList.get(0);
|
| | |
|
| | | }
|
| | |
|
| | | // 修改订单信息
|
| | | @Transactional
|
| | | private void updateOrderInfo(TaoBaoOrder taoBaoOrder, Long commonOrderId) throws Exception {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(commonOrderId);
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(taoBaoOrder.getAuctionId() + "", newCommonOrder.getSourceType());
|
| | | CommonOrderGoods cog = null;
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
|
| | | try {
|
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
|
| | | } catch (Exception e1) {
|
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
|
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | | if (commonGoods != null)
|
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods);
|
| | | }
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | cog = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | cog.setCreateTime(new Date());
|
| | | cog.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(cog);
|
| | | }
|
| | |
|
| | | newCommonOrder.setCommonOrderGoods(cog);
|
| | | newCommonOrder.setId(commonOrderId);
|
| | | newCommonOrder.setCreateTime(null);
|
| | | newCommonOrder.setUpdateTime(new Date());
|
| | | commonOrderService.updateByPrimaryKeySelective(newCommonOrder);
|
| | | // 更新主红包信息
|
| | | CommonOrder commonOrder = commonOrderService.selectByPrimaryKey(newCommonOrder.getId());
|
| | |
|
| | | if (hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_ZIGOU) {
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | // 免单处理
|
| | | boolean mianDan = false;
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | commonOrder.getOrderNo());
|
| | | if (orderList != null && orderList.size() == 1) {// 只有1个订单才参与免单
|
| | | BigDecimal payMent = commonOrder.getPayment();
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS)
|
| | | payMent = commonOrder.getSettlement();
|
| | | if (payMent.compareTo(new BigDecimal(10)) < 0) {
|
| | | mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getOrderNo());
|
| | | }
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2(hongBaoOrder.getHongBaoV2().getId());
|
| | | hongBao.setUpdateTime(new Date());
|
| | | // 更改状态与资金
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | if (mianDan)
|
| | | hongBao.setMoney(commonOrder.getPayment());
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | if (hongBaoOrder.getHongBaoV2().getPreGetTime().getTime() < System.currentTimeMillis())
|
| | | hongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | hongBao.setPreGetTime(new Date(commonOrder.getSettleTime().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | | if (mianDan)
|
| | | hongBao.setMoney(commonOrder.getSettlement().compareTo(commonOrder.getPayment()) <= 0
|
| | | ? commonOrder.getSettlement() : commonOrder.getPayment());// 返利结算与付款较小的金额
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | if (mianDan) {
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(12, "免单券退款出错");
|
| | | }
|
| | | }
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
|
| | |
|
| | | // 更新子红包信息
|
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null && children.size() > 0)
|
| | | for (HongBaoV2 child : children) {
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | | childUpdate.setState(hongBao.getState());
|
| | | childUpdate.setUpdateTime(new Date());
|
| | | BigDecimal rate = null;
|
| | | if (child.getType() == HongBaoV2.TYPE_YIJI) {// 一级分享赚
|
| | | rate = hongBaoManageService.getFirstInviteRate(child.getUrank(),
|
| | | commonOrder.getCreateTime().getTime());
|
| | | } else if (child.getType() == HongBaoV2.TYPE_ERJI) {// 二级分享赚
|
| | | rate = hongBaoManageService.getSecondInviteRate(child.getUrank(),
|
| | | commonOrder.getCreateTime().getTime());
|
| | | }
|
| | |
|
| | | // 以实际收入为准计算预估收益
|
| | | if (hongBao.getState() == HongBaoV2.STATE_YILINGQU) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | childUpdate.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | |
|
| | | if (child.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | childUpdate.setState(HongBaoV2.STATE_YILINGQU);
|
| | | childUpdate.setGetTime(child.getGetTime());
|
| | | }
|
| | |
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
|
| | | }
|
| | | } else if (hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | |
|
| | | BigDecimal fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | | List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService
|
| | | .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), commonOrder.getOrderNo());
|
| | | if (list != null && list.size() > 0) {
|
| | | fanliRate = list.get(0).getShareRate();
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2(hongBaoOrder.getHongBaoV2().getId());
|
| | | hongBao.setUpdateTime(new Date());
|
| | | // 更改状态与资金
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | hongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | if (hongBaoOrder.getHongBaoV2().getGetTime() == null) {
|
| | | hongBao.setGetTime(hongBaoOrder.getHongBaoV2().getPreGetTime());
|
| | | }
|
| | |
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
|
| | |
|
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children) {
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | | // 统一设置状态
|
| | | childUpdate.setState(hongBao.getState());
|
| | | childUpdate.setUpdateTime(new Date());
|
| | | BigDecimal rate = null;
|
| | | if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级分享赚
|
| | | rate = hongBaoManageService.getFirstShareRate(1, commonOrder.getCreateTime().getTime());
|
| | | } else if (child.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级分享赚
|
| | | rate = hongBaoManageService.getSecondShareRate(1, commonOrder.getCreateTime().getTime());
|
| | | }
|
| | |
|
| | | // 以实际收入为准计算预估收益
|
| | | if (CommonOrder.STATE_JS == commonOrder.getState()) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16",
|
| | | "yyyy-MM-dd"))
|
| | | childUpdate.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(),
|
| | | rate.divide(new BigDecimal(100))));
|
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | childUpdate.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | | if (child.getGetTime() == null) {
|
| | | childUpdate.setGetTime(child.getPreGetTime());
|
| | | }
|
| | |
|
| | | } else if (CommonOrder.STATE_FK == commonOrder.getState()) {
|
| | | if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16",
|
| | | "yyyy-MM-dd"))
|
| | | childUpdate.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(),
|
| | | rate.divide(new BigDecimal(100))));
|
| | | else
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void addOrder(CommonOrder commonOrder, int type, Long firstUid, Long secondUid) throws Exception {
|
| | | // 增加commonOrder
|
| | | commonOrder.setCreateTime(commonOrder.getThirdCreateTime());
|
| | | // 不存在就插入,存在就不管
|
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods();
|
| | |
|
| | | // 之前不存在于数据库
|
| | | if (commonOrder.getCommonOrderGoods().getId() == null) {
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | |
|
| | | if (commonGoodsList == null || commonGoodsList.size() < 1) {// 不存在
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | } else {// 存在
|
| | | goods = commonGoodsList.get(0);
|
| | | }
|
| | | if (goods.getId() == null)
|
| | | return;
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | }
|
| | |
|
| | | CommonOrder oldCommonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(commonOrder.getSourceType(),
|
| | | commonOrder.getTradeId());
|
| | | if (oldCommonOrder == null)// 新增
|
| | | {
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | | try {
|
| | | // 插入映射,保证交易ID的完整性
|
| | | commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
|
| | | commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加红包
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | // 查询是否有免单计划
|
| | | BigDecimal mianDanMoney = null;
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | commonOrder.getOrderNo());
|
| | | if (orderList != null && orderList.size() == 1) {// 只有1个订单才参与免单
|
| | | BigDecimal payMent = commonOrder.getPayment();
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS)
|
| | | payMent = commonOrder.getSettlement();
|
| | |
|
| | | goods = commonOrderGoodsMapper.selectByPrimaryKey(commonOrder.getCommonOrderGoods().getId());
|
| | | if (goods != null) {
|
| | |
|
| | | try {
|
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
|
| | | mianDanMoney = payMent;
|
| | | } catch (NumberFormatException e) {
|
| | | throw new HongBaoException(10, "免单商品处理出错");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(11, "免单商品处理出错");
|
| | | }
|
| | | }
|
| | | }
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | | hongBao.setBeizhu("2019年7月批量修改");
|
| | | hongBao.setUserInfo(commonOrder.getUserInfo());
|
| | | hongBao.setCreateTime(new Date());
|
| | | hongBao.setType(HongBaoV2.TYPE_ZIGOU);
|
| | | hongBao.setVersion(2);
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | hongBao.setPreGetTime(new Date(commonOrder.getSettleTime().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | |
|
| | | if (hongBao.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | hongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBao.setGetTime(hongBao.getPreGetTime());
|
| | | }
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | } else {
|
| | | throw new HongBaoException(3, "维权订单不能创建红包");
|
| | | }
|
| | |
|
| | | if (mianDanMoney != null)
|
| | | hongBao.setMoney(mianDanMoney);
|
| | |
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBaoV2Mapper.insertSelective(hongBao);
|
| | | // 添加红包与订单的映射
|
| | | HongBaoOrder hongBaoOrder = new HongBaoOrder();
|
| | | hongBaoOrder.setCommonOrder(commonOrder);
|
| | | hongBaoOrder.setCreateTime(new Date());
|
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | |
|
| | | UserInfo boss = null;
|
| | | if (firstUid != null)
|
| | | boss = userInfoService.selectByPKey(firstUid);
|
| | |
|
| | | if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && mianDanMoney == null) {// 1级BOSS存在且红包未失效,免单不支持多级分销
|
| | |
|
| | | // 插入一级子红包
|
| | | BigDecimal firstRate = hongBaoManageService
|
| | | .getFirstInviteRate(boss.getRank() == null ? 0 : boss.getRank());
|
| | | if (firstRate.compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | | HongBaoV2 firstHongbao = new HongBaoV2();
|
| | | firstHongbao.setBeizhu("2019年7月批量修改");
|
| | | firstHongbao.setUserInfo(boss);
|
| | | firstHongbao.setUrank(boss.getRank());
|
| | | firstHongbao.setParent(hongBao);
|
| | | firstHongbao.setCreateTime(new Date());
|
| | | firstHongbao.setType(HongBaoV2.TYPE_YIJI);
|
| | | firstHongbao.setVersion(2);
|
| | | firstHongbao.setState(hongBao.getState());
|
| | |
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | firstHongbao.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | | if (firstHongbao.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | firstHongbao.setGetTime(firstHongbao.getPreGetTime());
|
| | | firstHongbao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | }
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | // 返利为0的不通知
|
| | | if (firstHongbao.getMoney() == null || firstHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | |
|
| | | hongBaoV2Mapper.insertSelective(firstHongbao);
|
| | |
|
| | | // 插入二级子红包
|
| | | if (secondUid == null)
|
| | | boss = null;
|
| | | else
|
| | | boss = userInfoService.selectByPKey(secondUid);
|
| | |
|
| | | if (boss != null) {// 二级BOSS存在
|
| | | BigDecimal secondRate = hongBaoManageService
|
| | | .getSecondInviteRate(boss.getRank() == null ? 0 : boss.getRank());
|
| | | if (secondRate.compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | | HongBaoV2 secondHongbao = new HongBaoV2();
|
| | | secondHongbao.setBeizhu("2019年7月批量修改");
|
| | | secondHongbao.setUserInfo(boss);
|
| | | secondHongbao.setUrank(boss.getRank());
|
| | | secondHongbao.setParent(hongBao);
|
| | | secondHongbao.setCreateTime(new Date());
|
| | | secondHongbao.setType(HongBaoV2.TYPE_ERJI);
|
| | | secondHongbao.setVersion(2);
|
| | | secondHongbao.setState(hongBao.getState());
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | secondHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | secondHongbao.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | | if (secondHongbao.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | secondHongbao.setGetTime(secondHongbao.getPreGetTime());
|
| | | secondHongbao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | }
|
| | |
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | secondHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | }
|
| | |
|
| | | // 返利为0的不统计
|
| | | if (secondHongbao.getMoney() == null || secondHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | | hongBaoV2Mapper.insertSelective(secondHongbao);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | | // 分享赚不加入失效的订单
|
| | | if (commonOrder.getState() == CommonOrder.STATE_SX || commonOrder.getState() == CommonOrder.STATE_WQ)
|
| | | return;
|
| | | // 分享赚
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | | hongBao.setBeizhu("2019年7月批量修改");
|
| | | hongBao.setCreateTime(new Date());
|
| | | hongBao.setType(HongBaoV2.TYPE_SHARE_GOODS);
|
| | | hongBao.setVersion(2);
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), shareRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), shareRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | hongBao.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd")));
|
| | | if (hongBao.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | hongBao.setGetTime(hongBao.getPreGetTime());
|
| | | hongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | }
|
| | | }
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBao.setUserInfo(user);
|
| | | hongBaoV2Mapper.insertSelective(hongBao);
|
| | | // 插入红包与订单映射
|
| | | HongBaoOrder hongBaoOrder = new HongBaoOrder();
|
| | | hongBaoOrder.setCommonOrder(commonOrder);
|
| | | hongBaoOrder.setCreateTime(new Date());
|
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | |
|
| | | // 4月17日后才有一级分享赚
|
| | | if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-17", "yyyy-MM-dd")) {
|
| | | UserInfo boss = null;
|
| | | if (firstUid != null)
|
| | | boss = userInfoService.selectByPKey(firstUid);
|
| | | if (boss != null) {
|
| | | BigDecimal firstLevelRate = hongBaoManageService.getFirstShareRate(1,
|
| | | commonOrder.getThirdCreateTime().getTime());
|
| | | HongBaoV2 child = new HongBaoV2();
|
| | | child.setBeizhu("2019年7月批量修改");
|
| | | child.setParent(hongBao);
|
| | | child.setType(HongBaoV2.TYPE_SHARE_YIJI);
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | child.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(),
|
| | | firstLevelRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | child.setState(HongBaoV2.STATE_KELINGQU);
|
| | | child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(),
|
| | | firstLevelRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | child.setPreGetTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | |
|
| | | if (child.getPreGetTime().getTime() < System.currentTimeMillis()) {
|
| | | child.setGetTime(child.getPreGetTime());
|
| | | child.setState(HongBaoV2.STATE_YILINGQU);
|
| | | }
|
| | |
|
| | | }
|
| | | child.setUserInfo(boss);
|
| | | child.setUrank(boss.getRank());
|
| | | child.setVersion(2);
|
| | | child.setCreateTime(new Date());
|
| | | hongBaoV2Mapper.insertSelective(child);
|
| | | }
|
| | | }
|
| | |
|
| | | } else
|
| | | throw new HongBaoException(2, "type错误");
|
| | |
|
| | | // 添加
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void deleteByCommonOrderId(Long commonOrderId) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(commonOrderId);
|
| | | List<HongBaoV2> children = hongBaoV2Service.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 hongBao : children) {
|
| | | hongBaoV2Service.deleteByPrimaryKey(hongBao.getId());
|
| | | }
|
| | | hongBaoV2Service.deleteByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
|
| | | hongBaoOrderService.deleteByPrimaryKey(hongBaoOrder.getId());
|
| | | commonOrderService.deleteByPrimaryKey(commonOrderId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return deviceActive;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DeviceActive getFirstActiveInfo(String device) {
|
| | | return deviceActiveMapper.selectFirst(device);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | case 1: // 站内信
|
| | | pushService.pushZNX(uid, title, content, listIOS, listAndroid);
|
| | | userSystemMsgService.addUserSystemMsg(uid, UserSystemMsgTypeEnum.question, title, content,
|
| | | UserSystemMsg.TIME_TAG_EMERGENT, null);
|
| | | UserSystemMsg.TIME_TAG_COMMON, null);
|
| | | break;
|
| | | case 2: // 网页推送
|
| | | pushService.pushUrl(uid, title, content, url, listIOS, listAndroid);
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.ShareHotGoodsDao;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | @Resource
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Override
|
| | | public void addShareHotGoods(ShareHotGoods goods) {
|
| | | if (goods == null || StringUtil.isNullOrEmpty(goods.getDay()) || goods.getGoods() == null)
|
| | |
| | | shareHotGoodsDao.save(goods);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "commonContentCache", key = "'listByDay'+#day")
|
| | | @Override
|
| | | public List<ShareHotGoods> listByDay(String day) {
|
| | | return listByDay(day, 10);
|
| | |
| | |
|
| | | @Override
|
| | | public List<ShareHotGoods> listByDay(String day, int count) {
|
| | | return shareHotGoodsDao.listByDayOrderByUpdateTime(day, 1, count);
|
| | | List<ShareHotGoods> list = shareHotGoodsDao.listByDayOrderByUpdateTime(day, 1, count);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null) {
|
| | | for (ShareHotGoods shg : list)
|
| | | goodsList.add(shg.getGoods());
|
| | | }
|
| | | // 过滤下线商品
|
| | | goodsList = taoBaoGoodsBriefService.filterOffLineGoods(goodsList);
|
| | | // 添加大淘客信息
|
| | | goodsList = daTaoKeGoodsDetailService.filterTaoBaoGoods(goodsList);
|
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = new HashMap<>();
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief g : goodsList)
|
| | | goodsMap.put(g.getAuctionId(), g);
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | if (goodsMap.get(list.get(j).getGoods().getAuctionId()) == null) {
|
| | | list.remove(j);
|
| | | j--;
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listPreGoods() {
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Service.listPreShareHotGoods();
|
| | | public List<TaoBaoGoodsBrief> listPreGoods(int page) {
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Service.listPreShareHotGoods(page);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null) {
|
| | | for (DaTaoKeDetailV2 v2 : list)
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean verifyCanCreateTLJ(Long auctionId) {
|
| | | public boolean verifyCanCreateTLJ(Long auctionId,TaoKeAppInfo info) {
|
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金验证", new BigDecimal("1.00"), 1, new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6), new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6),
|
| | | TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT);
|
| | | info);
|
| | | } catch (TaoKeApiException e) {
|
| | | if (e.getCode() == TaoKeApiException.CODE_TLJ_FORBIDDEN) {
|
| | | // 该商品不支持创建淘礼金红包
|
| | |
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateShareGoods(TaoBaoGoodsBrief goods) {
|
| | | List<ShareHotGoods> list = shareHotGoodsDao.listByAuctionId(goods.getAuctionId());
|
| | | if (list != null)
|
| | | for (ShareHotGoods shareHotGoods : list) {
|
| | | // 更新券信息 ,价格信息,销量信息
|
| | | shareHotGoods.getGoods().setZkPrice(goods.getZkPrice());
|
| | | shareHotGoods.getGoods().setCouponAmount(goods.getCouponAmount());
|
| | | shareHotGoods.getGoods().setCouponInfo(goods.getCouponInfo());
|
| | | shareHotGoods.getGoods().setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime());
|
| | | shareHotGoods.getGoods().setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime());
|
| | | shareHotGoods.getGoods().setCouponLeftCount(goods.getCouponLeftCount());
|
| | | shareHotGoods.getGoods().setCouponStartFee(goods.getCouponStartFee());
|
| | | shareHotGoods.getGoods().setCouponTotalCount(goods.getCouponTotalCount());
|
| | | shareHotGoods.getGoods().setBiz30day(goods.getBiz30day());
|
| | | shareHotGoodsDao.save(shareHotGoods);
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.TLJBuyGoodsDao;
|
| | | import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class TLJBuyGoodsServiceImpl implements TLJBuyGoodsService {
|
| | | @Resource
|
| | | private TLJBuyGoodsDao tljBuyGoodsDao;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Override
|
| | | public void addTLJBuyGoods(TLJBuyGoods goods) {
|
| | | if (goods == null || StringUtil.isNullOrEmpty(goods.getDay()) || goods.getGoods() == null)
|
| | | return;
|
| | | goods.setId(StringUtil.Md5(goods.getDay() + "#" + goods.getGoods().getAuctionId()));
|
| | | if (goods.getUpdateTime() == null)
|
| | | goods.setUpdateTime(new Date());
|
| | | tljBuyGoodsDao.save(goods);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "commonContentCache", key = "'listByDay'+#day")
|
| | | @Override
|
| | | public List<TLJBuyGoods> listByDay(String day) {
|
| | | return listByDay(day, 10);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TLJBuyGoods> listByDay(String day, int count) {
|
| | | List<TLJBuyGoods> list = tljBuyGoodsDao.listByDayOrderByUpdateTime(day, 1, count);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null) {
|
| | | for (TLJBuyGoods shg : list)
|
| | | goodsList.add(shg.getGoods());
|
| | | }
|
| | | // 过滤下线商品
|
| | | goodsList = taoBaoGoodsBriefService.filterOffLineGoods(goodsList);
|
| | | // 添加大淘客信息
|
| | | goodsList = daTaoKeGoodsDetailService.filterTaoBaoGoods(goodsList);
|
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = new HashMap<>();
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief g : goodsList)
|
| | | goodsMap.put(g.getAuctionId(), g);
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | if (goodsMap.get(list.get(j).getGoods().getAuctionId()) == null) {
|
| | | list.remove(j);
|
| | | j--;
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteById(String id) {
|
| | | tljBuyGoodsDao.delete(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listPreGoods(int page) {
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Service.listPreTLJBuyGoods(page);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null) {
|
| | | for (DaTaoKeDetailV2 v2 : list)
|
| | | goodsList.add(TaoBaoUtil.convert(v2));
|
| | | }
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByGoodsId(Long goodsId) {
|
| | | tljBuyGoodsDao.deleteByGoodsId(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean verifyCanCreateTLJ(Long auctionId) {
|
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金验证", new BigDecimal("1.00"), 1, new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6), new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 6),
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT));
|
| | | } catch (TaoKeApiException e) {
|
| | | if (e.getCode() == TaoKeApiException.CODE_TLJ_FORBIDDEN) {
|
| | | // 该商品不支持创建淘礼金红包
|
| | | deleteByGoodsId(auctionId);
|
| | | return false;
|
| | | } else if (e.getCode() == TaoKeApiException.CODE_TLJ_NO_MONEY) {
|
| | | // 官方玩法钱包余额不足 TODO
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateGoods(TaoBaoGoodsBrief goods) {
|
| | | List<TLJBuyGoods> list = tljBuyGoodsDao.listByAuctionId(goods.getAuctionId());
|
| | | if (list != null)
|
| | | for (TLJBuyGoods TLJBuyGoods : list) {
|
| | | // 更新券信息 ,价格信息,销量信息
|
| | | TLJBuyGoods.getGoods().setZkPrice(goods.getZkPrice());
|
| | | TLJBuyGoods.getGoods().setCouponAmount(goods.getCouponAmount());
|
| | | TLJBuyGoods.getGoods().setCouponInfo(goods.getCouponInfo());
|
| | | TLJBuyGoods.getGoods().setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime());
|
| | | TLJBuyGoods.getGoods().setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime());
|
| | | TLJBuyGoods.getGoods().setCouponLeftCount(goods.getCouponLeftCount());
|
| | | TLJBuyGoods.getGoods().setCouponStartFee(goods.getCouponStartFee());
|
| | | TLJBuyGoods.getGoods().setCouponTotalCount(goods.getCouponTotalCount());
|
| | | TLJBuyGoods.getGoods().setBiz30day(goods.getBiz30day());
|
| | | tljBuyGoodsDao.save(TLJBuyGoods);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void subHongBaoLeftCount(Long auctionId, String day, int count) {
|
| | | TLJBuyGoods goods = tljBuyGoodsDao.selectByAuctionIdAndDay(auctionId, day);
|
| | | if (goods != null) {
|
| | | tljBuyGoodsDao.subHongBaoCount(goods.getId(), count);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TLJBuyGoods selectByAuctionIdAndDay(Long auctionId, String day) {
|
| | | return tljBuyGoodsDao.selectByAuctionIdAndDay(auctionId, day);
|
| | | }
|
| | | } |
| | |
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Override
|
| | | public void startUpdate() {
|
| | |
| | |
|
| | | // 更新简版商品状态为下架
|
| | | commonGoodsService.offlineCommonGoods(auctionId, CommonGoods.GOODS_TYPE_TB);
|
| | |
|
| | | // 分享爆款数据删除
|
| | | shareHotGoodsService.deleteByGoodsId(auctionId);
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | |
|
| | | // 更新动态商品
|
| | | activityService.updateRecommendActivityGoods(goods);
|
| | |
|
| | | // 更新分享库的商品
|
| | | shareHotGoodsService.updateShareGoods(goods);
|
| | |
|
| | | // 更新自购立减库商品
|
| | | tljBuyGoodsService.updateGoods(goods);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | taoBaoGoodsBriefMapper.updateBatchSelective(updateList);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<Long> listNeedUpdateGoodsId(long start, int count, int hour) {
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.UserTLJBuyHistoryDao;
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | | import com.yeshi.fanli.service.inter.taobao.UserTLJBuyHistoryService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class UserTLJBuyHistoryServiceImpl implements UserTLJBuyHistoryService {
|
| | | @Resource
|
| | | private UserTLJBuyHistoryDao userTLJBuyHistoryDao;
|
| | |
|
| | | @Override
|
| | | public boolean canBuy(Long uid, Long auctionId) {
|
| | | if (uid == null || auctionId == null)
|
| | | return false;
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | List<UserTLJBuyHistory> list = userTLJBuyHistoryDao.listByDayAndUidAndAuctionId(uid, auctionId, day);
|
| | | if (list == null || list.size() < 3)
|
| | | return true;
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addHistory(UserTLJBuyHistory history) throws Exception {
|
| | | if (history == null || history.getAuctionId() == null || history.getUid() == null)
|
| | | throw new Exception("信息不完整");
|
| | | if (history.getCreateTime() == null)
|
| | | history.setCreateTime(new Date());
|
| | | String day = TimeUtil.getGernalTime(history.getCreateTime().getTime(), "yyyy-MM-dd");
|
| | | history.setDay(day);
|
| | | history.setId(
|
| | | StringUtil.Md5(history.getAuctionId() + "-" + history.getUid() + "-" + System.currentTimeMillis()));
|
| | | userTLJBuyHistoryDao.save(history);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | List<DaTaoKeDetail> dtList = listByGoodsIds(goodsIdList);
|
| | |
|
| | | Map<Long, DaTaoKeDetail> map = new HashMap<>();
|
| | | if (dtList != null)
|
| | | for (DaTaoKeDetail goods : dtList)
|
| | | map.put(goods.getGoodsId(), goods);
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods() {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page) {
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "monthSales");
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE, "updateTime");
|
| | | System.out.println(list);
|
| | | list.addAll(daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "twoHoursSales"));
|
| | | list.addAll(daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "dailySales"));
|
| | | for (DaTaoKeDetailV2 v2 : list) {
|
| | | map.put(v2.getId(), v2);
|
| | | }
|
| | |
|
| | | List<DaTaoKeDetailV2> finalList = new ArrayList<>();
|
| | | for (Iterator<Long> its = map.keySet().iterator(); its.hasNext();) {
|
| | | finalList.add(map.get(its.next()));
|
| | | DaTaoKeDetailV2 v2 = map.get(its.next());
|
| | | Date time = new Date(TimeUtil.convertToTimeTemp(v2.getCouponEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | Date targetTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2L, "yyyy-MM-dd"),
|
| | | "yyyy-MM-dd") - 1000L);
|
| | | if (time.getTime() >= targetTime.getTime())
|
| | | finalList.add(v2);
|
| | | }
|
| | |
|
| | | Comparator<DaTaoKeDetailV2> cm = new Comparator<DaTaoKeDetailV2>() {
|
| | |
| | | return finalList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page) {
|
| | | if (page == 1) {
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_DAY);
|
| | | List<DaTaoKeDetailV2> goodsList = new ArrayList<>();
|
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
|
| | | BigDecimal commision = MoneyBigDecimalUtil
|
| | | .div(MoneyBigDecimalUtil.mul(v2.getActualPrice(), v2.getCommissionRate()), new BigDecimal(100));
|
| | | if (commision.multiply(new BigDecimal("0.7")).compareTo(new BigDecimal("1.01")) >= 0)
|
| | | goodsList.add(v2);
|
| | | }
|
| | | return goodsList;
|
| | | } else
|
| | | return new ArrayList<>();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | TaoLiJinDTO taoLiJinDTO = null;
|
| | | try {
|
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, name, perface, totalNum, sendStartTime,
|
| | | sendEndTime, useStartTime, useEndTime, pid);
|
| | | sendEndTime, useStartTime, useEndTime, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, pid));
|
| | | } catch (TaoKeApiException e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | executor.execute(new Runnable() {
|
| | |
| | | UserAccountBindingHistory.TYPE_PHONE);
|
| | | // 手机号更换绑定的7天内不能提现
|
| | | if (history != null && !history.getFirst()
|
| | | && (System.currentTimeMillis() - history.getCreateTime().getTime()) > 1000 * 60 * 60 * 24 * 7L) {
|
| | | && (System.currentTimeMillis() - history.getCreateTime().getTime()) < 1000 * 60 * 60 * 24 * 7L) {
|
| | | throw new AlipayAccountException(111, "修改手机号7天内不允许修改支付宝账号");
|
| | | }
|
| | | }
|
| | |
| | | return userActiveLogMapper.selectLatestByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserActiveLog getFirstActiveInfo(Long uid) {
|
| | | |
| | | |
| | | return userActiveLogMapper.selectFirstActiveInfo(uid);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | * @throws ShareGoodsException
|
| | | */
|
| | | public TaoBaoLink getTaoLiJinLinkForShare(Long uid, Long auctionId, String relationId) throws ShareGoodsException;
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * |
| | | * @param uid
|
| | | * @param auctionId
|
| | | * @return
|
| | | * @throws ShareGoodsException
|
| | | */
|
| | | public TaoBaoLink getTaoLiJinLinkForBuyWithOutFanLi(Long uid, Long auctionId) throws ShareGoodsException;
|
| | |
|
| | | }
|
| | |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | | |
| | | |
| | | /**
|
| | | * 过滤掉下架商品
|
| | | * @param goodsList
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> filterOffLineGoods(List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.goods.recommend;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 首页推荐商品服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface HomeRecommendGoodsService {
|
| | |
|
| | | /**
|
| | | * 获取推荐商品(根据页码)
|
| | | * |
| | | * @param uid
|
| | | * @param device
|
| | | * @param page
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listGoodsByPage(Long uid, String device,String imei,String idfa, int page);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public CommonOrder selectBySourceTypeAndTradeId(int sourceType, String tradeId);
|
| | |
|
| | | /**
|
| | | * 删除错误订单
|
| | | * |
| | | * @param coId
|
| | | */
|
| | | public void deleteErrorCommonOrder(Long coId);
|
| | |
|
| | | /**
|
| | | * 根据订单类型与交易ID查询
|
| | | * |
| | | * @param sourceType
|
| | | * @param tradeId
|
| | | * @return
|
| | | */
|
| | | public List<CommonOrder> listBySourceTypeAndTradeId(int sourceType, String tradeId);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.OrderRepairHistory;
|
| | |
|
| | | public interface OrderRepairHistoryService {
|
| | |
|
| | | /**
|
| | | * 添加记录
|
| | | * |
| | | * @param history
|
| | | */
|
| | | public void addOrderRepairHistory(OrderRepairHistory history);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | /**
|
| | | * 订单修复服务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface OrderRepairService {
|
| | |
|
| | | /**
|
| | | * 修复订单
|
| | | */
|
| | | public void repairOrder(String orderId);
|
| | | |
| | | |
| | | |
| | | }
|
| | |
| | |
|
| | | /**
|
| | | *
|
| | | * @param device 设备号
|
| | | * @param platform 平台类型
|
| | | * @param device
|
| | | * 设备号
|
| | | * @param platform
|
| | | * 平台类型
|
| | | * @return
|
| | | */
|
| | | public DeviceActive getDeviceByDeviceAndPlatform(String device, String deviceToken, String platform);
|
| | |
|
| | | /**
|
| | | * 获取设备的注册时间
|
| | | * |
| | | * @param device
|
| | | * @return
|
| | | */
|
| | | public DeviceActive getFirstActiveInfo(String device);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | |
|
| | | public interface ShareHotGoodsService {
|
| | |
|
| | |
| | | */
|
| | | public List<ShareHotGoods> listByDay(String day);
|
| | |
|
| | | |
| | | public List<ShareHotGoods> listByDay(String day,int count);
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listPreGoods();
|
| | | public List<TaoBaoGoodsBrief> listPreGoods(int page);
|
| | |
|
| | | /**
|
| | | * 根据商品id删除
|
| | |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | | public boolean verifyCanCreateTLJ(Long auctionId);
|
| | | public boolean verifyCanCreateTLJ(Long auctionId,TaoKeAppInfo info);
|
| | |
|
| | | /**
|
| | | * 更新分享库商品
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateShareGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 自购立减
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TLJBuyGoodsService {
|
| | |
|
| | | /**
|
| | | * 添加自购立减商品
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void addTLJBuyGoods(TLJBuyGoods goods);
|
| | |
|
| | | /**
|
| | | * 根据日期查找
|
| | | * |
| | | * @param day
|
| | | * @return
|
| | | */
|
| | | public List<TLJBuyGoods> listByDay(String day);
|
| | |
|
| | | public List<TLJBuyGoods> listByDay(String day, int count);
|
| | |
|
| | | /**
|
| | | * 根据主键删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteById(String id);
|
| | |
|
| | | /**
|
| | | * 获取备选商品
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listPreGoods(int page);
|
| | |
|
| | | /**
|
| | | * 根据商品id删除
|
| | | * |
| | | * @param goodsId
|
| | | */
|
| | | public void deleteByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 验证是否可以创建淘礼金
|
| | | * |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | | public boolean verifyCanCreateTLJ(Long auctionId);
|
| | |
|
| | | /**
|
| | | * 更新商品
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | /**
|
| | | * 减去剩余红包数量
|
| | | * |
| | | * @param auctionId
|
| | | * @param day
|
| | | * @param count
|
| | | */
|
| | | public void subHongBaoLeftCount(Long auctionId, String day, int count);
|
| | |
|
| | | /**
|
| | | * 根据商品ID和日期查询
|
| | | * |
| | | * @param auctionId
|
| | | * @param day
|
| | | * @return
|
| | | */
|
| | | public TLJBuyGoods selectByAuctionIdAndDay(Long auctionId, String day);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.UserTLJBuyHistory;
|
| | |
|
| | | /**
|
| | | * 淘礼金购买记录
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserTLJBuyHistoryService {
|
| | |
|
| | | public boolean canBuy(Long uid, Long auctionId);
|
| | |
|
| | | public void addHistory(UserTLJBuyHistory history) throws Exception;
|
| | |
|
| | | }
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods();
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page);
|
| | | |
| | | /**
|
| | | * 拉取自购立减备选商品
|
| | | * @param page
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public UserActiveLog getUserLatestActiveInfo(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取第一次活跃信息
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserActiveLog getFirstActiveInfo(Long uid);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | |
|
| | | public class TaoBaoConstant {
|
| | | // 淘宝第三方授权
|
| | | public static final String TAOBAO_AUTH_APPKEY = "24980167";
|
| | |
| | | // 淘宝将渠道ID处理成会员ID的pid
|
| | | public static final String TAOBAO_RELATION_AS_SPECIAL_PID = "mm_124933865_56750082_18689550042";
|
| | |
|
| | | // 自购立减PID
|
| | | public static TaoKeAppInfo ownBuyApp = new TaoKeAppInfo("24937414", "0457746e24622a6c8c7924288550af5f",
|
| | | "mm_133239778_45820106_699710614");
|
| | |
|
| | | public static BigDecimal OWN_BUY_WITHOUT_FANLI_RATE = new BigDecimal(70);// 自购立减的比例
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | | return taoBaoShopDTO;
|
| | | }
|
| | |
|
| | | public static int RANK_TYPE_TIME = 1;// 实时
|
| | | public static int RANK_TYPE_DAY = 2;// 全天榜
|
| | | public static int RANK_TYPE_HOT = 3;// 热推榜
|
| | |
|
| | | /**
|
| | | * 各大榜单
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public static DaTaoKeGoodsResult getRankingList(int type) {
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("rankType", type + "");
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-ranking-list", params, new HashMap<>());
|
| | | LogHelper.test("getRankingList:" + result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | if (json != null) {
|
| | | JSONArray array = json.optJSONArray("data");
|
| | |
|
| | | List<DaTaoKeDetailV2> list = new ArrayList<>();
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject itemData = array.optJSONObject(i);
|
| | | DaTaoKeDetailV2 item = gson.fromJson(itemData.toString(), DaTaoKeDetailV2.class);
|
| | | item.setCouponConditions(itemData.optString("quanUsageCondition"));
|
| | | item.setShopType(itemData.optInt("istmall"));
|
| | | item.setOriginalPrice(new BigDecimal(itemData.optString("originPrice")));
|
| | | item.setMainPic(itemData.optString("pic"));
|
| | | list.add(item);
|
| | | }
|
| | | daTaoKeGoodsResult.setGoodsList(list);
|
| | | }
|
| | | return daTaoKeGoodsResult;
|
| | |
|
| | | }
|
| | |
|
| | | class DaTaoKeResult {
|
| | | Date updateTime;
|
| | | List<DaTaoKeDetail> dataList;
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 返利维权
|
| | | *
|
| | |
| | | return createHongBaoDeduct(hb, "新人红包扣除");
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 返利奖励
|
| | | *
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单重复统计退款
|
| | | * |
| | | * @param orderId
|
| | | * @param money
|
| | | * @param user
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createRepeatStatistic(String orderId, BigDecimal money, UserInfo user)
|
| | | throws UserMoneyDetailException {
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | | throw new UserMoneyDetailException(1, "订单号不能为空");
|
| | | if (user == null)
|
| | | throw new UserMoneyDetailException(1, "UID不能为空");
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "金额不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.repeatStatistic.name() + "-" + orderId + "-" + user.getId()));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.repeatStatistic.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.repeatStatistic);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.UserMsgVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class UserMsgVOFactory {
|
| | |
|
| | |
| | | * @param msg
|
| | | * @return
|
| | | */
|
| | | public static UserMsgVO create(MsgOrderDetail msg) {
|
| | | public static UserMsgVO create(MsgOrderDetail msg, JumpDetailV2 jumpDetail, JSONObject params) {
|
| | |
|
| | | UserMsgVO vo = new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), null);
|
| | |
|
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | |
| | |
|
| | | } else {
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList,true));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("共", COLOR_CONTENT));
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" +filterMoney(msg.getPayMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getPayMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getHongBaoMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getHongBaoMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | |
|
| | | if (msg.getType() == MsgTypeOrderTypeEnum.fanli)
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("分享奖金", COLOR_TITLE), contentList));
|
| | | else if (msg.getType() == MsgTypeOrderTypeEnum.invite)
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", COLOR_TITLE), contentList));
|
| | |
|
| | | vo.setJumpDetail(jumpDetail);
|
| | | if (params != null)
|
| | | vo.setParams(params.toString());
|
| | | }
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | vo.setContentItems(items);
|
| | | return vo;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" +filterMoney(msg.getExtract().getMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(
|
| | | new ClientTextStyleVO("¥" + filterMoney(msg.getExtract().getMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金商品", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("到账金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖励订单", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖励金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "",
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | |
|
| | | if (dto.getFanLiMoney() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getFanLiMoney()),
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getFanLiMoney()), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("预估返利", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (dto.getOrderFanLiMoney() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getOrderFanLiMoney()),
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getOrderFanLiMoney()), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单返利", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (dto.getRewardMoney() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getRewardMoney()),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList
|
| | | .add(new ClientTextStyleVO("¥" + filterMoney(dto.getRewardMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖励金", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | if (dto.getMoney() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(dto.getMoney().setScale(2)),
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(
|
| | | new ClientTextStyleVO("¥" + filterMoney(dto.getMoney().setScale(2)), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("面额", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | return new UserMsgVO(icon, msg.getType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | return new UserMsgVO(icon, msg.getType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * Constant.systemCommonConfig.getIosBundleId());
|
| | | */
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | return 1;
|
| | |
|
| | | String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type);
|
| | | LogHelper.userInfo("IOS的推送日志:" + IOS);
|
| | | pushRecord.setIosPushId(IOS);
|
| | |
| | | */
|
| | | public static String singlePushIOS(MessageInfo info, PushRecord pushRecord, String url, int type,
|
| | | List<String> deviceTokenList) {
|
| | | if (Constant.IS_TEST)
|
| | | return null;
|
| | | if (deviceTokenList != null && deviceTokenList.size() > 0) {
|
| | | for (String deviceToken : deviceTokenList) {
|
| | | if (!StringUtil.isNullOrEmpty(deviceToken)) {
|
| | |
| | | if (detail != null && goods != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(detail.getdTitle());
|
| | | if (!StringUtil.isNullOrEmpty(detail.getPic()))
|
| | | goods.setPictUrlWhite(detail.getPic());
|
| | | }
|
| | | return goods;
|
| | | }
|
| | |
| | | if (detail != null && goods != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(detail.getDtitle());
|
| | | if (!StringUtil.isNullOrEmpty(detail.getMainPic()))
|
| | | goods.setPictUrlWhite(detail.getMainPic());
|
| | | }
|
| | | return goods;
|
| | | }
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | String result = HttpUtil.get(url);
|
| | |
|
| | | TaoBaoShop shop = new TaoBaoShop();
|
| | |
|
| | | try {
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | JSONObject dataJson = resultJson.optJSONObject("data");
|
| | | JSONObject sellerJson = dataJson.optJSONObject("seller");
|
| | | TaoBaoShop shop = new TaoBaoShop();
|
| | | shop.setGoodRatePercentage(new BigDecimal(sellerJson.optString("goodRatePercentage").replace("%", "")));
|
| | | shop.setId(sellerJson.optLong("userId"));
|
| | |
|
| | | shop.setGoodRatePercentage(new BigDecimal(sellerJson.optString("goodRatePercentage").replace("%", "")));
|
| | |
|
| | | LogHelper.test("卖家信息:" + result);
|
| | | shop.setId(sellerJson.optLong("userId"));
|
| | | JSONArray array = sellerJson.optJSONArray("evaluates");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | |
| | | shop.setUserType(0);
|
| | |
|
| | | shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
|
| | | } catch (Exception e) {
|
| | | // if (1 > 0)
|
| | | // return null;
|
| | | try {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | shop.setId(goods.getSellerId());
|
| | | shop.setShopName(goods.getShopTitle());
|
| | | shop.setUserType(goods.getUserType());
|
| | | } catch (Exception e1) {
|
| | | shop.setId(1L);
|
| | | shop.setShopName("");
|
| | | shop.setUserType(0);
|
| | | }
|
| | |
|
| | | shop.setGoodRatePercentage(new BigDecimal(100));
|
| | | shop.setScoreGoods(new BigDecimal("4.9"));
|
| | | shop.setScoreGoodsD(new BigDecimal("0"));
|
| | | shop.setScoreSeller(new BigDecimal("4.9"));
|
| | | shop.setScoreSellerD(new BigDecimal("0"));
|
| | | shop.setScoreLogistics(new BigDecimal("4.9"));
|
| | | shop.setScoreLogisticsD(new BigDecimal("0"));
|
| | | shop.setSellerNick("");
|
| | | shop.setShopIcon("https:");
|
| | | shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
|
| | | }
|
| | |
|
| | | return shop;
|
| | | }
|
| | |
| | | map.put("page_no", page + "");
|
| | | map.put("page_size", pageSize + "");
|
| | | map.put("material_id", materialId + "");
|
| | | map.put("content_id", "561388751621");
|
| | | // map.put("content_id", "561388751621");
|
| | |
|
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
|
| | | System.out.println(resultStr);
|
| | |
| | | .optString("relation_id");
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error("渠道ID申请出错:" + resultJSON);
|
| | | LogHelper.error("渠道ID申请出错:" + e.getMsg());
|
| | | }
|
| | |
|
| | | return null;
|
| | |
| | |
|
| | | // 淘礼金创建
|
| | | public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum,
|
| | | Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime,String pid) throws TaoKeApiException{
|
| | | Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime,TaoKeAppInfo app) throws TaoKeApiException{
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.dg.vegas.tlj.create");
|
| | | map.put("adzone_id", pid.split("_")[3]);
|
| | | map.put("adzone_id", app.getPid().split("_")[3]);
|
| | | map.put("item_id", auctionId + "");
|
| | | map.put("total_num", totalNum + "");
|
| | | map.put("name", name);
|
| | |
| | |
|
| | | if(useStartTime != null)
|
| | | map.put("use_start_time", TimeUtil.getGernalTime(useStartTime.getTime(), "yyyy-MM-dd"));
|
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | String result = TaoKeBaseUtil.baseRequestForThreeTimes(map, app);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | |
| | | switch(msgCode){
|
| | | case "FAIL_BIZ_ITEM_FORBIDDEN":
|
| | | throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_FORBIDDEN, "该商品不支持创建淘礼金红包");
|
| | | case "FAIL_BIZ_ACCOUNT_UN_PAID":
|
| | | case "2":
|
| | | throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_NO_MONEY, "官方玩法钱包余额不足");
|
| | | default:
|
New file |
| | |
| | | package com.yeshi.fanli.vo.goods.taobao;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | public class TLJBuyHongBaoVO {
|
| | | @Expose
|
| | | private String tagName;
|
| | | @Expose
|
| | | private int total;
|
| | | @Expose
|
| | | private int left;
|
| | | @Expose
|
| | | private String money;
|
| | | @Expose
|
| | | private String tip;
|
| | |
|
| | | public String getTagName() {
|
| | | return tagName;
|
| | | }
|
| | |
|
| | | public void setTagName(String tagName) {
|
| | | this.tagName = tagName;
|
| | | }
|
| | |
|
| | | public int getTotal() {
|
| | | return total;
|
| | | }
|
| | |
|
| | | public void setTotal(int total) {
|
| | | this.total = total;
|
| | | }
|
| | |
|
| | | public int getLeft() {
|
| | | return left;
|
| | | }
|
| | |
|
| | | public void setLeft(int left) {
|
| | | this.left = left;
|
| | | }
|
| | |
|
| | | public String getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(String money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public String getTip() {
|
| | | return tip;
|
| | | }
|
| | |
|
| | | public void setTip(String tip) {
|
| | | this.tip = tip;
|
| | | }
|
| | | }
|
| | |
| | | this.img = img;
|
| | | }
|
| | |
|
| | | public ClientTextStyleVO(String content, String color, String bottomColor, String img) {
|
| | | this.content = content;
|
| | | this.color = color;
|
| | | this.bottomColor = bottomColor;
|
| | | this.img = img;
|
| | | }
|
| | |
|
| | | public ClientTextStyleVO(String img) {
|
| | | this.img = img;
|
| | | }
|
| | |
| | | public class CommonMsgItemVO {
|
| | | private ClientTextStyleVO title;
|
| | | private List<ClientTextStyleVO> content;
|
| | | private boolean click;
|
| | |
|
| | | public boolean isClick() {
|
| | | return click;
|
| | | }
|
| | |
|
| | | public void setClick(boolean click) {
|
| | | this.click = click;
|
| | | }
|
| | |
|
| | | public CommonMsgItemVO(ClientTextStyleVO title, List<ClientTextStyleVO> content) {
|
| | | this.title = title;
|
| | | this.content = content;
|
| | | }
|
| | |
|
| | | public CommonMsgItemVO(ClientTextStyleVO title, List<ClientTextStyleVO> content, boolean click) {
|
| | | this.title = title;
|
| | | this.content = content;
|
| | | this.click = click;
|
| | | }
|
| | |
|
| | | public CommonMsgItemVO() {
|
| | | }
|
| | |
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | |
|
| | | public class UserMsgVO {
|
| | | private String icon;
|
| | | private String title;
|
| | | private Date time;
|
| | | private String type; // order(订单)/money(资金)/account(账号)/invite(邀请)/other(其他)
|
| | | private List<CommonMsgItemVO> contentItems;
|
| | | private JumpDetailV2 jumpDetail;// 跳转详情
|
| | | private String params;// 跳转参数
|
| | |
|
| | | public JumpDetailV2 getJumpDetail() {
|
| | | return jumpDetail;
|
| | | }
|
| | |
|
| | | public void setJumpDetail(JumpDetailV2 jumpDetail) {
|
| | | this.jumpDetail = jumpDetail;
|
| | | }
|
| | |
|
| | | public String getParams() {
|
| | | return params;
|
| | | }
|
| | |
|
| | | public void setParams(String params) {
|
| | | this.params = params;
|
| | | }
|
| | |
|
| | | public UserMsgVO(String icon, String title, Date time, List<CommonMsgItemVO> contentItems) {
|
| | | this.icon = icon;
|