Merge remote-tracking branch 'origin/div' into div
| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.security.SignatureException;
|
| | | 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.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.wx.WXUtil;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory;
|
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
|
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.shop.BanLiShopOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.wx.BanLiShopWXPayUtil;
|
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | |
|
| | | @Resource
|
| | | private GoodsEvaluateService goodsEvaluateService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | |
|
| | | /**
|
| | | * 客服消息回调
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 联盟好物圈
|
| | | * @Title: haoWuQuan
|
| | | * @Description: |
| | | * @param request
|
| | | * @param out |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @RequestMapping(value = "faquan/haowuquan")
|
| | | public void haoWuQuan(HttpServletRequest request, String content, String sign, PrintWriter out) {
|
| | | if (!sign.equalsIgnoreCase(StringUtil.Md5(content + "banliapp"))) {
|
| | | out.print(JsonUtil.loadFalseResult("签名错误"));
|
| | | return;
|
| | | }
|
| | | String contentDecode = StringUtil.getFromBase64(content);
|
| | | JSONObject data = JSONObject.fromObject(contentDecode);
|
| | |
|
| | | JSONArray array = data.optJSONObject("recommend").optJSONArray("resultList");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | String title = item.optString("itemName");
|
| | | String doc = item.optString("cusShareText");
|
| | | long itemId = item.optLong("itemId");
|
| | | JSONArray imageArray = item.optJSONArray("imageList");
|
| | | List<String> imgList = new ArrayList<>();
|
| | | for (int j = 0; j < imageArray.size(); j++) {
|
| | | imgList.add(imageArray.optString(j));
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | try {
|
| | | goodsBrief = TaoKeApiUtil.searchGoodsDetail(itemId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (goodsBrief == null)
|
| | | continue;
|
| | | // 商品VO
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate("android", "55");
|
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate());
|
| | | GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO);
|
| | |
|
| | | if (imgList.size() > 3)
|
| | | imgList = imgList.subList(0, 3);
|
| | |
|
| | | List<ImgInfo> imageList = new ArrayList<>();
|
| | | for (int j = 0; j < imgList.size(); j++) {
|
| | | ImgInfo imgInfo = new ImgInfo();
|
| | | imgInfo.setH(1);
|
| | | imgInfo.setW(1);
|
| | | imgInfo.setLarge(false);
|
| | | imgInfo.setUrl(imgList.get(j));
|
| | | if (i != 0) {
|
| | | imgInfo.setType(ImgEnum.img);
|
| | | } else {
|
| | | imgInfo.setType(ImgEnum.goods);
|
| | | SimpleGoods simpleGoods = new SimpleGoods();
|
| | | simpleGoods.setGoodsId(itemId);
|
| | | simpleGoods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | simpleGoods.setState(CommonGoods.STATE_NORMAL);
|
| | | CouponInfoVO couponInfo = goodsVO.getCouponInfo();
|
| | | if (couponInfo == null) {
|
| | | simpleGoods.setPrice(goodsVO.getZkPrice());
|
| | | } else {
|
| | | simpleGoods.setPrice(goodsVO.getCouponPrice());
|
| | | simpleGoods.setAmount(couponInfo.getAmount());
|
| | | }
|
| | | imgInfo.setGoods(simpleGoods);
|
| | | imgInfo.setGoodsVO(goodsVO);
|
| | | }
|
| | | imageList.add(imgInfo);
|
| | | }
|
| | |
|
| | | List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HOT, 1, 20);
|
| | |
|
| | | ruleList.get(0).getActivityUser();
|
| | |
|
| | | ActivityUser user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser();
|
| | | try {
|
| | | goodsEvaluateService.addGoodsEvaluate(itemId, imageList, user, doc, null);
|
| | | } catch (GoodsEvaluateException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountMomentsService; |
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService; |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | |
| | | @Resource |
| | | private ShareGoodsService shareGoodsService; |
| | | |
| | | @Resource |
| | | private DailyCountMomentsService dailyCountMomentsService; |
| | | // @Resource |
| | | // private DailyCountMomentsService dailyCountMomentsService; |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | |
| | | private final static long TYPE_REXIAO = 1;// 热销 |
| | | private final static long TYPE_TUIJIAN = 2;// 推荐 |
| | |
| | | if (imgInfo.getGoodsVO() != null) |
| | | if (imgInfo.getGoodsVO().getGoodsId().longValue() == goodsId.longValue() |
| | | && imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) { |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl()); |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, |
| | | imgInfo.getUrl()); |
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) { |
| | | list.add(jumpLink); |
| | | } |
| | |
| | | } else if (type == 2 || type == 3) { |
| | | for (ImgInfo imgInfo : imgs) { |
| | | if (imgInfo.getGoodsVO() != null) { |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl() ); |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, |
| | | imgInfo.getUrl()); |
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) { |
| | | list.add(jumpLink); |
| | | } |
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addShareClick(); |
| | | // TODO |
| | | // dailyCountMomentsService.addShareClick(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode, String mainPic) { |
| | | private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode, |
| | | String mainPic) { |
| | | String jumpLink = null; |
| | | if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { |
| | | TaoBaoLink taoBaoLink = null; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 替换价格 |
| | | if (goodsEvaluate.getType() == EvaluateEnum.single) { |
| | | GoodsDetailVO goods = goodsEvaluate.getGoods(); |
| | |
| | | newText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | } |
| | | |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("text", newText); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addCopyComment(); |
| | | // TODO |
| | | // dailyCountMomentsService.addCopyComment(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.order.ESOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyServiceV2;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | |
|
| | | @Resource
|
| | | private ESOrderService esOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
| | | data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | // 团队奖励 TODO
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | BigDecimal teamSubsidy = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, dateType, null);
|
| | | if (teamSubsidy == null) {
|
| | | teamSubsidy = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | BigDecimal teamReward = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, dateType, null);
|
| | | if (teamReward == null) {
|
| | | teamReward = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | data.put("teamSubsidy", teamSubsidy.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("teamReward", teamReward.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("tutorSubsidy", "0.00");
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | sumTeamSubsidy(out, user);
|
| | | } else if (type == 2) {
|
| | | // 奖励
|
| | | sumTeamReward(out, user);
|
| | | //TODO 团队奖励已经删除
|
| | | } else {
|
| | | // 导师津贴
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计团队奖励
|
| | | * @param out
|
| | | * @param user
|
| | | */
|
| | | private void sumTeamReward(PrintWriter out, UserInfo user) {
|
| | | Long uid = user.getId();
|
| | | // 是否VIP
|
| | | boolean vip = userVIPInfoService.isVIP(uid);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", configService.get(ConfigKeyEnum.orderTeamRewardLink.getKey()));
|
| | | if (!vip) {
|
| | | data.put("exist", false);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | data.put("exist", true);
|
| | | data.put("portrait", user.getPortrait());
|
| | |
|
| | | // 今日统计
|
| | | BigDecimal todayDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 1, OrderTeamReward.LEVEL_ONE);
|
| | | if (todayDirect == null) {
|
| | | todayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal todayIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 1, OrderTeamReward.LEVEL_TWO);
|
| | | if (todayIndirect == null) {
|
| | | todayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO today = new TeamBonusVO();
|
| | | today.setDirect(todayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setIndirect(todayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setTotal(
|
| | | MoneyBigDecimalUtil.add(todayDirect, todayIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | // 昨日统计
|
| | | BigDecimal yesterdayDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 2,
|
| | | OrderTeamReward.LEVEL_ONE);
|
| | | if (yesterdayDirect == null) {
|
| | | yesterdayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal yesterdayIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 2,
|
| | | OrderTeamReward.LEVEL_TWO);
|
| | | if (yesterdayIndirect == null) {
|
| | | yesterdayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO yesterday = new TeamBonusVO();
|
| | | yesterday.setDirect(yesterdayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setIndirect(yesterdayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setTotal(MoneyBigDecimalUtil.add(yesterdayDirect, yesterdayIndirect)
|
| | | .setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | // 本月统计
|
| | | BigDecimal thisMonthDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 3,
|
| | | OrderTeamReward.LEVEL_ONE);
|
| | | if (thisMonthDirect == null) {
|
| | | thisMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal thisMonthIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 3,
|
| | | OrderTeamReward.LEVEL_TWO);
|
| | | if (thisMonthIndirect == null) {
|
| | | thisMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO thisMonth = new TeamBonusVO();
|
| | | thisMonth.setDirect(thisMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setIndirect(thisMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setTotal(MoneyBigDecimalUtil.add(thisMonthDirect, thisMonthIndirect)
|
| | | .setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | // 本月统计
|
| | | BigDecimal lastMonthDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 4,
|
| | | OrderTeamReward.LEVEL_ONE);
|
| | | if (lastMonthDirect == null) {
|
| | | lastMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal lastMonthIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 4,
|
| | | OrderTeamReward.LEVEL_TWO);
|
| | | if (lastMonthIndirect == null) {
|
| | | lastMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO lastMonth = new TeamBonusVO();
|
| | | lastMonth.setDirect(lastMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setIndirect(lastMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setTotal(MoneyBigDecimalUtil.add(lastMonthDirect, lastMonthIndirect)
|
| | | .setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | BigDecimal direct = orderTeamRewardService.sumRecievedMoneyByUid(uid, OrderTeamReward.LEVEL_ONE);
|
| | | if (direct == null) {
|
| | | direct = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal indirect = orderTeamRewardService.sumRecievedMoneyByUid(uid, OrderTeamReward.LEVEL_TWO);
|
| | | if (indirect == null) {
|
| | | indirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal total = MoneyBigDecimalUtil.add(direct, indirect);
|
| | |
|
| | | data.put("today", today);
|
| | | data.put("yesterday", yesterday);
|
| | | data.put("thisMonth", thisMonth);
|
| | | data.put("lastMonth", lastMonth);
|
| | | data.put("total", total.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("direct", direct.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("indirect", indirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返利说明
|
| | |
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | // 团队奖励到账
|
| | | @XxlJob("fanliOrderTeamRewardHandler")
|
| | | public ReturnT<String> fanliOrderTeamRewardHandler(String param) throws Exception {
|
| | | if (StringUtil.isNullOrEmpty(param))
|
| | | orderProcessService.fanliOrderTeamReward();
|
| | | else {
|
| | | orderProcessService.fanliOrderTeamReward(Long.parseLong(param));
|
| | | }
|
| | |
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | // 维权订单处理-处理最近60天的
|
| | | // 30分钟一次
|
| | | @Scheduled(cron = "0 0/30 * * * ? ")
|
| | |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate.EvaluateEnum; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; |
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods; |
| | |
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; |
| | | import com.yeshi.fanli.exception.dynamic.ActivityUserException; |
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 数据对比 删除图片 |
| | | if (oldGoodsList != null && oldGoodsList.size() > 0) { |
| | | for (ImgInfo old : oldGoodsList) { |
| | |
| | | /* |
| | | * if (!StringUtil.isNullOrEmpty(content) && kind != 3) { try { |
| | | * convertLinkManager.convertLinkFromText(content, |
| | | * Constant.LINK_TOKEN_VERIFY_UID, true); } catch (ConvertLinkExceptionException |
| | | * e) { if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { throw new |
| | | * GoodsEvaluateException(1, "包含不可转链的口令与链接"); } } catch (Exception e) { throw |
| | | * new GoodsEvaluateException(1, "包含不可转链的口令与链接"); } } |
| | | * Constant.LINK_TOKEN_VERIFY_UID, true); } catch |
| | | * (ConvertLinkExceptionException e) { if |
| | | * (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { throw new |
| | | * GoodsEvaluateException(1, "包含不可转链的口令与链接"); } } catch (Exception e) { |
| | | * throw new GoodsEvaluateException(1, "包含不可转链的口令与链接"); } } |
| | | */ |
| | | |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); |
| | |
| | | listImg.add(imgInfo0); |
| | | totalImg++; |
| | | } |
| | | |
| | | |
| | | // 清理老图片 |
| | | if (listOld != null && listOld.size() > 0) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addGoodsEvaluate(Long goodsId, Integer cid, String title, String comment) throws GoodsEvaluateException{ |
| | | if (goodsId == null || cid == null || StringUtil.isNullOrEmpty(title)) { |
| | | public void addGoodsEvaluate(Long goodsId, List<ImgInfo> imgList, ActivityUser user, String title, String comment) |
| | | throws GoodsEvaluateException { |
| | | if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) { |
| | | throw new GoodsEvaluateException(1, "相关参数不能为空"); |
| | | } |
| | | |
| | |
| | | throw new GoodsEvaluateException(1, "该商品无券"); |
| | | } |
| | | |
| | | // 发布用户 |
| | | ActivityUser user = activityUserService.getRandomByDaTaoKeCid(cid); |
| | | if (user == null) { |
| | | throw new GoodsEvaluateException(1, "未找到发布用户"); |
| | | } |
| | | |
| | | |
| | | // 白底图 |
| | | List<String> imgs = new ArrayList<>(); |
| | | if (!StringUtil.isNullOrEmpty(goodsBrief.getPictUrlWhite())) { |
| | |
| | | |
| | | // 商品图片信息 |
| | | int i = 0; |
| | | List<ImgInfo> imgList = new ArrayList<>(); |
| | | if (imgList == null || imgList.size() == 0) |
| | | for (String img : imgs) { |
| | | ImgInfo imgInfo = new ImgInfo(); |
| | | imgInfo.setH(1); |
| | |
| | | commentText = commentText.replace("[券后价]", |
| | | MoneyBigDecimalUtil.getWithNoZera(goodsVO.getCouponPrice()) + ""); |
| | | } |
| | | commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n","\r\n"); |
| | | commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", |
| | | "\r\n"); |
| | | commentInfo.setContent(commentText); |
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc()); |
| | | } |
| | |
| | | lineNum = 3; |
| | | } |
| | | } |
| | | |
| | | |
| | | GoodsEvaluate goodsEvaluate = new GoodsEvaluate(); |
| | | goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", "")); |
| | |
| | | } |
| | | return descNew; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateTaoBaoGoods(TaoBaoGoodsBrief goods) { |
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt;
|
| | | import com.yeshi.fanli.entity.money.OrderTeamRewardDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.InviteOrderSubsidyDebtException;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | |
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService;
|
| | |
| | | throw new TaoBaoWeiQuanException(101, "邀请订单补贴异常");
|
| | | }
|
| | |
|
| | | doOrderTeamReard(subSidy.getId(), settleMent, weiQuanMoney, tradeId);
|
| | | //TODO 删除团队奖励维权处理
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 团队奖励维权处理
|
| | | * @Title: doOrderTeamReard
|
| | | * @Description: |
| | | * @param subsidyId |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void doOrderTeamReard(Long subsidyId, BigDecimal settleMent, BigDecimal weiQuanMoney, String tradeId)
|
| | | throws TaoBaoWeiQuanException {
|
| | | List<OrderTeamReward> list = orderTeamRewardService.listBySubsidyId(subsidyId);
|
| | | if (list != null)
|
| | | for (OrderTeamReward reward : list) {
|
| | | BigDecimal drawBackMoney = computeDrawBackMoney(settleMent, weiQuanMoney, reward.getOriginalMoney());
|
| | | if (drawBackMoney.compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | | OrderTeamRewardDebt debt = new OrderTeamRewardDebt();
|
| | | debt.setBeiZhu("订单售后");
|
| | | debt.setOriginMoney(drawBackMoney);
|
| | | debt.setUid(reward.getUid());
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setTradeId(tradeId);
|
| | | debt.setSourceId(reward.getId());
|
| | | try {
|
| | | orderTeamRewardDebtService.addDebt(debt);
|
| | | } catch (OrderTeamRewardDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(102, "团队奖励异常");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemId(String orderItemId) {
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService; |
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | |
| | | |
| | | @Resource |
| | | private UserInviteService userInviteService; |
| | | |
| | | @Resource |
| | | private UserLevelManager userLevelManager; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | |
| | | totalSettlement = commonOrder.getTotalPayment(); |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | |
| | | if (oldCommonOrder == null)// 新增 |
| | | { |
| | | commonOrder.setCreateTime(new Date()); |
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(commonOrder.getUserInfo().getId(), |
| | | commonOrder.getThirdCreateTime()); |
| | | // 查询是否为vip |
| | | boolean isVIP = userVIPInfoService.isVIP(commonOrder.getUserInfo().getId()); |
| | | if (isVIP) |
| | | commonOrder.setUrank(100);// VIP订单 |
| | | if (userLevel != null) |
| | | commonOrder.setUrank(userLevel.getOrderRank());// VIP订单 |
| | | else { |
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(commonOrder.getUserInfo().getId()); |
| | | if (user != null) |
| | |
| | | return commonOrderMapper.countSearchOrderByUid(uid, list); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getMinSettleTimeAndUid() { |
| | | return commonOrderMapper.getMinSettleTimeAndUid(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 订单类型 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | Integer orderType = order.getOrderType(); |
| | |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | if (thirdCreateTime != null) { |
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime)); |
| | |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | | } |
| | | |
| | | |
| | | /* 订单状态 转换处理 */ |
| | | String orderStateContent = ""; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 2.1显示返利说明连接> 未失效-自购-分享 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (CommonOrder.STATE_SX != orderState && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME) |
| | | && ((HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) || HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) ) { |
| | | if (CommonOrder.STATE_SX != orderState |
| | | && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME) |
| | | && ((HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) |
| | | || HongBaoV2.TYPE_SHARE_GOODS == hongBaoType)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | } |
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.InviteOrderSubsidyMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyServiceV2;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Override
|
| | |
| | | update.setState(orderSubsidy.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | // 添加奖励
|
| | | addTeamReward(old.getId());
|
| | | //TODO 删除添加奖励
|
| | | } else {// 添加
|
| | | if (orderSubsidy.getCreateTime() == null)
|
| | | orderSubsidy.setCreateTime(new Date());
|
| | | inviteOrderSubsidyMapper.insertSelective(orderSubsidy);
|
| | | // 添加奖励
|
| | | addTeamReward(orderSubsidy.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加团队奖励
|
| | | private void addTeamReward(Long subsidyId) throws OrderTeamRewardException, CommonOrderException {
|
| | | // 查询团队奖励的人
|
| | | // 计算相应的比例
|
| | | InviteOrderSubsidy subsidy = inviteOrderSubsidyMapper.selectByPrimaryKeyForUpdate(subsidyId);
|
| | | if (subsidy == null)
|
| | | throw new OrderTeamRewardException(20, "补贴不存在");
|
| | |
|
| | | // 获取上4级用户
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(subsidy.getSourceType(),
|
| | | subsidy.getOrderNo());
|
| | | if (commonOrderList == null || commonOrderList.size() == 0) {
|
| | | throw new CommonOrderException(1, "订单不存在");
|
| | | }
|
| | |
|
| | | Date orderTime = commonOrderList.get(0).getThirdCreateTime();
|
| | |
|
| | | Long sourceUid = commonOrderList.get(0).getUserInfo().getId();
|
| | |
|
| | | List<ThreeSale> bossList = threeSaleSerivce.getMyBossDeepList(sourceUid, 4);
|
| | | // 无需要团队奖励的上级
|
| | | if (bossList.size() < 3)
|
| | | return;
|
| | |
|
| | | Set<Long> rewardUid = new HashSet<>();
|
| | | for (int i = 2; i < bossList.size(); i++) {
|
| | | rewardUid.add(bossList.get(i).getBoss().getId());
|
| | | }
|
| | |
|
| | | // 删除补贴用户的下级用户
|
| | | for (int i = 0; i < bossList.size(); i++) {
|
| | | if (bossList.get(i).getBoss().getId().longValue() == subsidy.getUid()) {
|
| | | break;
|
| | | } else {
|
| | | bossList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 1; i < bossList.size(); i++) {
|
| | | if (rewardUid.contains(bossList.get(i).getBoss().getId())) {
|
| | | UserInfo boss = bossList.get(i).getBoss();
|
| | | if (i == 1) {
|
| | | if (bossList.get(i).getSucceedTime() < subsidy.getCreateTime().getTime()) {
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(boss.getId(), orderTime);
|
| | | BigDecimal rewardMoney = orderHongBaoMoneyComputeService
|
| | | .computeFirstTeamReward(subsidy.getMoney(), subsidy.getCreateTime(), userLevel);
|
| | |
|
| | | if (rewardMoney != null) {
|
| | | // 添加奖励
|
| | | orderTeamRewardService.addOrUpdate(subsidy, rewardMoney, boss.getId(),
|
| | | OrderTeamReward.LEVEL_ONE);
|
| | | }
|
| | | }
|
| | | } else if (i == 2) {
|
| | | if (bossList.get(i).getSucceedTime() < subsidy.getCreateTime().getTime()) {
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(boss.getId(), orderTime);
|
| | | BigDecimal rewardMoney = orderHongBaoMoneyComputeService
|
| | | .computeSecondTeamReward(subsidy.getMoney(), subsidy.getCreateTime(), userLevel);
|
| | |
|
| | | if (rewardMoney != null) {
|
| | | // 添加奖励
|
| | | orderTeamRewardService.addOrUpdate(subsidy, rewardMoney, boss.getId(),
|
| | | OrderTeamReward.LEVEL_TWO);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | //TODO 删除添加奖励
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | update.setUpdateTime(new Date());
|
| | | update.setInValidTime(new Date());
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | orderTeamRewardService.invalidByOrderIdAndSourceType(subsidy.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | update.setValidTime(new Date());
|
| | | update.setPreGetTime(preGetTime);
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | orderTeamRewardService.validByOrderIdAndSourceType(subsidy.getId(), preGetTime);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoV2SettleTemp;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.InviteOrderSubsidyDebtException;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtService orderTeamRewardDebtService;
|
| | |
| | | return debtMoney;
|
| | | }
|
| | |
|
| | | private BigDecimal kouKuanReward(List<OrderTeamReward> rewardList, BigDecimal debtMoney) {
|
| | | BigDecimal average = debtMoney.divide(new BigDecimal(rewardList.size()), 2, RoundingMode.UP);
|
| | | for (int i = 0; i < rewardList.size(); i++) {
|
| | | OrderTeamReward sidy = rewardList.get(i);
|
| | | BigDecimal subMoney = null;
|
| | | if (average.compareTo(sidy.getMoney()) >= 0) {
|
| | | subMoney = sidy.getMoney();
|
| | | } else {
|
| | | subMoney = average;
|
| | | }
|
| | | if (subMoney.compareTo(debtMoney) > 0)
|
| | | subMoney = debtMoney;
|
| | | debtMoney = debtMoney.subtract(subMoney);
|
| | | sidy.setMoney(sidy.getMoney().subtract(subMoney));
|
| | |
|
| | | if (sidy.getMoney().compareTo(new BigDecimal(0)) == 0) {
|
| | | rewardList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | return debtMoney;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void orderTeamRewardSettle(Long uid) throws OrderMoneySettleException {
|
| | | long count = orderTeamRewardService.countCanSettle(uid);
|
| | | if (count <= 0) {
|
| | | return;
|
| | | }
|
| | | int pageSize = 2000;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | // 查询出需要到账的奖励
|
| | | List<OrderTeamReward> totalList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<OrderTeamReward> list = orderTeamRewardService.listCanSettle(uid, i + 1, pageSize);
|
| | | if (list != null && list.size() > 0)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | if (totalList.size() > 0) {
|
| | | BigDecimal debtMoney = orderTeamRewardDebtService.getTotalDebtMoney(uid);
|
| | | BigDecimal originalDebtMoney = new BigDecimal(debtMoney.toString());// 总的欠款
|
| | | List<OrderTeamReward> copyRewardList = new ArrayList<>();
|
| | | copyRewardList.addAll(totalList);
|
| | | while (debtMoney.compareTo(new BigDecimal(0)) > 0 && copyRewardList.size() > 0) {// 有欠款,还有还的
|
| | | debtMoney = kouKuanReward(copyRewardList, debtMoney);
|
| | | }
|
| | | // 偿还欠款金额
|
| | | BigDecimal repayMoney = originalDebtMoney.subtract(debtMoney);
|
| | | BigDecimal bannce = null;
|
| | | if (repayMoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | try {
|
| | | bannce = orderTeamRewardDebtService.repayDebtByUid(uid, repayMoney);
|
| | | // 剩余的补贴金额
|
| | | } catch (OrderTeamRewardDebtException e) {
|
| | | throw new OrderMoneySettleException(2, "还款异常");
|
| | | }
|
| | | }
|
| | | if (bannce != null && bannce.compareTo(new BigDecimal(0)) > 0) {
|
| | | // 如果有还剩下的钱就加到第一个上面
|
| | | totalList.get(0).setMoney(totalList.get(0).getMoney().add(bannce));
|
| | | }
|
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0);
|
| | | for (OrderTeamReward reward : totalList) {
|
| | | orderTeamRewardService.settleById(reward.getId(), reward.getMoney());
|
| | | totalMoney = totalMoney.add(reward.getMoney());
|
| | | }
|
| | |
|
| | | // 实际到账奖励
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | try {
|
| | | userMoneyDetail = UserMoneyDetailFactory.createOrderTeamReward(uid, totalMoney, new Date());
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new OrderMoneySettleException(1, "账户明细构建出错");
|
| | | }
|
| | | // 添加资金
|
| | | userMoneyService.addUserMoney(uid, totalMoney, userMoneyDetail);
|
| | | // 添加消息
|
| | | userMoneyMsgNotificationService.orderTeamReward(uid, new Date(), "系统自动下发", totalMoney,
|
| | | userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao());
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | |
| | | @Resource
|
| | | private HongBaoV2AddManager hongBaoV2AddManager;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | /**
|
| | | * 是否是分享订单
|
| | |
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderTeamReward() {
|
| | | Date time = new Date();
|
| | | long count = orderTeamRewardService.countCanSettleUid(time);
|
| | | int pageSize = 500;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<Long> list = orderTeamRewardService.listCanSettleUid(time, i + 1, pageSize);
|
| | | if (list != null && list.size() > 0)
|
| | | uidList.addAll(list);
|
| | | }
|
| | | // 添加到队列
|
| | | if (uidList != null)
|
| | | for (Long uid : uidList)
|
| | | if (!Constant.IS_TEST)
|
| | | CMQManager.getInstance().addFanLiOrderTeamRewardMsg(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderTeamReward(Long uid) throws OrderMoneySettleException {
|
| | | orderMoneySettleService.orderTeamRewardSettle(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import com.sun.istack.Nullable; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | |
| | | * @param title 标题 必传 |
| | | * @param comment |
| | | */ |
| | | public void addGoodsEvaluate(Long goodsId, Integer cid, String title, String comment) throws GoodsEvaluateException; |
| | | public void addGoodsEvaluate(Long goodsId,List<ImgInfo> imgList, ActivityUser user, String title,String comment) throws GoodsEvaluateException; |
| | | |
| | | |
| | | } |
| | |
| | | */
|
| | | public void inviteSubsidySettle(Long uid, String taskKey) throws OrderMoneySettleException;
|
| | |
|
| | | /**
|
| | | * 团队奖励到账
|
| | | * @Title: orderTeamRewardSettle
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void orderTeamRewardSettle(Long uid) throws OrderMoneySettleException;
|
| | | }
|
| | |
| | | public void fanliInvaiteAndShare(Long uid) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 团队奖励到账
|
| | | * @Title: fanliOrderTeamReward
|
| | | * @Description: |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void fanliOrderTeamReward();
|
| | |
|
| | | /**
|
| | | * 团队奖励到账(按用户)
|
| | | * @Title: fanliOrderTeamReward
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void fanliOrderTeamReward(Long uid) throws OrderMoneySettleException;
|
| | |
|
| | | /**
|
| | | * 订单维权
|
| | | *
|
| | | * @param orderList
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserLevelManager userLevelManager;
|
| | |
|
| | | /**
|
| | | * 添加红包信息
|
| | |
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | if (user == null)
|
| | | throw new UserAccountException(1001, "用户不存在/被封禁");
|
| | | if (isVIP) {
|
| | | hongBao.setUrank(HongBaoV2.RANK_VIP);// VIP的等级设置为100
|
| | | } else {
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getThirdCreateTime());
|
| | | if (userLevel != null)
|
| | | hongBao.setUrank(userLevel.getOrderRank());
|
| | | else {
|
| | | hongBao.setUrank(user.getRank());
|
| | | }
|
| | | hongBao.setOrderType(commonOrder.getSourceType());
|
| | |
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | if (user == null)
|
| | | throw new UserAccountException(1001, "用户不存在/被封禁");
|
| | | if (isVip)
|
| | | hongBao.setUrank(HongBaoV2.RANK_VIP);
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getThirdCreateTime());
|
| | | if (userLevel != null)
|
| | | hongBao.setUrank(userLevel.getOrderRank());
|
| | | else
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBao.setUserInfo(user);
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | // 团队奖励
|
| | | public void addFanLiOrderTeamRewardMsg(Long uid) {
|
| | | cmqUtil.sendMsg(FANLI_ORDER_TEAM_REWARD, uid + "");
|
| | | }
|
| | |
|
| | | public Map<String, Long> consumeOrderTeamRewardMsg(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER_TEAM_REWARD);
|
| | | Map<String, Long> map = new HashMap<>();
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | map.put(msg.receiptHandle, Long.parseLong(result));
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void deleteOrderTeamRewardMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER_TEAM_REWARD, receiptHandle);
|
| | | }
|
| | | |
| | | // 维权订单
|
| | | public void addWeiQuanOrderMsg(TaoBaoWeiQuanOrder order) {
|
| | | cmqUtil.sendMsg(ORDER_WEIQUAN, new Gson().toJson(order));
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
|
| | |
| | | doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
|
| | | doOrderFanLiNew();// 新版返利
|
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doOrderTeamRewardFanLi();// 团队奖励到账
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | | doUserMoneyDebtJob();// 债务偿还
|
| | |
| | | orderProcessService.fanliInvaiteAndShare(map.get(handler));
|
| | | CMQManager.getInstance().deleteFanLiTiChengMsg(handler);
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单团队奖励到账
|
| | | */
|
| | | public void doOrderTeamRewardFanLi() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | |
|
| | | Map<String, Long> map = CMQManager.getInstance().consumeOrderTeamRewardMsg(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String handler = its.next();
|
| | | try {
|
| | | orderProcessService.fanliOrderTeamReward(map.get(handler));
|
| | | CMQManager.getInstance().deleteOrderTeamRewardMsg(handler);
|
| | | } catch (OrderMoneySettleException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
| | | #redis.addr=192.168.1.253
|
| | | #redis.port=6379 |
| | | #redis.auth=123456
|
| | | redis.addr=193.112.34.40
|
| | | redis.addr=192.168.1.253
|
| | | redis.port=6379
|
| | | redis.auth=weikou2014
|
| | | redis.auth=123456
|
| | | #redis.addr=193.112.34.40
|
| | | #redis.port=6379
|
| | | #redis.auth=weikou2014
|
| | | redis.max_total=1024 |
| | | redis.max_idle=200
|
| | | redis.max_wait=10000
|
| | |
| | |
|
| | | @Test
|
| | | public void test1() {
|
| | | ColumnParseUtil.parseColumn(OrderTeamReward.class,
|
| | | "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml");
|
| | | |
| | | ColumnParseUtil.parseColumn(InviteOrderSubsidy.class,
|
| | | "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/InviteOrderSubsidyMapper.xml");
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Test
|
| | | public void test2() {
|
| | | String[] marks = new String[] { "\\(-\\)"};
|
| | | // String result = TaoKeApiUtil.officialActivityConvert("19507100253",
|
| | | // "1584519810786", "20211660");
|
| | | // System.out.println(result);
|
| | |
|
| | | List<String> textList = TaoBaoUtil.getTokenListFromText("復製这条(VzUl1fzQWMT)进入【Tao宝】即可抢购", Arrays.asList(marks));
|
| | | // TaoKeApiUtil.getQuanInfo(579875678934L,
|
| | | // "91b8984019e24fe1b1e3d6bd15479785");
|
| | | String result = TaoKeApiUtil.getActivityInfo("1583739244161", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT,
|
| | | "511374878");
|
| | | System.out.println(result);
|
| | |
|
| | | System.out.println(textList);
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑外卖红包", result);
|
| | | |
| | | System.out.println(token);
|
| | | }
|
| | |
|
| | | @Test
|
| | |
| | |
|
| | | @Test
|
| | | public void test13(){
|
| | | TaoKeApiUtil.specialConvertCoupon(579875678934L, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | try {
|
| | | TaoKeApiUtil.getSimpleGoodsInfo(573867930843L);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test14() {
|
| | | TaoKeApiUtil.getCouponListByItemId(614089154947L);
|
| | | }
|
| | |
|
| | | }
|