fanli/src/main/java/com/yeshi/fanli/controller/TestController.java
@@ -42,14 +42,9 @@ import com.yeshi.fanli.dto.jd.JDSearchResult; import com.yeshi.fanli.entity.bus.activity.ActivityShareResult; import com.yeshi.fanli.entity.bus.activity.RecommendActivity; import com.yeshi.fanli.entity.dynamic.DynamicInfo; import com.yeshi.fanli.entity.dynamic.GoodsPicture; import com.yeshi.fanli.entity.dynamic.InviteMaterial; import com.yeshi.fanli.entity.jd.JDGoods; import com.yeshi.fanli.entity.taobao.SearchFilter; 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.exception.ActivityException; import com.yeshi.fanli.exception.push.PushException; import com.yeshi.fanli.exception.share.UserShareGoodsRecordException; @@ -73,8 +68,6 @@ import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; import com.yeshi.fanli.util.jd.JDApiUtil; import com.yeshi.fanli.util.push.OPPOPushUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.vo.goods.GoodsDetailVO; import net.sf.json.JSONArray; @@ -299,76 +292,6 @@ } } @RequestMapping(value = "insertShop") public void insertShop(PrintWriter out) { try { dynamicInfoService.insertShopInfo(); dynamicInfoService.insertTimeHotSale(); dynamicInfoService.insertTimeRecommend(); } catch (Exception e) { e.printStackTrace(); } } /** * 插入邀请素材 * * @param out */ @RequestMapping(value = "uploadInviteMaterial") public void uploadInviteMaterial(PrintWriter out) { try { List<InviteMaterial> list = new ArrayList<InviteMaterial>(); // 图片文件 File file = new File("E:\\Invite\\Picture"); File[] files = file.listFiles(); for (File filePic : files) {// 遍历这个数组 String name = filePic.getName(); String prefix = name.substring(name.lastIndexOf(".") + 1); // 上传文件相对位置 String filePath = "/resource/invite/everyday/" + UUID.randomUUID().toString().replace("-", "") + "." + prefix; String fileUrl = COSManager.getInstance().uploadFile(filePic, filePath).getUrl(); System.out.println("FileName:" + name); System.out.println("url:" + fileUrl); InviteMaterial inviteMaterial = new InviteMaterial(); inviteMaterial.setState(0); inviteMaterial.setPicture(fileUrl); list.add(inviteMaterial); } List<String> listTxt = new ArrayList<String>(); File textfile = new File("E:\\Invite\\content.txt");// Text文件 BufferedReader br = new BufferedReader(new FileReader(textfile));// 构造一个BufferedReader类来读取文件 String s = ""; while ((s = br.readLine()) != null) {// 使用readLine方法,一次读一行 if (StringUtil.isNullOrEmpty(s)) { continue; } listTxt.add(s); } br.close(); if (list.size() == 0 || listTxt.size() == 0 || listTxt.size() < list.size()) { return; } for (int i = 0; i < list.size(); i++) { InviteMaterial invite = list.get(i); invite.setText(listTxt.get(i)); inviteMaterialService.insert(invite); } JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("上传成功")); } catch (Exception e) { JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("上传失败")); e.printStackTrace(); } } /** * 插入邀请素材 * @@ -476,7 +399,8 @@ if (goodsList != null && goodsList.size() > 0) { BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate()); ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, hongBaoManageService.getVIPFanLiRate()); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); @@ -492,48 +416,6 @@ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败")); e.printStackTrace(); } } /** * 插入邀请素材 * * @param out */ @RequestMapping(value = "queryExistsId") public void queryExistsAuctionId(PrintWriter out) { try { List<DynamicInfo> list = dynamicInfoDao.queryExistsAuctionId(); for (DynamicInfo dynamicInfo : list) { List<GoodsPicture> imgs = dynamicInfo.getImgs(); if (imgs == null || imgs.size() == 0) { continue; } boolean update = false; for (GoodsPicture goodsPicture : imgs) { TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods(); if (goods == null) { continue; } if (goods.getAuctionId() == null) { update = true; goods.setAuctionId(goods.getId()); } } if (update) { dynamicInfo.setImgs(imgs); dynamicInfoDao.updateGoodInfo(dynamicInfo); } } JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("操作成功")); // JsonUtil.printMode(out, null, // JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(list))); } catch (Exception e) { JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("操作失败")); e.printStackTrace(); } } @@ -590,43 +472,6 @@ } out.print("success"); } @RequestMapping(value = "testListTLJGoods") public void getGoodsList(String callback, PrintWriter out) { SearchFilter sf = new SearchFilter(); sf.setQuan(1); sf.setTmall(true); // sf.setEndPrice(new BigDecimal(1000)); sf.setPage(1); sf.setPage(100); sf.setCateIds("16"); sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf); Gson gson = new Gson(); JSONArray array = new JSONArray(); for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) { array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, "100", null))); } out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array))); } /** * 插入邀请素材 * * @param out */ @RequestMapping(value = "addInviteOrderLevelOne") public void addInviteOrderLevelOne(PrintWriter out) { try { System.out.println("-------------请求---------------"); integralGetService.addShareSingleGoods(974767L); JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("操作成功")); } catch (Exception e) { JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("操作失败")); e.printStackTrace(); } } @RequestMapping("getLocalTime") fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -81,13 +81,14 @@ * 时间段:1-最近三天 2-最近七天 3最近半月 4本月 5近三月 6近半年 * @param dateType * 1-今日 2-昨天 3-本月 4-上个月 | * @param needCount * @param source * 页面来源:welfareCore-福利中心、bonus -奖金统计(我的界面) * @param out */ @RequestMapping(value = "getOrderList", method = RequestMethod.POST) public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type, Integer orderState, String orderNo, String startTime, String endTime, Integer slotTime, Integer dateType, Integer goodsType, PrintWriter out) { Integer dateType, Integer goodsType, String source, PrintWriter out) { if (uid == null) { out.print(JsonUtil.loadFalseResult(1, "用户未登录")); return; @@ -117,6 +118,9 @@ orderType = Integer.parseInt(type); } if (goodsType != null && goodsType == 0) goodsType = null; // 筛选时间 if (slotTime != null) { try { @@ -162,12 +166,12 @@ String invalidMoney = "0.00"; if (page == 1) { BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 1, orderNo, goodsType, startTime, endTime); orderNo, state, goodsType, startTime, endTime); if (predictMoney != null) validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 2, orderNo, goodsType, startTime, endTime); orderNo, state, goodsType, startTime, endTime); if (postSaleMoney != null) invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -220,6 +220,7 @@ */ BigDecimal getRewardMoneyByDate(@Param("uid") Long uid, @Param("day")Integer dateType, @Param("type") Integer hbType, @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, @Param("source") Integer source, @Param("orderNo") String orderNo, @Param("moneyState") Integer moneyState, @Param("source") Integer source, @Param("startTime") String startTime, @Param("endTime") String endTime); } fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -206,9 +206,7 @@ `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR ts.expire IS NULL) WHERE ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND tf.`state` = 1 <if test="key != null and key !='' "> and ts.`worker_id` like '%${key}%' </if> @@ -224,9 +222,7 @@ `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR ts.expire IS NULL) WHERE ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND tf.`state` = 1 <if test="key != null and key !='' "> and ts.`worker_id` like '%${key}%' </if> @@ -315,7 +311,7 @@ `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE 1=1 WHERE 1=1 AND tf.`state` = 1 <if test="uid != null"> AND tf.`boss_id` = #{uid} </if> @@ -348,7 +344,7 @@ `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE 1=1 WHERE 1=1 AND tf.`state` = 1 <if test="uid != null"> AND tf.`boss_id` = #{uid} </if> @@ -431,7 +427,7 @@ SELECT yet.* FROM ( SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE tf.`boss_id` = #{uid})A WHERE tf.`boss_id` = #{uid} AND tf.`state` = 1)A LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id WHERE 1=1 <if test="state != null"> @@ -447,7 +443,7 @@ SELECT COUNT(A.id) FROM ( SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE tf.`boss_id` = #{uid} WHERE tf.`boss_id` = #{uid} AND tf.`state` = 1 <if test="state != null"> AND ts.`state` = #{state} </if> fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -436,6 +436,16 @@ <if test="type == 3 and day == 4"> <!-- 本月将要到账 --> AND DATE_FORMAT(v.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="moneyState != null and moneyState == 1"> <!-- 未到账 --> AND (v.hb_state = 1 or v.hb_state = 2) </if> <if test="moneyState != null and moneyState == 2"> <!-- 已到账 --> AND v.hb_state = 3 </if> <if test="moneyState != null and moneyState == 3"> <!-- 红包已失效、整个订单失效 --> AND v.hb_state =4 AND co.co_state_whole_order = 3 </if> )v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -8,7 +8,6 @@ import javax.annotation.Resource; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; import org.yeshi.utils.DateUtil; @@ -346,13 +345,14 @@ @Override public BigDecimal getRewardMoneyToCount(Long uid, Integer dateType, Integer hbType) { return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, hbType, null, null, null, null, null); return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, hbType, null, null, null, null, null, null); } @Override public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer orderType, Integer orderState, String orderNo, Integer source, String startTime, String endTime) { return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, orderType, orderState, orderNo, source, public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer orderType, Integer orderState, String orderNo, Integer moneyState, Integer source, String startTime, String endTime) { return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, orderType, orderState, orderNo, moneyState, source, startTime, endTime); } fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -199,227 +199,11 @@ } // 数据加工重新组织 orderInfoFactory(acceptData, listOrder, listGoods, uid); // listDataFactory(acceptData, listOrder, listGoods, uid); orderVOFactory(acceptData, listOrder, listGoods, uid); return listOrder; } /** * 订单: 免单标识 奖励标识 * * @param order * @param hasRewardCoupon * @param hongBaoState * @param list * @param signList */ public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList, Long uid, AcceptData acceptData) { // 是否免单商品 boolean freeOrder = false; // 是否奖励成功 boolean rewardSuccess = false; if (list != null && list.size() > 0) { for (UserSystemCouponRecord couponRecord : list) { // 订单号匹配 if (order.getOrderNo().equals(couponRecord.getOrderNo())) { Integer state = couponRecord.getState(); String systemCouponType = couponRecord.getCouponType(); // 奖励订单: 且成功 if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType) && UserSystemCouponRecord.STATE_SUCCESS == state) { rewardSuccess = true; signList.add(PIC_REWARD); // 加入奖励成功图片 } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType) || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType) || CouponTypeEnum.freeCouponBuy.name().equals(systemCouponType)) { if (UserSystemCouponRecord.STATE_FREE_ON == state) { // 免单中 freeOrder = true; signList.add(PIC_FREE_ON); } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { // 免单成功 freeOrder = true; signList.add(PIC_FREE_SUCCEED); } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) { // 规则不匹配、退款 freeOrder = true; signList.add(PIC_FREE_FAIL); } } break; } } } // 订单标识 order.setSignList(signList); int type = 1; // 1 常规跳转页面 2弹出选项(奖励券) boolean rewardOrder = false; if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { if (rewardSuccess) { rewardOrder = true; // 以前版本奖励成功 的显示入口 } // 已到账的返利订单、非会员可使用奖励券 if (!freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState && !userVIPInfoService.isVIP(uid)) { type = 2; rewardOrder = true; } } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState && !userVIPInfoService.isVIP(uid)) { // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单、 非超级会员 type = 2; rewardOrder = true; } // 维权订单 不可使用 Integer orderState = order.getState(); if(CommonOrder.STATE_WQ == orderState) { rewardOrder = false; } if (rewardOrder) { try { boolean newEdition = false; String num = null; String unit = null; boolean canUse = false; // 版本区分:2.1 奖励券倒计时 if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { Date thirdCreateTime = order.getThirdCreateTime(); if (thirdCreateTime != null) { long downOrderTime = thirdCreateTime.getTime(); long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime(); if (downOrderTime > limitDate) { newEdition = true; Date endDay = DateUtil.plusDayDate(4, thirdCreateTime); long currentTime = java.lang.System.currentTimeMillis(); if (endDay.getTime() > currentTime) { DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime()); if (dateInfo != null) { if (dateInfo.getDay() > 0) { canUse = true; unit = "天"; num = dateInfo.getDay().toString(); } if (!canUse && dateInfo.getHour() > 0) { canUse = true; unit = "小时"; num = dateInfo.getHour().toString(); } if (!canUse && dateInfo.getMinute() > 0) { canUse = true; unit = "分"; num = dateInfo.getMinute().toString(); } if (!canUse && dateInfo.getSecond() > 0) { canUse = true; unit = "秒"; num = dateInfo.getSecond().toString(); } } } } } } if (newEdition && !canUse) { // 新版不可使用 } else { Map<String, Object> rewardMap = new HashMap<String, Object>(); ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); if (!newEdition) { if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardStyleVO.setContent("使用奖励券 >"); } else { rewardStyleVO.setContent("返利奖励 >"); } } else if (canUse) { rewardStyleVO.setContent("使用奖励券"); ClientTextStyleVO txt1 = new ClientTextStyleVO(); txt1.setContent("剩"); txt1.setColor("#666666"); txt1.setBottomColor("#FFDCEA"); ClientTextStyleVO txt2 = new ClientTextStyleVO(); txt2.setContent(num); txt2.setColor("#E5005C"); txt2.setBottomColor("#FFDCEA"); txt2.setFontSize("1.33"); ClientTextStyleVO txt3 = new ClientTextStyleVO(); txt3.setContent(unit + "关闭 >"); txt3.setColor("#666666"); txt3.setBottomColor("#FFDCEA"); List<ClientTextStyleVO> ticking = new ArrayList<ClientTextStyleVO>(); ticking.add(txt1); ticking.add(txt2); ticking.add(txt3); rewardMap.put("ticking", ticking); } rewardMap.put("text", rewardStyleVO); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); jumpLink.put("goodsType", order.getSourceType() + ""); Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", type); jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } } catch (Exception e) { e.printStackTrace(); } } if (freeOrder) { ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); // 返利、免单详情 rewardStyleVO.setContent("免单详情 >"); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { jumpLink.put("goodsType", order.getSourceType() + ""); } Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 1); // 页面跳转 jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail")); Map<String, Object> rewardMap = new HashMap<String, Object>(); rewardMap.put("text", rewardStyleVO); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } } /** * 订单信息加工 @@ -429,7 +213,7 @@ * @param listGoods * @param uid */ public void orderInfoFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, private void orderVOFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) throws Exception { List<String> listTB = new ArrayList<String>(); List<String> listJD = new ArrayList<String>(); @@ -462,14 +246,6 @@ listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD); } SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); // 2019.8.1开始返回维权信息 Date august = TimeUtil.parse("2019-08-01"); // 是否存在奖励券 boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); // 需要查询是否为VIP的用户ID,只有邀请订单才需要查询 List<Long> needSelectVIPUidList = new ArrayList<>(); @@ -497,6 +273,16 @@ if(order.isVipOrder()) order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); } SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); // 2019.8.1开始返回维权信息 Date august = TimeUtil.parse("2019-08-01"); // 当前用户是否VIP boolean vip = userVIPInfoService.isVIP(uid); // 是否存在奖励券 boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); for (CommonOrderVO order : listOrder) { String orderNo = order.getOrderNo(); @@ -702,7 +488,8 @@ } } } order.setSignList(signList); String hongBaoDate = null; String hongBaoState_Str = ""; String hongbaoInfoFontColor = "#E5005C"; @@ -762,24 +549,21 @@ hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBaoMap.put("fontColor", hongbaoInfoFontColor); order.setHongBaoInfo(hongBaoMap); // 非自购的订单 不显示返利、免单详情 if (HongBaoV2.TYPE_ZIGOU != hongBaoType) { order.setSignList(signList); } else { // 显示返利、免单详情 if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { // 奖励订单、免单 使用记录 if (sourceType == null) { setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null, signList, uid, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, signList, uid, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_JD) { setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, signList, uid, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, uid, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, acceptData); } } @@ -790,9 +574,238 @@ order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo())); } } } /** * 订单: 免单标识 奖励标识 * * @param order * @param hasRewardCoupon * @param hongBaoState * @param list * @param signList */ private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception{ // 是否免单商品 boolean freeOrder = false; // 是否奖励成功 boolean rewardSuccess = false; boolean version2_1 = VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()); if (list != null && list.size() > 0) { for (UserSystemCouponRecord couponRecord : list) { int goodSource = couponRecord.getGoodSource(); if (goodSource == 0) goodSource = 1; if (order.getOrderNo().equals(couponRecord.getOrderNo()) && goodSource == order.getSourceType()) { Integer state = couponRecord.getState(); String systemCouponType = couponRecord.getCouponType(); if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType) && UserSystemCouponRecord.STATE_SUCCESS == state) { rewardSuccess = true; if (!version2_1) { // 奖励成功 order.getSignList().add(PIC_REWARD); } } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType) || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType) || CouponTypeEnum.freeCouponBuy.name().equals(systemCouponType)) { if (UserSystemCouponRecord.STATE_FREE_ON == state) { // 免单中 freeOrder = true; order.getSignList().add(PIC_FREE_ON); } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { // 免单成功 freeOrder = true; order.getSignList().add(PIC_FREE_SUCCEED); } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) { // 规则不匹配、退款 freeOrder = true; order.getSignList().add(PIC_FREE_FAIL); } } break; } } } // 免单详情 if (freeOrder) { ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); rewardStyleVO.setContent("免单详情 >"); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { jumpLink.put("goodsType", order.getSourceType() + ""); } Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 1); // 页面跳转 jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail")); Map<String, Object> rewardMap = new HashMap<String, Object>(); rewardMap.put("text", rewardStyleVO); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } // 已使用奖励券 if (rewardSuccess) { ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); if (version2_1) { rewardStyleVO.setContent("已使用奖励券 >"); } else { rewardStyleVO.setContent("返利奖励 >"); } Map<String, Object> rewardMap = new HashMap<String, Object>(); rewardMap.put("text", rewardStyleVO); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); jumpLink.put("goodsType", order.getSourceType() + ""); Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 1); // 1 常规跳转页面 jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } // 是否可使用奖励券 if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) { // 下单时间 Date thirdCreateTime = order.getThirdCreateTime(); // 到账时间 Date accountTime = order.getAccountTime(); if (thirdCreateTime == null || accountTime == null) return; // 下单日期是否是符合上线日期 long downOrderTime = thirdCreateTime.getTime(); long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime(); if (downOrderTime > limitDate) { // 2.1 开始新版 rewardCounponLimitTime(order, accountTime); } else if (hasRewardCoupon) { // 在2.1新版上线之前订单-存在则显示奖励券可使用 ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); rewardStyleVO.setContent("返利奖励 >"); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); jumpLink.put("goodsType", order.getSourceType() + ""); Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 2); // 弹框 jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); Map<String, Object> rewardMap = new HashMap<String, Object>(); rewardMap.put("text", rewardStyleVO); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } } } private void rewardCounponLimitTime(CommonOrderVO order,Date accountTime) throws Exception { // 倒计时验证 Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime); long currentTime = java.lang.System.currentTimeMillis(); if (endDay.getTime() <= currentTime) return; String num = null; String unit = null; boolean canUse = false; DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime()); if (dateInfo.getDay() > 0) { canUse = true; unit = "天"; num = dateInfo.getDay().toString(); } if (!canUse && dateInfo.getHour() > 0) { canUse = true; unit = "小时"; num = dateInfo.getHour().toString(); } if (!canUse && dateInfo.getMinute() > 0) { canUse = true; unit = "分"; num = dateInfo.getMinute().toString(); } if (!canUse && dateInfo.getSecond() > 0) { canUse = true; unit = "秒"; num = dateInfo.getSecond().toString(); } // 已经超时 if (!canUse) return; Map<String, Object> rewardMap = new HashMap<String, Object>(); ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); rewardStyleVO.setColor("#E5005C"); rewardStyleVO.setBottomColor("#FFDCEA"); rewardStyleVO.setContent("使用奖励券"); rewardMap.put("text", rewardStyleVO); ClientTextStyleVO txt1 = new ClientTextStyleVO(); txt1.setContent("剩"); txt1.setColor("#666666"); txt1.setBottomColor("#FFDCEA"); ClientTextStyleVO txt2 = new ClientTextStyleVO(); txt2.setContent(num); txt2.setColor("#E5005C"); txt2.setBottomColor("#FFDCEA"); txt2.setFontSize("1.33"); ClientTextStyleVO txt3 = new ClientTextStyleVO(); txt3.setContent(unit + "关闭 >"); txt3.setColor("#666666"); txt3.setBottomColor("#FFDCEA"); List<ClientTextStyleVO> ticking = new ArrayList<ClientTextStyleVO>(); ticking.add(txt1); ticking.add(txt2); ticking.add(txt3); rewardMap.put("ticking", ticking); Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); jumpLink.put("goodsType", order.getSourceType() + ""); Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 2); // 弹出框使用券 jump.put("params", jumpLink); jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } @Override public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) { return commonOrderMapper.countHistoryOrder(uid, day, source); @@ -1628,7 +1641,7 @@ public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType) { return commonOrderMapper.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, sourceType); } @Override public long count24HValidOrderByUid(Long uid, Date minTime) { return commonOrderMapper.count24HValidOrderByUid(uid, minTime); fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackForbidServiceImpl.java
@@ -150,7 +150,8 @@ dto.setReason("封禁时间到期,自动解封"); dto.setTime("已可以重新使用红包功能"); dto.setHandle("已被清空"); userMoneyMsgNotificationService.redPackMsg(id, MsgTypeMoneyTypeEnum.redPackForbidRemove, new Gson().toJson(dto), "封禁无法申诉,请按照规则使用红包功能 "); userMoneyMsgNotificationService.redPackMsg(id, MsgTypeMoneyTypeEnum.redPackForbidRemove, new Gson().toJson(dto), null); } } fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -739,7 +739,7 @@ return userSystemCouponMapper.countUsableByUid(uid, listCouponId); } @Transactional @Transactional(rollbackFor = Exception.class) @Override public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception { @@ -816,7 +816,7 @@ } @Transactional @Transactional(rollbackFor = Exception.class) @Override public void useOrderCoupon(Long uid, Long id, String orderNo, Integer sourceType, AcceptData acceptData) throws UserSystemCouponException, Exception { @@ -869,23 +869,26 @@ throw new UserSystemCouponException(1, "亲,很遗憾,售后维权订单不能使用返利奖励券~"); } // 订单 CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS, sourceType); if (orderVO == null) throw new UserSystemCouponException(1, "订单信息获取失败"); List<CommonOrderVO> listVo = commonOrderService.listGroupOrderNoByUid(0, 1, uid, 2, 1,1, orderNo, null, null, null, sourceType); if (listVo == null || listVo.size() == 0) throw new UserSystemCouponException(1, "亲,很遗憾,该订单已不能使用返利奖励券~"); CommonOrderVO orderVO = listVo.get(0); // 版本区分:2.1 if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { boolean valid = false; Date thirdCreateTime = orderVO.getThirdCreateTime(); if (thirdCreateTime != null) { Date accountTime = orderVO.getAccountTime(); if (thirdCreateTime != null && accountTime != null) { long downOrderTime = thirdCreateTime.getTime(); long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime(); if (downOrderTime > limitDate) { Date endDay = DateUtil.plusDayDate(4, thirdCreateTime); Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime); long currentTime = java.lang.System.currentTimeMillis(); if (endDay.getTime() > currentTime) { boolean valid = false; DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime()); if (dateInfo != null) { if (dateInfo.getDay() > 0) @@ -900,12 +903,12 @@ if (!valid && dateInfo.getSecond() > 0) valid = true; } if (!valid) throw new UserSystemCouponException(1, "该订单已超过有效使用奖励券时间"); } } } } if (!valid) throw new UserSystemCouponException(1, "该订单不能使用奖励券"); } BigDecimal hongBao = orderVO.getHongBao(); @@ -2017,7 +2020,7 @@ return listVO; } @Transactional @Transactional(rollbackFor = Exception.class) @Override public UserSystemCouponVO giveCoupon(Long uid, Long id) throws UserSystemCouponException { UserSystemCoupon userSystemCoupon = userSystemCouponMapper.selectByPrimaryKey(id); fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -261,6 +261,6 @@ * @return */ public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer hbType, Integer orderState, String orderNo, Integer source, String startTime, String endTime); Integer moneyState, Integer source, String startTime, String endTime); } fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -171,9 +171,10 @@ // vip赠送金币 public static final int VIP_COLDCOIN_NUM = 1800; // 奖励券倒计时 - 待确定 public static final String COUPON_REWARD_TIME = "2019-12-20"; // TODO // 奖励券倒计时 - 执行时间待确定 public static final String COUPON_REWARD_TIME = "2019-12-01"; // TODO // 奖励券倒计时 - 天数 public static final int COUPON_REWARD_LIMIT_DAY = 5; public static WXGZConfig wxGZConfig; fanli/src/main/resource/env-dev/constant.properties
@@ -1,3 +1,3 @@ task =false outnetwork =false test =true test=true fanli/src/main/resource/env-dev/mongo.properties
@@ -1,13 +1,13 @@ mongo.dbname=flq mongo.port=27016 mongo.port=27017 #开发环境 #mongo.host=192.168.1.253 #mongo.username=admin #mongo.password=123456 mongo.host=192.168.1.253 mongo.username=admin mongo.password=123456 mongo.host=193.112.35.168 mongo.username=yeshi mongo.password=Yeshi2016@ #mongo.host=193.112.35.168 #mongo.username=yeshi #mongo.password=Yeshi2016@ mongo.connectionsPerHost=8 mongo.threadsAllowedToBlockForConnectionMultiplier=4 fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -36,7 +36,6 @@ import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import net.sf.json.JSONArray; @@ -55,20 +54,35 @@ // TaoBaoUtil.getTBDetailImageWithSize(597016140493L); // System.out.println(goods); // DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L); try { TaoKeApiUtil.specialConvertCoupon(608512721647L, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT)); } catch (Exception e) { // TODO Auto-generated catch block // try { // TaoKeApiUtil.specialConvertCoupon(608512721647L, new // TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, // TaoBaoConstant.TAOBAO_AUTH_APPSECRET, // TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT)); // } catch (Exception e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // String link = TaoKeApiUtil.officialActivityConvert(87140050199L + "", "1571715733668", "513796574"); // System.out.println(link); // String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(TaoBaoConstant.TAOBAO_AUTH_APPKEY, // "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", 6396582L, "share"); // System.out.println(link); try { TaoKeApiUtil.searchGoodsDetail(608512721647L); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } } @Test public void test2() { String link = TaoKeApiUtil.officialActivityConvert("87140050199", "1571120794546", "20211660"); System.out.println(TaoKeApiUtil.getTKToken("http://", "母婴预售", link)); String link = TaoKeApiUtil.officialActivityConvert("87140050199", "1571715733668", "20211660"); System.out.println(link); // https://s.click.taobao.com/t?e=m%3D2%26s%3DW%2Fys7R71JXMcQipKwQzePCperVdZeJviyK8Cckff7TVRAdhuF14FMXC%2FEJQELlNo5x%2BIUlGKNpVpS9y0ojX%2FfMsvmRQfeMsreH9%2FasRClvq63GoCXmcqkTiRUN2xVR4GdesO8XD8dsNdITvXwTxvKDqJgCOacH%2BU%2FVJqtNeEg5OOvkjnk315zzvflh4%2Fhqj8BmyXDtEFdgwjGkouqJtJeds5wF0j1Yhhp1953%2FcnpLUV6UUID4c8TeTEWJdP8jmRdTEuB5K8MGvkLv1nNhnYz%2FB0z8qlrv%2Bjr%2B%2FiM5RbEEle7auY0HPYWszlTEcWhO9mli2vZjCuAmyG1kYtrC7hgcEnE%2FQxigjMfFc2hYciEyAdpuz3kb9JWJVVX36lFeRKtwLUkdbL0syg%2BG8%2FlCRQJ1YlOPkYHNIul3paqKYwK75NNUki5Nwcg2GYz3Bez8Z8OusR9%2BDFlSU%2BcenL13XDY2hrrfx7OMbmkUtLKDKbz1CCoC2zoKs%2FmnEqY%2Bakgpmw&pvid=24980167&union_lens=lensId:0b013a8d_0cec_16df214d979_38a1 }