| | |
| | | public interface IntegralDetailMapper extends BaseMapper<IntegralDetail> { |
| | | |
| | | /** |
| | | * 根据唯一值查询明细 |
| | | * @param uniqueKey |
| | | * @return |
| | | */ |
| | | IntegralDetail getDetailByUniqueKey(@Param("uniqueKey")String uniqueKey); |
| | | |
| | | /** |
| | | * 获取用户总共有多少记录数据 |
| | | * |
| | | * @param uid |
| | |
| | | private String remark; // 备注
|
| | |
|
| | | @Expose
|
| | | @Column(name = "td_unique_key")
|
| | | private String uniqueKey; // 唯一值
|
| | |
|
| | | @Expose
|
| | | @Column(name = "td_create_time")
|
| | | private Date createTime;
|
| | |
|
| | |
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public String getUniqueKey() {
|
| | | return uniqueKey;
|
| | | }
|
| | |
|
| | | public void setUniqueKey(String uniqueKey) {
|
| | | this.uniqueKey = uniqueKey;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | <result column="td_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="td_desc_info" property="descInfo" jdbcType="VARCHAR"/> |
| | | <result column="td_remark" property="remark" jdbcType="VARCHAR"/> |
| | | <result column="td_unique_key" property="uniqueKey" jdbcType="VARCHAR"/> |
| | | <result column="td_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | |
| | | <result column="dateFormate" property="dateFormate" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">td_id,td_uid,td_money,td_title,td_desc_info,td_remark,td_create_time</sql> |
| | | <sql id="Base_Column_List">td_id,td_uid,td_money,td_title,td_desc_info,td_remark,td_unique_key,td_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_integral_detail where td_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_integral_detail where td_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_detail (td_id,td_uid,td_money,td_title,td_desc_info,td_remark,td_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=INTEGER},#{title,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_detail (td_id,td_uid,td_money,td_title,td_desc_info,td_remark,td_unique_key,td_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=INTEGER},#{title,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{uniqueKey,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_detail |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">td_id,</if> |
| | |
| | | <if test="title != null">td_title,</if> |
| | | <if test="descInfo != null">td_desc_info,</if> |
| | | <if test="remark != null">td_remark,</if> |
| | | <if test="uniqueKey != null">td_unique_key,</if> |
| | | <if test="createTime != null">td_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="descInfo != null">#{descInfo,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="uniqueKey != null">#{uniqueKey,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail">update yeshi_ec_integral_detail set td_uid = #{uid,jdbcType=BIGINT},td_money = #{money,jdbcType=INTEGER},td_title = #{title,jdbcType=VARCHAR},td_desc_info = #{descInfo,jdbcType=VARCHAR},td_remark = #{remark,jdbcType=VARCHAR},td_create_time = #{createTime,jdbcType=TIMESTAMP} where td_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail">update yeshi_ec_integral_detail set td_uid = #{uid,jdbcType=BIGINT},td_money = #{money,jdbcType=INTEGER},td_title = #{title,jdbcType=VARCHAR},td_desc_info = #{descInfo,jdbcType=VARCHAR},td_remark = #{remark,jdbcType=VARCHAR},td_unique_key = #{uniqueKey,jdbcType=VARCHAR},td_create_time = #{createTime,jdbcType=TIMESTAMP} where td_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.IntegralDetail">update yeshi_ec_integral_detail |
| | | <set> |
| | | <if test="uid != null">td_uid=#{uid,jdbcType=BIGINT},</if> |
| | |
| | | <if test="title != null">td_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="descInfo != null">td_desc_info=#{descInfo,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">td_remark=#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="uniqueKey != null">td_unique_key=#{uniqueKey,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">td_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where td_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getDetailByUniqueKey" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_integral_detail |
| | | WHERE td_unique_key = #{uniqueKey} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectCountByUid" resultType="java.lang.Long" parameterType="java.lang.Long"> |
| | | SELECT count(td_id) FROM yeshi_ec_integral_detail |
| | |
| | | </trim> |
| | | </foreach> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | integralDetailMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public IntegralDetail getDetailByUniqueKey(String uniqueKey) {
|
| | | return integralDetailMapper.getDetailByUniqueKey(uniqueKey);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<IntegralDetailVO> listDetailForClient(Long uid, Long detailId, Date maxTime, Integer type) {
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
| | | @Resource
|
| | | private IntegralTaskService integralTaskService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private IntegralTaskClassService integralTaskClassService;
|
| | |
|
| | |
| | | return integralTaskRecordMapper.listByUidAndTaskId(uid, taskId, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 被邀请人下了首单(第一笔返利订单) 直接给邀请人一笔金币
|
| | | * @param uid
|
| | | */
|
| | | |
| | | @Async()
|
| | | @Override
|
| | | public void firstOrderRewardInviter(Long uid, String beizu) {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null) |
| | | public void firstRebateOrderRewardBoss(Long uid, Long originUid, String beizu) {
|
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | |
|
| | | String reward = configService.get("first_order_reward_boss");
|
| | | if (StringUtil.isNullOrEmpty(reward))
|
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
|
| | | }
|
| | | |
| | | @Async()
|
| | | @Override
|
| | | public void firstRebateOrderRewardBossSuper(Long uid, Long originUid, String beizu) {
|
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | | |
| | | String reward = configService.get("first_order_reward_boss_super");
|
| | | if (StringUtil.isNullOrEmpty(reward)) |
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "二", beizu);
|
| | | }
|
| | | |
| | | |
| | | @Async()
|
| | | @Override
|
| | | public void firstShareOrderReward(Long uid, String beizu) {
|
| | | if(uid == null)
|
| | | return;
|
| | | |
| | | String reward = configService.get("first_share_order_reward");
|
| | | if (StringUtil.isNullOrEmpty(reward)) |
| | | return;
|
| | | firstOrderReward(uid, null, Integer.parseInt(reward), null, beizu);
|
| | | }
|
| | | |
| | | |
| | | @Async()
|
| | | @Override
|
| | | public void firstSharerOrderRewardBoss(Long uid, Long originUid, String beizu) {
|
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | | |
| | | String reward = configService.get("first_share_order_reward_boss");
|
| | | if (StringUtil.isNullOrEmpty(reward)) |
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 队员首单奖励金币
|
| | | * @param uid
|
| | | * @param addGoldCoin
|
| | | * @param level 所属哪级队员
|
| | | * @param beizu
|
| | | */
|
| | | private void firstOrderReward(Long uid, Long originUid, Integer addGoldCoin, String level, String beizu) {
|
| | | if (uid == null)
|
| | | return;
|
| | | String uniqueKey = uid.toString();
|
| | | if (originUid != null) |
| | | uniqueKey = uniqueKey + "-" + originUid;
|
| | | |
| | | // 判断是否已领取
|
| | | IntegralDetail detailRecord = integralDetailService.getDetailByUniqueKey(uniqueKey);
|
| | | if (detailRecord != null)
|
| | | return;
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null) |
| | | return;
|
| | |
|
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null)
|
| | | goldCoin = 0;
|
| | | |
| | | int addGoldCoin = Integer.parseInt(reward);
|
| | | goldCoin = goldCoin + addGoldCoin;
|
| | |
|
| | | try {
|
| | | // 增加金币
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setGoldCoin(goldCoin);
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | return;
|
| | | }
|
| | |
|
| | | // 金币详情
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("队员首笔奖励");
|
| | | detail.setTitle("金币奖励");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(addGoldCoin);
|
| | | detail.setRemark(beizu);
|
| | | detail.setUniqueKey(uniqueKey);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | |
|
| | | // 消息
|
| | | MsgOtherRewardIntegralDTO msgOther = new MsgOtherRewardIntegralDTO();
|
| | | msgOther.setTitle("金币奖励");
|
| | | msgOther.setSource("一级队员首笔下单,系统奖励邀请人金币");
|
| | | msgOther.setNum(addGoldCoin + "金币");
|
| | | msgOther.setTotal(goldCoin + "金币");
|
| | | msgOther.setExplain("仅一级队员首笔下单奖励");
|
| | | userOtherMsgNotificationService.firstOrderRewardMsg(uid, "订单已到账后系统会自动奖励", msgOther);
|
| | | if (StringUtil.isNullOrEmpty(level)) {
|
| | | msgOther.setSource("首笔分享订单,系统奖励金币 ");
|
| | | msgOther.setExplain("首笔分享订单得到的奖金不足0.01元时奖励 ");
|
| | | } else {
|
| | | msgOther.setSource(level + "级队员首次下单,系统奖励金币 ");
|
| | | msgOther.setExplain("仅新邀请队员首下单你得到的奖金不足0.01元时奖励 ");
|
| | | }
|
| | | |
| | | userOtherMsgNotificationService.firstOrderRewardMsg(uid, null, msgOther);
|
| | | }
|
| | | }
|
| | |
| | | */
|
| | | public void insertSelective(IntegralDetail record);
|
| | |
|
| | | |
| | | /**
|
| | | * 唯一值查询
|
| | | * @param uniqueKey
|
| | | * @return
|
| | | */
|
| | | public IntegralDetail getDetailByUniqueKey(String uniqueKey);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public long countByCidAndUidAndCreateTime(Long cid,Long uid, Date minTime, Date maxTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 被邀请人下了首单(第一笔返利订单),则直接给邀请人一笔金币进入到金币余额中(金币的额度暂定为1500金币)
|
| | | * @param uid 邀请人id
|
| | | * @param beizu 备注信息
|
| | | * 补偿上级 :一级队员首笔返利订单不足0.01元
|
| | | * @param uid
|
| | | * @param beizu
|
| | | */
|
| | | public void firstOrderRewardInviter(Long uid, String beizu);
|
| | | public void firstRebateOrderRewardBoss(Long uid, Long originUid, String beizu);
|
| | |
|
| | | /**
|
| | | * 补偿上上级:二级队员首笔返利订单不足0.01元
|
| | | * @param uid
|
| | | * @param beizu
|
| | | */
|
| | | public void firstRebateOrderRewardBossSuper(Long uid, Long originUid,String beizu);
|
| | |
|
| | | /**
|
| | | * 首笔分享订单不足0.01元补偿
|
| | | * @param uid
|
| | | * @param beizu
|
| | | */
|
| | | public void firstShareOrderReward(Long uid, String beizu);
|
| | |
|
| | | /**
|
| | | * 补偿上级 :首笔分享订单不足0.01元补偿
|
| | | * @param uid
|
| | | * @param beizu
|
| | | */
|
| | | public void firstSharerOrderRewardBoss(Long uid, Long originUid, String beizu);
|
| | |
|
| | | }
|