| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.json.simple.JSONArray;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | } catch (TaobaoGoodsDownException e) {
|
| | | // 商品下架
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
|
| | | public void run() {
|
| | | taoBaoGoodsUpdateService.offlineTaoBaoGoods(id);
|
| | | }
|
| | |
| | | try {
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods, acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | |
| | | // goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | |
| | |
|
| | | // goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | |
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | shareInfoVO.setHelpLink(helpLink);
|
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | if (goodsDetail.isHasCoupon()) {
|
| | | // 设置couponList
|
| | | List<CouponInfoVO> couponInfoList = new ArrayList<>();
|
| | | couponInfoList.add(goodsDetail.getCouponInfo());
|
| | | if (Constant.IS_TEST) {
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(coupon, goodsDetail.getCouponInfo());
|
| | | } catch (IllegalAccessException e) {
|
| | | e.printStackTrace();
|
| | | } catch (InvocationTargetException e) {
|
| | | e.printStackTrace();
|
| | | } catch (NoSuchMethodException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | coupon.setShopCoupon(true);
|
| | | coupon.setLink("https://uland.taobao.com/quan/detail?sellerId=725677994&activityId=d03aa6d23a5a4040afb3942e7ea9a007");
|
| | | couponInfoList.add(coupon);
|
| | | }
|
| | | goodsDetail.setCouponInfoList(couponInfoList);
|
| | | }
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
|
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | | object.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | object.put("weiXinState", 2);
|
| | | object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | | object.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | object.put("weiXinState", 2);
|
| | | object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
|
| | | bossData.put("weiXinState", 1);
|
| | | bossData.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | bossData.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | bossData.put("weiXinState", 2);
|
| | | bossData.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | public enum UserLevelEnum {
|
| | | //team_subsidy_6_pre_0_0
|
| | | //team_subsidy_6_pre_0_3
|
| | | //team_subsidy_6_pre_0_7
|
| | | //team_subsidy_6_pre_0_10
|
| | | //team_subsidy_6_pre_0_11
|
| | | |
| | | |
| | | //team_subsidy_6_pre_3_0
|
| | | //team_subsidy_6_pre_3_3
|
| | | //team_subsidy_6_pre_3_7
|
| | | //team_subsidy_6_pre_3_10
|
| | | //team_subsidy_6_pre_3_11
|
| | | |
| | | |
| | | //team_subsidy_6_pre_7_0
|
| | | //team_subsidy_6_pre_7_3
|
| | | //team_subsidy_6_pre_7_7
|
| | | //team_subsidy_6_pre_7_10
|
| | | //team_subsidy_6_pre_7_11
|
| | | |
| | | |
| | | //team_subsidy_6_pre_10_0=0
|
| | | //team_subsidy_6_pre_10_3=0
|
| | | //team_subsidy_6_pre_10_7=0
|
| | | //team_subsidy_6_pre_10_10=0
|
| | | //team_subsidy_6_pre_10_11=0
|
| | | |
| | | |
| | | //team_subsidy_6_pre_11_0=0
|
| | | //team_subsidy_6_pre_11_3=0
|
| | | //team_subsidy_6_pre_11_7=0
|
| | | //team_subsidy_6_pre_11_10=0
|
| | | //team_subsidy_6_pre_11_11=0
|
| | | |
| | | |
| | | |
| | | //team_subsidy_7_pre_0_0
|
| | | //team_subsidy_7_pre_0_3
|
| | | //team_subsidy_7_pre_0_7
|
| | | //team_subsidy_7_pre_0_10
|
| | | //team_subsidy_7_pre_0_11
|
| | | |
| | | |
| | | //team_subsidy_7_pre_3_0
|
| | | //team_subsidy_7_pre_3_3
|
| | | //team_subsidy_7_pre_3_7
|
| | | //team_subsidy_7_pre_3_10
|
| | | //team_subsidy_7_pre_3_11
|
| | | |
| | | |
| | | //team_subsidy_7_pre_7_0
|
| | | //team_subsidy_7_pre_7_3
|
| | | //team_subsidy_7_pre_7_7
|
| | | //team_subsidy_7_pre_7_10
|
| | | //team_subsidy_7_pre_7_11
|
| | | |
| | | |
| | | //team_subsidy_7_pre_10_0=0
|
| | | //team_subsidy_7_pre_10_3=0
|
| | | //team_subsidy_7_pre_10_7=0
|
| | | //team_subsidy_7_pre_10_10=0
|
| | | //team_subsidy_7_pre_10_11=0
|
| | | |
| | | |
| | | //team_subsidy_7_pre_11_0=0
|
| | | //team_subsidy_7_pre_11_3=0
|
| | | //team_subsidy_7_pre_11_7=0
|
| | | //team_subsidy_7_pre_11_10=0
|
| | | //team_subsidy_7_pre_11_11=0
|
| | | |
| | | |
| | | |
| | |
|
| | | daRen(0, 0, "快省达人", "actived", "http://www.baidu.com"),
|
| | | normalVIP(3, 30, "普通会员", "vipPre1", "http://www.baidu.com"),
|
| | | highVIP(7, 70, "高级会员", "vipPre2", "http://www.baidu.com"),
|
New file |
| | |
| | | package com.yeshi.fanli.entity.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 团队收益记录表
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_team_income")
|
| | | public class TeamEincomeRecord {
|
| | | @Column(name = "ti_id")
|
| | | private Long id;
|
| | | @Column(name = "ti_uid")
|
| | | private Long uid;
|
| | | @Column(name = "ti_type")
|
| | | private Integer type;
|
| | | @Column(name = "ti_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "ti_state")
|
| | | private Integer state;
|
| | | @Column(name = "ti_source_type")
|
| | | private Integer sourceType;
|
| | | @Column(name = "ti_pre_recieve_time")
|
| | | private Date preRecieveTime;
|
| | | @Column(name = "ti_recieve_time")
|
| | | private Date recieveTime;
|
| | | @Column(name = "ti_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "ti_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "ti_beizhu")
|
| | | private String beiZhu;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public Date getPreRecieveTime() {
|
| | | return preRecieveTime;
|
| | | }
|
| | |
|
| | | public void setPreRecieveTime(Date preRecieveTime) {
|
| | | this.preRecieveTime = preRecieveTime;
|
| | | }
|
| | |
|
| | | public Date getRecieveTime() {
|
| | | return recieveTime;
|
| | | }
|
| | |
|
| | | public void setRecieveTime(Date recieveTime) {
|
| | | this.recieveTime = recieveTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public String getBeiZhu() {
|
| | | return beiZhu;
|
| | | }
|
| | |
|
| | | public void setBeiZhu(String beiZhu) {
|
| | | this.beiZhu = beiZhu;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.money;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class TeamEincomeRecordException extends BaseException {
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public TeamEincomeRecordException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public TeamEincomeRecordException() {
|
| | | super();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | JDSearchFilter jdfilter = new JDSearchFilter();
|
| | | jdfilter.setPageNo(page);
|
| | | jdfilter.setPageSize(Constant.PAGE_SIZE);
|
| | | result =JDApiUtil.getJingFenGoods(page,15); //JDUtil.searchByKey(jdfilter);
|
| | | result =JDApiUtil.getJingFenGoods(page,125); //JDUtil.searchByKey(jdfilter);
|
| | | }
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | Collections.shuffle(result.getGoodsList());
|
| | |
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | |
| | | // 添加事务消息
|
| | | try {
|
| | | orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.money;
|
| | |
|
| | | import com.yeshi.fanli.entity.money.TeamEincomeRecord;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.money.TeamEincomeRecordException;
|
| | |
|
| | | /**
|
| | | * 团队收益记录服务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TeamEincomeRecordService {
|
| | |
|
| | | /**
|
| | | * 添加用户手团队收益记录
|
| | | * @Title: addTeamEincomeRecord
|
| | | * @Description: |
| | | * @param record
|
| | | * @throws ParamsException |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamEincomeRecord(TeamEincomeRecord record) throws TeamEincomeRecordException,ParamsException;
|
| | | |
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.manger.money;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | /**
|
| | | * 团队收益管理
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class TeamEincomeManager {
|
| | |
|
| | | /**
|
| | | * 添加团队奖金
|
| | | * @Title: addTeamReward
|
| | | * @Description: |
| | | * @param hongBaoList
|
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamReward(Long uid, Date preSendTime,int sourceType) {
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加团队补贴
|
| | | * @Title: addTeamSubsidy
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param taskKey |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamSubsidy(Long uid, String taskKey,int sourceType) {
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加团队分红
|
| | | * @Title: addTeamDividents
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param preSendTime |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamDividents(Long uid, Date preSendTime) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = createFanLiHongBao(commonOrder, fanliRate, mianDanMoney, vip);
|
| | | HongBaoV2 hongBao = createFanLiHongBao(commonOrder, fanliRate, mianDanMoney);
|
| | | if (hongBao == null)
|
| | | return;
|
| | | addFanLiOrShareHongBao(hongBao, commonOrder, notificationMap);
|
| | |
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid);
|
| | | if (user == null)
|
| | | return null;
|
| | | boolean isVIP = userVIPInfoService.isVIP(uid);
|
| | |
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(uid);
|
| | |
|
| | | HongBaoV2 child = new HongBaoV2();
|
| | | child.setParent(parent);
|
| | |
| | | }
|
| | |
|
| | | child.setUserInfo(user);
|
| | | child.setUrank(user.getRank());
|
| | | child.setUrank(level.getOrderRank());
|
| | | child.setVersion(2);
|
| | | child.setCreateTime(new Date());
|
| | | child.setOrderType(commonOrder.getSourceType());
|
| | | if (child.getMoney() == null)
|
| | | return null;
|
| | | if (child.getMoney().compareTo(new BigDecimal(0)) <= 0 && !isVIP)
|
| | | return null;
|
| | | return child;
|
| | | }
|
| | |
| | | * -返利比例
|
| | | * @param mianDanMoney
|
| | | * 免单金额
|
| | | * @param isVIP-是否为VIP订单
|
| | | * @return
|
| | | * @throws HongBaoException
|
| | | * @throws UserAccountException
|
| | | */
|
| | | private HongBaoV2 createFanLiHongBao(CommonOrder commonOrder, BigDecimal fanliRate, BigDecimal mianDanMoney,
|
| | | boolean isVIP) throws HongBaoException, UserAccountException {
|
| | | private HongBaoV2 createFanLiHongBao(CommonOrder commonOrder, BigDecimal fanliRate, BigDecimal mianDanMoney) throws HongBaoException, UserAccountException {
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | | hongBao.setUserInfo(commonOrder.getUserInfo());
|
| | | hongBao.setCreateTime(new Date());
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder;
|
| | |
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsSourceOrderException;
|
| | | import com.yeshi.fanli.service.inter.money.TeamDividentsDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.factory.order.dividents.TeamDividentsSourceOrderFactory;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | |
|
| | | /**
|
| | | * 团队分红管理
|
| | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addDividentsSourceOrder(List<CommonOrder> commonOrderList) throws TeamDividentsSourceOrderException {
|
| | | UserLevelEnum level = UserLevelUtil.getByOrderRank(commonOrderList.get(0).getUrank());
|
| | | if (level == null)
|
| | | level = UserLevelEnum.daRen;
|
| | | BigDecimal rate = getSourceOrderDividentsRate(level);
|
| | | TeamDividentsSourceOrder order = TeamDividentsSourceOrderFactory.create(commonOrderList, rate);
|
| | | try {
|
| | | teamDividentsSourceOrderService.addTeamDividentsSourceOrder(order);
|
| | | } catch (TeamDividentsSourceOrderException e) {
|
| | | e.printStackTrace();
|
| | | } catch (ParamsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 开始分红
|
| | | * @Title: startDividents
|
| | |
| | | if (orderRank == UserLevelEnum.superVIP.getOrderRank()) {
|
| | | return UserLevelEnum.superVIP.getName();
|
| | | }
|
| | |
|
| | | if (orderRank == UserLevelEnum.tearcher.getOrderRank()) {
|
| | | return UserLevelEnum.tearcher.getName();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | } else if (level == UserLevelEnum.highVIP) {
|
| | | return UserLevelEnum.superVIP;
|
| | | } else if (level == UserLevelEnum.superVIP) {
|
| | | return null;
|
| | | return UserLevelEnum.tearcher;
|
| | | }
|
| | |
|
| | | return null;
|