Merge branch 'div' into div-1
Conflicts:
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
| | |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | |
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | public void login(AcceptData acceptData, String code, String vcode, String phone, boolean wxinstall,
|
| | | String tbOpenid, String tbNickName, String tbPortrait, String tbSession, int loginType, Boolean first,
|
| | | HttpSession session, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | @RequestMapping(value = "register")
|
| | | public void register(AcceptData acceptData, String tbOpenid, String tbNickName, String tbPortrait, String vcode,
|
| | | String phone, HttpServletRequest request, HttpSession session, PrintWriter out) {
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 获取用户ID
|
| | |
| | | public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | // 2.0以下版本不允许登录
|
| | | if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | out.print("请升级到最新版本");
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
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.money.OrderTeamRewardDebt;
|
| | |
|
| | | public interface OrderTeamRewardDebtMapper extends BaseMapper<OrderTeamRewardDebt> {
|
| | |
|
| | | /**
|
| | | * 检索(根据剩余资金与用户ID)
|
| | | * |
| | | * @param minMoney
|
| | | * @param maxMoney
|
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | List<OrderTeamRewardDebt> 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);
|
| | |
|
| | | OrderTeamRewardDebt 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.money.OrderTeamRewardDebtRepayHistory;
|
| | |
|
| | | public interface OrderTeamRewardDebtRepayHistoryMapper extends BaseMapper<OrderTeamRewardDebtRepayHistory> {
|
| | |
|
| | | } |
| | |
| | | * @return
|
| | | */
|
| | | List<InviteOrderSubsidy> listByOrderNoAndType(@Param("orderNo") String orderNo, @Param("type") Integer type);
|
| | | |
| | |
|
| | | InviteOrderSubsidy selectByPrimaryKeyForUpdate(Long id);
|
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | 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.OrderTeamReward;
|
| | |
|
| | | public interface OrderTeamRewardMapper extends BaseMapper<OrderTeamReward> {
|
| | |
|
| | | /**
|
| | | * 查询用户补贴
|
| | | * |
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @param Type
|
| | | * @return
|
| | | */
|
| | | OrderTeamReward getByOrderNoAndType(@Param("uid") Long uid, @Param("orderNo") String orderNo,
|
| | | @Param("type") Integer type);
|
| | |
|
| | | /**
|
| | | * 查询加锁
|
| | | * |
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | OrderTeamReward getByOrderNoAndTypeForUpdate(@Param("uid") Long uid, @Param("orderNo") String orderNo,
|
| | | @Param("type") Integer type);
|
| | |
|
| | | /**
|
| | | * 根据订单号与来源类型查询
|
| | | * |
| | | * @param orderNo
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | long countByOrderNoAndType(@Param("orderNo") String orderNo, @Param("type") Integer type);
|
| | |
|
| | | /**
|
| | | * 根据订单号与来源类型查询
|
| | | * |
| | | * @param orderNo
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | List<OrderTeamReward> listByOrderNoAndType(@Param("orderNo") String orderNo, @Param("type") Integer type);
|
| | |
|
| | | /**
|
| | | * 根据补贴与用户ID查询
|
| | | * @Title: selectBySubsidyIdAndUid
|
| | | * @Description: |
| | | * @param subsidyId
|
| | | * @param uid
|
| | | * @return |
| | | * OrderTeamReward 返回类型
|
| | | * @throws
|
| | | */
|
| | | OrderTeamReward selectBySubsidyIdAndUidForUpdate(@Param("subsidyId") Long subsidyId, @Param("uid") Long uid);
|
| | |
|
| | | /**
|
| | | * 根据补贴ID查询
|
| | | * @Title: listBySubsidyId
|
| | | * @Description: |
| | | * @param subsidyId
|
| | | * @return |
| | | * List<OrderTeamReward> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<OrderTeamReward> listBySubsidyId(Long subsidyId);
|
| | |
|
| | | /**
|
| | | * 通过用户ID查询可以结算的奖励列表
|
| | | * @Title: listCanSettleByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<OrderTeamReward> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<OrderTeamReward> listCanSettleByUid(@Param("uid") Long uid, @Param("start") long start,
|
| | | @Param("count") int count);
|
| | |
|
| | | /**
|
| | | * 通过用户ID统计可以结算的奖励数量
|
| | | * @Title: countCanSettle
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | long countCanSettle(@Param("uid") Long uid);
|
| | |
|
| | | /**
|
| | | * 获取某个时间点可以结算的用户ID列表
|
| | | * @Title: listCanSettleUid
|
| | | * @Description: |
| | | * @param time
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<Long> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<Long> listCanSettleUid( @Param("time") Date time, @Param("start") long start, @Param("count") int count);
|
| | |
|
| | | /**
|
| | | * 获取某个时间点可以结算的用户数量
|
| | | * @Title: countCanSettleUid
|
| | | * @Description: |
| | | * @param time
|
| | | * @return |
| | | * Long 返回类型
|
| | | * @throws
|
| | | */
|
| | | Long countCanSettleUid(Date time);
|
| | | } |
| | |
| | | redPackUseFail("红包使用失败"),
|
| | | redPackForbid("红包封禁"),
|
| | | redPackForbidRemove("红包解封"),
|
| | | redPackDeduct("红包扣除");
|
| | | redPackDeduct("红包扣除"),
|
| | | orderTeamReward("团队奖励");
|
| | |
|
| | | private final String desc;
|
| | |
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "sd_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "sd_trade_id")
|
| | | private String tradeId;
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
| | | }
|
| | |
|
| | | public void setTradeId(String tradeId) {
|
| | | this.tradeId = tradeId;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "trd_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "trd_trade_id")
|
| | | private String tradeId;
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
| | | }
|
| | |
|
| | | public void setTradeId(String tradeId) {
|
| | | this.tradeId = tradeId;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | redPackExchange("红包提现到余额", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", ""),
|
| | | 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", "");
|
| | | subsidy("额外补贴", "http://img.flqapp.com/resource/msg/icon_msg_subsidy.png", ""),
|
| | | orderTeamReward("团队奖励", "http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", "");
|
| | |
|
| | | private final String desc;
|
| | | private final String picture;
|
| | |
| | | */
|
| | | @Table("yeshi_ec_invite_order_subsidy")
|
| | | public class InviteOrderSubsidy {
|
| | |
|
| | | public static final int LEVEL_ONE = 1;// 直接补贴
|
| | | public static final int LEVEL_TWO = 2;// 间接补贴
|
| | |
|
| | | // 未知
|
| | | public static final int STATE_UNKNOWN = 0;
|
| | | // 可补贴
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "os_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "os_pre_get_time")
|
| | | private Date preGetTime;
|
| | | @Column(name = "os_get_time")
|
| | | private Date getTime;
|
| | | @Column(name = "os_level")
|
| | | private Integer level;// 直接/间接
|
| | |
|
| | | public Integer getLevel() {
|
| | | return level;
|
| | | }
|
| | |
|
| | | public void setLevel(Integer level) {
|
| | | this.level = level;
|
| | | }
|
| | |
|
| | | public Date getPreGetTime() {
|
| | | return preGetTime;
|
| | | }
|
| | |
|
| | | public void setPreGetTime(Date preGetTime) {
|
| | | this.preGetTime = preGetTime;
|
| | | }
|
| | |
|
| | | public Date getGetTime() {
|
| | | return getTime;
|
| | | }
|
| | |
|
| | | public void setGetTime(Date getTime) {
|
| | | this.getTime = getTime;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | */
|
| | | @Table("yeshi_ec_order_team_reward")
|
| | | public class OrderTeamReward {
|
| | |
|
| | | public static final int LEVEL_ONE = 1;// 直接奖励
|
| | | public static final int LEVEL_TWO = 2;// 间接奖励
|
| | |
|
| | | // 未知
|
| | | public static final int STATE_UNKNOWN = 0;
|
| | | // 未到账
|
| | |
| | | private BigDecimal money;
|
| | | @Column(name = "otr_original_money")
|
| | | private BigDecimal originalMoney;
|
| | |
|
| | | @Column(name = "otr_pre_get_time")
|
| | | private Date preGetTime;// 预估到账时间
|
| | | @Column(name = "otr_get_time")
|
| | | private Date getTime;// 实际到账时间
|
| | |
|
| | | @Column(name = "otr_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "otr_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | @Column(name = "otr_level")
|
| | | private Integer level;// 直接/间接补贴
|
| | |
|
| | | public Integer getLevel() {
|
| | | return level;
|
| | | }
|
| | |
|
| | | public void setLevel(Integer level) {
|
| | | this.level = level;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Date getPreGetTime() {
|
| | | return preGetTime;
|
| | | }
|
| | |
|
| | | public void setPreGetTime(Date preGetTime) {
|
| | | this.preGetTime = preGetTime;
|
| | | }
|
| | |
|
| | | public Date getGetTime() {
|
| | | return getTime;
|
| | | }
|
| | |
|
| | | public void setGetTime(Date getTime) {
|
| | | this.getTime = getTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.money;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class OrderTeamRewardDebtException extends BaseException {
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public OrderTeamRewardDebtException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public OrderTeamRewardDebtException() {
|
| | | super();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.common.DataMonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderMoneySettleService orderMoneySettleService;
|
| | |
|
| | | /**
|
| | | * 新版获取普通订单
|
| | |
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | // 团队奖励到账
|
| | | @XxlJob("fanliOrderTeamRewardHandler")
|
| | | public ReturnT<String> fanliOrderTeamRewardHandler(String param) throws Exception {
|
| | | if (StringUtil.isNullOrEmpty(param))
|
| | | orderProcessService.fanliOrderTeamReward();
|
| | | else {
|
| | | orderProcessService.fanliOrderTeamReward(Long.parseLong(param));
|
| | | }
|
| | |
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | // 维权订单处理-处理最近60天的
|
| | | // 30分钟一次
|
| | | @Scheduled(cron = "0 0/30 * * * ? ")
|
| | |
| | | <?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.InviteOrderSubsidyDebtMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt">
|
| | | <id column="sd_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="sd_uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="sd_origin_money" property="originMoney"
|
| | | jdbcType="DECIMAL" />
|
| | | <result column="sd_left_money" property="leftMoney" jdbcType="DECIMAL" />
|
| | | <result column="sd_source_id" property="sourceId" jdbcType="BIGINT" />
|
| | | <result column="sd_beizhu" property="beiZhu" jdbcType="VARCHAR" />
|
| | | <result column="sd_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="sd_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">sd_id,sd_uid,sd_origin_money,sd_left_money,sd_source_id,sd_beizhu,sd_create_time,sd_update_time
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_invite_order_subsidy_debt where sd_id =
|
| | | #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_invite_order_subsidy_debt where sd_id =
|
| | | #{0} for update
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByLeftMoneyAndUid" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_invite_order_subsidy_debt where sd_uid =
|
| | | #{uid}
|
| | | <if test="minMoney!=null">
|
| | | and sd_left_money>=#{minMoney}
|
| | | </if>
|
| | |
|
| | | <if test="maxMoney!=null">
|
| | | and #{maxMoney}>sd_left_money
|
| | | </if>
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countByLeftMoneyAndUid" resultType="java.lang.Long">
|
| | | select
|
| | | count(*)
|
| | | from yeshi_ec_invite_order_subsidy_debt where sd_uid =
|
| | | #{uid}
|
| | | <if test="minMoney!=null">
|
| | | and sd_left_money>=#{minMoney}
|
| | | </if>
|
| | |
|
| | | <if test="maxMoney!=null">
|
| | | and #{maxMoney}>sd_left_money
|
| | | </if>
|
| | | </select>
|
| | | |
| | | |
| | | <select id="sumLeftMoneyByUid" resultType="java.math.BigDecimal" parameterType="java.lang.Long">
|
| | | select
|
| | | sum(sd_left_money)
|
| | | from yeshi_ec_invite_order_subsidy_debt where sd_uid =
|
| | | #{0}
|
| | | </select>
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_invite_order_subsidy_debt where sd_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_invite_order_subsidy_debt
|
| | | (sd_id,sd_uid,sd_origin_money,sd_left_money,sd_source_id,sd_beizhu,sd_create_time,sd_update_time)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{originMoney,jdbcType=DECIMAL},#{leftMoney,jdbcType=DECIMAL},#{sourceId,jdbcType=BIGINT},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_invite_order_subsidy_debt
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">sd_id,</if>
|
| | | <if test="uid != null">sd_uid,</if>
|
| | | <if test="originMoney != null">sd_origin_money,</if>
|
| | | <if test="leftMoney != null">sd_left_money,</if>
|
| | | <if test="sourceId != null">sd_source_id,</if>
|
| | | <if test="beiZhu != null">sd_beizhu,</if>
|
| | | <if test="createTime != null">sd_create_time,</if>
|
| | | <if test="updateTime != null">sd_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="sourceId != null">#{sourceId,jdbcType=BIGINT},</if>
|
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</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.money.InviteOrderSubsidyDebt">update
|
| | | yeshi_ec_invite_order_subsidy_debt set sd_uid =
|
| | | #{uid,jdbcType=BIGINT},sd_origin_money =
|
| | | #{originMoney,jdbcType=DECIMAL},sd_left_money =
|
| | | #{leftMoney,jdbcType=DECIMAL},sd_source_id =
|
| | | #{sourceId,jdbcType=BIGINT},sd_beizhu =
|
| | | #{beiZhu,jdbcType=VARCHAR},sd_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP},sd_update_time =
|
| | | #{updateTime,jdbcType=TIMESTAMP} where sd_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt">
|
| | | update yeshi_ec_invite_order_subsidy_debt
|
| | | <set>
|
| | | <if test="uid != null">sd_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="originMoney != null">sd_origin_money=#{originMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="leftMoney != null">sd_left_money=#{leftMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="sourceId != null">sd_source_id=#{sourceId,jdbcType=BIGINT},</if>
|
| | | <if test="beiZhu != null">sd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">sd_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">sd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where sd_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | | <?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.InviteOrderSubsidyDebtMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt"> |
| | | <id column="sd_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sd_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="sd_origin_money" property="originMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="sd_left_money" property="leftMoney" jdbcType="DECIMAL" /> |
| | | <result column="sd_source_id" property="sourceId" jdbcType="BIGINT" /> |
| | | <result column="sd_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="sd_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sd_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sd_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sd_id,sd_uid,sd_origin_money,sd_left_money,sd_source_id,sd_beizhu,sd_create_time,sd_update_time,sd_trade_id</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy_debt where sd_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy_debt where sd_id = #{0} for update |
| | | </select> |
| | | <select id="listByLeftMoneyAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy_debt where sd_uid = #{uid} |
| | | <if test="minMoney!=null">and sd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>sd_left_money</if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | <select id="countByLeftMoneyAndUid" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_invite_order_subsidy_debt where sd_uid = |
| | | #{uid} |
| | | <if test="minMoney!=null">and sd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>sd_left_money</if> |
| | | </select> |
| | | <select id="sumLeftMoneyByUid" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long">select sum(sd_left_money) from |
| | | yeshi_ec_invite_order_subsidy_debt where sd_uid = #{0}</select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_invite_order_subsidy_debt where sd_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_invite_order_subsidy_debt |
| | | (sd_id,sd_uid,sd_origin_money,sd_left_money,sd_source_id,sd_beizhu,sd_create_time,sd_update_time,sd_trade_id) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{originMoney,jdbcType=DECIMAL},#{leftMoney,jdbcType=DECIMAL},#{sourceId,jdbcType=BIGINT},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{tradeId,jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_invite_order_subsidy_debt |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sd_id,</if> |
| | | <if test="uid != null">sd_uid,</if> |
| | | <if test="originMoney != null">sd_origin_money,</if> |
| | | <if test="leftMoney != null">sd_left_money,</if> |
| | | <if test="sourceId != null">sd_source_id,</if> |
| | | <if test="beiZhu != null">sd_beizhu,</if> |
| | | <if test="createTime != null">sd_create_time,</if> |
| | | <if test="updateTime != null">sd_update_time,</if> |
| | | <if test="tradeId != null">sd_trade_id,</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="sourceId != null">#{sourceId,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt">update |
| | | yeshi_ec_invite_order_subsidy_debt set sd_uid = |
| | | #{uid,jdbcType=BIGINT},sd_origin_money = |
| | | #{originMoney,jdbcType=DECIMAL},sd_left_money = |
| | | #{leftMoney,jdbcType=DECIMAL},sd_source_id = |
| | | #{sourceId,jdbcType=BIGINT},sd_beizhu = |
| | | #{beiZhu,jdbcType=VARCHAR},sd_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sd_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,sd_trade_id |
| | | =#{tradeId,jdbcType=VARCHAR} where sd_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt"> |
| | | update yeshi_ec_invite_order_subsidy_debt |
| | | <set> |
| | | <if test="uid != null">sd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="originMoney != null">sd_origin_money=#{originMoney,jdbcType=DECIMAL},</if> |
| | | <if test="leftMoney != null">sd_left_money=#{leftMoney,jdbcType=DECIMAL},</if> |
| | | <if test="sourceId != null">sd_source_id=#{sourceId,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">sd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">sd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tradeId !=null">sd_trade_id =#{tradeId,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where sd_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.OrderTeamRewardDebtMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.money.OrderTeamRewardDebt"> |
| | | <id column="trd_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="trd_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="trd_origin_money" property="originMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="trd_left_money" property="leftMoney" jdbcType="DECIMAL" /> |
| | | <result column="trd_source_id" property="sourceId" jdbcType="BIGINT" /> |
| | | <result column="trd_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="trd_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="trd_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="trd_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">trd_id,trd_uid,trd_origin_money,trd_left_money,trd_source_id,trd_beizhu,trd_create_time,trd_update_time,trd_trade_id |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_reward_debt where trd_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_reward_debt where trd_id = #{0} for update |
| | | </select> |
| | | <select id="listByLeftMoneyAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_reward_debt where trd_uid = #{uid} |
| | | <if test="minMoney!=null">and trd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>trd_left_money</if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | <select id="countByLeftMoneyAndUid" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_order_team_reward_debt where trd_uid = |
| | | #{uid} |
| | | <if test="minMoney!=null">and trd_left_money>=#{minMoney}</if> |
| | | <if test="maxMoney!=null">and #{maxMoney}>trd_left_money</if> |
| | | </select> |
| | | <select id="sumLeftMoneyByUid" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long">select sum(trd_left_money) from |
| | | yeshi_ec_order_team_reward_debt where trd_uid = #{0} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_order_team_reward_debt where trd_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.money.OrderTeamRewardDebt" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_order_team_reward_debt |
| | | (trd_id,trd_uid,trd_origin_money,trd_left_money,trd_source_id,trd_beizhu,trd_create_time,trd_update_time,trd_trade_id) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{originMoney,jdbcType=DECIMAL},#{leftMoney,jdbcType=DECIMAL},#{sourceId,jdbcType=BIGINT},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{tradeId,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.OrderTeamRewardDebt" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_order_team_reward_debt |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">trd_id,</if> |
| | | <if test="uid != null">trd_uid,</if> |
| | | <if test="originMoney != null">trd_origin_money,</if> |
| | | <if test="leftMoney != null">trd_left_money,</if> |
| | | <if test="sourceId != null">trd_source_id,</if> |
| | | <if test="beiZhu != null">trd_beizhu,</if> |
| | | <if test="createTime != null">trd_create_time,</if> |
| | | <if test="updateTime != null">trd_update_time,</if> |
| | | <if test="tradeId != null">trd_trade_id,</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="sourceId != null">#{sourceId,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.OrderTeamRewardDebt">update |
| | | yeshi_ec_order_team_reward_debt set trd_uid = |
| | | #{uid,jdbcType=BIGINT},trd_origin_money = |
| | | #{originMoney,jdbcType=DECIMAL},trd_left_money = |
| | | #{leftMoney,jdbcType=DECIMAL},trd_source_id = |
| | | #{sourceId,jdbcType=BIGINT},trd_beizhu = |
| | | #{beiZhu,jdbcType=VARCHAR},trd_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},trd_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,trd_trade_id |
| | | =#{tradeId,jdbcType=VARCHAR} where trd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.OrderTeamRewardDebt"> |
| | | update yeshi_ec_order_team_reward_debt |
| | | <set> |
| | | <if test="uid != null">trd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="originMoney != null">trd_origin_money=#{originMoney,jdbcType=DECIMAL},</if> |
| | | <if test="leftMoney != null">trd_left_money=#{leftMoney,jdbcType=DECIMAL},</if> |
| | | <if test="sourceId != null">trd_source_id=#{sourceId,jdbcType=BIGINT},</if> |
| | | <if test="beiZhu != null">trd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">trd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">trd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tradeId !=null">trd_trade_id =#{tradeId,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where trd_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.OrderTeamRewardDebtRepayHistoryMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.money.OrderTeamRewardDebtRepayHistory">
|
| | | <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.money.InviteOrderSubsidyDebt">
|
| | | <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_reward_debt_repay_history where drh_id =
|
| | | #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_order_team_reward_debt_repay_history where drh_id =
|
| | | #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert"
|
| | | parameterType="com.yeshi.fanli.entity.money.OrderTeamRewardDebtRepayHistory"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_order_team_reward_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.money.OrderTeamRewardDebtRepayHistory"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_order_team_reward_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.money.OrderTeamRewardDebtRepayHistory">update yeshi_ec_order_team_reward_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.money.OrderTeamRewardDebtRepayHistory">
|
| | | update yeshi_ec_order_team_reward_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>
|
| | |
| | | where d.co_uid = #{uid} and d.co_source_type = 1 and d.co_state <![CDATA[<>]]> 4 |
| | | GROUP BY d.`co_order_no` |
| | | ORDER BY d.co_third_create_time desc |
| | | limit 50)A where A.payment<![CDATA[<]]> 10 |
| | | limit 100)A where A.payment<![CDATA[<]]> 10 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <?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.InviteOrderSubsidyMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.order.InviteOrderSubsidy">
|
| | | <id column="os_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="os_uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="os_money" property="money" jdbcType="DECIMAL" />
|
| | | <result column="os_order_no" property="orderNo" jdbcType="VARCHAR" />
|
| | | <result column="os_source_type" property="sourceType" jdbcType="INTEGER" />
|
| | | <result column="os_state" property="state" jdbcType="INTEGER" />
|
| | | <result column="os_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="os_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | <result column="os_original_money" property="originalMoney"
|
| | | jdbcType="DECIMAL" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">os_id,os_uid,os_money,os_order_no,os_source_type,os_state,os_create_time,os_update_time,os_original_money
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_invite_order_subsidy where os_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <select id="listByOrderNoAndType" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_invite_order_subsidy where os_order_no = #{orderNo} AND
|
| | | os_source_type = #{type}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_invite_order_subsidy where os_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_invite_order_subsidy
|
| | | (os_id,os_uid,os_money,os_order_no,os_source_type,os_state,os_create_time,os_update_time,os_original_money)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{originalMoney,jdbcType=DECIMAL})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_invite_order_subsidy
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">os_id,</if>
|
| | | <if test="uid != null">os_uid,</if>
|
| | | <if test="money != null">os_money,</if>
|
| | | <if test="orderNo != null">os_order_no,</if>
|
| | | <if test="sourceType != null">os_source_type,</if>
|
| | | <if test="state != null">os_state,</if>
|
| | | <if test="createTime != null">os_create_time,</if>
|
| | | <if test="updateTime != null">os_update_time,</if>
|
| | | <if test="originalMoney != null">os_original_money,</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="money != null">#{money,jdbcType=DECIMAL},</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="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="originalMoney != null">#{originalMoney,jdbcType=DECIMAL}</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy">update
|
| | | yeshi_ec_invite_order_subsidy set os_uid =
|
| | | #{uid,jdbcType=BIGINT},os_money =
|
| | | #{money,jdbcType=DECIMAL},os_order_no =
|
| | | #{orderNo,jdbcType=VARCHAR},os_source_type =
|
| | | #{sourceType,jdbcType=INTEGER},os_state =
|
| | | #{state,jdbcType=INTEGER},os_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP},os_update_time =
|
| | | #{updateTime,jdbcType=TIMESTAMP} ,os_original_money
|
| | | =#{originalMoney,jdbcType=DECIMAL} where os_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy">
|
| | | update yeshi_ec_invite_order_subsidy
|
| | | <set>
|
| | | <if test="uid != null">os_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="money != null">os_money=#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="orderNo != null">os_order_no=#{orderNo,jdbcType=VARCHAR},</if>
|
| | | <if test="sourceType != null">os_source_type=#{sourceType,jdbcType=INTEGER},</if>
|
| | | <if test="state != null">os_state=#{state,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">os_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">os_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="originalMoney !=null">os_original_money =#{originalMoney,jdbcType=DECIMAL},
|
| | | </if>
|
| | | </set>
|
| | | where os_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <select id="getByOrderNoAndType" resultMap="BaseResultMap">SELECT * FROM
|
| | | yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND os_order_no =
|
| | | #{orderNo} AND os_source_type = #{type} LIMIT 1
|
| | | </select>
|
| | |
|
| | | <select id="getByOrderNoAndTypeForUpdate" resultMap="BaseResultMap">SELECT *
|
| | | FROM
|
| | | yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND
|
| | | os_order_no =
|
| | | #{orderNo} AND os_source_type = #{type} for update
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | | <select id="countByOrderNoAndType" resultType="java.lang.Long">SELECT count(*)
|
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_order_no = #{orderNo} AND
|
| | | os_source_type = #{type}
|
| | | </select>
|
| | | </mapper>
|
| | | <?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.InviteOrderSubsidyMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.order.InviteOrderSubsidy"> |
| | | <id column="os_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="os_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="os_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="os_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="os_source_type" property="sourceType" jdbcType="INTEGER" /> |
| | | <result column="os_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="os_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="os_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="os_original_money" property="originalMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="os_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="os_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="os_level" property="level" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">os_id,os_uid,os_money,os_order_no,os_source_type,os_state,os_create_time,os_update_time,os_original_money,os_pre_get_time,os_get_time,os_level |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy where os_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy where os_id = #{0} for update |
| | | </select> |
| | | <select id="listByOrderNoAndType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_invite_order_subsidy where os_order_no = #{orderNo} AND |
| | | os_source_type = #{type} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_invite_order_subsidy where os_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_invite_order_subsidy |
| | | (os_id,os_uid,os_money,os_order_no,os_source_type,os_state,os_create_time,os_update_time,os_original_money,os_pre_get_time,os_get_time,os_level) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{originalMoney,jdbcType=DECIMAL},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{level,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_invite_order_subsidy |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">os_id,</if> |
| | | <if test="uid != null">os_uid,</if> |
| | | <if test="money != null">os_money,</if> |
| | | <if test="orderNo != null">os_order_no,</if> |
| | | <if test="sourceType != null">os_source_type,</if> |
| | | <if test="state != null">os_state,</if> |
| | | <if test="createTime != null">os_create_time,</if> |
| | | <if test="updateTime != null">os_update_time,</if> |
| | | <if test="originalMoney != null">os_original_money,</if> |
| | | <if test="preGetTime != null">os_pre_get_time,</if> |
| | | <if test="getTime != null">os_get_time,</if> |
| | | <if test="level != null">os_level,</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="money != null">#{money,jdbcType=DECIMAL},</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="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="originalMoney != null">#{originalMoney,jdbcType=DECIMAL},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="level != null">#{level,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy">update |
| | | yeshi_ec_invite_order_subsidy set os_uid = |
| | | #{uid,jdbcType=BIGINT},os_money = |
| | | #{money,jdbcType=DECIMAL},os_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},os_source_type = |
| | | #{sourceType,jdbcType=INTEGER},os_state = |
| | | #{state,jdbcType=INTEGER},os_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},os_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,os_original_money |
| | | =#{originalMoney,jdbcType=DECIMAL} ,os_pre_get_time |
| | | =#{preGetTime,jdbcType=TIMESTAMP} ,os_get_time |
| | | =#{getTime,jdbcType=TIMESTAMP} ,os_level =#{level,jdbcType=INTEGER} |
| | | where os_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.InviteOrderSubsidy"> |
| | | update yeshi_ec_invite_order_subsidy |
| | | <set> |
| | | <if test="uid != null">os_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="money != null">os_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="orderNo != null">os_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">os_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="state != null">os_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">os_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">os_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="originalMoney !=null">os_original_money =#{originalMoney,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="preGetTime !=null">os_pre_get_time =#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime !=null">os_get_time =#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="level !=null">os_level =#{level,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where os_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="getByOrderNoAndType" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND os_order_no = |
| | | #{orderNo} AND os_source_type = #{type} LIMIT 1</select> |
| | | <select id="getByOrderNoAndTypeForUpdate" resultMap="BaseResultMap">SELECT * |
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_uid = #{uid} AND |
| | | os_order_no = #{orderNo} AND os_source_type = #{type} for update |
| | | </select> |
| | | <select id="countByOrderNoAndType" resultType="java.lang.Long">SELECT count(*) |
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_order_no = #{orderNo} AND |
| | | os_source_type = #{type}</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.OrderTeamRewardMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.OrderTeamReward"> |
| | | <id column="otr_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="otr_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="otr_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="otr_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="otr_source_type" property="sourceType" |
| | | jdbcType="INTEGER" /> |
| | | <result column="otr_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="otr_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="otr_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="otr_original_money" property="originalMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="otr_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="otr_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="otr_level" property="level" jdbcType="INTEGER" /> |
| | | <association property="subsidy" |
| | | javaType="com.yeshi.fanli.entity.order.InviteOrderSubsidy" column="otr_subsidy_id"> |
| | | <id column="otr_subsidy_id" property="id" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">otr_id,otr_uid,otr_money,otr_order_no,otr_source_type,otr_state,otr_create_time,otr_update_time,otr_original_money,otr_subsidy_id,otr_pre_get_time,otr_get_time,otr_level |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_reward where otr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="listByOrderNoAndType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_order_team_reward where otr_order_no = #{orderNo} AND |
| | | otr_source_type = #{type} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_order_team_reward where otr_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.OrderTeamReward" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_order_team_reward |
| | | (otr_id,otr_uid,otr_money,otr_order_no,otr_source_type,otr_state,otr_create_time,otr_update_time,otr_original_money,otr_subsidy_id,otr_pre_get_time,otr_get_time,otr_level) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{originalMoney,jdbcType=DECIMAL},#{subsidy.id,jdbcType=BIGINT},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{level,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.OrderTeamReward" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_order_team_reward |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">otr_id,</if> |
| | | <if test="uid != null">otr_uid,</if> |
| | | <if test="money != null">otr_money,</if> |
| | | <if test="orderNo != null">otr_order_no,</if> |
| | | <if test="sourceType != null">otr_source_type,</if> |
| | | <if test="state != null">otr_state,</if> |
| | | <if test="createTime != null">otr_create_time,</if> |
| | | <if test="updateTime != null">otr_update_time,</if> |
| | | <if test="originalMoney != null">otr_original_money,</if> |
| | | <if test="subsidy != null">otr_subsidy_id,</if> |
| | | <if test="preGetTime != null">otr_pre_get_time,</if> |
| | | <if test="getTime != null">otr_get_time,</if> |
| | | <if test="level != null">otr_level,</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="money != null">#{money,jdbcType=DECIMAL},</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="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="originalMoney != null">#{originalMoney,jdbcType=DECIMAL},</if> |
| | | <if test="subsidy != null">#{subsidy.id,jdbcType=BIGINT},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="level != null">#{level,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.OrderTeamReward">update |
| | | yeshi_ec_order_team_reward set otr_uid = |
| | | #{uid,jdbcType=BIGINT},otr_money = |
| | | #{money,jdbcType=DECIMAL},otr_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},otr_source_type = |
| | | #{sourceType,jdbcType=INTEGER},otr_state = |
| | | #{state,jdbcType=INTEGER},otr_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},otr_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,otr_original_money |
| | | =#{originalMoney,jdbcType=DECIMAL},otr_subsidy_id |
| | | =#{subsidy.id,jdbcType=BIGINT} ,otr_pre_get_time |
| | | =#{preGetTime,jdbcType=TIMESTAMP} ,otr_get_time |
| | | =#{getTime,jdbcType=TIMESTAMP} ,otr_level =#{level,jdbcType=INTEGER} |
| | | where otr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.OrderTeamReward"> |
| | | update yeshi_ec_order_team_reward |
| | | <set> |
| | | <if test="uid != null">otr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="money != null">otr_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="orderNo != null">otr_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceType != null">otr_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="state != null">otr_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">otr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">otr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="originalMoney !=null">otr_original_money =#{originalMoney,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="subsidy !=null">otr_subsidy_id =#{subsidy.id,jdbcType=BIGINT},</if> |
| | | <if test="preGetTime !=null">otr_pre_get_time =#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime !=null">otr_get_time =#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="id !=null">otr_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="level !=null">otr_level =#{level,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where otr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="getByOrderNoAndType" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_order_team_reward WHERE otr_uid = #{uid} AND otr_order_no = |
| | | #{orderNo} AND otr_source_type = #{type} LIMIT 1 |
| | | </select> |
| | | <select id="getByOrderNoAndTypeForUpdate" resultMap="BaseResultMap">SELECT * |
| | | FROM yeshi_ec_order_team_reward WHERE otr_uid = #{uid} AND |
| | | otr_order_no = #{orderNo} AND otr_source_type = #{type} for update |
| | | </select> |
| | | <select id="countByOrderNoAndType" resultType="java.lang.Long">SELECT count(*) |
| | | FROM yeshi_ec_order_team_reward WHERE otr_order_no = #{orderNo} AND |
| | | otr_source_type = #{type} |
| | | </select> |
| | | <select id="selectBySubsidyIdAndUidForUpdate" resultMap="BaseResultMap">SELECT * |
| | | FROM yeshi_ec_order_team_reward WHERE otr_subsidy_id = #{subsidyId} |
| | | AND otr_uid = #{uid} for update |
| | | </select> |
| | | <select id="listBySubsidyId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long">SELECT * FROM yeshi_ec_order_team_reward WHERE |
| | | otr_subsidy_id = #{0} |
| | | </select> |
| | | |
| | | <select id="listCanSettleByUid" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_order_team_reward WHERE |
| | | otr_uid |
| | | =#{uid} AND otr_state=1 AND |
| | | NOW()>otr_pre_get_time |
| | | limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countCanSettle" resultType="java.lang.Long" |
| | | parameterType="java.lang.Long">SELECT count(*) FROM yeshi_ec_order_team_reward |
| | | WHERE |
| | | otr_uid =#{uid} AND otr_state=1 AND NOW()>otr_pre_get_time |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanSettleUid" resultType="java.lang.Long"> |
| | | SELECT t.`otr_uid` FROM |
| | | yeshi_ec_order_team_reward t WHERE t.`otr_state`=1 |
| | | AND #{time} > |
| | | t.`otr_pre_get_time` GROUP BY t.`otr_uid` LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countCanSettleUid" resultType="java.lang.Long" |
| | | parameterType="java.util.Date"> |
| | | SELECT COUNT(*) FROM |
| | | ( |
| | | SELECT t.otr_uid FROM |
| | | yeshi_ec_order_team_reward t WHERE t.otr_state=1 AND |
| | | #{0}>t.otr_pre_get_time GROUP BY t.otr_uid) a |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | |
| | | listImg.add(imgInfo0); |
| | | totalImg++; |
| | | } |
| | | |
| | | |
| | | // 清理老图片 |
| | | if (listOld != null && listOld.size() > 0) { |
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.OrderTeamRewardDebtMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.OrderTeamRewardDebtRepayHistoryMapper;
|
| | | import com.yeshi.fanli.entity.money.OrderTeamRewardDebt;
|
| | | import com.yeshi.fanli.entity.money.OrderTeamRewardDebtRepayHistory;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | | import com.yeshi.fanli.service.inter.money.OrderTeamRewardDebtService;
|
| | |
|
| | | @Service
|
| | | public class OrderTeamRewardDebtServiceImpl implements OrderTeamRewardDebtService {
|
| | | @Resource
|
| | | private OrderTeamRewardDebtMapper orderTeamRewardDebtMapper;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtRepayHistoryMapper orderTeamRewardDebtRepayHistoryMapper;
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void addDebt(OrderTeamRewardDebt debt) throws OrderTeamRewardDebtException {
|
| | | if (debt == null || debt.getOriginMoney() == null || debt.getUid() == null) {
|
| | | throw new OrderTeamRewardDebtException(1, "数据不完整");
|
| | | }
|
| | | if (debt.getCreateTime() == null)
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setLeftMoney(debt.getOriginMoney());
|
| | | orderTeamRewardDebtMapper.insertSelective(debt);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void repayDebt(Long debtId, BigDecimal money) throws OrderTeamRewardDebtException {
|
| | | OrderTeamRewardDebt debt = orderTeamRewardDebtMapper.selectByPrimaryKeyForUpdate(debtId);
|
| | | if (debt == null)
|
| | | throw new OrderTeamRewardDebtException(1, "债务ID不存在");
|
| | | if (money == null || money.compareTo(new BigDecimal(0)) <= 0)
|
| | | throw new OrderTeamRewardDebtException(3, "还钱必须大于0");
|
| | | if (debt.getLeftMoney().compareTo(money) < 0)
|
| | | throw new OrderTeamRewardDebtException(2, "还钱过多");
|
| | | // 还钱
|
| | | OrderTeamRewardDebt update = new OrderTeamRewardDebt();
|
| | | update.setId(debt.getId());
|
| | | update.setLeftMoney(debt.getLeftMoney().subtract(money));
|
| | | update.setUpdateTime(new Date());
|
| | | orderTeamRewardDebtMapper.updateByPrimaryKeySelective(update);
|
| | | // 加入还钱记录
|
| | | OrderTeamRewardDebtRepayHistory record = new OrderTeamRewardDebtRepayHistory();
|
| | | record.setCreateTime(new Date());
|
| | | record.setDebt(debt);
|
| | | record.setMoney(money);
|
| | | record.setUid(debt.getUid());
|
| | | orderTeamRewardDebtRepayHistoryMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public BigDecimal repayDebtByUid(Long uid, BigDecimal money) throws OrderTeamRewardDebtException {
|
| | | // 还钱
|
| | | long count = countNeedRepayDebt(uid);
|
| | | int page = (int) (count % 200 == 0 ? count / 200 : count / 200 + 1);
|
| | | List<OrderTeamRewardDebt> totalList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<OrderTeamRewardDebt> tempList = listNeedRepayDebt(uid, i + 1, 200);
|
| | | if (tempList != null && tempList.size() > 0) {
|
| | | totalList.addAll(tempList);
|
| | | }
|
| | | }
|
| | |
|
| | | // 剩余资金
|
| | | BigDecimal leftMoney = new BigDecimal(money.toString());
|
| | |
|
| | | for (OrderTeamRewardDebt 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 (OrderTeamRewardDebtException e) {
|
| | | // 上笔还款未成功,继续下一笔还款
|
| | | }
|
| | | }
|
| | |
|
| | | return leftMoney;//返回剩余的资金
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<OrderTeamRewardDebt> listNeedRepayDebt(Long uid, int page, int count) {
|
| | | return orderTeamRewardDebtMapper.listByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid, (page - 1) * count,
|
| | | count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countNeedRepayDebt(Long uid) {
|
| | | return orderTeamRewardDebtMapper.countByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalDebtMoney(Long uid) {
|
| | | BigDecimal money = orderTeamRewardDebtMapper.sumLeftMoneyByUid(uid);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | return money;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.cmq.UserMoneyChangeCMQManager;
|
| | |
|
| | | @Service
|
| | |
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.subHongBaoByUid(uid, money);
|
| | | try {
|
| | | UserMoneyChangeCMQManager.getInstance()
|
| | | .addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, new BigDecimal(0).subtract(money)));
|
| | | if (!Constant.IS_TEST)
|
| | | UserMoneyChangeCMQManager.getInstance()
|
| | | .addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, new BigDecimal(0).subtract(money)));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | | try {
|
| | | if (!Constant.IS_TEST)
|
| | | UserMoneyChangeCMQManager.getInstance().addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, money));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.orderTeamReward) {
|
| | | if (detail.getMoney() == null || detail.getUser() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | }
|
| | | userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void redPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createRedPackMsg(uid, type, content, beiZhu);
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void teamRedPackRewardMsg(Long uid, MsgTypeMoneyTypeEnum type,BigDecimal money, String stateDesc, |
| | | public void teamRedPackRewardMsg(Long uid, MsgTypeMoneyTypeEnum type, BigDecimal money, String stateDesc,
|
| | | String content) {
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setRead(false);
|
| | |
| | |
|
| | | @Override
|
| | | public void inviteOrderSubSidy(Long uid, Date date, String from, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteOrderSubSidyMsg(uid, date, from, money, balance, null);
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteOrderSubSidyMsg(uid, date, from, money, balance,
|
| | | null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderTeamReward(Long uid, Date date, String from, BigDecimal money, BigDecimal balance) {
|
| | |
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createOrderTeamRewardMsg(uid, date, from, money, balance, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt;
|
| | | import com.yeshi.fanli.entity.money.OrderTeamRewardDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.InviteOrderSubsidyDebtException;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.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;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtService orderTeamRewardDebtService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);// 加入返还记录
|
| | |
|
| | | // 加入邀请补贴返还记录
|
| | | doInviteOrderSubsidy(orderId, Constant.SOURCE_TYPE_TAOBAO, uid, settleMent, wqMoney);
|
| | | doInviteOrderSubsidy(orderId, Constant.SOURCE_TYPE_TAOBAO, uid, settleMent, wqMoney,
|
| | | weiQuanOrder.getOrderItemId());
|
| | |
|
| | | // 如果资金大于0才扣除
|
| | |
|
| | |
| | | * @param sourceType
|
| | | */
|
| | | private void doInviteOrderSubsidy(String orderId, int sourceType, Long uid, BigDecimal settleMent,
|
| | | BigDecimal weiQuanMoney) throws TaoBaoWeiQuanException {
|
| | | BigDecimal weiQuanMoney, String tradeId) throws TaoBaoWeiQuanException {
|
| | | InviteOrderSubsidy subSidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, orderId, sourceType);
|
| | | if (subSidy != null)// 添加借贷关系
|
| | | {
|
| | |
| | | debt.setOriginMoney(drawBackMoney);
|
| | | debt.setUid(uid);
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setSourceId(subSidy.getId());
|
| | | debt.setTradeId(tradeId);
|
| | | try {
|
| | | inviteOrderSubsidyDebtService.addDebt(debt);
|
| | | } catch (InviteOrderSubsidyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "邀请订单补贴异常");
|
| | | }
|
| | |
|
| | | doOrderTeamReard(subSidy.getId(), settleMent, weiQuanMoney, tradeId);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 团队奖励维权处理
|
| | | * @Title: doOrderTeamReard
|
| | | * @Description: |
| | | * @param subsidyId |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void doOrderTeamReard(Long subsidyId, BigDecimal settleMent, BigDecimal weiQuanMoney, String tradeId)
|
| | | throws TaoBaoWeiQuanException {
|
| | | List<OrderTeamReward> list = orderTeamRewardService.listBySubsidyId(subsidyId);
|
| | | if (list != null)
|
| | | for (OrderTeamReward reward : list) {
|
| | | BigDecimal drawBackMoney = computeDrawBackMoney(settleMent, weiQuanMoney, reward.getOriginalMoney());
|
| | | if (drawBackMoney.compareTo(new BigDecimal(0)) <= 0)
|
| | | return;
|
| | | OrderTeamRewardDebt debt = new OrderTeamRewardDebt();
|
| | | debt.setBeiZhu("订单售后");
|
| | | debt.setOriginMoney(drawBackMoney);
|
| | | debt.setUid(reward.getUid());
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setTradeId(tradeId);
|
| | | debt.setSourceId(reward.getId());
|
| | | try {
|
| | | orderTeamRewardDebtService.addDebt(debt);
|
| | | } catch (OrderTeamRewardDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(102, "团队奖励异常");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemId(String orderItemId) {
|
| | | List<TaoBaoWeiQuanDrawBack> list = taoBaoWeiQuanDrawBackMapper.selectByOrderItemId(orderItemId);
|
| | |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | |
| | | order.getListOrderGoods().add(commonGoodsVO); |
| | | } |
| | | } |
| | | |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime)); |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO; |
| | | |
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrders) { |
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder); |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(taoBaoOrder); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); |
| | |
| | | @Override |
| | | public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state, |
| | | Integer type, Integer orderState, String startTime, String endTime, Integer source, List<Long> listShopId, |
| | | List<Long> listGoodsId, Date minTime, BigDecimal money,BigDecimal payment) throws CommonOrderException { |
| | | List<Long> listGoodsId, Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException { |
| | | |
| | | List<CommonOrderVO> list = null; |
| | | |
| | |
| | | startTime, endTime, source, payment); |
| | | } else { |
| | | list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime, |
| | | source, listShopId, listGoodsId, minTime, money,payment); |
| | | source, listShopId, listGoodsId, minTime, money, payment); |
| | | } |
| | | |
| | | if (list == null) { |
| | |
| | | @Override |
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState, |
| | | String startTime, String endTime, Integer source, List<Long> listShopId, List<Long> listGoodsId, |
| | | Date minTime, BigDecimal money,BigDecimal payment) throws CommonOrderException { |
| | | Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException { |
| | | if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 搜索框无值或者按订单号搜索时都只搜索主订单 |
| | | return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime, |
| | | source, payment); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) throws Exception { |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) |
| | | throws Exception { |
| | | List<CommonOrderVO> listVO = commonOrderMapper.searchOrderByUid((page - 1) * size, size, uid, list); |
| | | |
| | | // 订单信息为空 |
| | |
| | | * @param listGoods |
| | | * @param uid |
| | | */ |
| | | private void orderVOFactoryNew(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) |
| | | throws Exception { |
| | | private void orderVOFactoryNew(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, |
| | | Long uid) throws Exception { |
| | | List<String> listTB = new ArrayList<String>(); |
| | | List<String> listJD = new ArrayList<String>(); |
| | | List<String> listPDD = new ArrayList<String>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); |
| | |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | |
| | | |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | |
| | | totalSettlement = commonOrder.getTotalPayment(); |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | } |
| | | } |
| | | |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Date getThirdCreateTime(String orderId, int sourceType) { |
| | | List<CommonOrder> list = listBySourceTypeAndOrderId(sourceType, orderId); |
| | | if (list == null || list.size() == 0) |
| | | return null; |
| | | return list.get(0).getThirdCreateTime(); |
| | | } |
| | | |
| | | } |
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.InviteOrderSubsidyMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | 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.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | | 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.InviteOrderSubsidyService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class InviteOrderSubsidyServiceImpl implements InviteOrderSubsidyService {
|
| | |
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Override
|
| | | public InviteOrderSubsidy getByOrderNoAndType(Long uid, String orderNo, Integer type) {
|
| | | return inviteOrderSubsidyMapper.getByOrderNoAndType(uid, orderNo, type);
|
| | |
| | | return inviteOrderSubsidyMapper.getByOrderNoAndTypeForUpdate(uid, orderNo, type);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void addOrderSubsidy(InviteOrderSubsidy orderSubsidy) throws InviteOrderSubsidyException {
|
| | | if (orderSubsidy.getMoney() == null || StringUtil.isNullOrEmpty(orderSubsidy.getOrderNo())
|
| | | || orderSubsidy.getSourceType() == null || orderSubsidy.getUid() == null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void addOrUpdateByOrder(String orderId, int sourceType) throws InviteOrderSubsidyException {
|
| | | List<HongBaoOrder> list = hongBaoOrderService.listByOrderIdAndSourceType(orderId, sourceType);
|
| | |
| | | orderSubsidy.setOrderNo(orderId);
|
| | | orderSubsidy.setSourceType(sourceType);
|
| | | orderSubsidy.setState(state);
|
| | | if (type == HongBaoV2.TYPE_YIJI)
|
| | | orderSubsidy.setLevel(InviteOrderSubsidy.LEVEL_ONE);
|
| | | else
|
| | | orderSubsidy.setLevel(InviteOrderSubsidy.LEVEL_TWO);
|
| | | // VIP用户才能补贴
|
| | | if (userVIPInfoService.isVIP(uid))
|
| | | addOrderSubsidy(orderSubsidy);
|
| | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) {
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) throws InviteOrderSubsidyException {
|
| | |
|
| | | List<InviteOrderSubsidy> list = inviteOrderSubsidyMapper.listByOrderNoAndType(orderId, sourceType);
|
| | | if (list != null && list.size() > 0)
|
| | | for (InviteOrderSubsidy subsidy : list) {
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void settleById(Long id, BigDecimal money) {
|
| | | InviteOrderSubsidy orderSubsidy = new InviteOrderSubsidy(id);
|
| | |
| | | orderSubsidy.setState(InviteOrderSubsidy.STATE_SUBSIDIZED);
|
| | | orderSubsidy.setUpdateTime(new Date());
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(orderSubsidy);
|
| | | // 设置可结算
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.InviteOrderSubsidyMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyServiceV2;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class InviteOrderSubsidyServiceImplV2 implements InviteOrderSubsidyServiceV2 {
|
| | |
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Override
|
| | | public InviteOrderSubsidy getByOrderNoAndType(Long uid, String orderNo, Integer type) {
|
| | | return inviteOrderSubsidyMapper.getByOrderNoAndType(uid, orderNo, type);
|
| | |
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void addOrderSubsidy(InviteOrderSubsidy orderSubsidy) throws InviteOrderSubsidyException {
|
| | | private void addOrderSubsidy(InviteOrderSubsidy orderSubsidy)
|
| | | throws InviteOrderSubsidyException, OrderTeamRewardException, CommonOrderException {
|
| | | if (orderSubsidy.getMoney() == null || StringUtil.isNullOrEmpty(orderSubsidy.getOrderNo())
|
| | | || orderSubsidy.getSourceType() == null || orderSubsidy.getUid() == null)
|
| | | throw new InviteOrderSubsidyException(1, "数据不完整");
|
| | |
| | | update.setState(orderSubsidy.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | // 添加奖励
|
| | | addTeamReward(old.getId());
|
| | | } else {// 添加
|
| | | if (orderSubsidy.getCreateTime() == null)
|
| | | orderSubsidy.setCreateTime(new Date());
|
| | | inviteOrderSubsidyMapper.insertSelective(orderSubsidy);
|
| | | // 添加奖励
|
| | | addTeamReward(orderSubsidy.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加团队奖励
|
| | | private void addTeamReward(Long subsidyId) throws OrderTeamRewardException, CommonOrderException {
|
| | | // 查询团队奖励的人
|
| | | // 计算相应的比例
|
| | | InviteOrderSubsidy subsidy = inviteOrderSubsidyMapper.selectByPrimaryKeyForUpdate(subsidyId);
|
| | | if (subsidy == null)
|
| | | throw new OrderTeamRewardException(20, "补贴不存在");
|
| | |
|
| | | // 获取上4级用户
|
| | | List<CommonOrder> commonOrderList = commonOrderService.listBySourceTypeAndOrderId(subsidy.getSourceType(),
|
| | | subsidy.getOrderNo());
|
| | | if (commonOrderList == null || commonOrderList.size() == 0) {
|
| | | throw new CommonOrderException(1, "订单不存在");
|
| | | }
|
| | |
|
| | | Date orderTime = commonOrderList.get(0).getThirdCreateTime();
|
| | |
|
| | | Long sourceUid = commonOrderList.get(0).getUserInfo().getId();
|
| | |
|
| | | List<ThreeSale> bossList = threeSaleSerivce.getMyBossDeepList(sourceUid, 4);
|
| | | // 无需要团队奖励的上级
|
| | | if (bossList.size() < 3)
|
| | | return;
|
| | |
|
| | | Set<Long> rewardUid = new HashSet<>();
|
| | | for (int i = 2; i < bossList.size(); i++) {
|
| | | rewardUid.add(bossList.get(i).getBoss().getId());
|
| | | }
|
| | |
|
| | | // 删除补贴用户的下级用户
|
| | | for (int i = 0; i < bossList.size(); i++) {
|
| | | if (bossList.get(i).getBoss().getId().longValue() == subsidy.getUid()) {
|
| | | break;
|
| | | } else {
|
| | | bossList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 1; i < bossList.size(); i++) {
|
| | | if (rewardUid.contains(bossList.get(i).getBoss().getId())) {
|
| | | UserInfo boss = bossList.get(i).getBoss();
|
| | | if (i == 1) {
|
| | | if (bossList.get(i).getSucceedTime() < subsidy.getCreateTime().getTime()) {
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(boss.getId(), orderTime);
|
| | | BigDecimal rewardMoney = orderHongBaoMoneyComputeService
|
| | | .computeFirstTeamReward(subsidy.getMoney(), subsidy.getCreateTime(), userLevel);
|
| | |
|
| | | if (rewardMoney != null) {
|
| | | // 添加奖励
|
| | | orderTeamRewardService.addOrUpdate(subsidy, rewardMoney, boss.getId(),
|
| | | OrderTeamReward.LEVEL_ONE);
|
| | | }
|
| | | }
|
| | | } else if (i == 2) {
|
| | | if (bossList.get(i).getSucceedTime() < subsidy.getCreateTime().getTime()) {
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(boss.getId(), orderTime);
|
| | | BigDecimal rewardMoney = orderHongBaoMoneyComputeService
|
| | | .computeSecondTeamReward(subsidy.getMoney(), subsidy.getCreateTime(), userLevel);
|
| | |
|
| | | if (rewardMoney != null) {
|
| | | // 添加奖励
|
| | | orderTeamRewardService.addOrUpdate(subsidy, rewardMoney, boss.getId(),
|
| | | OrderTeamReward.LEVEL_TWO);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | if (list != null && list.size() > 0) {
|
| | | // 必须是自购订单才返利
|
| | | HongBaoV2 parent = hongBaoV2Service.selectByPrimaryKey(list.get(0).getHongBaoV2().getId());
|
| | | if (parent != null && parent.getUrank() != UserLevelEnum.superVIP.getOrderRank()) {// 不是超级会员的自购/分享才补贴
|
| | | if (parent != null && parent.getUrank() != UserLevelEnum.superVIP.getOrderRank()
|
| | | && (parent.getType() == HongBaoV2.TYPE_SHARE_GOODS || parent.getType() == HongBaoV2.TYPE_ZIGOU)) {// 不是超级会员的自购/分享才补贴
|
| | | boolean isShare = (parent.getType() == HongBaoV2.TYPE_SHARE_GOODS);
|
| | |
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(sourceType, orderId);
|
| | | if (orderList == null || orderList.size() == 0)
|
| | |
| | | // 计算奖励金
|
| | | for (Iterator<Long> its = uidHongBaoMap.keySet().iterator(); its.hasNext();) {
|
| | | Long uid = its.next();
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(uid);
|
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(uid, placeOrderTime);
|
| | |
|
| | | int type = uidHongBaoMap.get(uid);
|
| | | if (type == HongBaoV2.TYPE_YIJI || type == HongBaoV2.TYPE_ERJI) {
|
| | |
| | | orderSubsidy.setOrderNo(orderId);
|
| | | orderSubsidy.setSourceType(sourceType);
|
| | | orderSubsidy.setState(state);
|
| | | if (type == HongBaoV2.TYPE_YIJI)
|
| | | orderSubsidy.setLevel(InviteOrderSubsidy.LEVEL_ONE);
|
| | | else
|
| | | orderSubsidy.setLevel(InviteOrderSubsidy.LEVEL_TWO);
|
| | | // 会员才能补贴
|
| | | if (userLevel != UserLevelEnum.daRen)
|
| | | addOrderSubsidy(orderSubsidy);
|
| | | if (userLevel != UserLevelEnum.daRen) {
|
| | | try {
|
| | | addOrderSubsidy(orderSubsidy);
|
| | | } catch (OrderTeamRewardException e) {
|
| | | throw new InviteOrderSubsidyException(e.getCode(), e.getMsg());
|
| | | } catch (CommonOrderException e) {
|
| | | throw new InviteOrderSubsidyException(e.getCode(), e.getMsg());
|
| | | }
|
| | | // 分享赚不能使用返利奖励券,不用等待5天
|
| | | if (isShare) {
|
| | | validByOrderIdAndSourceType(orderId, sourceType);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return inviteOrderSubsidyMapper.countByOrderNoAndType(orderId, sourceType);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void invalidByOrderIdAndSourceType(String orderId, int sourceType) {
|
| | | List<InviteOrderSubsidy> list = inviteOrderSubsidyMapper.listByOrderNoAndType(orderId, sourceType);
|
| | |
| | | update.setState(InviteOrderSubsidy.STATE_INVALID);
|
| | | update.setUpdateTime(new Date());
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | orderTeamRewardService.invalidByOrderIdAndSourceType(subsidy.getId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) {
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) throws InviteOrderSubsidyException {
|
| | | // 查询预计到账时间
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(sourceType, orderId);
|
| | | if (orderList == null || orderList.size() == 0)
|
| | | throw new InviteOrderSubsidyException(31, "订单不存在");
|
| | |
|
| | | if (orderList.get(0).getSettleTime() == null)
|
| | | throw new InviteOrderSubsidyException(32, "订单尚未确认收货");
|
| | |
|
| | | // 确认收货时间的下月25号到账
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(orderList.get(0).getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | | Date preGetTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd"));
|
| | |
|
| | | List<InviteOrderSubsidy> list = inviteOrderSubsidyMapper.listByOrderNoAndType(orderId, sourceType);
|
| | | if (list != null && list.size() > 0)
|
| | | for (InviteOrderSubsidy subsidy : list) {
|
| | |
| | | InviteOrderSubsidy update = new InviteOrderSubsidy(subsidy.getId());
|
| | | update.setState(InviteOrderSubsidy.STATE_VALID);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setPreGetTime(preGetTime);
|
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(update);
|
| | | orderTeamRewardService.validByOrderIdAndSourceType(subsidy.getId(), preGetTime);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | if (rate == null)
|
| | | return null;
|
| | | BigDecimal baseRate = hongBaoManageService.getBaseFanliRate(placeOrderTime.getTime());
|
| | | BigDecimal officialSubsidyRate = getOfficialSubsidyRate(placeOrderTime, userLevel, false);
|
| | | BigDecimal officialSubsidyRate = getOfficialSubsidyRate(placeOrderTime, buyerUserLevel, false);
|
| | | return MoneyBigDecimalUtil.div(fanLiMoney.multiply(baseRate).multiply(rate),
|
| | | baseRate.add(officialSubsidyRate).multiply(new BigDecimal(100)));
|
| | | }
|
| | |
| | | if (rate == null)
|
| | | return null;
|
| | | BigDecimal baseRate = hongBaoManageService.getBaseFanliRate(placeOrderTime.getTime());
|
| | | BigDecimal officialSubsidyRate = getOfficialSubsidyRate(placeOrderTime, userLevel, false);
|
| | | BigDecimal officialSubsidyRate = getOfficialSubsidyRate(placeOrderTime, buyerUserLevel, false);
|
| | | return MoneyBigDecimalUtil.div(fanLiMoney.multiply(baseRate).multiply(rate),
|
| | | baseRate.add(officialSubsidyRate).multiply(new BigDecimal(100)));
|
| | | }
|
| | |
|
| | | public BigDecimal computeFirstTeamReward(BigDecimal firstTeamSubsidy, Date placeOrderTime,
|
| | | BigDecimal secondTeamSubsidy, UserLevelEnum userLevel) {
|
| | | @Override
|
| | | public BigDecimal computeFirstTeamReward(BigDecimal money, Date placeOrderTime, UserLevelEnum userLevel) {
|
| | |
|
| | | if (userLevel != UserLevelEnum.superVIP)
|
| | | return null;
|
| | |
|
| | | BigDecimal firstRate = getTeamRewardRate(placeOrderTime, userLevel, true);
|
| | | BigDecimal secondRate = getTeamRewardRate(placeOrderTime, userLevel, false);
|
| | |
|
| | | if (firstRate == null || secondRate == null)
|
| | | if (firstRate == null)
|
| | | return null;
|
| | |
|
| | | BigDecimal firstReward = MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(secondRate, firstTeamSubsidy),
|
| | | new BigDecimal(100));
|
| | | BigDecimal secondReward = MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(firstRate, secondTeamSubsidy),
|
| | | new BigDecimal(100));
|
| | | BigDecimal reward = MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(firstRate, money), new BigDecimal(100));
|
| | |
|
| | | return firstReward.add(secondReward);
|
| | | return reward;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoV2SettleTemp;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.InviteOrderSubsidyDebtException;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.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;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | |
|
| | | @Service
|
| | | public class OrderMoneySettleServiceImpl implements OrderMoneySettleService {
|
| | |
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | |
|
| | | //下级被封禁,红包失效
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardDebtService orderTeamRewardDebtService;
|
| | |
|
| | | // 下级被封禁,红包失效
|
| | | private void invalidHongBaoForbidden(Long id) {
|
| | | HongBaoV2 updateHongBaoV2 = new HongBaoV2(id);
|
| | | updateHongBaoV2.setState(HongBaoV2.STATE_SHIXIAO);
|
| | |
| | | }
|
| | | return debtMoney;
|
| | | }
|
| | |
|
| | | private BigDecimal kouKuanReward(List<OrderTeamReward> rewardList, BigDecimal debtMoney) {
|
| | | BigDecimal average = debtMoney.divide(new BigDecimal(rewardList.size()), 2, RoundingMode.UP);
|
| | | for (int i = 0; i < rewardList.size(); i++) {
|
| | | OrderTeamReward sidy = rewardList.get(i);
|
| | | BigDecimal subMoney = null;
|
| | | if (average.compareTo(sidy.getMoney()) >= 0) {
|
| | | subMoney = sidy.getMoney();
|
| | | } else {
|
| | | subMoney = average;
|
| | | }
|
| | | if (subMoney.compareTo(debtMoney) > 0)
|
| | | subMoney = debtMoney;
|
| | | debtMoney = debtMoney.subtract(subMoney);
|
| | | sidy.setMoney(sidy.getMoney().subtract(subMoney));
|
| | |
|
| | | if (sidy.getMoney().compareTo(new BigDecimal(0)) == 0) {
|
| | | rewardList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | return debtMoney;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void orderTeamRewardSettle(Long uid) throws OrderMoneySettleException {
|
| | | long count = orderTeamRewardService.countCanSettle(uid);
|
| | | if (count <= 0) {
|
| | | return;
|
| | | }
|
| | | int pageSize = 2000;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | // 查询出需要到账的奖励
|
| | | List<OrderTeamReward> totalList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<OrderTeamReward> list = orderTeamRewardService.listCanSettle(uid, i + 1, pageSize);
|
| | | if (list != null && list.size() > 0)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | if (totalList.size() > 0) {
|
| | | BigDecimal debtMoney = orderTeamRewardDebtService.getTotalDebtMoney(uid);
|
| | | BigDecimal originalDebtMoney = new BigDecimal(debtMoney.toString());// 总的欠款
|
| | | List<OrderTeamReward> copyRewardList = new ArrayList<>();
|
| | | copyRewardList.addAll(totalList);
|
| | | while (debtMoney.compareTo(new BigDecimal(0)) > 0 && copyRewardList.size() > 0) {// 有欠款,还有还的
|
| | | debtMoney = kouKuanReward(copyRewardList, debtMoney);
|
| | | }
|
| | | // 偿还欠款金额
|
| | | BigDecimal repayMoney = originalDebtMoney.subtract(debtMoney);
|
| | | BigDecimal bannce = null;
|
| | | if (repayMoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | try {
|
| | | bannce = orderTeamRewardDebtService.repayDebtByUid(uid, repayMoney);
|
| | | // 剩余的补贴金额
|
| | | } catch (OrderTeamRewardDebtException e) {
|
| | | throw new OrderMoneySettleException(2, "还款异常");
|
| | | }
|
| | | }
|
| | | if (bannce != null && bannce.compareTo(new BigDecimal(0)) > 0) {
|
| | | // 如果有还剩下的钱就加到第一个上面
|
| | | totalList.get(0).setMoney(totalList.get(0).getMoney().add(bannce));
|
| | | }
|
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0);
|
| | | for (OrderTeamReward reward : totalList) {
|
| | | orderTeamRewardService.settleById(reward.getId(), reward.getMoney());
|
| | | totalMoney = totalMoney.add(reward.getMoney());
|
| | | }
|
| | |
|
| | | // 实际到账奖励
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | try {
|
| | | userMoneyDetail = UserMoneyDetailFactory.createOrderTeamReward(uid, totalMoney, new Date());
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new OrderMoneySettleException(1, "账户明细构建出错");
|
| | | }
|
| | | // 添加资金
|
| | | userMoneyService.addUserMoney(uid, totalMoney, userMoneyDetail);
|
| | | // 添加消息
|
| | | userMoneyMsgNotificationService.orderTeamReward(uid, new Date(), "系统自动下发", totalMoney,
|
| | | userInfoMapper.selectAvailableByPrimaryKey(uid).getMyHongBao());
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2AddManager hongBaoV2AddManager;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | /**
|
| | | * 是否是分享订单
|
| | |
| | | order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | try {
|
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
|
| | | if (!Constant.IS_TEST)
|
| | | PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderTeamReward() {
|
| | | Date time = new Date();
|
| | | long count = orderTeamRewardService.countCanSettleUid(time);
|
| | | int pageSize = 500;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<Long> list = orderTeamRewardService.listCanSettleUid(time, i + 1, pageSize);
|
| | | if (list != null && list.size() > 0)
|
| | | uidList.addAll(list);
|
| | | }
|
| | | // 添加到队列
|
| | | if (uidList != null)
|
| | | for (Long uid : uidList)
|
| | | if (!Constant.IS_TEST)
|
| | | CMQManager.getInstance().addFanLiOrderTeamRewardMsg(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderTeamReward(Long uid) throws OrderMoneySettleException {
|
| | | orderMoneySettleService.orderTeamRewardSettle(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.CommonOrderFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
|
| | |
|
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrderList) {
|
| | | CommonOrder commonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrder commonOrder = CommonOrderFactory.create(taoBaoOrder);
|
| | | commonOrder.setStateWholeOrder(wholeOrderState);
|
| | | commonOrder.setCommonOrderGoods(getCommonOrderGoods(taoBaoOrder.getAuctionId()));
|
| | | commonOrder.setUserInfo(new UserInfo(mainUid));
|
| | |
| | | @Transactional(rollbackFor=Exception.class)
|
| | | private void updateOrderInfo(TaoBaoOrder taoBaoOrder, Long commonOrderId) throws Exception {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(commonOrderId);
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(taoBaoOrder);
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(taoBaoOrder.getAuctionId() + "", newCommonOrder.getSourceType());
|
| | | CommonOrderGoods cog = null;
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | 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.OrderTeamRewardMapper;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class OrderTeamRewardServiceImpl implements OrderTeamRewardService {
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardMapper orderTeamRewardMapper;
|
| | |
|
| | | @Override
|
| | | public OrderTeamReward getByOrderNoAndType(Long uid, String orderNo, Integer type) {
|
| | | return orderTeamRewardMapper.getByOrderNoAndType(uid, orderNo, type);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public OrderTeamReward getByOrderNoAndTypeForUpdate(Long uid, String orderNo, Integer type) {
|
| | | return orderTeamRewardMapper.getByOrderNoAndTypeForUpdate(uid, orderNo, type);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void addOrderSubsidy(OrderTeamReward orderSubsidy) throws OrderTeamRewardException {
|
| | | if (orderSubsidy.getMoney() == null || StringUtil.isNullOrEmpty(orderSubsidy.getOrderNo())
|
| | | || orderSubsidy.getSourceType() == null || orderSubsidy.getUid() == null)
|
| | | throw new OrderTeamRewardException(1, "数据不完整");
|
| | | OrderTeamReward old = getByOrderNoAndType(orderSubsidy.getUid(), orderSubsidy.getOrderNo(),
|
| | | orderSubsidy.getSourceType());
|
| | | if (old != null) {// 修改
|
| | | if (old.getState() == OrderTeamReward.STATE_INVALID || old.getState() == OrderTeamReward.STATE_RECIEVED)
|
| | | return;
|
| | |
|
| | | // 修改状态
|
| | | OrderTeamReward update = new OrderTeamReward(old.getId());
|
| | | update.setMoney(orderSubsidy.getMoney());
|
| | | if (old.getState() == OrderTeamReward.STATE_UNKNOWN) {// 状态未确定之前才可以更改原始补贴资金
|
| | | update.setOriginalMoney(orderSubsidy.getOriginalMoney());
|
| | | }
|
| | | update.setState(orderSubsidy.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | orderTeamRewardMapper.updateByPrimaryKeySelective(update);
|
| | | } else {// 添加
|
| | | if (orderSubsidy.getCreateTime() == null)
|
| | | orderSubsidy.setCreateTime(new Date());
|
| | | orderTeamRewardMapper.insertSelective(orderSubsidy);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void addOrUpdate(InviteOrderSubsidy subsidy, BigDecimal money, Long uid, int level)
|
| | | throws OrderTeamRewardException {
|
| | | if (subsidy == null || subsidy.getId() == null)
|
| | | throw new OrderTeamRewardException(1, "补贴为空");
|
| | | if (money == null)
|
| | | throw new OrderTeamRewardException(2, "团队奖励资金为空");
|
| | | OrderTeamReward reward = orderTeamRewardMapper.selectBySubsidyIdAndUidForUpdate(subsidy.getId(), uid);
|
| | | if (reward != null) {// 原来已存在
|
| | | if (reward.getState() == OrderTeamReward.STATE_RECIEVED)
|
| | | return;
|
| | |
|
| | | if (reward.getState() == OrderTeamReward.STATE_INVALID)
|
| | | return;
|
| | |
|
| | | if (subsidy.getState().intValue() != reward.getState() || money.compareTo(reward.getMoney()) != 0) {
|
| | | // 状态或者资金改变,需要改变数据
|
| | | OrderTeamReward updateReward = new OrderTeamReward(reward.getId());
|
| | | updateReward.setState(subsidy.getState());
|
| | | updateReward.setMoney(money);
|
| | | updateReward.setUpdateTime(new Date());
|
| | | orderTeamRewardMapper.updateByPrimaryKeySelective(updateReward);
|
| | | }
|
| | | } else {// 原来不存在
|
| | | reward = new OrderTeamReward();
|
| | | reward.setCreateTime(new Date());
|
| | | reward.setMoney(money);
|
| | | reward.setOrderNo(subsidy.getOrderNo());
|
| | | reward.setOriginalMoney(money);
|
| | | reward.setSourceType(subsidy.getSourceType());
|
| | | reward.setState(subsidy.getState());
|
| | | reward.setSubsidy(subsidy);
|
| | | reward.setUid(uid);
|
| | | reward.setLevel(level);
|
| | | orderTeamRewardMapper.insertSelective(reward);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByOrderIdAndSourceType(String orderId, int sourceType) {
|
| | | return orderTeamRewardMapper.countByOrderNoAndType(orderId, sourceType);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void invalidByOrderIdAndSourceType(Long subsidyId) {
|
| | | List<OrderTeamReward> list = orderTeamRewardMapper.listBySubsidyId(subsidyId);
|
| | | if (list != null && list.size() > 0)
|
| | | for (OrderTeamReward subsidy : list) {
|
| | | if (subsidy.getState() == OrderTeamReward.STATE_UNKNOWN
|
| | | || subsidy.getState() == OrderTeamReward.STATE_VALID) {
|
| | | OrderTeamReward update = new OrderTeamReward(subsidy.getId());
|
| | | update.setState(OrderTeamReward.STATE_INVALID);
|
| | | update.setUpdateTime(new Date());
|
| | |
|
| | | orderTeamRewardMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void validByOrderIdAndSourceType(Long subsidyId, Date preGetTime) {
|
| | | List<OrderTeamReward> list = orderTeamRewardMapper.listBySubsidyId(subsidyId);
|
| | | if (list != null && list.size() > 0)
|
| | | for (OrderTeamReward subsidy : list) {
|
| | | if (subsidy.getState() == OrderTeamReward.STATE_UNKNOWN) {
|
| | | OrderTeamReward update = new OrderTeamReward(subsidy.getId());
|
| | | update.setState(OrderTeamReward.STATE_VALID);
|
| | | update.setUpdateTime(new Date());
|
| | | update.setPreGetTime(preGetTime);
|
| | | orderTeamRewardMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void settleById(Long id, BigDecimal money) {
|
| | | OrderTeamReward orderSubsidy = new OrderTeamReward(id);
|
| | | orderSubsidy.setMoney(money);
|
| | | orderSubsidy.setState(OrderTeamReward.STATE_RECIEVED);
|
| | | orderSubsidy.setGetTime(new Date());
|
| | | orderSubsidy.setUpdateTime(new Date());
|
| | | orderTeamRewardMapper.updateByPrimaryKeySelective(orderSubsidy);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<OrderTeamReward> listBySubsidyId(Long subsidyId) {
|
| | |
|
| | | return orderTeamRewardMapper.listBySubsidyId(subsidyId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<OrderTeamReward> listCanSettle(Long uid, int page, int pageSize) {
|
| | |
|
| | | return orderTeamRewardMapper.listCanSettleByUid(uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countCanSettle(Long uid) {
|
| | | return orderTeamRewardMapper.countCanSettle(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Long> listCanSettleUid(Date time, int page, int count) {
|
| | | return orderTeamRewardMapper.listCanSettleUid(time, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countCanSettleUid(Date time) {
|
| | | return orderTeamRewardMapper.countCanSettleUid(time);
|
| | | }
|
| | | }
|
| | |
| | | return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime) {
|
| | | return threeSaleMapper.getValidWorkerIdsByTime(bossId, limitTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid, int deep) {
|
| | |
|
| | | List<ThreeSale> deepList = new ArrayList<>();
|
| | | ThreeSale boss = getMyBoss(uid);
|
| | | while (deep > 0 && boss != null) {
|
| | | deep--;
|
| | | deepList.add(boss);
|
| | | boss = getMyBoss(boss.getBoss().getId());
|
| | | }
|
| | |
|
| | | return deepList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | |
|
| | | @Override
|
| | | public boolean isVIP(Long uid) {
|
| | | return isVIP(uid, System.currentTimeMillis());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isVIP(Long uid, Long time) {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(uid);
|
| | | if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS)
|
| | | if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS
|
| | | && userInfo.getSuccessTime().getTime() < time)
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | |
| | |
|
| | | // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | | // long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | // long teamNum =
|
| | | // hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | long teamNum = 0L;
|
| | | long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
|
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
|
| | | if (listThreeSale != null && listThreeSale.size() > 0) {
|
| | | for (ThreeSale three: listThreeSale) {
|
| | | for (ThreeSale three : listThreeSale) {
|
| | | UserInfo worker = three.getWorker();
|
| | | if (worker == null || worker.getId() == null) {
|
| | | continue;
|
| | | }
|
| | | // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
|
| | | long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
|
| | | long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(),
|
| | | three.getSucceedTime(), payMoney);
|
| | | if (countValid > 0) {
|
| | | teamNum ++;
|
| | | teamNum++;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void applyVIPNew(Long uid) throws UserVIPInfoException {
|
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | if (!verifyVipNew(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | | |
| | |
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserVIPInfo();
|
| | |
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | |
| | | |
| | |
|
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setTitle("尊敬的高级会员,系统已收到你的超级会员升级申请,正在受理中");
|
| | | detail.setBeiZhu("如有疑问请联系我的-人工客服");
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void passVIPApplyNew(Long uid) throws UserVIPInfoException {
|
| | |
| | | if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | | |
| | |
|
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | if (!verifyVipNew(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | | |
| | |
|
| | | // 额外信息
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | |
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | |
|
| | | try {
|
| | | // 奖励券
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | |
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | |
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("已将你的账户由高级会员升级为超级会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部超级会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, "恭喜你!经人工审核你满足升级超级会员条件", "如有疑问请联系我的-人工客服", msgDto);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @param uid
|
| | |
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | |
| | |
|
| | | if (countZiGou >= Constant.VIP_PROCESS_3_ZIGOU || countShare >= Constant.VIP_PROCESS_3_SHARE
|
| | | || (firstTeam >= Constant.VIP_PROCESS_3_TEAM && secondTeam >= Constant.VIP_PROCESS_3_TEAM_SECOND)) {
|
| | | return true;
|
| | | } |
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException {
|
| | |
| | | info.setState(UserVIPInfo.STATE_INVALID);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | |
| | |
|
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("你的账号仍是高级会员");
|
| | | msgDto.setReason(reason);
|
| | | msgAccountDetailService.addMsgVIP(uid, "很抱歉!经人工审核你未满足或不符合升级超级会员的条件", "如有疑问请联系我的-人工客服", msgDto);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | return infoList.get(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserVIPPreInfo getProcessInfo(Long uid, Date time) {
|
| | | List<UserVIPPreInfo> infoList = userVIPPreInfoMapper.listByUid(uid);
|
| | | if (infoList == null || infoList.size() == 0)
|
| | | return null;
|
| | | Comparator<UserVIPPreInfo> cm = new Comparator<UserVIPPreInfo>() {
|
| | |
|
| | | @Override
|
| | | public int compare(UserVIPPreInfo o1, UserVIPPreInfo o2) {
|
| | | return o2.getProcess() - o1.getProcess();
|
| | | }
|
| | | };
|
| | | Collections.sort(infoList, cm);
|
| | |
|
| | | for (UserVIPPreInfo info : infoList) {
|
| | | if (time.getTime() >= info.getCreateTime().getTime())
|
| | | return info;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void verifyVipPreInfo(Long uid, boolean inviteSuccess) {
|
| | | if (uid == null || uid <= 0)
|
| | | return;
|
| | | |
| | |
|
| | | verifyCondition(uid);
|
| | | |
| | |
|
| | | // 验证上级
|
| | | if (inviteSuccess) {
|
| | | UserInfo boss = threeSaleSerivce.getBoss(uid);
|
| | |
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | long countZiGou =hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | |
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_1_ZIGOU +"笔";
|
| | | msg = "恭喜你!返利订单达到 " + Constant.VIP_PROCESS_1_ZIGOU + "笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_1_SHARE) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_1_SHARE +"笔";
|
| | | msg = "恭喜你!分享订单达到 " + Constant.VIP_PROCESS_1_SHARE + "笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到"+ Constant.VIP_PROCESS_1_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_1_TEAM_SECOND +"人";
|
| | | msg = "直接粉丝达到" + Constant.VIP_PROCESS_1_TEAM + "人,间接粉丝达到 " + Constant.VIP_PROCESS_1_TEAM_SECOND + "人";
|
| | | }
|
| | | |
| | |
|
| | | if (process) {
|
| | | try {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | |
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | addUserVIPPreInfo(info);
|
| | | |
| | |
|
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("系统已将你的账户由快省达人升级为普通会员");
|
| | |
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } |
| | | }
|
| | | return process;
|
| | | }
|
| | |
|
| | |
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_2_ZIGOU +"笔";
|
| | | msg = "恭喜你!返利订单达到 " + Constant.VIP_PROCESS_2_ZIGOU + "笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_2_SHARE) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_2_SHARE +"笔";
|
| | | msg = "恭喜你!分享订单达到 " + Constant.VIP_PROCESS_2_SHARE + "笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到"+ Constant.VIP_PROCESS_2_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_2_TEAM_SECOND +"人";
|
| | | msg = "直接粉丝达到" + Constant.VIP_PROCESS_2_TEAM + "人,间接粉丝达到 " + Constant.VIP_PROCESS_2_TEAM_SECOND + "人";
|
| | | }
|
| | | |
| | |
|
| | | if (process) {
|
| | | try {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | |
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | addUserVIPPreInfo(info);
|
| | | |
| | |
|
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("系统已将你的账户由普通会员升级为高级会员");
|
| | |
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } |
| | | }
|
| | | return process;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.money.OrderTeamRewardDebt;
|
| | | import com.yeshi.fanli.exception.money.OrderTeamRewardDebtException;
|
| | |
|
| | | /**
|
| | | * 团队奖金欠款处理
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface OrderTeamRewardDebtService {
|
| | |
|
| | | /**
|
| | | * 添加债务
|
| | | * |
| | | * @param debt
|
| | | * @throws OrderTeamRewardDebtException
|
| | | */
|
| | | public void addDebt(OrderTeamRewardDebt debt) throws OrderTeamRewardDebtException;
|
| | |
|
| | | /**
|
| | | * 偿还债务
|
| | | * |
| | | * @param debtId
|
| | | * @param money
|
| | | */
|
| | | public void repayDebt(Long debtId, BigDecimal money) throws OrderTeamRewardDebtException;
|
| | |
|
| | | /**
|
| | | * 还款
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | * @return 还剩下的资金
|
| | | * @throws OrderTeamRewardDebtException
|
| | | */
|
| | | public BigDecimal repayDebtByUid(Long uid, BigDecimal money) throws OrderTeamRewardDebtException;
|
| | |
|
| | | /**
|
| | | * 检索需要偿还的债务
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<OrderTeamRewardDebt> listNeedRepayDebt(Long uid, int page, int count);
|
| | |
|
| | | /**
|
| | | * 检索需要偿还的债务
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countNeedRepayDebt(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取总共欠钱金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getTotalDebtMoney(Long uid);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void teamRedPackRewardMsg(Long uid, MsgTypeMoneyTypeEnum type, BigDecimal money, String stateDesc,String content);
|
| | |
|
| | | /**
|
| | | * 团队奖励消息
|
| | | * @Title: orderTeamReward
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param date
|
| | | * @param from
|
| | | * @param money
|
| | | * @param balance |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void orderTeamReward(Long uid, Date date, String from, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | |
| | | }
|
| | |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) throws Exception; |
| | | |
| | | public long countSearchOrderByUid(Long uid, List<ESOrder> list); |
| | | |
| | | /** |
| | | * 返回订单的第三方创建时间 |
| | | * @Title: getThirdCreateTime |
| | | * @Description: |
| | | * @param orderId |
| | | * @param sourceType |
| | | * @return |
| | | * Date 返回类型 |
| | | * @throws |
| | | */ |
| | | public Date getThirdCreateTime(String orderId,int sourceType); |
| | | |
| | | } |
| | |
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType);
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) throws InviteOrderSubsidyException;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | |
|
| | | public interface InviteOrderSubsidyServiceV2 {
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public InviteOrderSubsidy getByOrderNoAndTypeForUpdate(Long uid, String orderNo, Integer type);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 添加或修改(按照订单号与来源)
|
| | |
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void addOrUpdateByOrder(String orderId, int sourceType) throws InviteOrderSubsidyException;
|
| | | public void addOrUpdateByOrder(String orderId, int sourceType)
|
| | | throws InviteOrderSubsidyException, OrderTeamRewardException, CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 根据订单号与来源查询
|
| | |
| | | */
|
| | | public void invalidByOrderIdAndSourceType(String orderId, int sourceType);
|
| | |
|
| | | |
| | | /**
|
| | | * 使订单号对应的数据有效
|
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType);
|
| | | |
| | | |
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType) throws InviteOrderSubsidyException;
|
| | |
|
| | | /**
|
| | | * 结算金额
|
| | | * @param id
|
| | | * @param money
|
| | | */
|
| | | public void settleById(Long id,BigDecimal money);
|
| | | public void settleById(Long id, BigDecimal money);
|
| | | }
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal computeFirstInviteMoney(CommonOrder order,UserLevelEnum buyer);
|
| | | public BigDecimal computeFirstInviteMoney(CommonOrder order, UserLevelEnum buyer);
|
| | |
|
| | | /**
|
| | | * 计算间接粉丝邀请奖金
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal computeSecondInviteMoney(CommonOrder order,UserLevelEnum buyer);
|
| | | public BigDecimal computeSecondInviteMoney(CommonOrder order, UserLevelEnum buyer);
|
| | |
|
| | | /**
|
| | | * 计算直接粉丝团队补贴
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal computeFirstTeamSubsidy(BigDecimal fanLiMoney,Date placeOrderTime, UserLevelEnum buyerUserLevel, UserLevelEnum userLevel);
|
| | | public BigDecimal computeFirstTeamSubsidy(BigDecimal fanLiMoney, Date placeOrderTime, UserLevelEnum buyerUserLevel,
|
| | | UserLevelEnum userLevel);
|
| | |
|
| | | /**
|
| | | * 计算间接粉丝团队补贴
|
| | |
| | | * @throws
|
| | | */
|
| | |
|
| | | public BigDecimal computeSecondTeamSubsidy(BigDecimal fanLiMoney,Date placeOrderTime, UserLevelEnum buyerUserLevel,
|
| | | public BigDecimal computeSecondTeamSubsidy(BigDecimal fanLiMoney, Date placeOrderTime, UserLevelEnum buyerUserLevel,
|
| | | UserLevelEnum userLevel);
|
| | |
|
| | | /**
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal computeFirstTeamReward(BigDecimal firstTeamSubsidy,Date placeOrderTime, BigDecimal secondTeamSubsidy,
|
| | | UserLevelEnum userLevel);
|
| | | public BigDecimal computeFirstTeamReward(BigDecimal firstTeamSubsidy, Date placeOrderTime, UserLevelEnum userLevel);
|
| | |
|
| | | |
| | | /**
|
| | | * 计算二级团队奖励
|
| | | * @Title: computeSecondTeamReward
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal computeSecondTeamReward(BigDecimal secondTeamSubsidy,Date placeOrderTime, UserLevelEnum userLevel);
|
| | | public BigDecimal computeSecondTeamReward(BigDecimal secondTeamSubsidy, Date placeOrderTime,
|
| | | UserLevelEnum userLevel);
|
| | |
|
| | | }
|
| | |
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void ziGouSettle(String orderId, int sourceType,String taskKey) throws OrderMoneySettleException;
|
| | | public void ziGouSettle(String orderId, int sourceType, String taskKey) throws OrderMoneySettleException;
|
| | |
|
| | | /**
|
| | | * 邀请补贴结算
|
| | |
| | | * @throws OrderMoneySettleException
|
| | | */
|
| | | public void inviteSubsidySettle(Long uid, String taskKey) throws OrderMoneySettleException;
|
| | |
|
| | | /**
|
| | | * 团队奖励到账
|
| | | * @Title: orderTeamRewardSettle
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void orderTeamRewardSettle(Long uid) throws OrderMoneySettleException;
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.OrderItemException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | |
| | | public void fanliInvaiteAndShare(Long uid) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 团队奖励到账
|
| | | * @Title: fanliOrderTeamReward
|
| | | * @Description: |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void fanliOrderTeamReward();
|
| | |
|
| | | /**
|
| | | * 团队奖励到账(按用户)
|
| | | * @Title: fanliOrderTeamReward
|
| | | * @Description: |
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void fanliOrderTeamReward(Long uid) throws OrderMoneySettleException;
|
| | |
|
| | | /**
|
| | | * 订单维权
|
| | | *
|
| | | * @param orderList
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public OrderTeamReward getByOrderNoAndTypeForUpdate(Long uid, String orderNo, Integer type);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 添加或修改(按照订单号与来源)
|
| | |
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void addOrUpdateByOrder(String orderId, int sourceType) throws OrderTeamRewardException;
|
| | | public void addOrUpdate(InviteOrderSubsidy subsidy, BigDecimal money, Long uid,int level)
|
| | | throws OrderTeamRewardException;
|
| | |
|
| | | /**
|
| | | * 根据订单号与来源查询
|
| | |
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void invalidByOrderIdAndSourceType(String orderId, int sourceType);
|
| | | public void invalidByOrderIdAndSourceType(Long subsidyId);
|
| | |
|
| | | |
| | | /**
|
| | | * 使订单号对应的数据有效
|
| | | * @param orderId
|
| | | * @param sourceType
|
| | | */
|
| | | public void validByOrderIdAndSourceType(String orderId, int sourceType);
|
| | | |
| | | |
| | | public void validByOrderIdAndSourceType(Long subsidyId,Date preGetTime);
|
| | |
|
| | | /**
|
| | | * 结算金额
|
| | | * @param id
|
| | | * @param money
|
| | | */
|
| | | public void settleById(Long id,BigDecimal money);
|
| | | public void settleById(Long id, BigDecimal money);
|
| | | |
| | | /**
|
| | | * 根据补贴ID获取团队奖励
|
| | | * @Title: listBySubsidyId
|
| | | * @Description: |
| | | * @param subsidyId
|
| | | * @return |
| | | * List<OrderTeamReward> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<OrderTeamReward> listBySubsidyId(Long subsidyId);
|
| | | |
| | | |
| | | /**
|
| | | * 查询可以结算的
|
| | | * @Title: listCanSettle
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<OrderTeamReward> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<OrderTeamReward> listCanSettle(Long uid,int page,int pageSize);
|
| | | |
| | | /**
|
| | | * 统计可以结算的数量
|
| | | * @Title: countCanSettle
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long countCanSettle(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 能够结算的用户ID列表
|
| | | * @Title: listCanSettleUid
|
| | | * @Description: |
| | | * @param page
|
| | | * @param count
|
| | | * @return |
| | | * List<Long> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<Long> listCanSettleUid(Date time, int page,int count);
|
| | | |
| | | |
| | | /**
|
| | | * 能够结算的用户ID数量
|
| | | * @Title: countCanSettleUid
|
| | | * @Description: |
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long countCanSettleUid(Date time);
|
| | | |
| | | |
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
|
| | | |
| | | |
| | | /**
|
| | | * 获取上几级邀请人
|
| | | * @Title: getMyBossDeepList
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param deep 上deep级
|
| | | * @return |
| | | * List<ThreeSale> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid,int deep);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean isVIP(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 在某个时间是否为VIP
|
| | | * @Title: isVIP
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param time
|
| | | * @return |
| | | * boolean 返回类型
|
| | | * @throws
|
| | | */
|
| | | public boolean isVIP(Long uid,Long time);
|
| | |
|
| | | /**
|
| | | * 根据UID检索
|
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | |
| | | * @return
|
| | | */
|
| | | public UserVIPPreInfo getLatestProcessInfo(Long uid);
|
| | | |
| | | /**
|
| | | * 获取某个时间的进度
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserVIPPreInfo getProcessInfo(Long uid,Date time);
|
| | |
|
| | | /**
|
| | | * 会员等级添加并验证
|
| | |
| | | package com.yeshi.fanli.service.manger.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
| | | return UserLevelEnum.daRen;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取当时的用户等级
|
| | | * @Title: getUserLevel
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param date
|
| | | * @return |
| | | * UserLevelEnum 返回类型
|
| | | * @throws
|
| | | */
|
| | | public UserLevelEnum getUserLevel(Long uid, Date date) {
|
| | | if (userVIPInfoService.isVIP(uid, date.getTime()))
|
| | | return UserLevelEnum.superVIP;
|
| | | UserVIPPreInfo info = userVIPPreInfoService.getProcessInfo(uid, date);
|
| | | if (info != null)
|
| | | for (UserLevelEnum level : UserLevelEnum.values())
|
| | | if (level.getLevel() == info.getProcess())
|
| | | return level;
|
| | | return UserLevelEnum.daRen;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
|
| | | private static CMQManager cmqManager;
|
| | | private static CMQUtil cmqUtil;
|
| | | // TODO 订单处理队列
|
| | | // 订单处理队列
|
| | | public static String QUEUENAME_ORDER = "fanli-orders";
|
| | |
|
| | | // 刚刚产生的订单处理队列
|
| | |
| | |
|
| | | // 提现结果处理队列
|
| | | public static String EXTRACT_RESULT = "extract-result";
|
| | | // TODO IOS推送队列
|
| | | // IOS推送队列
|
| | | public static String PUSH_IOS = "push-ios";
|
| | |
|
| | | // TODO 返利队列
|
| | | // 返利队列
|
| | | public static String FANLI_ORDER = "fanli-order";
|
| | |
|
| | | // TODO 返利队列
|
| | | // 返利队列
|
| | | public static String FANLI_ORDER_NEW = "fanli-order-new";
|
| | |
|
| | | // TODO 提成订单
|
| | | // 提成订单
|
| | | public static String FANLI_TICHENG_ORDER = "fanli-ticheng-order";
|
| | | // TODO 维权订单
|
| | | |
| | | // 团队奖励到账
|
| | | 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";
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | FANLI_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();
|
| | |
|
| | |
| | | cmqUtil.createQueue(FANLI_ORDER);
|
| | | cmqUtil.createQueue(FANLI_ORDER_NEW);
|
| | | cmqUtil.createQueue(FANLI_TICHENG_ORDER);
|
| | | cmqUtil.createQueue(FANLI_ORDER_TEAM_REWARD);
|
| | | cmqUtil.createQueue(ORDER_WEIQUAN);
|
| | | cmqUtil.createQueue(GOODS_UPDATE);
|
| | | cmqUtil.createQueue(IMPORTANT_GOODS_UPDATE);
|
| | |
| | | cmqUtil.deleteMsg(FANLI_TICHENG_ORDER, receiptHandle);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | // 团队奖励
|
| | | public void addFanLiOrderTeamRewardMsg(Long uid) {
|
| | | cmqUtil.sendMsg(FANLI_ORDER_TEAM_REWARD, uid + "");
|
| | | }
|
| | |
|
| | | public Map<String, Long> consumeOrderTeamRewardMsg(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER_TEAM_REWARD);
|
| | | Map<String, Long> map = new HashMap<>();
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | map.put(msg.receiptHandle, Long.parseLong(result));
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void deleteOrderTeamRewardMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER_TEAM_REWARD, receiptHandle);
|
| | | }
|
| | | |
| | | // 维权订单
|
| | | public void addWeiQuanOrderMsg(TaoBaoWeiQuanOrder order) {
|
| | | cmqUtil.sendMsg(ORDER_WEIQUAN, new Gson().toJson(order));
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
|
| | |
| | | doTaoBaoOrders();// 处理淘宝订单
|
| | | doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
|
| | | doOrderFanLiNew();// 新版返利
|
| | | // doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doOrderTeamRewardFanLi();// 团队奖励到账
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | | doUserMoneyDebtJob();// 债务偿还
|
| | |
| | | try {
|
| | | HongBaoV2 hongbao = map.get(handler);
|
| | | if (hongbao != null) {
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.hongBaoFanLi, hongbao.getId() + "");
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.hongBaoFanLi,
|
| | | hongbao.getId() + "");
|
| | | if (StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | // 处理之后要隔2小时再次进行处理
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 订单团队奖励到账
|
| | | */
|
| | | public void doOrderTeamRewardFanLi() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | |
|
| | | Map<String, Long> map = CMQManager.getInstance().consumeOrderTeamRewardMsg(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String handler = its.next();
|
| | | try {
|
| | | orderProcessService.fanliOrderTeamReward(map.get(handler));
|
| | | CMQManager.getInstance().deleteOrderTeamRewardMsg(handler);
|
| | | } catch (OrderMoneySettleException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理淘宝订单维权
|
| | | */
|
| | | public void doWeiQuanOrder() {
|
| | |
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static UserMoneyDetail createOrderTeamReward(Long uid,BigDecimal money, Date time)
|
| | | throws UserMoneyDetailException {
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (uid == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | if (time == null)
|
| | | throw new UserMoneyDetailException(1, "发生时间为空");
|
| | |
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.orderTeamReward.name() + "-" + uid + "-" + timeF));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(
|
| | | timeF + UserMoneyDetailTypeEnum.orderTeamReward.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.orderTeamReward);
|
| | | detail.setDescInfo("团队奖励");
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | public class CommonOrderFactory {
|
| | |
|
| | |
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | public static CommonOrder create(TaoBaoOrder taoBaoOrder) {
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(taoBaoOrder.getCount());
|
| | | commonOrder.setCreateTime(new Date());
|
| | | if (taoBaoOrder.geteIncome() != null && taoBaoOrder.getSubsidy() != null)
|
| | | commonOrder.seteIncome(taoBaoOrder.geteIncome().add(taoBaoOrder.getSubsidy()));
|
| | | else
|
| | | commonOrder.seteIncome(taoBaoOrder.geteIncome());
|
| | | commonOrder.setEstimate(taoBaoOrder.getEstimate());
|
| | | commonOrder.setOrderNo(taoBaoOrder.getOrderId());
|
| | | commonOrder.setPayment(taoBaoOrder.getPayment());
|
| | | commonOrder.setSettlement(taoBaoOrder.getSettlement());
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
|
| | | commonOrder.setSettleTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setSourcePosition(String.format("mm_%s_%s_%s", "124933865", taoBaoOrder.getSourceMediaId(),
|
| | | taoBaoOrder.getAdPositionId()));
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | int state = 0;
|
| | | if ("订单付款".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单成功".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单失效".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | } else if ("订单结算".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_JS;
|
| | | }
|
| | | commonOrder.setOrderBy(taoBaoOrder.getOrderBy());
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(taoBaoOrder.getTradeId());
|
| | |
|
| | | return commonOrder;
|
| | | }
|
| | | }
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 团队奖励
|
| | | * @Title: createOrderTeamRewardMsg
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param date
|
| | | * @param from
|
| | | * @param money
|
| | | * @param balance
|
| | | * @param beiZhu
|
| | | * @return |
| | | * MsgMoneyDetail 返回类型
|
| | | * @throws
|
| | | */
|
| | | public static MsgMoneyDetail createOrderTeamRewardMsg(Long uid, Date date, String from, BigDecimal money,
|
| | | BigDecimal balance, String beiZhu) {
|
| | | if (money == null || money == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.orderTeamReward);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(date);
|
| | | detail.setStateDesc(String.format("%s年%s月团队奖励到账", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)));
|
| | | detail.setDesc(from);
|
| | |
|
| | | return detail;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 红包相关信息
|
| | |
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_subsidy.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.orderTeamReward) { // 团队奖励
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getStateDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("来源", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账户余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackReceiveOff) { // 红包成功领取
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.order;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.exception.mq.MQUnSendInfoException;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | | import com.yeshi.fanli.exception.order.OrderTeamRewardException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyServiceV2;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | |
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyServiceV2 inviteOrderSubsidyServiceV2;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderMoneySettleService orderMoneySettleService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | // 团队奖励开始时间
|
| | | private static final long TEAM_REWARD_START_TIME = TimeUtil.convertToTimeTemp("2019-04-15", "yyyy-MM-dd");
|
| | |
|
| | | public InviteOrderSubsidyMessageListener() {
|
| | |
|
| | |
| | | // 查询上级红包
|
| | | OrderMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (dto != null) {
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | // 查询出订单创建时间
|
| | | Date orderTime = commonOrderService.getThirdCreateTime(dto.getOrderId(), dto.getType());
|
| | | if (orderTime.getTime() >= TEAM_REWARD_START_TIME) {
|
| | | try {
|
| | | inviteOrderSubsidyServiceV2.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | return Action.CommitMessage;
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, new Gson().toJson(dto), "");
|
| | | } catch (OrderTeamRewardException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, new Gson().toJson(dto), "");
|
| | | } catch (CommonOrderException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, new Gson().toJson(dto), "");
|
| | | }
|
| | | return Action.ReconsumeLater;
|
| | | } else {
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | LogHelper.errorDetailInfo(e, new Gson().toJson(dto), "");
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | |
| | | && record.getCouponType()
|
| | | .equalsIgnoreCase(SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name())
|
| | | && record.getGoodSource() == dto.getSourceType()) {// 成功使用了奖励券
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | |
|
| | | Date orderTime = commonOrderService.getThirdCreateTime(dto.getOrderId(), dto.getType());
|
| | | if (orderTime.getTime() >= TEAM_REWARD_START_TIME) {
|
| | | inviteOrderSubsidyServiceV2.invalidByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | } else
|
| | |
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | } else {
|
| | | // 使数据有效
|
| | | inviteOrderSubsidyService.validByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | try {
|
| | | Date orderTime = commonOrderService.getThirdCreateTime(dto.getOrderId(),
|
| | | dto.getType());
|
| | | if (orderTime.getTime() >= TEAM_REWARD_START_TIME) {
|
| | | inviteOrderSubsidyServiceV2.validByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | } else
|
| | |
|
| | | inviteOrderSubsidyService.validByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | e.printStackTrace();
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | dto.getSourceType());
|
| | | if (count > 0) {
|
| | | // 使相关订单失效
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(), dto.getSourceType());
|
| | | Date orderTime = commonOrderService.getThirdCreateTime(dto.getOrderId(), dto.getSourceType());
|
| | | if (orderTime.getTime() >= TEAM_REWARD_START_TIME) {
|
| | | inviteOrderSubsidyServiceV2.invalidByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | } else
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2SettleTempService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2SettleTempService hongBaoV2SettleTempService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
| | | return TimeUtil.convertToTimeTemp(time, "yyyy-M-dd HH:mm:ss");
|
| | | }
|
| | |
|
| | | public static CommonOrder convert(TaoBaoOrder taoBaoOrder) {
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(taoBaoOrder.getCount());
|
| | | commonOrder.setCreateTime(new Date());
|
| | | if (taoBaoOrder.geteIncome() != null && taoBaoOrder.getSubsidy() != null)
|
| | | commonOrder.seteIncome(taoBaoOrder.geteIncome().add(taoBaoOrder.getSubsidy()));
|
| | | else
|
| | | commonOrder.seteIncome(taoBaoOrder.geteIncome());
|
| | | commonOrder.setEstimate(taoBaoOrder.getEstimate());
|
| | | commonOrder.setOrderNo(taoBaoOrder.getOrderId());
|
| | | commonOrder.setPayment(taoBaoOrder.getPayment());
|
| | | commonOrder.setSettlement(taoBaoOrder.getSettlement());
|
| | | if (!StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
|
| | | commonOrder.setSettleTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setSourcePosition(String.format("mm_%s_%s_%s", "124933865", taoBaoOrder.getSourceMediaId(),
|
| | | taoBaoOrder.getAdPositionId()));
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | int state = 0;
|
| | | if ("订单付款".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单成功".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if ("订单失效".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | } else if ("订单结算".equalsIgnoreCase(taoBaoOrder.getOrderState())) {
|
| | | state = CommonOrder.STATE_JS;
|
| | | }
|
| | | commonOrder.setOrderBy(taoBaoOrder.getOrderBy());
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(taoBaoOrder.getTradeId());
|
| | |
|
| | | return commonOrder;
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取一组订单的hash值
|
| | | *
|
| | |
| | | import org.junit.Test;
|
| | | import org.yeshi.utils.mybatis.ColumnParseUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | |
|
| | | //@Ignore
|
| | | public class MyBatisProduce {
|
| | |
| | | public void test3() { |
| | | }
|
| | |
|
| | | // @Test
|
| | | @Test
|
| | | public void test1() {
|
| | | ColumnParseUtil.parseColumn(CommonOrder.class,
|
| | | "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml");
|
| | | ColumnParseUtil.parseColumn(OrderTeamReward.class,
|
| | | "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderTeamRewardMapper.xml");
|
| | | }
|
| | |
|
| | | }
|