Merge remote-tracking branch 'origin/div' into div
3个文件已删除
32个文件已修改
44个文件已添加
| | |
| | | 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", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | |
| | | int updateByPrimaryKey(AlipayAccountValidNormalHistory record);
|
| | |
|
| | | AlipayAccountValidNormalHistory selectLatestByUid(Long uid);
|
| | | |
| | | AlipayAccountValidNormalHistory selectFirstByUid(Long uid);
|
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.money; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt; |
| | | |
| | | public interface TeamDividentsDebtMapper extends BaseMapper<TeamDividentsDebt> { |
| | | |
| | | /** |
| | | * 检索(根据剩余资金与用户ID) |
| | | * |
| | | * @param minMoney |
| | | * @param maxMoney |
| | | * @param uid |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<TeamDividentsDebt> listByLeftMoneyAndUid(@Param("minMoney") BigDecimal minMoney, |
| | | @Param("maxMoney") BigDecimal maxMoney, @Param("uid") Long uid, @Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 检索(根据剩余资金与用户ID) |
| | | * |
| | | * @param minMoney |
| | | * @param maxMoney |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countByLeftMoneyAndUid(@Param("minMoney") BigDecimal minMoney, @Param("maxMoney") BigDecimal maxMoney, |
| | | @Param("uid") Long uid); |
| | | |
| | | TeamDividentsDebt selectByPrimaryKeyForUpdate(Long id); |
| | | |
| | | /** |
| | | * 计算欠款金额(根据用户ID) |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal sumLeftMoneyByUid(Long uid); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.money; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory; |
| | | |
| | | public interface TeamDividentsDebtRepayHistoryMapper extends BaseMapper<TeamDividentsDebtRepayHistory> { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order.dividents; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord; |
| | | |
| | | public interface TeamDividentsRecordMapper extends BaseMapper<TeamDividentsRecord> { |
| | | |
| | | /** |
| | | * 根据用户ID与日期检索 |
| | | * @Title: selectByUidAndDay |
| | | * @Description: |
| | | * @param uid |
| | | * @param day |
| | | * @return |
| | | * TeamDividentsRecord 返回类型 |
| | | * @throws |
| | | */ |
| | | TeamDividentsRecord selectByUidAndDayForUpdate(@Param("uid") Long uid, @Param("day")String day); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order.dividents; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder; |
| | | |
| | | public interface TeamDividentsSourceOrderMapper extends BaseMapper<TeamDividentsSourceOrder> { |
| | | |
| | | TeamDividentsSourceOrder selectByPrimaryKeyForUpdate(Long id); |
| | | |
| | | /** |
| | | * 根据用户ID和预计发送时间查询能参与分红的订单 |
| | | * @Title: listCanSendByUidAndPreSendTime |
| | | * @Description: |
| | | * @param uid |
| | | * @param preSendTime |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | * List<TeamDividentsSourceOrder> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<TeamDividentsSourceOrder> lisByUidAndPreSendTimeAndState(@Param("uid") Long uid, |
| | | @Param("preSendTime") Date preSendTime, @Param("state") int state, @Param("start") long start, @Param("count") int count); |
| | | |
| | | long countByUidAndPreSendTimeAndState(@Param("uid") Long uid, @Param("preSendTime") Date preSendTime, |
| | | @Param("state") int state); |
| | | |
| | | /** |
| | | * 根据预计发送时间与状态统计产生分红订单的用户ID |
| | | * @Title: listUidByPreSendTimeAndSatte |
| | | * @Description: |
| | | * @param preSendTime |
| | | * @param state |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | * List<Long> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<Long> listUidByPreSendTimeAndState(@Param("preSendTime") Date preSendTime, @Param("state") Integer state, |
| | | @Param("start") long start, @Param("count") int count); |
| | | |
| | | long countUidByPreSendTimeAndState(@Param("preSendTime") Date preSendTime, @Param("state") Integer state); |
| | | |
| | | /** |
| | | * 设置用户的订单为无效 |
| | | * @Title: setInvalidByUidAndState |
| | | * @Description: |
| | | * @param uid |
| | | * @param state |
| | | * @param beiZhu |
| | | * @return |
| | | * int 返回类型 |
| | | * @throws |
| | | */ |
| | | int setStateByUidAndState(@Param("uid") Long uid, @Param("targetState") int targetState, @Param("state") int state, @Param("beiZhu") String beiZhu); |
| | | |
| | | /** |
| | | * 根据订单信息检索 |
| | | * @Title: selectByOrderNoSourceType |
| | | * @Description: |
| | | * @param orderNo |
| | | * @param sourceType |
| | | * @return |
| | | * TeamDividentsSourceOrder 返回类型 |
| | | * @throws |
| | | */ |
| | | TeamDividentsSourceOrder selectByOrderNoAndSourceType(@Param("orderNo") String orderNo, |
| | | @Param("sourceType") int sourceType); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order.dividents; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser; |
| | | |
| | | public interface TeamDividentsSourceUserMapper extends BaseMapper<TeamDividentsSourceUser> { |
| | | |
| | | /** |
| | | * 根据日期与目标用户ID统计资金 |
| | | * @Title: sumMoneyByUidAndDay |
| | | * @Description: |
| | | * @param uid |
| | | * @param day |
| | | * @return |
| | | * BigDecimal 返回类型 |
| | | * @throws |
| | | */ |
| | | BigDecimal sumMoneyByTargetUidAndDay(@Param("uid") Long uid, @Param("day") String day); |
| | | |
| | | /** |
| | | * 根据日期检索用户ID |
| | | * @Title: listTargetUidByDay |
| | | * @Description: |
| | | * @param day |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | * List<Long> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<Long> listTargetUidByDay(@Param("day") String day, @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据日期查询目标用户ID |
| | | * @Title: countTargetUidByDay |
| | | * @Description: |
| | | * @param day |
| | | * @return |
| | | * long 返回类型 |
| | | * @throws |
| | | */ |
| | | long countTargetUidByDay(@Param("day") String day); |
| | | |
| | | /** |
| | | * 根据日期与源用户ID查询 |
| | | * @Title: listBySourceUidAndDay |
| | | * @Description: |
| | | * @param sourceUid |
| | | * @param day |
| | | * @return |
| | | * List<TeamDividentsSourceUser> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<TeamDividentsSourceUser> listBySourceUidAndDay(@Param("sourceUid") Long sourceUid, @Param("day") String day); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user.vip; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic; |
| | | |
| | | public interface TeamUserLevelStatisticMapper extends BaseMapper<TeamUserLevelStatistic> { |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | |
|
| | | public enum OrderTopicTagEnum {
|
| | | orderStatistic(OrderMQMsg.class), // 订单统计
|
| | |
| | | orderUpdate(OrderMoneyRecievedMQMsg.class), // 订单修改
|
| | | orderFanLiActual(OrderMoneyRecievedMQMsg.class), // 订单实时到账
|
| | | orderFanLiDelay(OrderMoneyRecievedMQMsg.class), // 订单到账延时消息
|
| | | orderConfirm(OrderConfirmMQMsg.class),//订单确认收货
|
| | | orderFanLiSeparateByOrderNo(OrderMoneyRecievedMQMsg.class),//订单实时到账,按订单号分离
|
| | | orderConfirm(OrderConfirmMQMsg.class), // 订单确认收货
|
| | | orderFanLiSeparateByOrderNo(OrderMoneyRecievedMQMsg.class), // 订单实时到账,按订单号分离
|
| | | banLiShopOrderDelay(BanLiShopOrderMQMsg.class), // 板栗商城下单
|
| | | banLiShopOrderRefund(BanLiShopOrderMQMsg.class), // 板栗商城订单退款
|
| | | banLiShopOrderPaid(BanLiShopOrderMQMsg.class);// 商城订单支付成功
|
| | | banLiShopOrderPaid(BanLiShopOrderMQMsg.class), // 商城订单支付成功
|
| | | taoBaoOrderWeiQuan(TaoBaoWeiQuanOrder.class);// 淘宝维权订单
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InterTokenMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InviteCodeActiveMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.ThreeSaleSeparateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserForbiddenMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserLevelChangedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRedPackGiftMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserRegisterMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | |
| | | userAccountBinding(UserAccountBindingMQMsg.class), // 用户账号绑定
|
| | | userActve(UserActive.class), // 用户活跃
|
| | | useSystemCoupon(UserSystemCouponUseMQMsg.class), // 系统券使用
|
| | | systemCouponDrawback(UserSystemCouponUseMQMsg.class),//系统券退回
|
| | | systemCouponDrawback(UserSystemCouponUseMQMsg.class), // 系统券退回
|
| | | inviteSuccess(UserInviteMQMsg.class), // 邀请成功
|
| | | integralTaskFinish(IntegralTaskMQMsg.class), // 完成金币任务
|
| | | userRegister(UserRegisterMQMsg.class),//注册
|
| | | tokenOutOfDate(InterTokenMQMsg.class),//口令过期
|
| | | redPackGiftDrawback(UserRedPackGiftMQMsg.class),// 红包赠送退回
|
| | | inviteCodeActive(InviteCodeActiveMQMsg.class),//邀请码激活
|
| | | userInfoUpdate(UserInfoUpdateMQMsg.class); //用户信息修改
|
| | | userRegister(UserRegisterMQMsg.class), // 注册
|
| | | tokenOutOfDate(InterTokenMQMsg.class), // 口令过期
|
| | | redPackGiftDrawback(UserRedPackGiftMQMsg.class), // 红包赠送退回
|
| | | inviteCodeActive(InviteCodeActiveMQMsg.class), // 邀请码激活
|
| | | forbiddenUser(UserForbiddenMQMsg.class), // 封禁用户
|
| | | userInfoUpdate(UserInfoUpdateMQMsg.class), // 用户信息修改
|
| | | userLevelChanged(UserLevelChangedMQMsg.class), // 用户等级变化
|
| | | threeSaleSeparate(ThreeSaleSeparateMQMsg.class);// 邀请关系脱离
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | public class ThreeSaleSeparateMQMsg {
|
| | | private Long bossUid;
|
| | | private Long workerUid;
|
| | | private Date createTime;
|
| | |
|
| | | public ThreeSaleSeparateMQMsg(Long bossUid, Long workerUid, Date createTime) {
|
| | | this.bossUid = bossUid;
|
| | | this.workerUid = workerUid;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Long getBossUid() {
|
| | | return bossUid;
|
| | | }
|
| | |
|
| | | public void setBossUid(Long bossUid) {
|
| | | this.bossUid = bossUid;
|
| | | }
|
| | |
|
| | | public Long getWorkerUid() {
|
| | | return workerUid;
|
| | | }
|
| | |
|
| | | public void setWorkerUid(Long workerUid) {
|
| | | this.workerUid = workerUid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | |
|
| | | /**
|
| | | * 用户封禁
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserForbiddenMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;// 用户ID
|
| | | private Date createTime;// 创建时间
|
| | | private AdminUser admin;// 封禁的管理员
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public AdminUser getAdmin() {
|
| | | return admin;
|
| | | }
|
| | |
|
| | | public void setAdmin(AdminUser admin) {
|
| | | this.admin = admin;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | |
|
| | | /**
|
| | | * 金币任务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserLevelChangedMQMsg extends BaseMQMsgBody {
|
| | | private Long uid;
|
| | | private UserLevelEnum fromLevel;
|
| | | private UserLevelEnum toLevel;
|
| | | private Date createTime;
|
| | |
|
| | | public UserLevelChangedMQMsg(Long uid, UserLevelEnum fromLevel, UserLevelEnum toLevel, Date createTime) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.fromLevel = fromLevel;
|
| | | this.toLevel = toLevel;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public UserLevelEnum getFromLevel() {
|
| | | return fromLevel;
|
| | | }
|
| | |
|
| | | public void setFromLevel(UserLevelEnum fromLevel) {
|
| | | this.fromLevel = fromLevel;
|
| | | }
|
| | |
|
| | | public UserLevelEnum getToLevel() {
|
| | | return toLevel;
|
| | | }
|
| | |
|
| | | public void setToLevel(UserLevelEnum toLevel) {
|
| | | this.toLevel = toLevel;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.order.dividents;
|
| | |
|
| | | public class UserDividentsDayDTO {
|
| | | private Long uid;
|
| | | private String day;
|
| | |
|
| | | public UserDividentsDayDTO(Long uid, String day) {
|
| | | super();
|
| | | this.uid = uid;
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 团队成员等级统计
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_team_user_level_statistic")
|
| | | public class TeamUserLevelStatistic {
|
| | | @Column(name = "tuls_uid")
|
| | | private Long id;
|
| | | @Column(name = "tuls_level")
|
| | | private UserLevelEnum level;
|
| | | @Column(name = "tuls_normal_first_count")
|
| | | private Integer normalFirstCount;
|
| | | @Column(name = "tuls_normal_second_count")
|
| | | private Integer normalSecondCount;
|
| | | @Column(name = "tuls_high_first_count")
|
| | | private Integer highFirstCount;
|
| | | @Column(name = "tuls_high_second_count")
|
| | | private Integer highSecondCount;
|
| | | @Column(name = "tuls_super_first_count")
|
| | | private Integer superFirstCount;
|
| | | @Column(name = "tuls_super_second_count")
|
| | | private Integer superSecondCount;
|
| | | @Column(name = "tuls_tearcher_first_count")
|
| | | private Integer tearcherFirstCount;
|
| | | @Column(name = "tuls_tearcher_second_count")
|
| | | private Integer tearcherSecondCount;
|
| | |
|
| | | @Column(name = "tuls_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "tuls_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserLevelEnum getLevel() {
|
| | | return level;
|
| | | }
|
| | |
|
| | | public void setLevel(UserLevelEnum level) {
|
| | | this.level = level;
|
| | | }
|
| | |
|
| | | public Integer getNormalFirstCount() {
|
| | | return normalFirstCount;
|
| | | }
|
| | |
|
| | | public void setNormalFirstCount(Integer normalFirstCount) {
|
| | | this.normalFirstCount = normalFirstCount;
|
| | | }
|
| | |
|
| | | public Integer getNormalSecondCount() {
|
| | | return normalSecondCount;
|
| | | }
|
| | |
|
| | | public void setNormalSecondCount(Integer normalSecondCount) {
|
| | | this.normalSecondCount = normalSecondCount;
|
| | | }
|
| | |
|
| | | public Integer getHighFirstCount() {
|
| | | return highFirstCount;
|
| | | }
|
| | |
|
| | | public void setHighFirstCount(Integer highFirstCount) {
|
| | | this.highFirstCount = highFirstCount;
|
| | | }
|
| | |
|
| | | public Integer getHighSecondCount() {
|
| | | return highSecondCount;
|
| | | }
|
| | |
|
| | | public void setHighSecondCount(Integer highSecondCount) {
|
| | | this.highSecondCount = highSecondCount;
|
| | | }
|
| | |
|
| | | public Integer getSuperFirstCount() {
|
| | | return superFirstCount;
|
| | | }
|
| | |
|
| | | public void setSuperFirstCount(Integer superFirstCount) {
|
| | | this.superFirstCount = superFirstCount;
|
| | | }
|
| | |
|
| | | public Integer getSuperSecondCount() {
|
| | | return superSecondCount;
|
| | | }
|
| | |
|
| | | public void setSuperSecondCount(Integer superSecondCount) {
|
| | | this.superSecondCount = superSecondCount;
|
| | | }
|
| | |
|
| | | 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 Integer getTearcherFirstCount() {
|
| | | return tearcherFirstCount;
|
| | | }
|
| | |
|
| | | public void setTearcherFirstCount(Integer tearcherFirstCount) {
|
| | | this.tearcherFirstCount = tearcherFirstCount;
|
| | | }
|
| | |
|
| | | public Integer getTearcherSecondCount() {
|
| | | return tearcherSecondCount;
|
| | | }
|
| | |
|
| | | public void setTearcherSecondCount(Integer tearcherSecondCount) {
|
| | | this.tearcherSecondCount = tearcherSecondCount;
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | public enum UserLevelEnum {
|
| | |
|
| | | daRen(0, 0, "快省达人", "actived", "http://www.baidu.com"),
|
| | | normalVIP(3, 30, "普通会员", "vipPre1", "http://www.baidu.com"),
|
| | | highVIP(7, 70, "高级会员", "vipPre2", "http://www.baidu.com"),
|
| | | superVIP(10, 100, "超级会员", "vip", "http://www.baidu.com");
|
| | | superVIP(10, 100, "超级会员", "vip", "http://www.baidu.com"),
|
| | | tearcher(11, 101, "资深导师", "tearcher", "http://www.baidu.com");
|
| | |
|
| | | private int level;
|
| | | private int orderRank;
|
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;
|
| | | }
|
| | | }
|
| | |
| | | extractAutoWX("自动提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),
|
| | | extractAutoWXRefund("自动提现失败", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),
|
| | | subsidy("额外补贴", "http://img.flqapp.com/resource/msg/icon_msg_subsidy.png", ""),
|
| | | orderTeamReward("团队奖励", "http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", "");
|
| | | orderTeamDividents("团队分红", "http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", "");
|
| | |
|
| | | private final String desc;
|
| | | private final String picture;
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order.dividents;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_order_team_dividents_debt")
|
| | | public class TeamDividentsDebt {
|
| | | @Column(name="tdd_id")
|
| | | private Long id;
|
| | | @Column(name="tdd_uid")
|
| | | private Long uid;
|
| | | @Column(name="tdd_origin_money")
|
| | | private BigDecimal originMoney;
|
| | | @Column(name="tdd_left_money")
|
| | | private BigDecimal leftMoney;
|
| | | @Column(name="tdd_order_no")
|
| | | private String orderNo;
|
| | | @Column(name="tdd_source_type")
|
| | | private Integer sourceType;
|
| | | @Column(name="tdd_create_time")
|
| | | private Date createTime;
|
| | | @Column(name="tdd_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | 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 BigDecimal getOriginMoney() {
|
| | | return originMoney;
|
| | | }
|
| | |
|
| | | public void setOriginMoney(BigDecimal originMoney) {
|
| | | this.originMoney = originMoney;
|
| | | }
|
| | |
|
| | | public BigDecimal getLeftMoney() {
|
| | | return leftMoney;
|
| | | }
|
| | |
|
| | | public void setLeftMoney(BigDecimal leftMoney) {
|
| | | this.leftMoney = leftMoney;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order.dividents;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_order_team_dividents_debt_repay_history")
|
| | | public class TeamDividentsDebtRepayHistory {
|
| | | @Column(name = "drh_id")
|
| | | private Long id;
|
| | | @Column(name = "drh_debt_id")
|
| | | private TeamDividentsDebt debt;
|
| | | @Column(name = "drh_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "drh_uid")
|
| | | private Long uid;
|
| | | @Column(name = "drh_beizhu")
|
| | | private String beiZhu;
|
| | | @Column(name = "drh_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public TeamDividentsDebt getDebt() {
|
| | | return debt;
|
| | | }
|
| | |
|
| | | public void setDebt(TeamDividentsDebt debt) {
|
| | | this.debt = debt;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getBeiZhu() {
|
| | | return beiZhu;
|
| | | }
|
| | |
|
| | | public void setBeiZhu(String beiZhu) {
|
| | | this.beiZhu = beiZhu;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order.dividents;
|
| | |
|
| | | 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_dividents_record")
|
| | | public class TeamDividentsRecord {
|
| | |
|
| | | public final static int STATE_VALID = 1;
|
| | | public final static int STATE_INVALID = 0;
|
| | |
|
| | | @Column(name = "td_id")
|
| | | private Long id;
|
| | | @Column(name = "td_uid")
|
| | | private Long uid;
|
| | | @Column(name = "td_day")
|
| | | private String day;// 天,如:2020-04-01
|
| | | @Column(name = "td_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "td_state")
|
| | | private Integer state;
|
| | | @Column(name = "td_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "td_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | 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 String getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | 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 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.order.dividents;
|
| | |
|
| | | 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_dividents_source_order")
|
| | | public class TeamDividentsSourceOrder {
|
| | |
|
| | | // 已经发送
|
| | | public final static int STATE_ALREADY_SEND = 2;
|
| | | // 可以发送
|
| | | public final static int STATE_CAN_SEND = 1;
|
| | | // 无效
|
| | | public final static int STATE_INVALID = 0;
|
| | |
|
| | | @Column(name = "tdo_id")
|
| | | private Long id;
|
| | | @Column(name = "tdo_uid")
|
| | | private Long uid;
|
| | | @Column(name = "tdo_order_no")
|
| | | private String orderNo;
|
| | | @Column(name = "tdo_source_type")
|
| | | private Integer sourceType;
|
| | | @Column(name = "tdo_state")
|
| | | private Integer state;
|
| | | @Column(name = "tdo_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "tdo_pre_send_time")
|
| | | private Date preSendTime;// 预计发送时间
|
| | | @Column(name = "tdo_send_time")
|
| | | private Date sendTime;
|
| | | @Column(name = "tdo_beizhu")
|
| | | private String beiZhu;// 备注
|
| | |
|
| | | @Column(name = "tdo_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "tdo_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | 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 String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public Date getPreSendTime() {
|
| | | return preSendTime;
|
| | | }
|
| | |
|
| | | public void setPreSendTime(Date preSendTime) {
|
| | | this.preSendTime = preSendTime;
|
| | | }
|
| | |
|
| | | public Date getSendTime() {
|
| | | return sendTime;
|
| | | }
|
| | |
|
| | | public void setSendTime(Date sendTime) {
|
| | | this.sendTime = sendTime;
|
| | | }
|
| | |
|
| | | 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.entity.order.dividents;
|
| | |
|
| | | 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_dividents_source_user")
|
| | | public class TeamDividentsSourceUser {
|
| | | @Column(name = "tdsu_id")
|
| | | private Long id;
|
| | | @Column(name = "tdsu_target_uid")
|
| | | private Long targetUid;
|
| | | @Column(name = "tdsu_source_uid")
|
| | | private Long sourceUid;
|
| | | @Column(name = "tdsu_day")
|
| | | private String day;
|
| | | @Column(name = "tdsu_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "tdsu_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "tdsu_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getTargetUid() {
|
| | | return targetUid;
|
| | | }
|
| | |
|
| | | public void setTargetUid(Long targetUid) {
|
| | | this.targetUid = targetUid;
|
| | | }
|
| | |
|
| | | public Long getSourceUid() {
|
| | | return sourceUid;
|
| | | }
|
| | |
|
| | | public void setSourceUid(Long sourceUid) {
|
| | | this.sourceUid = sourceUid;
|
| | | }
|
| | |
|
| | | public String getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception;
|
| | |
|
| | | public class ParamsException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public ParamsException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public ParamsException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.money;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class TeamDividentsDebtException extends BaseException {
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public TeamDividentsDebtException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public TeamDividentsDebtException() {
|
| | | super();
|
| | | }
|
| | |
|
| | | }
|
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();
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.order.dividents;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class TeamDividentsRecordException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public TeamDividentsRecordException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public TeamDividentsRecordException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.order.dividents;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class TeamDividentsSourceOrderException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public TeamDividentsSourceOrderException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public TeamDividentsSourceOrderException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.job.order;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | //订单团队分红
|
| | | @Component
|
| | | public class OrderTeamDividentsJob {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsManager teamDividentsManager;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderService teamDividentsSourceOrderService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceUserService teamDividentsSourceUserService;
|
| | |
|
| | | public OrderTeamDividentsJob() {
|
| | |
|
| | | }
|
| | |
|
| | | // 开始分红,每月25号执行
|
| | | @XxlJob("startOrderTeamDividents")
|
| | | public ReturnT<String> startDividents(String param) throws Exception {
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
|
| | |
|
| | | long count = teamDividentsSourceOrderService.countCanSendUidByPreSendTime(preSendTime);
|
| | | int pageSize = 500;
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < totalPage; i++) {
|
| | | List<Long> list = teamDividentsSourceOrderService.listCanSendUidByPreSendTime(preSendTime, i + 1, pageSize);
|
| | | for (Long uid : list) {
|
| | | teamDividentsManager.startDividents(uid);
|
| | | }
|
| | | }
|
| | | startAddDividentsRecord(day);
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | private void startAddDividentsRecord(String day) {
|
| | | if (!teamDividentsManager.isSourceUserComupteFinish(day))
|
| | | return;
|
| | | // 统计资金
|
| | | int pageSize = 500;
|
| | | long count = teamDividentsSourceUserService.countTargetUid(day);
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | |
|
| | | List<Long> targetUidList = new ArrayList<>();
|
| | | for (int p = 0; p < totalPage; p++) {
|
| | | List<Long> uidList = teamDividentsSourceUserService.listTargetUid(day, p + 1, pageSize);
|
| | | if (uidList != null && uidList.size() > 0)
|
| | | targetUidList.addAll(uidList);
|
| | | }
|
| | |
|
| | | // for (Long uid : targetUidList)
|
| | | // CMQManager.getInstance().addTeamDividentsMsg(new
|
| | | // UserDividentsDayDTO(uid, day));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | from yeshi_ec_alipayaccount_valid_normal_history where avnh_uid =
|
| | | #{0} order by avnh_createtime desc limit 1 for update
|
| | | </select>
|
| | | |
| | | <select id="selectFirstByUid" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_alipayaccount_valid_normal_history where avnh_uid =
|
| | | #{0} limit 1
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | |
|
| | |
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.money.TeamDividentsDebtMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt"> |
| | | <id column="tdd_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tdd_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="tdd_origin_money" property="originMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="tdd_left_money" property="leftMoney" jdbcType="DECIMAL" /> |
| | | <result column="tdd_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="tdd_source_type" property="sourceType" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tdd_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdd_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tdd_id,tdd_uid,tdd_origin_money,tdd_left_money,tdd_order_no,tdd_source_type,tdd_create_time,tdd_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_dividents_debt where tdd_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_dividents_debt where tdd_id = #{0} for update |
| | | </select> |
| | | <select id="listByLeftMoneyAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_dividents_debt where tdd_uid = #{uid} |
| | | <if test="minMoney!=null">and tdd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>tdd_left_money</if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | <select id="countByLeftMoneyAndUid" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_order_team_dividents_debt where tdd_uid = |
| | | #{uid} |
| | | <if test="minMoney!=null">and tdd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>tdd_left_money</if> |
| | | </select> |
| | | <select id="sumLeftMoneyByUid" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long">select sum(tdd_left_money) from |
| | | yeshi_ec_order_team_dividents_debt where tdd_uid = #{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_order_team_dividents_debt where tdd_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_order_team_dividents_debt |
| | | (tdd_id,tdd_uid,tdd_origin_money,tdd_left_money,tdd_order_no,tdd_source_type,tdd_create_time,tdd_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{originMoney,jdbcType=DECIMAL},#{leftMoney,jdbcType=DECIMAL},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_order_team_dividents_debt |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tdd_id,</if> |
| | | <if test="uid != null">tdd_uid,</if> |
| | | <if test="originMoney != null">tdd_origin_money,</if> |
| | | <if test="leftMoney != null">tdd_left_money,</if> |
| | | <if test="orderNo != null">tdd_order_no,</if> |
| | | <if test="sourceType != null">tdd_source_type,</if> |
| | | <if test="createTime != null">tdd_create_time,</if> |
| | | <if test="updateTime != null">tdd_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="originMoney != null">#{originMoney,jdbcType=DECIMAL},</if> |
| | | <if test="leftMoney != null">#{leftMoney,jdbcType=DECIMAL},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt">update yeshi_ec_order_team_dividents_debt set tdd_uid = |
| | | #{uid,jdbcType=BIGINT},tdd_origin_money = |
| | | #{originMoney,jdbcType=DECIMAL},tdd_left_money = |
| | | #{leftMoney,jdbcType=DECIMAL},tdd_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},tdd_source_type = |
| | | #{sourceType,jdbcType=INTEGER},tdd_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tdd_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where tdd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt"> |
| | | update yeshi_ec_order_team_dividents_debt |
| | | <set> |
| | | <if test="uid != null">tdd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="originMoney != null">tdd_origin_money=#{originMoney,jdbcType=DECIMAL},</if> |
| | | <if test="leftMoney != null">tdd_left_money=#{leftMoney,jdbcType=DECIMAL},</if> |
| | | <if test="orderNo != null">tdd_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">tdd_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">tdd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tdd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where tdd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.money.TeamDividentsDebtRepayHistoryMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory"> |
| | | <id column="drh_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="drh_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="drh_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="drh_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="drh_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="debt" column="drh_debt_id" |
| | | javaType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt"> |
| | | <id column="drh_debt_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">drh_id,drh_debt_id,drh_money,drh_uid,drh_beizhu,drh_create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_dividents_debt_repay_history where drh_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_order_team_dividents_debt_repay_history where drh_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_order_team_dividents_debt_repay_history |
| | | (drh_id,drh_debt_id,drh_money,drh_uid,drh_beizhu,drh_create_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{debt.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{uid,jdbcType=BIGINT},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_order_team_dividents_debt_repay_history |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">drh_id,</if> |
| | | <if test="debt != null">drh_debt_id,</if> |
| | | <if test="money != null">drh_money,</if> |
| | | <if test="uid != null">drh_uid,</if> |
| | | <if test="beiZhu != null">drh_beizhu,</if> |
| | | <if test="createTime != null">drh_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="debt != null">#{debt.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory">update yeshi_ec_order_team_dividents_debt_repay_history |
| | | set drh_debt_id = #{debt.id,jdbcType=BIGINT},drh_money = |
| | | #{money,jdbcType=DECIMAL},drh_uid = #{uid,jdbcType=BIGINT},drh_beizhu |
| | | = #{beiZhu,jdbcType=VARCHAR},drh_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where drh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory"> |
| | | update yeshi_ec_order_team_dividents_debt_repay_history |
| | | <set> |
| | | <if test="debt != null">drh_debt_id=#{debt.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">drh_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="uid != null">drh_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">drh_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">drh_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where drh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsRecordMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord"> |
| | | <id column="td_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="td_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="td_day" property="day" jdbcType="VARCHAR" /> |
| | | <result column="td_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="td_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="td_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="td_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_record where td_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByUidAndDayForUpdate" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_record where td_uid = |
| | | #{uid} and td_day=#{day} for update |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_team_dividents_record where td_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_dividents_record |
| | | (td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_team_dividents_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">td_id,</if> |
| | | <if test="uid != null">td_uid,</if> |
| | | <if test="day != null">td_day,</if> |
| | | <if test="money != null">td_money,</if> |
| | | <if test="state != null">td_state,</if> |
| | | <if test="createTime != null">td_create_time,</if> |
| | | <if test="updateTime != null">td_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="day != null">#{day,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord">update yeshi_ec_team_dividents_record set td_uid = |
| | | #{uid,jdbcType=BIGINT},td_day = #{day,jdbcType=VARCHAR},td_money = |
| | | #{money,jdbcType=DECIMAL},td_state = |
| | | #{state,jdbcType=INTEGER},td_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},td_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where td_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord"> |
| | | update yeshi_ec_team_dividents_record |
| | | <set> |
| | | <if test="uid != null">td_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="day != null">td_day=#{day,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">td_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">td_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">td_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">td_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where td_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceOrderMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder"> |
| | | <id column="tdo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tdo_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="tdo_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="tdo_source_type" property="sourceType" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tdo_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="tdo_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="tdo_pre_send_time" property="preSendTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdo_send_time" property="sendTime" jdbcType="TIMESTAMP" /> |
| | | <result column="tdo_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdo_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdo_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tdo_id,tdo_uid,tdo_order_no,tdo_source_type,tdo_state,tdo_money,tdo_pre_send_time,tdo_send_time,tdo_create_time,tdo_update_time,tdo_beizhu |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_source_order where tdo_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_team_dividents_source_order where tdo_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_dividents_source_order |
| | | (tdo_id,tdo_uid,tdo_order_no,tdo_source_type,tdo_state,tdo_money,tdo_pre_send_time,tdo_send_time,tdo_create_time,tdo_update_time,tdo_beizhu) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{money,jdbcType=DECIMAL},#{preSendTime,jdbcType=TIMESTAMP},#{sendTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_team_dividents_source_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tdo_id,</if> |
| | | <if test="uid != null">tdo_uid,</if> |
| | | <if test="orderNo != null">tdo_order_no,</if> |
| | | <if test="sourceType != null">tdo_source_type,</if> |
| | | <if test="state != null">tdo_state,</if> |
| | | <if test="money != null">tdo_money,</if> |
| | | <if test="preSendTime != null">tdo_pre_send_time,</if> |
| | | <if test="sendTime != null">tdo_send_time,</if> |
| | | <if test="createTime != null">tdo_create_time,</if> |
| | | <if test="updateTime != null">tdo_update_time,</if> |
| | | <if test="beiZhu != null">tdo_beizhu,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="preSendTime != null">#{preSendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sendTime != null">#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder">update yeshi_ec_team_dividents_source_order set tdo_uid |
| | | = #{uid,jdbcType=BIGINT},tdo_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},tdo_source_type = |
| | | #{sourceType,jdbcType=INTEGER},tdo_state = |
| | | #{state,jdbcType=INTEGER},tdo_money = |
| | | #{money,jdbcType=DECIMAL},tdo_pre_send_time = |
| | | #{preSendTime,jdbcType=TIMESTAMP},tdo_send_time = |
| | | #{sendTime,jdbcType=TIMESTAMP},tdo_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tdo_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,tdo_beizhu |
| | | =#{beiZhu,jdbcType=VARCHAR} where tdo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder"> |
| | | update yeshi_ec_team_dividents_source_order |
| | | <set> |
| | | <if test="uid != null">tdo_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">tdo_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">tdo_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="state != null">tdo_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="money != null">tdo_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="preSendTime != null">tdo_pre_send_time=#{preSendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sendTime != null">tdo_send_time=#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">tdo_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tdo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="beiZhu !=null">tdo_beizhu =#{beiZhu,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where tdo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_source_order where tdo_id = #{0} for |
| | | update |
| | | </select> |
| | | <select id="lisByUidAndPreSendTimeAndState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_source_order where tdo_uid=#{uid} and |
| | | tdo_pre_send_time=#{preSendTime} and tdo_state=#{state} limit |
| | | #{start},#{count} |
| | | </select> |
| | | <select id="countByUidAndPreSendTimeAndState" resultType="java.lang.Long">select |
| | | count(*) from yeshi_ec_team_dividents_source_order where |
| | | tdo_uid=#{uid} and tdo_pre_send_time=#{preSendTime} and |
| | | tdo_state=#{state} |
| | | </select> |
| | | |
| | | <select id="listUidByPreSendTimeAndState" resultType="java.lang.Long">select |
| | | distinct(tdo_uid) from yeshi_ec_team_dividents_source_order where |
| | | tdo_pre_send_time=#{preSendTime} and |
| | | tdo_state=#{state} limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countUidByPreSendTimeAndState" resultType="java.lang.Long">select |
| | | count(distinct(tdo_uid)) from yeshi_ec_team_dividents_source_order |
| | | where tdo_pre_send_time=#{preSendTime} and |
| | | tdo_state=#{state} |
| | | </select> |
| | | |
| | | <update id="setStateByUidAndState"> |
| | | update yeshi_ec_team_dividents_source_order |
| | | <set>tdo_state=#{targetState}, tdo_update_time=now(), |
| | | tdo_beizhu=#{beiZhu}, |
| | | </set> |
| | | where tdo_uid = #{uid} and tdo_state=#{state} |
| | | </update> |
| | | <select id="selectByOrderNoAndSourceType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_source_order where |
| | | tdo_order_no=#{orderNo} and tdo_source_type=#{sourceType} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceUserMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser"> |
| | | <id column="tdsu_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tdsu_target_uid" property="targetUid" jdbcType="BIGINT" /> |
| | | <result column="tdsu_source_uid" property="sourceUid" jdbcType="BIGINT" /> |
| | | <result column="tdsu_day" property="day" jdbcType="VARCHAR" /> |
| | | <result column="tdsu_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="tdsu_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdsu_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_source_user where tdsu_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_team_dividents_source_user where tdsu_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_dividents_source_user |
| | | (tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{targetUid,jdbcType=BIGINT},#{sourceUid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_team_dividents_source_user |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tdsu_id,</if> |
| | | <if test="targetUid != null">tdsu_target_uid,</if> |
| | | <if test="sourceUid != null">tdsu_source_uid,</if> |
| | | <if test="day != null">tdsu_day,</if> |
| | | <if test="money != null">tdsu_money,</if> |
| | | <if test="createTime != null">tdsu_create_time,</if> |
| | | <if test="updateTime != null">tdsu_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="targetUid != null">#{targetUid,jdbcType=BIGINT},</if> |
| | | <if test="sourceUid != null">#{sourceUid,jdbcType=BIGINT},</if> |
| | | <if test="day != null">#{day,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser">update yeshi_ec_team_dividents_source_user set |
| | | tdsu_target_uid = #{targetUid,jdbcType=BIGINT},tdsu_source_uid = |
| | | #{sourceUid,jdbcType=BIGINT},tdsu_day = |
| | | #{day,jdbcType=VARCHAR},tdsu_money = |
| | | #{money,jdbcType=DECIMAL},tdsu_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tdsu_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where tdsu_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser"> |
| | | update yeshi_ec_team_dividents_source_user |
| | | <set> |
| | | <if test="targetUid != null">tdsu_target_uid=#{targetUid,jdbcType=BIGINT},</if> |
| | | <if test="sourceUid != null">tdsu_source_uid=#{sourceUid,jdbcType=BIGINT},</if> |
| | | <if test="day != null">tdsu_day=#{day,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">tdsu_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">tdsu_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tdsu_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where tdsu_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | |
| | | <select id="sumMoneyByTargetUidAndDay" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(tdsu_money) |
| | | from yeshi_ec_team_dividents_source_user where |
| | | tdsu_target_uid =#{uid} and tdsu_day=#{day} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listTargetUidByDay" resultType="java.lang.Long"> |
| | | SELECT |
| | | DISTINCT(u.`tdsu_target_uid`) FROM |
| | | yeshi_ec_team_dividents_source_user |
| | | u WHERE u.`tdsu_day`=#{day} limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countTargetUidByDay" resultType="java.lang.Long" |
| | | parameterType="java.lang.String"> |
| | | SELECT count(DISTINCT(u.`tdsu_target_uid`)) FROM |
| | | yeshi_ec_team_dividents_source_user u WHERE u.`tdsu_day`=#{day} |
| | | </select> |
| | | |
| | | |
| | | <select id="listBySourceUidAndDay" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM |
| | | yeshi_ec_team_dividents_source_user WHERE |
| | | `tdsu_source_uid`=#{sourceUid} and tdsu_day=#{day} |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.user.vip.TeamUserLevelStatisticMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic"> |
| | | <id column="tuls_uid" property="id" jdbcType="BIGINT" /> |
| | | <result column="tuls_level" property="level" jdbcType="VARCHAR" /> |
| | | <result column="tuls_normal_first_count" property="normalFirstCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_normal_second_count" property="normalSecondCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_high_first_count" property="highFirstCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_high_second_count" property="highSecondCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_super_first_count" property="superFirstCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_super_second_count" property="superSecondCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tuls_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tuls_tearcher_first_count" property="tearcherFirstCount" |
| | | jdbcType="INTEGER" /> |
| | | <result column="tuls_tearcher_second_count" property="tearcherSecondCount" |
| | | jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tuls_uid,tuls_level,tuls_normal_first_count,tuls_normal_second_count,tuls_high_first_count,tuls_high_second_count,tuls_super_first_count,tuls_super_second_count,tuls_create_time,tuls_update_time,tuls_tearcher_first_count,tuls_tearcher_second_count |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_user_level_statistic where tuls_uid = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_team_user_level_statistic where tuls_uid = |
| | | #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_user_level_statistic |
| | | (tuls_uid,tuls_level,tuls_normal_first_count,tuls_normal_second_count,tuls_high_first_count,tuls_high_second_count,tuls_super_first_count,tuls_super_second_count,tuls_create_time,tuls_update_time,tuls_tearcher_first_count,tuls_tearcher_second_count) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{level,jdbcType=VARCHAR},#{normalFirstCount,jdbcType=INTEGER},#{normalSecondCount,jdbcType=INTEGER},#{highFirstCount,jdbcType=INTEGER},#{highSecondCount,jdbcType=INTEGER},#{superFirstCount,jdbcType=INTEGER},#{superSecondCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{tearcherFirstCount,jdbcType=INTEGER},#{tearcherSecondCount,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_team_user_level_statistic |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tuls_uid,</if> |
| | | <if test="level != null">tuls_level,</if> |
| | | <if test="normalFirstCount != null">tuls_normal_first_count,</if> |
| | | <if test="normalSecondCount != null">tuls_normal_second_count,</if> |
| | | <if test="highFirstCount != null">tuls_high_first_count,</if> |
| | | <if test="highSecondCount != null">tuls_high_second_count,</if> |
| | | <if test="superFirstCount != null">tuls_super_first_count,</if> |
| | | <if test="superSecondCount != null">tuls_super_second_count,</if> |
| | | <if test="createTime != null">tuls_create_time,</if> |
| | | <if test="updateTime != null">tuls_update_time,</if> |
| | | <if test="tearcherFirstCount != null">tuls_tearcher_first_count,</if> |
| | | <if test="tearcherSecondCount != null">tuls_tearcher_second_count,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="level != null">#{level,jdbcType=VARCHAR},</if> |
| | | <if test="normalFirstCount != null">#{normalFirstCount,jdbcType=INTEGER},</if> |
| | | <if test="normalSecondCount != null">#{normalSecondCount,jdbcType=INTEGER},</if> |
| | | <if test="highFirstCount != null">#{highFirstCount,jdbcType=INTEGER},</if> |
| | | <if test="highSecondCount != null">#{highSecondCount,jdbcType=INTEGER},</if> |
| | | <if test="superFirstCount != null">#{superFirstCount,jdbcType=INTEGER},</if> |
| | | <if test="superSecondCount != null">#{superSecondCount,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tearcherFirstCount != null">#{tearcherFirstCount,jdbcType=INTEGER},</if> |
| | | <if test="tearcherSecondCount != null">#{tearcherSecondCount,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic">update yeshi_ec_team_user_level_statistic set tuls_level |
| | | = #{level,jdbcType=VARCHAR},tuls_normal_first_count = |
| | | #{normalFirstCount,jdbcType=INTEGER},tuls_normal_second_count = |
| | | #{normalSecondCount,jdbcType=INTEGER},tuls_high_first_count = |
| | | #{highFirstCount,jdbcType=INTEGER},tuls_high_second_count = |
| | | #{highSecondCount,jdbcType=INTEGER},tuls_super_first_count = |
| | | #{superFirstCount,jdbcType=INTEGER},tuls_super_second_count = |
| | | #{superSecondCount,jdbcType=INTEGER},tuls_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tuls_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,tuls_tearcher_first_count |
| | | =#{tearcherFirstCount,jdbcType=INTEGER} ,tuls_tearcher_second_count |
| | | =#{tearcherSecondCount,jdbcType=INTEGER} where tuls_uid = |
| | | #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic"> |
| | | update yeshi_ec_team_user_level_statistic |
| | | <set> |
| | | <if test="level != null">tuls_level=#{level,jdbcType=VARCHAR},</if> |
| | | <if test="normalFirstCount != null">tuls_normal_first_count=#{normalFirstCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="normalSecondCount != null">tuls_normal_second_count=#{normalSecondCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="highFirstCount != null">tuls_high_first_count=#{highFirstCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="highSecondCount != null">tuls_high_second_count=#{highSecondCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="superFirstCount != null">tuls_super_first_count=#{superFirstCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="superSecondCount != null">tuls_super_second_count=#{superSecondCount,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="createTime != null">tuls_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tuls_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tearcherFirstCount !=null">tuls_tearcher_first_count |
| | | =#{tearcherFirstCount,jdbcType=INTEGER},</if> |
| | | <if test="tearcherSecondCount !=null">tuls_tearcher_second_count |
| | | =#{tearcherSecondCount,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where tuls_uid = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | 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());
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.money.TeamDividentsDebtMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.TeamDividentsDebtRepayHistoryMapper;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebtRepayHistory;
|
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | | import com.yeshi.fanli.service.inter.money.TeamDividentsDebtService;
|
| | |
|
| | | @Service
|
| | | public class TeamDividentsDebtServiceImpl implements TeamDividentsDebtService {
|
| | | @Resource
|
| | | private TeamDividentsDebtMapper teamDividentsDebtMapper;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsDebtRepayHistoryMapper teamDividentsDebtRepayHistoryMapper;
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void addDebt(TeamDividentsDebt debt) throws TeamDividentsDebtException {
|
| | | if (debt == null || debt.getOriginMoney() == null || debt.getUid() == null) {
|
| | | throw new TeamDividentsDebtException(1, "数据不完整");
|
| | | }
|
| | | if (debt.getCreateTime() == null)
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setLeftMoney(debt.getOriginMoney());
|
| | | teamDividentsDebtMapper.insertSelective(debt);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void repayDebt(Long debtId, BigDecimal money) throws TeamDividentsDebtException {
|
| | | TeamDividentsDebt debt = teamDividentsDebtMapper.selectByPrimaryKeyForUpdate(debtId);
|
| | | if (debt == null)
|
| | | throw new TeamDividentsDebtException(1, "债务ID不存在");
|
| | | if (money == null || money.compareTo(new BigDecimal(0)) <= 0)
|
| | | throw new TeamDividentsDebtException(3, "还钱必须大于0");
|
| | | if (debt.getLeftMoney().compareTo(money) < 0)
|
| | | throw new TeamDividentsDebtException(2, "还钱过多");
|
| | | // 还钱
|
| | | TeamDividentsDebt update = new TeamDividentsDebt();
|
| | | update.setId(debt.getId());
|
| | | update.setLeftMoney(debt.getLeftMoney().subtract(money));
|
| | | update.setUpdateTime(new Date());
|
| | | teamDividentsDebtMapper.updateByPrimaryKeySelective(update);
|
| | | // 加入还钱记录
|
| | | TeamDividentsDebtRepayHistory record = new TeamDividentsDebtRepayHistory();
|
| | | record.setCreateTime(new Date());
|
| | | record.setDebt(debt);
|
| | | record.setMoney(money);
|
| | | record.setUid(debt.getUid());
|
| | | teamDividentsDebtRepayHistoryMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public BigDecimal repayDebtByUid(Long uid, BigDecimal money) throws TeamDividentsDebtException {
|
| | | // 还钱
|
| | | long count = countNeedRepayDebt(uid);
|
| | | int page = (int) (count % 200 == 0 ? count / 200 : count / 200 + 1);
|
| | | List<TeamDividentsDebt> totalList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<TeamDividentsDebt> tempList = listNeedRepayDebt(uid, i + 1, 200);
|
| | | if (tempList != null && tempList.size() > 0) {
|
| | | totalList.addAll(tempList);
|
| | | }
|
| | | }
|
| | |
|
| | | // 剩余资金
|
| | | BigDecimal leftMoney = new BigDecimal(money.toString());
|
| | |
|
| | | for (TeamDividentsDebt debt : totalList) {
|
| | | if (leftMoney.compareTo(new BigDecimal(0)) <= 0)// 余额不足扣款
|
| | | break;
|
| | | BigDecimal repayMoney = null;
|
| | | if (debt.getLeftMoney().compareTo(leftMoney) >= 0)
|
| | | repayMoney = new BigDecimal(leftMoney.toString());
|
| | | else
|
| | | repayMoney = debt.getLeftMoney();
|
| | | try {
|
| | | repayDebt(debt.getId(), repayMoney);
|
| | | leftMoney = leftMoney.subtract(repayMoney);
|
| | | } catch (TeamDividentsDebtException e) {
|
| | | // 上笔还款未成功,继续下一笔还款
|
| | | }
|
| | | }
|
| | |
|
| | | return leftMoney;// 返回剩余的资金
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDividentsDebt> listNeedRepayDebt(Long uid, int page, int count) {
|
| | | return teamDividentsDebtMapper.listByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid, (page - 1) * count,
|
| | | count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countNeedRepayDebt(Long uid) {
|
| | | return teamDividentsDebtMapper.countByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalDebtMoney(Long uid) {
|
| | | BigDecimal money = teamDividentsDebtMapper.sumLeftMoneyByUid(uid);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | return money;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebtReturnHistory;
|
| | | 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.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | 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.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Override
|
| | | public void addUserMoneyDebt(UserMoneyDebt debt) throws UserMoneyDebtException {
|
| | |
| | | return userMoneyDebtMapper.selectByTypeAndSourceId(type, sourceId);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void repayDebt(UserMoneyDebt debt, BigDecimal money) throws UserMoneyDebtException {
|
| | | if (debt == null || debt.getId() == null)
|
| | |
| | | }
|
| | |
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanDrawBack.getOrderId());
|
| | | int goodsCount = 0;
|
| | | for (CommonOrder co : orderList) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderService
|
| | | .listDetailByOrderIdAndSourceType(weiQuanDrawBack.getOrderId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | for (HongBaoOrder hongBaoOrder : hongBaoOrderList) {
|
| | | fanliMoney = fanliMoney.add(hongBaoOrder.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, userInfoService.getBalance(uid));
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, fanliMoney, goodsCount,
|
| | | orderList.get(0).getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
| | | weiQuanDrawBack, money);
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(debt.getUid(), weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, userInfoService.getBalance(uid));
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList1 = commonOrderService
|
| | | .listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, weiQuanDrawBack.getOrderId());
|
| | | int goodsCount1 = 0;
|
| | | for (CommonOrder co : orderList1) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount1 += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney1 = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList1 = hongBaoOrderService.listDetailByOrderIdAndSourceType(
|
| | | weiQuanDrawBack.getOrderId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | for (HongBaoOrder hongBaoOrder : hongBaoOrderList1) {
|
| | | fanliMoney1 = fanliMoney1.add(hongBaoOrder.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, fanliMoney1, goodsCount1,
|
| | | orderList1.get(0).getThirdCreateTime());
|
| | |
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | |
| | | // 新版资金记录
|
| | | AlipayAccountValidNormalHistory aliPayAccountHistory = alipayAccountValidNormalHistoryMapper
|
| | | .selectByPrimaryKey(debt.getSourceId());
|
| | |
|
| | | AlipayAccountValidNormalHistory first = alipayAccountValidNormalHistoryMapper
|
| | | .selectLatestByUid(aliPayAccountHistory.getUid());
|
| | |
|
| | | if (aliPayAccountHistory == null)
|
| | | return;
|
| | | try {
|
| | |
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.alipayAccountValid(aliPayAccountHistory);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(aliPayAccountHistory, "1个月",
|
| | | first.getId().longValue() != aliPayAccountHistory.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void repayDebt(Long uid) {
|
| | | // 查询是否有欠债
|
| | |
| | | "该支付宝账号已被其他账号绑定,请更换其他的支付宝账号来绑定");
|
| | | }
|
| | |
|
| | | // TODO 做频率验证-每月验证一次
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | Calendar caLatest = Calendar.getInstance();
|
| | |
| | | if (userInfo.getMyHongBao().compareTo(money) >= 0) {
|
| | | // 扣款
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(history);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(history,"1个月",latest!=null);
|
| | | } else {// 余额不足,暂时不扣款,加入借贷关系
|
| | | UserMoneyDebt debt = new UserMoneyDebt();
|
| | | debt.setCreateTime(new Date());
|
| | |
| | | auditRecord.setExtract(extract);
|
| | |
|
| | | Date minTime = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 180L);
|
| | | |
| | |
|
| | | extractAuditRecordMapper.insertSelective(auditRecord);
|
| | |
|
| | | ThreadUtil.run(new Runnable() {
|
| | |
| | | public void run() {
|
| | | // 统计数据
|
| | | int less10Count = commonOrderCountService.countOderByUidAndLess10(user.getId());
|
| | | ExtractAuditRecord update=new ExtractAuditRecord();
|
| | | ExtractAuditRecord update = new ExtractAuditRecord();
|
| | | update.setId(auditRecord.getId());
|
| | | int orderCount50More = orderUserStatisticService.countOrderCount100MoreByUidAndMinTime(user.getId(), minTime);
|
| | | int orderCount50More = orderUserStatisticService.countOrderCount100MoreByUidAndMinTime(user.getId(),
|
| | | minTime);
|
| | | BigDecimal weiQuanOrderFanAmount = orderUserStatisticService.sumWeiQuanOrderFanAmountByUid(user.getId(),
|
| | | minTime);
|
| | | int weiQuanOrderCount = orderUserStatisticService.countWeiQuanOrderByUid(user.getId(), minTime);
|
| | | update.setExtraInfoStr(new Gson().toJson(
|
| | | new ExtractOrderStatisticDTO(orderCount50More, weiQuanOrderCount, weiQuanOrderFanAmount, 0, less10Count)));
|
| | | update.setExtraInfoStr(new Gson().toJson(new ExtractOrderStatisticDTO(orderCount50More,
|
| | | weiQuanOrderCount, weiQuanOrderFanAmount, 0, less10Count)));
|
| | | extractAuditRecordMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | });
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | List<PayInfo> payInfoList = payInfoMapper.getListbyExtractId(extract.getId());
|
| | | String alipayNo = "";
|
| | | if (payInfoList != null && payInfoList.size() > 0)
|
| | | alipayNo = payInfoList.get(0).getOrderId();
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.extractSuccess(extract);
|
| | | userMoneyMsgNotificationService.extractSuccess(extract, alipayNo);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | // 4、发送消息通知
|
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | | }
|
| | |
|
| | | private boolean parseSendResult(String result) {
|
| | |
| | | // 资金计算
|
| | | userMoneyService.subUserMoney(userInfo.getId(), money, detail);
|
| | |
|
| | | // 4、发送消息通知
|
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | |
|
| | | // 满足条件返回信息
|
| | | return userInfo;
|
| | | }
|
| | |
| | | extractWeiXinRecordService.updateByPrimaryKeySelective(updeteRecord);
|
| | |
|
| | | if (ExtractWeiXinRecord.RECEIVED.equals(status)) {
|
| | | // 发送消息通知
|
| | | userMoneyMsgNotificationService.extractAuto(record, "已领取-已提现", null, null);
|
| | | } else if (ExtractWeiXinRecord.REFUND.equals(status)) {
|
| | | // 资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWXRefund);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(record.getUid()));
|
| | |
|
| | | // 资金计算
|
| | | userMoneyService.addUserMoney(record.getUid(), record.getMoney(), detail);
|
| | |
|
| | | // 发送消息通知
|
| | | userMoneyMsgNotificationService.extractAuto(record, "已退回-余额中", null, null);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history, int limitDay, boolean change) {
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history, String limitDay, boolean change) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createAlipayAccountValidMsg(history, history.getUid(),
|
| | | Constant.systemCommonConfig.getProjectChineseName(), new BigDecimal("0.1"), limitDay, change);
|
| | | try {
|
| | |
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.InviteOrderSubsidyDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.OrderTeamRewardDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | |
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtService orderTeamRewardDebtService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
| | | userMoneyService.subUserMoney(uid, drawBackMoney, userMoneyDetail);
|
| | |
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList = commonOrderMapper.listBySourceTypeAndOrderNo(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | int goodsCount = 0;
|
| | | for (CommonOrder co : orderList) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderMapper.listDetailByOrderIdAndSourceType(orderId,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | for (HongBaoOrder hb : hongBaoOrderList) {
|
| | | fanliMoney = fanliMoney.add(hb.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, orderId, Constant.SOURCE_TYPE_TAOBAO,
|
| | | drawBackMoney, userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | | drawBackMoney, fanliMoney, goodsCount, orderList.get(0).getThirdCreateTime());
|
| | |
|
| | | } else {// 记录资金记录,但是不显示给用户
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | |
| | | }
|
| | | }
|
| | | userMoneyService.subUserMoney(uid, drawBackMoney, userMoneyDetail);
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(uid, orderId, Constant.SOURCE_TYPE_TAOBAO, drawBackMoney,
|
| | |
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList = commonOrderMapper.listBySourceTypeAndOrderNo(Constant.SOURCE_TYPE_TAOBAO,
|
| | | orderId);
|
| | | int goodsCount = 0;
|
| | | for (CommonOrder co : orderList) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderMapper.listDetailByOrderIdAndSourceType(orderId,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | for (HongBaoOrder hb : hongBaoOrderList) {
|
| | | fanliMoney = fanliMoney.add(hb.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(uid, orderId, Constant.SOURCE_TYPE_TAOBAO, drawBackMoney,
|
| | | fanliMoney, goodsCount, orderList.get(0).getThirdCreateTime());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | throw new TaoBaoWeiQuanException(101, "邀请订单补贴异常");
|
| | | }
|
| | |
|
| | | //TODO 删除团队奖励维权处理
|
| | | // TODO 删除团队奖励维权处理
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemId(String orderItemId) {
|
| | |
| | | return hongBaoV2Mapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public int addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException, UserAccountException {
|
| | | Set<Integer> stateSet = new HashSet<>();// 订单状态Set
|
| | |
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | |
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,
|
| | | goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime());
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | |
| | | return CommonOrder.STATE_SX;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException {
|
| | | System.out.println(commonOrder.getOrderNo());
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
|
| | | throws HongBaoException, UserAccountException {
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | |
| | | public List<HongBaoV2> listByIds(List<Long> idList) {
|
| | | return hongBaoV2Mapper.listByIds(idList);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<HongBaoDTO> listByOrderTradeId(String tradeId) {
|
| | | return hongBaoV2Mapper.listByOrderTradeId(tradeId);
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoPunishOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | |
|
| | | @Service
|
| | |
| | | update.setResultCode(LostOrder.RESULT_CODE_SUCCESS);
|
| | | lostOrderMapper.updateByPrimaryKeySelective(update);
|
| | | Order order = orderService.findOrderByOrderIdAndType(orderId, orderType);
|
| | |
|
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderService.listDetailByOrderIdAndSourceType(orderId,
|
| | | orderType);
|
| | | int goodsCount = 0;
|
| | | for (HongBaoOrder hongBaoOrder : hongBaoOrderList) {
|
| | | if (hongBaoOrder.getCommonOrder().getState() != CommonOrder.STATE_SX)
|
| | | goodsCount += hongBaoOrder.getCommonOrder().getCount();
|
| | | }
|
| | |
|
| | | // TODO 分享订单可找回
|
| | | if (order != null)
|
| | | // 添加通知
|
| | | userOrderMsgNotificationService.orderFoundSuccess(lo.getUserInfo().getId(), lo.getOrderId(),
|
| | | order.getMoney(), orderType, new Date(lo.getHandleTime()));
|
| | | userOrderMsgNotificationService.orderFoundSuccess(lo.getUserInfo().getId(), orderId, orderType,
|
| | | Constant.TYPE_REBATE, order.getMoney(), order.getMoney(), goodsCount,
|
| | | new Date(lo.getCreateTime()));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Integer countLostOrderNum(String preDay, int resultCode) {
|
| | | public Integer countLostOrderNum(String preDay, int resultCode) {
|
| | | return lostOrderMapper.countLostOrderNum(preDay, resultCode);
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2SettleTempService;
|
| | | import com.yeshi.fanli.service.inter.money.InviteOrderSubsidyDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.OrderTeamRewardDebtService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtService orderTeamRewardDebtService;
|
| | |
|
| | | // 下级被封禁,红包失效
|
| | | private void invalidHongBaoForbidden(Long id) {
|
| | |
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | |
|
| | | // 添加事务消息
|
| | | try {
|
| | | orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | |
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | |
|
| | | // 新版通知
|
| | |
|
| | | userMoneyMsgNotificationService.fanliOrderReceived(uid, orderId, sourceType, userGoodsCount.get(uid), money,
|
| | | user.getMyHongBao());
|
| | | user.getMyHongBao(), orderList.get(0).getThirdCreateTime());
|
| | | }
|
| | | // 通知免单到账
|
| | | try {
|
| | |
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.shareOrderReceived(uid, Constant.SOURCE_TYPE_TAOBAO, shareOrders.size(),
|
| | | shareGoodsCount, sharemoney, userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao());
|
| | | shareGoodsCount, sharemoney, userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao(), null,
|
| | | null);
|
| | |
|
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanShare(orderId);
|
| | |
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.shareOrderReceived(uid, Constant.SOURCE_TYPE_TAOBAO, shareOrders.size(),
|
| | | shareGoodsCount, sharemoney, userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | shareGoodsCount, sharemoney, userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao(), null,
|
| | | null);
|
| | | }
|
| | |
|
| | | hongBaoV2SettleTempService.addTemp(recieveHongBaoIds, key);
|
| | |
| | | public String get(final String key) {
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKey(key);
|
| | | if (hongBaoManage != null)
|
| | | hongBaoManage.getValue();
|
| | | return hongBaoManage.getValue();
|
| | | return null;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order.dividents;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsRecordMapper;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class TeamDividentsRecordServiceImpl implements TeamDividentsRecordService {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsRecordMapper teamDividentsRecordMapper;
|
| | |
|
| | | @Override
|
| | | public void addTeamDividentsRecord(TeamDividentsRecord record)
|
| | | throws TeamDividentsRecordException, ParamsException {
|
| | | // 验证参数完整性
|
| | | if (record == null || StringUtil.isNullOrEmpty(record.getDay()) || record.getMoney() == null
|
| | | || record.getState() == null || record.getUid() == null)
|
| | | throw new ParamsException(1, "参数不完整");
|
| | |
|
| | | // 判断是否存在
|
| | | TeamDividentsRecord old = teamDividentsRecordMapper.selectByUidAndDayForUpdate(record.getUid(),
|
| | | record.getDay());
|
| | | if (old != null)
|
| | | throw new TeamDividentsRecordException(1, "记录已存在");
|
| | | // 加入记录
|
| | |
|
| | | if (record.getCreateTime() == null)
|
| | | record.setCreateTime(new Date());
|
| | | teamDividentsRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order.dividents;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceOrderMapper;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsSourceOrderException;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class TeamDividentsSourceOrderServiceImpl implements TeamDividentsSourceOrderService {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderMapper teamDividentsSourceOrderMapper;
|
| | |
|
| | | @Override
|
| | | public void addTeamDividentsSourceOrder(TeamDividentsSourceOrder order)
|
| | | throws TeamDividentsSourceOrderException, ParamsException {
|
| | | if (order == null || order.getMoney() == null || StringUtil.isNullOrEmpty(order.getOrderNo())
|
| | | || order.getSourceType() == null || order.getState() == null || order.getUid() == null
|
| | | || order.getPreSendTime() == null)
|
| | | throw new ParamsException(1, "参数不完整");
|
| | |
|
| | | TeamDividentsSourceOrder sourceOrder = selectByOrderNoSourceType(order.getOrderNo(), order.getSourceType());
|
| | | if (sourceOrder != null)
|
| | | throw new TeamDividentsSourceOrderException(1, "订单已存在");
|
| | |
|
| | | if (order.getCreateTime() == null)
|
| | | order.setCreateTime(new Date());
|
| | | teamDividentsSourceOrderMapper.insertSelective(order);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDividentsSourceOrder> listCanSendByUidAndPreSendTime(Long uid, Date preSendTime, int page,
|
| | | int pageSize) {
|
| | | return teamDividentsSourceOrderMapper.lisByUidAndPreSendTimeAndState(uid, preSendTime,
|
| | | TeamDividentsSourceOrder.STATE_CAN_SEND, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countCanSendByUidAndPreSendTime(Long uid, Date preSendTime) {
|
| | | return teamDividentsSourceOrderMapper.countByUidAndPreSendTimeAndState(uid, preSendTime,
|
| | | TeamDividentsSourceOrder.STATE_CAN_SEND);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Long> listCanSendUidByPreSendTime(Date preSendTime, int page, int pageSize) {
|
| | | return teamDividentsSourceOrderMapper.listUidByPreSendTimeAndState(preSendTime,
|
| | | TeamDividentsSourceOrder.STATE_CAN_SEND, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countCanSendUidByPreSendTime(Date preSendTime) {
|
| | | return teamDividentsSourceOrderMapper.countUidByPreSendTimeAndState(preSendTime,
|
| | | TeamDividentsSourceOrder.STATE_CAN_SEND);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TeamDividentsSourceOrder selectByPrimaryKeyForUpdate(Long id) {
|
| | | return teamDividentsSourceOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void invalidOrder(String orderNo, int sourceType, String beiZhu) {
|
| | | TeamDividentsSourceOrder order = selectByOrderNoSourceType(orderNo, sourceType);
|
| | | if (order == null)
|
| | | return;
|
| | | if (order.getState() != TeamDividentsSourceOrder.STATE_CAN_SEND)
|
| | | return;
|
| | | TeamDividentsSourceOrder update = new TeamDividentsSourceOrder();
|
| | | update.setId(order.getId());
|
| | | update.setState(TeamDividentsSourceOrder.STATE_INVALID);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setBeiZhu(beiZhu);
|
| | | teamDividentsSourceOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void invalidOrderByUid(Long uid, String beiZhu) {
|
| | | teamDividentsSourceOrderMapper.setStateByUidAndState(uid, TeamDividentsSourceOrder.STATE_INVALID,
|
| | | TeamDividentsSourceOrder.STATE_CAN_SEND, beiZhu);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void send(Long id) {
|
| | | TeamDividentsSourceOrder order = teamDividentsSourceOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | if (order == null)
|
| | | return;
|
| | | if (order.getState() != TeamDividentsSourceOrder.STATE_CAN_SEND)
|
| | | return;
|
| | | TeamDividentsSourceOrder update = new TeamDividentsSourceOrder();
|
| | | update.setId(order.getId());
|
| | | update.setState(TeamDividentsSourceOrder.STATE_ALREADY_SEND);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setSendTime(new Date());
|
| | | teamDividentsSourceOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TeamDividentsSourceOrder selectByOrderNoSourceType(String orderNo, int sourceType) {
|
| | |
|
| | | return teamDividentsSourceOrderMapper.selectByOrderNoAndSourceType(orderNo, sourceType);
|
| | |
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order.dividents;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.dividents.TeamDividentsSourceUserMapper;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class TeamDividentsSourceUserServiceImpl implements TeamDividentsSourceUserService {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceUserMapper teamDividentsSourceUserMapper;
|
| | |
|
| | | @Override
|
| | | public void addTeamDividentsSourceUser(TeamDividentsSourceUser teamDividentsSourceUser) throws ParamsException {
|
| | | if (teamDividentsSourceUser == null || StringUtil.isNullOrEmpty(teamDividentsSourceUser.getDay())
|
| | | || teamDividentsSourceUser.getMoney() == null || teamDividentsSourceUser.getSourceUid() == null
|
| | | || teamDividentsSourceUser.getTargetUid() == null)
|
| | | throw new ParamsException(1, "参数不完整");
|
| | | if (teamDividentsSourceUser.getCreateTime() == null)
|
| | | teamDividentsSourceUser.setCreateTime(new Date());
|
| | | teamDividentsSourceUserMapper.insertSelective(teamDividentsSourceUser);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day) {
|
| | | BigDecimal money = teamDividentsSourceUserMapper.sumMoneyByTargetUidAndDay(uid, day);
|
| | | if (money == null)
|
| | | return new BigDecimal(0);
|
| | | return money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Long> listTargetUid(String day, int page, int pageSize) {
|
| | | return teamDividentsSourceUserMapper.listTargetUidByDay(day, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDividentsSourceUser> listBySourceUidAndDay(Long sourceUid, String day) {
|
| | | return teamDividentsSourceUserMapper.listBySourceUidAndDay(sourceUid, day);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countTargetUid(String day) {
|
| | | return teamDividentsSourceUserMapper.countTargetUidByDay(day);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public List<ThreeSale> listFirstTeamByUndeleted(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listFirstTeamByUndeleted(start, count, uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countFirstTeamByUndeleted(Long uid) {
|
| | | return threeSaleMapper.countFirstTeamByUndeleted(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeamByUndeleted(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listSecondTeamByUndeleted(start, count, uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countSecondTeamByUndeleted(Long uid) {
|
| | | return threeSaleMapper.countSecondTeamByUndeleted(uid);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid, state);
|
| | |
| | |
|
| | | return deepList;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid) {
|
| | | //TODO 需要更加简便的方式处理
|
| | | return getMyBossDeepList(uid, 100);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void remvoeBreak(Long id, Long uid, Long tid) {
|
| | |
| | | if (threeSale == null) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Long workerId = threeSale.getWorker().getId();
|
| | | if (tid.longValue() != workerId.longValue()) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Integer expire = threeSale.getExpire();
|
| | | if (expire == ThreeSale.EXPIRE_NORMAL) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | int upExpire = expire;
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | if (bossId.longValue() == uid.longValue()) { // 直接粉丝
|
| | | if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL4) {
|
| | | upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | } else {
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL3;
|
| | | }
|
| | | } else { // 间接粉丝
|
| | | if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL3) {
|
| | | upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | } else {
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL4;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | ThreeSale update = new ThreeSale();
|
| | | update.setId(id);
|
| | | update.setExpire(upExpire);
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.TeamUserLevelStatisticMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | |
|
| | | @Service
|
| | | public class TeamUserLevelStatisticServiceImpl implements TeamUserLevelStatisticService {
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserLevelManager userLevelManager;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticMapper teamUserLevelStatisticMapper;
|
| | |
|
| | | @Override
|
| | | public TeamUserLevelStatistic selectByUid(Long uid) {
|
| | | return teamUserLevelStatisticMapper.selectByPrimaryKey(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void initData(Long uid) {
|
| | | int state = ThreeSale.STATE_SUCCESS;
|
| | | long count = threeSaleSerivce.countFirstTeam(uid, state);
|
| | | List<ThreeSale> list = threeSaleSerivce.listFirstTeam(0L, (int) count, uid, state);
|
| | | int normalFirstCount = 0;
|
| | | int highFirstCount = 0;
|
| | | int superFirstCount = 0;
|
| | | int tearcherFirstCount = 0;
|
| | | for (ThreeSale ts : list) {
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId());
|
| | | if (level == UserLevelEnum.normalVIP) {
|
| | | normalFirstCount++;
|
| | | } else if (level == UserLevelEnum.highVIP) {
|
| | | highFirstCount++;
|
| | | } else if (level == UserLevelEnum.superVIP) {
|
| | | superFirstCount++;
|
| | | } else if (level == UserLevelEnum.tearcher) {
|
| | | tearcherFirstCount++;
|
| | | }
|
| | | }
|
| | |
|
| | | int normalSecondCount = 0;
|
| | | int highSecondCount = 0;
|
| | | int superSecondCount = 0;
|
| | | int tearcherSecondCount = 0;
|
| | |
|
| | | long secondCount = threeSaleSerivce.countSecondTeam(uid, state);
|
| | | int pageSize = 1000;
|
| | | int toalPage = (int) (secondCount % pageSize == 0 ? secondCount / pageSize : secondCount / pageSize + 1);
|
| | | for (int i = 0; i < toalPage; i++) {
|
| | | list = threeSaleSerivce.listSecondTeam(i * pageSize, pageSize, uid, state);
|
| | | if (list != null)
|
| | | for (ThreeSale ts : list) {
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId());
|
| | | if (level == UserLevelEnum.normalVIP) {
|
| | | normalSecondCount++;
|
| | | } else if (level == UserLevelEnum.highVIP) {
|
| | | highSecondCount++;
|
| | | } else if (level == UserLevelEnum.superVIP) {
|
| | | superSecondCount++;
|
| | | } else if (level == UserLevelEnum.tearcher) {
|
| | | tearcherSecondCount++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(uid);
|
| | | TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
|
| | | statistic.setNormalFirstCount(normalFirstCount);
|
| | | statistic.setNormalSecondCount(normalSecondCount);
|
| | | statistic.setHighFirstCount(highFirstCount);
|
| | | statistic.setHighSecondCount(highSecondCount);
|
| | | statistic.setSuperFirstCount(superFirstCount);
|
| | | statistic.setSuperSecondCount(superSecondCount);
|
| | | statistic.setTearcherFirstCount(tearcherFirstCount);
|
| | | statistic.setTearcherSecondCount(tearcherSecondCount);
|
| | | statistic.setId(uid);
|
| | | statistic.setLevel(level);
|
| | | add(statistic);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void add(TeamUserLevelStatistic statistic) {
|
| | | TeamUserLevelStatistic old = selectByUid(statistic.getId());
|
| | | if (old == null) {
|
| | | if (statistic.getCreateTime() == null)
|
| | | statistic.setCreateTime(new Date());
|
| | | teamUserLevelStatisticMapper.insertSelective(statistic);
|
| | | } else {
|
| | | statistic.setUpdateTime(new Date());
|
| | | teamUserLevelStatisticMapper.updateByPrimaryKeySelective(statistic);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateUserLevel(Long uid) {
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(uid);
|
| | | TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
|
| | | statistic.setId(uid);
|
| | | statistic.setLevel(level);
|
| | | statistic.setUpdateTime(new Date());
|
| | | teamUserLevelStatisticMapper.updateByPrimaryKeySelective(statistic);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsDebt;
|
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | |
|
| | | /**
|
| | | * 团队奖金欠款处理
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TeamDividentsDebtService {
|
| | |
|
| | | /**
|
| | | * 添加债务
|
| | | * |
| | | * @param debt
|
| | | * @throws TeamDividentsDebtException
|
| | | */
|
| | | public void addDebt(TeamDividentsDebt debt) throws TeamDividentsDebtException;
|
| | |
|
| | | /**
|
| | | * 偿还债务
|
| | | * |
| | | * @param debtId
|
| | | * @param money
|
| | | */
|
| | | public void repayDebt(Long debtId, BigDecimal money) throws TeamDividentsDebtException;
|
| | |
|
| | | /**
|
| | | * 还款
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | * @return 还剩下的资金
|
| | | * @throws TeamDividentsDebtException
|
| | | */
|
| | | public BigDecimal repayDebtByUid(Long uid, BigDecimal money) throws TeamDividentsDebtException;
|
| | |
|
| | | /**
|
| | | * 检索需要偿还的债务
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<TeamDividentsDebt> listNeedRepayDebt(Long uid, int page, int count);
|
| | |
|
| | | /**
|
| | | * 检索需要偿还的债务
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countNeedRepayDebt(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取总共欠钱金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getTotalDebtMoney(Long uid);
|
| | |
|
| | | }
|
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;
|
| | | |
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | |
|
| | | /**
|
| | | * 用户资金消息通知
|
| | |
| | | */
|
| | | public void extractFail(Extract extract, String stateDesc);
|
| | |
|
| | | |
| | | /**
|
| | | * 提现成功
|
| | | * |
| | | * 提现成功
|
| | | * @Title: extractSuccess
|
| | | * @Description: |
| | | * @param extract
|
| | | * @param alipayNo 支付宝流水号
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void extractSuccess(Extract extract, String reason);
|
| | | public void extractSuccess(Extract extract, String alipayNo);
|
| | |
|
| | | /**
|
| | | * 支付宝账号验证
|
| | |
| | | * @param limitDay 限制时间
|
| | | * @param change 是否为修改 true 修改 false 首次绑定
|
| | | */
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history, int limitDay, boolean change);
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history, String limitDay, boolean change);
|
| | |
|
| | | /**
|
| | | * 付宝账号验证失败
|
| | |
| | |
|
| | | /**
|
| | | * 返利订单维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param fanliMoney 订单返利
|
| | | * @Title: fanliOrderWeiQuan
|
| | | * @Description: |
| | | * @param uid 用户ID
|
| | | * @param orderId -订单号
|
| | | * @param orderType -订单类型
|
| | | * @param money -维权扣除金额
|
| | | * @param fanliMoney -返利金额
|
| | | * @param goodsCount 商品数量
|
| | | * @param downTime 下单时间
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void fanliOrderWeiQuan(Long uid, String orderId, int orderType, BigDecimal money, BigDecimal fanliMoney, int goodsCount, Date downTime);
|
| | |
|
| | | /**
|
| | | * 分享赚订单被统计
|
| | | * 分享赚订单到账
|
| | | *
|
| | | * @param uid
|
| | | * @param orderCount
|
| | |
| | | public void shareOrderReceived(Long uid, int orderType, int orderCount, int goodsCount, BigDecimal money,
|
| | | BigDecimal balance, String orderId, Date downTime);
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 分享订单维权
|
| | | * |
| | | * @Title: shareOrderWeiQuan
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param fanliMoney
|
| | | * @param orderId -订单号
|
| | | * @param orderType 订单类型
|
| | | * @param money 维权金额
|
| | | * @param fanliMoney 返利金额
|
| | | * @param goodsCount -商品数量
|
| | | * @param downTime 下单时间
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | |
|
| | | public void shareOrderWeiQuan(Long uid, String orderId, int orderType, BigDecimal money,BigDecimal fanliMoney, int goodsCount, Date downTime);
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order.dividents;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsRecordException;
|
| | |
|
| | | public interface TeamDividentsRecordService {
|
| | |
|
| | | /**
|
| | | * 添加团队分红记录
|
| | | * @Title: addTeamDividentsRecord
|
| | | * @Description: |
| | | * @param record |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamDividentsRecord(TeamDividentsRecord record) throws TeamDividentsRecordException, ParamsException;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order.dividents;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsSourceOrderException;
|
| | |
|
| | | public interface TeamDividentsSourceOrderService {
|
| | |
|
| | | /**
|
| | | * 添加团队分红来源订单
|
| | | * @Title: addTeamDividentsSourceOrder
|
| | | * @Description: |
| | | * @param order |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamDividentsSourceOrder(TeamDividentsSourceOrder order) throws TeamDividentsSourceOrderException,ParamsException;
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: listCanSendByUidAndPreSendTime
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param preSendTime
|
| | | * @return |
| | | * List<TeamDividentsSourceOrder> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<TeamDividentsSourceOrder> listCanSendByUidAndPreSendTime(Long uid, Date preSendTime, int page,
|
| | | int pageSize);
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: countCanSendByUidAndPreSendTime
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param preSendTime
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long countCanSendByUidAndPreSendTime(Long uid, Date preSendTime);
|
| | |
|
| | | /**
|
| | | * 获取能够分红的订单源用户ID列表
|
| | | * @Title: listCanSendUidByPreSendTime
|
| | | * @Description: |
| | | * @param preSendTime
|
| | | * @param page
|
| | | * @param count
|
| | | * @return |
| | | * List<Long> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<Long> listCanSendUidByPreSendTime(Date preSendTime, int page, int count);
|
| | |
|
| | | /**
|
| | | * 获取能够分红的订单源用户ID数量
|
| | | * @Title: countCanSendUidByPreSendTime
|
| | | * @Description: |
| | | * @param preSendTime
|
| | | * @return |
| | | * Long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public Long countCanSendUidByPreSendTime(Date preSendTime);
|
| | |
|
| | | /**
|
| | | * 根据主键查询
|
| | | * @Title: selectByPrimaryKeyForUpdate
|
| | | * @Description: |
| | | * @param id
|
| | | * @return |
| | | * TeamDividentsSourceOrder 返回类型
|
| | | * @throws
|
| | | */
|
| | | public TeamDividentsSourceOrder selectByPrimaryKeyForUpdate(Long id);
|
| | |
|
| | | /**
|
| | | * 使订单失效
|
| | | * @Title: invalidOrder
|
| | | * @Description: |
| | | * @param orderNo
|
| | | * @param sourceType
|
| | | * @param beiZhu
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void invalidOrder(String orderNo, int sourceType, String beiZhu);
|
| | |
|
| | | /**
|
| | | * 根据uid失效
|
| | | * @Title: invalidOrderByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param beiZhu |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void invalidOrderByUid(Long uid, String beiZhu);
|
| | |
|
| | | /**
|
| | | * 发送
|
| | | * @Title: send
|
| | | * @Description: |
| | | * @param id |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void send(Long id);
|
| | | |
| | | |
| | | /**
|
| | | * 根据订单查询
|
| | | * @Title: selectByOrderNoSourceType
|
| | | * @Description: |
| | | * @param orderNo
|
| | | * @param sourceType
|
| | | * @return |
| | | * TeamDividentsSourceOrder 返回类型
|
| | | * @throws
|
| | | */
|
| | | public TeamDividentsSourceOrder selectByOrderNoSourceType(String orderNo,int sourceType);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order.dividents;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | |
|
| | | public interface TeamDividentsSourceUserService {
|
| | |
|
| | | /**
|
| | | * 添加分红源用户
|
| | | * @Title: addTeamDividentsSourceUser
|
| | | * @Description: |
| | | * @param teamDividentsSourceUser |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTeamDividentsSourceUser(TeamDividentsSourceUser teamDividentsSourceUser) throws ParamsException;
|
| | |
|
| | | /**
|
| | | * 计算用户总共得到的分红
|
| | | * @Title: sumMoneyByUidAndDay
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param day
|
| | | * @return |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day);
|
| | |
|
| | | /**
|
| | | * 查询目标用户列表
|
| | | * @Title: listTargetUid
|
| | | * @Description: |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<Long> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<Long> listTargetUid(String day, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据来源用户ID与日期查询
|
| | | * @Title: listBySourceUidAndDay
|
| | | * @Description: |
| | | * @param sourceUid
|
| | | * @param day
|
| | | * @return |
| | | * List<TeamDividentsSourceUser> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<TeamDividentsSourceUser> listBySourceUidAndDay(Long sourceUid, String day);
|
| | |
|
| | | /**
|
| | | * 计算用户数量
|
| | | * @Title: countTargetUid
|
| | | * @Description: |
| | | * @param day
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long countTargetUid(String day);
|
| | |
|
| | | }
|
| | |
| | | * @throws
|
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid,int deep);
|
| | | |
| | | |
| | | /**
|
| | | * 获取上级列表
|
| | | * @Title: getMyBossDeepList
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * List<ThreeSale> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid);
|
| | |
|
| | | /**
|
| | | * 查询未删除版-粉丝一级
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | |
|
| | | /**
|
| | | * 团队用户
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TeamUserLevelStatisticService {
|
| | |
|
| | | /**
|
| | | * 根据用户检索
|
| | | * @Title: selectByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * TeamUserLevelStatistic 返回类型
|
| | | * @throws
|
| | | */
|
| | | public TeamUserLevelStatistic selectByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 初始化数据
|
| | | * @Title: initData
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void initData(Long uid);
|
| | |
|
| | | /**
|
| | | * 添加
|
| | | * @Title: add
|
| | | * @Description: |
| | | * @param statistic |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void add(TeamUserLevelStatistic statistic);
|
| | |
|
| | | /**
|
| | | * 更新用户等级
|
| | | * @Title: updateUserLevel
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void updateUserLevel(Long uid);
|
| | | }
|
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) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | |
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,
|
| | | goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | 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());
|
| | |
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | commonOrder.getPayment(), money, goodsCount, commonOrder.getState(),
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state);
|
| | | |
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, commonOrder.getPayment(), money,
|
| | | goodsCount, commonOrder.getState(), commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu());
|
New file |
| | |
| | | package com.yeshi.fanli.service.manger.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | 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.entity.order.dividents.TeamDividentsSourceUser;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | 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.service.inter.order.dividents.TeamDividentsRecordService;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | 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;
|
| | |
|
| | | /**
|
| | | * 团队分红管理
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class TeamDividentsManager {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderService teamDividentsSourceOrderService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceUserService teamDividentsSourceUserService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsRecordService teamDividentsRecordService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsDebtService teamDividentsDebtService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | @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
|
| | | * @Description: |
| | | * @param sourceUid -源用户
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void startDividents(Long sourceUid) throws ParamsException {
|
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
|
| | | startDividents(sourceUid, preSendTime);
|
| | | }
|
| | |
|
| | | // 是否可以分红
|
| | | private boolean isCanDividents(TeamUserLevelStatistic tus) {
|
| | | if (Constant.IS_TEST)
|
| | | return true;
|
| | |
|
| | | if (tus != null && (tus.getLevel() == UserLevelEnum.highVIP || tus.getLevel() == UserLevelEnum.superVIP
|
| | | || tus.getLevel() == UserLevelEnum.tearcher)) {
|
| | | if (tus.getLevel() == UserLevelEnum.highVIP) {
|
| | | int vipFirstCount = tus.getNormalFirstCount() + tus.getHighFirstCount() + tus.getSuperFirstCount()
|
| | | + tus.getTearcherFirstCount();
|
| | | if (vipFirstCount >= 3)// 直接粉丝普通会员等级以上的用户>=3
|
| | | return true;
|
| | | } else if (tus.getLevel() == UserLevelEnum.superVIP) {
|
| | | int firstCount = tus.getSuperFirstCount() + tus.getTearcherFirstCount();
|
| | | int secondCount = tus.getNormalSecondCount() + tus.getHighSecondCount() + tus.getSuperSecondCount()
|
| | | + tus.getTearcherSecondCount();
|
| | | if (firstCount >= 3 && secondCount >= 3) {// 直接粉丝超级会员等级以上的用户>=3
|
| | | // 间接粉丝普通会员以上等级>=3
|
| | | return true;
|
| | | }
|
| | | } else {
|
| | | int firstCount = tus.getSuperFirstCount() + tus.getTearcherFirstCount();
|
| | | int secondCount = tus.getHighSecondCount() + tus.getSuperSecondCount() + tus.getTearcherSecondCount();
|
| | | if (firstCount >= 3 && secondCount >= 3) {// 直接粉丝超级会员等级以上的用户>=3
|
| | | // 间接粉丝高级会员以上等级>=3
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void startDividents(Long sourceUid, Date preSendTime) throws ParamsException {
|
| | | String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd");
|
| | | // 查询出可用于分红的用户的总金额
|
| | | long count = teamDividentsSourceOrderService.countCanSendByUidAndPreSendTime(sourceUid, preSendTime);
|
| | | int pageSize = 1000;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | List<TeamDividentsSourceOrder> totalList = new ArrayList<>();
|
| | | for (int p = 0; p < page; p++) {
|
| | | List<TeamDividentsSourceOrder> list = teamDividentsSourceOrderService
|
| | | .listCanSendByUidAndPreSendTime(sourceUid, preSendTime, p + 1, pageSize);
|
| | | if (list != null && list.size() > 0)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0);
|
| | |
|
| | | for (TeamDividentsSourceOrder order : totalList) {
|
| | | TeamDividentsSourceOrder sourceOrder = teamDividentsSourceOrderService
|
| | | .selectByPrimaryKeyForUpdate(order.getId());
|
| | | if (sourceOrder != null && sourceOrder.getState() == TeamDividentsSourceOrder.STATE_CAN_SEND) {
|
| | | totalMoney = totalMoney.add(sourceOrder.getMoney());
|
| | | teamDividentsSourceOrderService.send(sourceOrder.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | // 分红金额为0的不参与
|
| | | if (totalMoney.compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | |
|
| | | // 查询出可以参与分红的用户
|
| | | List<ThreeSale> threeSalesList = threeSaleSerivce.getMyBossDeepList(sourceUid);
|
| | | if (threeSalesList == null)
|
| | | return;
|
| | |
|
| | | Map<Long, UserLevelEnum> uidLevel = new HashMap<Long, UserLevelEnum>();
|
| | | for (ThreeSale ts : threeSalesList) {
|
| | | if (ts.getBoss() != null) {
|
| | | TeamUserLevelStatistic tus = teamUserLevelStatisticService.selectByUid(ts.getBoss().getId());
|
| | | if (tus == null)
|
| | | teamUserLevelStatisticService.initData(ts.getBoss().getId());
|
| | | tus = teamUserLevelStatisticService.selectByUid(ts.getBoss().getId());
|
| | |
|
| | | if (isCanDividents(tus)) {
|
| | | uidLevel.put(tus.getId(), tus.getLevel());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal perDivident = computePerDivident(uidLevel, totalMoney);
|
| | | for (Iterator<Long> its = uidLevel.keySet().iterator(); its.hasNext();) {
|
| | | Long uid = its.next();
|
| | | BigDecimal dividents = computeUserDivident(perDivident, uidLevel.get(uid));
|
| | | // 将资金分配到参与分红的用户
|
| | | TeamDividentsSourceUser teamDividentsSourceUser = new TeamDividentsSourceUser();
|
| | | teamDividentsSourceUser.setDay(day);
|
| | | teamDividentsSourceUser.setMoney(dividents);
|
| | | teamDividentsSourceUser.setSourceUid(sourceUid);
|
| | | teamDividentsSourceUser.setTargetUid(uid);
|
| | | teamDividentsSourceUserService.addTeamDividentsSourceUser(teamDividentsSourceUser);
|
| | | }
|
| | | // if (1 / 0 > 0)
|
| | | // return;
|
| | | }
|
| | |
|
| | | // 计算平均分红
|
| | | private BigDecimal computePerDivident(Map<Long, UserLevelEnum> uidLevels, BigDecimal totalMoney) {
|
| | | int count = 0;
|
| | | for (Iterator<Long> its = uidLevels.keySet().iterator(); its.hasNext();) {
|
| | | Long uid = its.next();
|
| | | if (uidLevels.get(uid) == UserLevelEnum.highVIP) {
|
| | | count += 1;
|
| | | } else if (uidLevels.get(uid) == UserLevelEnum.superVIP) {
|
| | | count += 2;
|
| | | }
|
| | | }
|
| | | return MoneyBigDecimalUtil.div(totalMoney, new BigDecimal(count));
|
| | | }
|
| | |
|
| | | private BigDecimal computeUserDivident(BigDecimal perDivident, UserLevelEnum userLevel) {
|
| | | if (userLevel == UserLevelEnum.highVIP) {
|
| | | return perDivident;
|
| | | } else if (userLevel == UserLevelEnum.superVIP) {
|
| | | return MoneyBigDecimalUtil.mul(perDivident, new BigDecimal(2));
|
| | | } else if (userLevel == UserLevelEnum.tearcher) {
|
| | | return MoneyBigDecimalUtil.mul(perDivident, new BigDecimal(2));
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分红计算是否完成
|
| | | * @Title: isSourceUserComupteFinish
|
| | | * @Description: |
| | | * @return |
| | | * boolean 返回类型
|
| | | * @throws
|
| | | */
|
| | | public boolean isSourceUserComupteFinish(String day) {
|
| | | Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
|
| | | long count = teamDividentsSourceOrderService.countCanSendByUidAndPreSendTime(null, preSendTime);
|
| | | return count == 0;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @throws TeamDividentsDebtException |
| | | * 添加分红记录
|
| | | * @Title: addDividentsRecord
|
| | | * @Description: |
| | | * @param uid -用户ID
|
| | | * @param money -分红金额
|
| | | * @param day -分红日期
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addDividents(Long uid, String day)
|
| | | throws TeamDividentsRecordException, TeamDividentsDebtException, UserMoneyDetailException, ParamsException {
|
| | | BigDecimal money = teamDividentsSourceUserService.sumMoneyByUidAndDay(uid, day);
|
| | | // 查询需要扣除的资金
|
| | | List<TeamDividentsDebt> list = teamDividentsDebtService.listNeedRepayDebt(uid, 1, 1000);
|
| | | for (TeamDividentsDebt debt : list) {
|
| | | if (money.subtract(debt.getLeftMoney()).compareTo(new BigDecimal(0)) >= 0) {// 还有钱还
|
| | | money = money.subtract(debt.getLeftMoney());
|
| | | teamDividentsDebtService.repayDebt(debt.getId(), debt.getLeftMoney());
|
| | | } else if (money.compareTo(new BigDecimal(0)) > 0) {
|
| | | teamDividentsDebtService.repayDebt(debt.getId(), money);
|
| | | money = new BigDecimal(0);
|
| | | } else// 没有钱还了
|
| | | break;
|
| | | }
|
| | |
|
| | | // 统计资金
|
| | | TeamDividentsRecord record = new TeamDividentsRecord();
|
| | | record.setDay(day);
|
| | | record.setMoney(money);
|
| | | record.setState(TeamDividentsRecord.STATE_VALID);
|
| | | record.setUid(uid);
|
| | | teamDividentsRecordService.addTeamDividentsRecord(record);
|
| | |
|
| | | // 有分红才显示资金明细
|
| | | if (money.compareTo(new BigDecimal(0)) > 0) {
|
| | | UserMoneyDetail detail = UserMoneyDetailFactory.createOrderTeamDividents(uid, money, new Date());
|
| | | // 增加资金
|
| | | userMoneyService.addUserMoney(uid, money, detail);
|
| | | // TODO 加入通知
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * @throws TeamDividentsDebtException |
| | | * 订单维权
|
| | | * @Title: weiQuan
|
| | | * @Description: |
| | | * @param orderNo
|
| | | * @param tradeId
|
| | | * @param sourceType |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void weiQuan(String orderNo, int sourceType) throws TeamDividentsDebtException {
|
| | | // 查询订单是否已经分红
|
| | | TeamDividentsSourceOrder sourceOrder = teamDividentsSourceOrderService.selectByOrderNoSourceType(orderNo,
|
| | | sourceType);
|
| | | if (sourceOrder == null)
|
| | | return;
|
| | | if (sourceOrder.getState() == TeamDividentsSourceOrder.STATE_INVALID)
|
| | | return;
|
| | |
|
| | | if (sourceOrder.getState() == TeamDividentsSourceOrder.STATE_ALREADY_SEND) {// 已经发送,需要参与分红的人分摊
|
| | | BigDecimal money = sourceOrder.getMoney();
|
| | | // 查询参与这一单分红的人
|
| | | String day = TimeUtil.getGernalTime(sourceOrder.getSendTime().getTime(), "yyyy-MM-dd");
|
| | | if (Constant.IS_TEST)
|
| | | day = TimeUtil.getGernalTime(sourceOrder.getPreSendTime().getTime(), "yyyy-MM-dd");
|
| | |
|
| | | List<TeamDividentsSourceUser> list = teamDividentsSourceUserService
|
| | | .listBySourceUidAndDay(sourceOrder.getUid(), day);
|
| | | // 计算每个人的比例
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | for (TeamDividentsSourceUser su : list) {
|
| | | total = total.add(su.getMoney());
|
| | | }
|
| | |
|
| | | for (TeamDividentsSourceUser su : list) {
|
| | | BigDecimal debtMoney = MoneyBigDecimalUtil.divUp(money.multiply(su.getMoney()), total);
|
| | | // 需要偿还的资金
|
| | | TeamDividentsDebt debt = new TeamDividentsDebt();
|
| | | debt.setLeftMoney(debtMoney);
|
| | | debt.setOriginMoney(debtMoney);
|
| | | debt.setOrderNo(orderNo);
|
| | | debt.setSourceType(sourceType);
|
| | | debt.setUid(su.getTargetUid());
|
| | | // 加入待偿还记录
|
| | | teamDividentsDebtService.addDebt(debt);
|
| | | }
|
| | | } else if (sourceOrder.getState() == TeamDividentsSourceOrder.STATE_CAN_SEND) {
|
| | | teamDividentsSourceOrderService.invalidOrder(orderNo, sourceType, "订单维权");
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取源订单需要参与分红的比例
|
| | | * @Title: getSourceOrderDividentsRate
|
| | | * @Description: |
| | | * @param level
|
| | | * @return |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal getSourceOrderDividentsRate(UserLevelEnum level) {
|
| | | String rate = hongBaoManageService.get("team_source_order_dividents_" + level.getLevel());
|
| | | return new BigDecimal(rate);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.qcloud.cmq.Message;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.dto.order.dividents.UserDividentsDayDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
| | |
|
| | | // 提现结果处理队列
|
| | | public static String EXTRACT_RESULT = "extract-result";
|
| | | // IOS推送队列
|
| | | // IOS推送队列
|
| | | public static String PUSH_IOS = "push-ios";
|
| | |
|
| | | // 返利队列
|
| | | // 返利队列
|
| | | public static String FANLI_ORDER = "fanli-order";
|
| | |
|
| | | // 返利队列
|
| | | // 返利队列
|
| | | public static String FANLI_ORDER_NEW = "fanli-order-new";
|
| | |
|
| | | // 提成订单
|
| | | // 提成订单
|
| | | public static String FANLI_TICHENG_ORDER = "fanli-ticheng-order";
|
| | | |
| | | // 团队奖励到账
|
| | | public static String FANLI_ORDER_TEAM_REWARD="fanli-order-team-reward";
|
| | | |
| | | // 维权订单
|
| | |
|
| | | // 团队奖励到账
|
| | | public static String FANLI_ORDER_TEAM_REWARD = "fanli-order-team-reward";
|
| | |
|
| | | // 维权订单
|
| | | public static String ORDER_WEIQUAN = "weiquan-order";
|
| | |
|
| | | public static String GOODS_UPDATE = "goods_update_queue";
|
| | | // 重要数据更新
|
| | | public static String IMPORTANT_GOODS_UPDATE = "imp_goods_update_queue";
|
| | | // 团队分红
|
| | | public static String TEAM_DIVIDENTS = "team_dividents";
|
| | |
|
| | | static {
|
| | |
|
| | |
| | | FANLI_ORDER = "test-" + FANLI_ORDER;
|
| | | FANLI_ORDER_NEW = "test-" + FANLI_ORDER_NEW;
|
| | | FANLI_TICHENG_ORDER = "test-" + FANLI_TICHENG_ORDER;
|
| | | |
| | | FANLI_ORDER_TEAM_REWARD = "test-" + FANLI_ORDER_TEAM_REWARD;
|
| | | |
| | | ORDER_WEIQUAN = "test-" + ORDER_WEIQUAN;
|
| | | IMPORTANT_GOODS_UPDATE = "test-" + IMPORTANT_GOODS_UPDATE;
|
| | | TEAM_DIVIDENTS = "test-" + TEAM_DIVIDENTS;
|
| | | }
|
| | |
|
| | | QUEUENAME_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
| | | FANLI_ORDER_NEW += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_TICHENG_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_ORDER_TEAM_REWARD += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | |
| | | ORDER_WEIQUAN += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | IMPORTANT_GOODS_UPDATE += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | TEAM_DIVIDENTS += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
|
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey);
|
| | | // 最大消息为1M
|
| | |
| | | cmqUtil.createQueue(ORDER_WEIQUAN);
|
| | | cmqUtil.createQueue(GOODS_UPDATE);
|
| | | cmqUtil.createQueue(IMPORTANT_GOODS_UPDATE);
|
| | | cmqUtil.createQueue(TEAM_DIVIDENTS);
|
| | | }
|
| | |
|
| | | public static CMQManager getInstance() {
|
| | |
| | | cmqUtil.deleteMsg(FANLI_TICHENG_ORDER, receiptHandle);
|
| | | }
|
| | |
|
| | | |
| | | // 维权订单
|
| | | public void addWeiQuanOrderMsg(TaoBaoWeiQuanOrder order) {
|
| | | cmqUtil.sendMsg(ORDER_WEIQUAN, new Gson().toJson(order));
|
| | |
| | | cmqUtil.deleteMsg(IMPORTANT_GOODS_UPDATE, receiptHandle);
|
| | | }
|
| | |
|
| | | // 团队分红
|
| | | public void addTeamDividentsMsg(UserDividentsDayDTO dto) {
|
| | | cmqUtil.sendMsg(TEAM_DIVIDENTS, new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | | public Map<String, UserDividentsDayDTO> consumeTeamDividentsMsg(int count) {
|
| | | Gson gson = new Gson();
|
| | | List<Message> list = cmqUtil.recieveMsg(count, TEAM_DIVIDENTS);
|
| | | Map<String, UserDividentsDayDTO> map = new HashMap<>();
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | map.put(msg.receiptHandle, gson.fromJson(result, UserDividentsDayDTO.class));
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void deleteTeamDividentsMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(TEAM_DIVIDENTS, receiptHandle);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static BigDecimal div(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | return d1.divide(d2,2, BigDecimal.ROUND_DOWN);
|
| | | return d1.divide(d2, 2, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | |
|
| | | public static BigDecimal divUp(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | return d1.divide(d2, 2, BigDecimal.ROUND_UP);
|
| | | }
|
| | |
|
| | | public static BigDecimal div3(BigDecimal d1, BigDecimal d2) {// 进行除法运算
|
| | | return d1.divide(d2, 3, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | |
| | |
|
| | | public static BigDecimal getWithNoZera(BigDecimal num) {// 进行除法运算
|
| | | while (num.toString().endsWith("0") && num.toString().indexOf(".") > -1) {
|
| | | num = new BigDecimal(num.toString().substring(0, num.toString().length()-1));
|
| | | num = new BigDecimal(num.toString().substring(0, num.toString().length() - 1));
|
| | | return getWithNoZera(num);
|
| | | }
|
| | | return num;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.dto.order.dividents.UserDividentsDayDTO;
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
|
| | | import com.yeshi.fanli.util.ad.DouYinAdUtil;
|
| | | import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
|
| | |
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsManager teamDividentsManager;
|
| | |
|
| | | private static boolean isInited = false;
|
| | |
|
| | | public void onApplicationEvent(ContextRefreshedEvent arg0) {
|
| | |
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | // doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | |
|
| | | doDividentsJob();
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | // 分红
|
| | | public void doDividentsJob() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | Map<String, UserDividentsDayDTO> map = CMQManager.getInstance().consumeTeamDividentsMsg(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | UserDividentsDayDTO dto = map.get(key);
|
| | | try {
|
| | | teamDividentsManager.addDividents(dto.getUid(), dto.getDay());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } finally {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static UserMoneyDetail createOrderTeamReward(Long uid,BigDecimal money, Date time)
|
| | |
|
| | | /**
|
| | | * 团队分红
|
| | | * @Title: createOrderTeamDividents
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param money
|
| | | * @param time
|
| | | * @return
|
| | | * @throws UserMoneyDetailException |
| | | * UserMoneyDetail 返回类型
|
| | | * @throws
|
| | | */
|
| | | public static UserMoneyDetail createOrderTeamDividents(Long uid, BigDecimal money, Date time)
|
| | | throws UserMoneyDetailException {
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.orderTeamReward.name() + "-" + uid + "-" + timeF));
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.orderTeamDividents.name() + "-" + uid + "-" + timeF));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(
|
| | | timeF + UserMoneyDetailTypeEnum.orderTeamReward.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.orderTeamReward);
|
| | | detail.setDescInfo("团队奖励");
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.orderTeamDividents.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.orderTeamDividents);
|
| | | detail.setDescInfo("团队分红");
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createAlipayAccountValidMsg(AlipayAccountValidNormalHistory valid, Long uid,
|
| | | String appName, BigDecimal money, int limitDay, boolean change) {
|
| | | String appName, BigDecimal money, String limitDay, boolean change) {
|
| | | if (valid == null || uid == null || appName == null)
|
| | | return null;
|
| | |
|
| | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(String.format("成功%s的提现账号", changeWay), ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO( limitDay+"", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("天内无法修改", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("内无法修改", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | |
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.util.factory.order.dividents;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | public class TeamDividentsSourceOrderFactory {
|
| | |
|
| | | public static TeamDividentsSourceOrder create(List<CommonOrder> commonOrderList,
|
| | | BigDecimal rate) {
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | int invalidCount = 0;
|
| | | for (CommonOrder commonOrder : commonOrderList) {
|
| | | if (commonOrder.geteIncome() != null)
|
| | | money = money.add(commonOrder.geteIncome());
|
| | |
|
| | | if (commonOrder.getState() == CommonOrder.STATE_SX)
|
| | | invalidCount++;
|
| | | }
|
| | |
|
| | | if (money.compareTo(new BigDecimal(0)) <= 0)
|
| | | return null;
|
| | |
|
| | | if (invalidCount >= commonOrderList.size())
|
| | | return null;
|
| | |
|
| | | BigDecimal dividents = MoneyBigDecimalUtil.div(money.multiply(rate), new BigDecimal(100));
|
| | | TeamDividentsSourceOrder sourceOrder = new TeamDividentsSourceOrder();
|
| | | sourceOrder.setMoney(dividents);
|
| | | sourceOrder.setOrderNo(commonOrderList.get(0).getOrderNo());
|
| | | sourceOrder.setSourceType(commonOrderList.get(0).getSourceType());
|
| | | sourceOrder.setState(TeamDividentsSourceOrder.STATE_CAN_SEND);
|
| | | sourceOrder.setUid(commonOrderList.get(0).getUserInfo().getId());
|
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrderList.get(0).getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | sourceOrder.setPreSendTime(new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd")));
|
| | |
|
| | | return sourceOrder;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserForbiddenMQMsg;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | | import com.yeshi.fanli.exception.order.dividents.TeamDividentsSourceOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 订单分红消息
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class OrderDividentsMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderService teamDividentsSourceOrderService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsManager teamDividentsManager;
|
| | |
|
| | | public OrderDividentsMessageListener() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer:OrderDividentsMessageListener", message.getMsgID(), message.getTopic(),
|
| | | message.getTag(), new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.forbiddenUser.name())) {
|
| | | // 查询上级红包
|
| | | UserForbiddenMQMsg dto = new Gson().fromJson(new String(message.getBody()), UserForbiddenMQMsg.class);
|
| | | if (dto != null) {
|
| | | teamDividentsSourceOrderService.invalidOrderByUid(dto.getUid(), "用户被封禁");
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | } else if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 订单确认收货
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderConfirm.name())) {
|
| | | // 插入分红
|
| | | OrderConfirmMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderConfirmMQMsg.class);
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(dto.getSourceType(),
|
| | | dto.getOrderNo());
|
| | | BigDecimal eincome = new BigDecimal(0);
|
| | | Date settleTime = null;
|
| | | for (CommonOrder order : commonOrderList) {
|
| | | if (order.getState() == CommonOrder.STATE_JS)
|
| | | eincome = eincome.add(order.geteIncome());
|
| | | if (settleTime == null)
|
| | | settleTime = order.getSettleTime();
|
| | | }
|
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(settleTime);
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | Date preSendTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd"));
|
| | |
|
| | | TeamDividentsSourceOrder sourceOrder = new TeamDividentsSourceOrder();
|
| | | sourceOrder.setMoney(eincome);
|
| | | sourceOrder.setOrderNo(dto.getOrderNo());
|
| | | sourceOrder.setPreSendTime(preSendTime);
|
| | | sourceOrder.setSourceType(dto.getSourceType());
|
| | | sourceOrder.setState(TeamDividentsSourceOrder.STATE_CAN_SEND);
|
| | | sourceOrder.setUid(dto.getSourceUid());
|
| | | try {
|
| | | teamDividentsSourceOrderService.addTeamDividentsSourceOrder(sourceOrder);
|
| | | return Action.CommitMessage;
|
| | | } catch (ParamsException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TeamDividentsSourceOrderException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.taoBaoOrderWeiQuan.name())) {
|
| | | TaoBaoWeiQuanOrder dto = new Gson().fromJson(new String(message.getBody()), TaoBaoWeiQuanOrder.class);
|
| | | try {
|
| | | teamDividentsManager.weiQuan(dto.getOrderId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | | return Action.CommitMessage;
|
| | | } catch (TeamDividentsDebtException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.ThreeSaleSeparateMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserLevelChangedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component |
| | | @Component
|
| | | public class UserVIPMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | |
| | | LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(),
|
| | | message.getTag(), new String(message.getBody()));
|
| | |
|
| | | LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | |
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 邀请成功
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {
|
| | | UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()),UserInviteMQMsg.class);
|
| | | UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()), UserInviteMQMsg.class);
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(msg.getBossId(), true);
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userLevelChanged.name())) {// 用户等级发生变化
|
| | | UserLevelChangedMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | UserLevelChangedMQMsg.class);
|
| | | // 更新上2级的邀请统计
|
| | | teamUserLevelStatisticService.updateUserLevel(msg.getUid());
|
| | | UserInfo boss = threeSaleSerivce.getBoss(msg.getUid());
|
| | | if (boss != null) {
|
| | | teamUserLevelStatisticService.initData(boss.getId());
|
| | | boss = threeSaleSerivce.getBoss(boss.getId());
|
| | | if (boss != null) {
|
| | | teamUserLevelStatisticService.initData(boss.getId());
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.threeSaleSeparate.name())) {// 邀请关系脱离
|
| | | ThreeSaleSeparateMQMsg msg = new Gson().fromJson(new String(message.getBody()),
|
| | | ThreeSaleSeparateMQMsg.class);
|
| | | // 更新上两级邀请统计
|
| | | teamUserLevelStatisticService.initData(msg.getBossUid());
|
| | | UserInfo boss = threeSaleSerivce.getBoss(msg.getBossUid());
|
| | | if (boss != null) {
|
| | | teamUserLevelStatisticService.initData(boss.getId());
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | |
| | | // 订单到账相关
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | |
|
| | | } else if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 订单到账相关
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 邀请队员成功 -->
|
| | | <!-- 邀请队员成功,用户等级发生变化,邀请关系脱离 -->
|
| | | <entry value-ref="userVIPMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="inviteSuccess" />
|
| | | <property name="expression"
|
| | | value="inviteSuccess||userLevelChanged||threeSaleSeparate" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | |
| | |
|
| | |
|
| | | <!-- 订单到账 -->
|
| | | <entry value-ref="userVIPMessageListener">
|
| | | <key>
|
| | |
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!--团队分红消息订阅 -->
|
| | | <bean id="orderDividentsMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.OrderDividentsMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderDividentsConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">${rocketmq.AccessKey}</prop>
|
| | | <prop key="SecretKey">${rocketmq.SecretKey}</prop>
|
| | | <prop key="GROUP_ID">GID_ORDER_TEAM_DIVIDENTS</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 订单收货 ,淘宝订单维权 -->
|
| | | <entry value-ref="orderDividentsMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderConfirm||taoBaoOrderWeiQuan" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
|
| | | <!-- 用户被封禁 -->
|
| | | <entry value-ref="orderDividentsMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="forbiddenUser" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | </beans> |
| | |
| | |
|
| | | import org.junit.Test;
|
| | | import org.yeshi.utils.mybatis.ColumnParseUtil;
|
| | | import org.yeshi.utils.mybatis.MyBatisMapperUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | |
|
| | | //@Ignore
|
| | | public class MyBatisProduce {
|
| | |
|
| | | @Test
|
| | | public void test3() { |
| | | public void test3() {
|
| | | MyBatisMapperUtil.createMapper(TeamUserLevelStatistic.class);
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test1() {
|
| | | |
| | |
|
| | | ColumnParseUtil.parseColumn(InviteOrderSubsidy.class,
|
| | | "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/InviteOrderSubsidyMapper.xml");
|
| | | }
|