Browse Source

会员等级增加成长值

zyj
sj 2 years ago
parent
commit
b6a9c87e2a
  1. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java
  2. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponUserMapper.java
  3. 1
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java
  4. 8
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  5. 2
      zsw-bxg/src/main/java/co/yixiang/modules/shop/domain/YxSystemUserLevel.java
  6. 2
      zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxSystemUserLevel.java
  7. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java
  8. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUserLevel.java
  9. 6
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/YxUserService.java
  10. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelDto.java
  11. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/dto/YxUserDto.java
  12. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java
  13. 19
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserLevelServiceImpl.java
  14. 18
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserServiceImpl.java
  15. 5
      zsw-bxg/src/main/java/co/yixiang/modules/user/vo/YxSystemUserLevelQueryVo.java
  16. 3
      zsw-bxg/src/main/java/co/yixiang/modules/user/vo/YxUserQueryVo.java

4
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java

@ -25,7 +25,7 @@ import java.util.List;
*/ */
@Repository @Repository
public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue> { public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue> {
@Select("<script>select A.cid,A.end_time as endTime,A.start_time as startTime,A.cname,A.ctype," + @Select("<script>select A.cid,A.use_end_time as endTime,A.start_time as startTime,A.cname,A.ctype," +
"A.is_permanent as isPermanent,A.remain_count as remainCount," + "A.is_permanent as isPermanent,A.remain_count as remainCount," +
"A.total_count as totalCount,A.id,B.coupon_price as couponPrice," + "A.total_count as totalCount,A.id,B.coupon_price as couponPrice," +
"B.use_min_price as useMinPrice" + "B.use_min_price as useMinPrice" +
@ -33,7 +33,7 @@ public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue>
"on A.cid = B.id " + "on A.cid = B.id " +
"where A.status =1 <if test='type == 1'> AND B.type = #{type} AND FIND_IN_SET(#{productId},product_id)</if> " + "where A.status =1 <if test='type == 1'> AND B.type = #{type} AND FIND_IN_SET(#{productId},product_id)</if> " +
"<if test='type == 0'> AND B.type in (0,1)</if>" + "<if test='type == 0'> AND B.type in (0,1)</if>" +
" AND ( A.start_time &lt; now() AND A.end_time &gt; now() ) " + " AND ( A.start_time &lt; now() AND A.use_end_time &gt; now() ) " +
" AND A.is_del = 0 AND " + " AND A.is_del = 0 AND " +
"( A.remain_count > 0 OR A.is_permanent = 1 ) ORDER BY B.sort DESC</script>") "( A.remain_count > 0 OR A.is_permanent = 1 ) ORDER BY B.sort DESC</script>")
List<YxStoreCouponIssueQueryVo> selecCoupontList(Page page,@Param("type") Integer type, List<YxStoreCouponIssueQueryVo> selecCoupontList(Page page,@Param("type") Integer type,

4
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponUserMapper.java

@ -25,12 +25,12 @@ import java.util.List;
@Repository @Repository
public interface YxStoreCouponUserMapper extends CoreMapper<YxStoreCouponUser> { public interface YxStoreCouponUserMapper extends CoreMapper<YxStoreCouponUser> {
@Select("select A.id,A.coupon_title as couponTitle,A.coupon_price as couponPrice," + @Select("select A.id,A.coupon_title as couponTitle,A.coupon_price as couponPrice," +
"A.end_time as endTime,B.use_min_price as useMinPrice,B.type," + "A.use_end_time as endTime,B.use_min_price as useMinPrice,B.type," +
"B.product_id as productId" + "B.product_id as productId" +
" from yx_store_coupon_user A left join yx_store_coupon B " + " from yx_store_coupon_user A left join yx_store_coupon B " +
"on A.cid = B.id " + "on A.cid = B.id " +
"where A.status = 0" + "where A.status = 0" +
" AND A.end_time > #{now} " + " AND A.use_end_time > #{now} " +
" AND A.uid = #{uid} AND A.use_min_price <= #{price} " + " AND A.uid = #{uid} AND A.use_min_price <= #{price} " +
" ORDER BY B.id DESC") " ORDER BY B.id DESC")
List<StoreCouponUserVo> selectCouponList(@Param("now") Date now, @Param("price") double price, List<StoreCouponUserVo> selectCouponList(@Param("now") Date now, @Param("price") double price,

1
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java

@ -41,7 +41,6 @@ public class YxEvaluation implements Serializable {
/** 评测视频 */ /** 评测视频 */
@NotBlank
private String videoInput; private String videoInput;

8
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -1539,10 +1539,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
//增加用户购买次数 //增加用户购买次数
userService.incPayCount(orderInfo.getUid()); userService.incPayCount(orderInfo.getUid());
//用户累计消费 //更新用户当前成长值
double sumPrice=storeOrderMapper.sumPrice(orderInfo.getUid()); userService.upGrowth(orderInfo.getUid());
//修改用户当前成长值 //判断是否满足会员等级升级,并更新用户等级
bxgUserMapper.selectById(orderInfo.getUid()).setGrowth((int) Math.round(sumPrice)); userLevelService.setLevelComplete(orderInfo.getUid());
//增加状态 //增加状态
orderStatusService.create(orderInfo.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(), orderStatusService.create(orderInfo.getId(), OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),

2
zsw-bxg/src/main/java/co/yixiang/modules/shop/domain/YxSystemUserLevel.java

@ -87,6 +87,8 @@ public class YxSystemUserLevel extends BaseDomain {
@TableField(value = "`explain`") @TableField(value = "`explain`")
private String explain; private String explain;
/** 会员等级所需成长值*/
private Integer growthValue;
public void copy(YxSystemUserLevel source){ public void copy(YxSystemUserLevel source){

2
zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxSystemUserLevel.java

@ -33,6 +33,8 @@ public class YxSystemUserLevel extends BaseDomain {
/** 等级id */ /** 等级id */
private Integer levelId; private Integer levelId;
/** 等级所需成长值 */
private Integer growthValue;
/** 排序 */ /** 排序 */
private Integer sort; private Integer sort;

3
zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java

@ -113,6 +113,9 @@ public class YxUser extends BaseDomain {
/** 用户剩余积分 */ /** 用户剩余积分 */
private BigDecimal integral; private BigDecimal integral;
/** 用户获得成长值*/
private Integer growth;
/** 连续签到天数 */ /** 连续签到天数 */
private Integer signNum; private Integer signNum;

3
zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUserLevel.java

@ -35,6 +35,9 @@ public class YxUserLevel extends BaseDomain {
@ApiModelProperty(value = "会员等级") @ApiModelProperty(value = "会员等级")
private Integer grade; private Integer grade;
@ApiModelProperty(value = "会员当前成长值")
private Integer growth;
@ApiModelProperty(value = "过期时间") @ApiModelProperty(value = "过期时间")
private Integer validTime; private Integer validTime;

6
zsw-bxg/src/main/java/co/yixiang/modules/user/service/YxUserService.java

@ -77,6 +77,12 @@ public interface YxUserService extends BaseService<YxUser>{
*/ */
void incPayCount(Long uid); void incPayCount(Long uid);
/**
* 更新会员当前成长值
* @param uid uid
*/
void upGrowth(Long uid);
/** /**
* 减去用户余额 * 减去用户余额
* @param uid uid * @param uid uid

3
zsw-bxg/src/main/java/co/yixiang/modules/user/service/dto/YxSystemUserLevelDto.java

@ -52,6 +52,9 @@ public class YxSystemUserLevelDto implements Serializable {
/** 会员图标 */ /** 会员图标 */
private String icon; private String icon;
/** 达成当前等级所需成长值 */
private Integer growthValue;
/** 规则说明 */ /** 规则说明 */
private String explain; private String explain;

3
zsw-bxg/src/main/java/co/yixiang/modules/user/service/dto/YxUserDto.java

@ -82,6 +82,9 @@ public class YxUserDto implements Serializable {
/** 等级 */ /** 等级 */
private Integer level; private Integer level;
/** 成长值 */
private Integer growth;
/** 推广元id */ /** 推广元id */
private Long spreadUid; private Long spreadUid;

3
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java

@ -194,8 +194,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
map.put("享受折扣", yxSystemUserLevel.getDiscount()); map.put("享受折扣", yxSystemUserLevel.getDiscount());
map.put("会员卡背景", yxSystemUserLevel.getImage()); map.put("会员卡背景", yxSystemUserLevel.getImage());
map.put("会员图标", yxSystemUserLevel.getIcon()); map.put("会员图标", yxSystemUserLevel.getIcon());
map.put("规则说明", yxSystemUserLevel.getExplain()); map.put("会员规则说明", yxSystemUserLevel.getExplain());
map.put("会员权益说明", yxSystemUserLevel.getBenefit()); map.put("会员权益说明", yxSystemUserLevel.getBenefit());
map.put("所需成长值",yxSystemUserLevel.getGrowthValue());
map.put("添加时间", yxSystemUserLevel.getAddTime()); map.put("添加时间", yxSystemUserLevel.getAddTime());
map.put("是否删除.1=删除,0=未删除", yxSystemUserLevel.getIsDel()); map.put("是否删除.1=删除,0=未删除", yxSystemUserLevel.getIsDel());
list.add(map); list.add(map);

19
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserLevelServiceImpl.java

@ -19,6 +19,8 @@ import co.yixiang.modules.user.service.YxSystemUserLevelService;
import co.yixiang.modules.user.service.YxSystemUserTaskService; import co.yixiang.modules.user.service.YxSystemUserTaskService;
import co.yixiang.modules.user.service.YxUserLevelService; import co.yixiang.modules.user.service.YxUserLevelService;
import co.yixiang.modules.user.service.YxUserService; import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.mapper.BxgUserMapper;
import co.yixiang.modules.user.service.mapper.SystemUserLevelMapper;
import co.yixiang.modules.user.service.mapper.SystemUserTaskMapper; import co.yixiang.modules.user.service.mapper.SystemUserTaskMapper;
import co.yixiang.modules.user.service.mapper.YxUserLevelMapper; import co.yixiang.modules.user.service.mapper.YxUserLevelMapper;
import co.yixiang.utils.OrderUtil; import co.yixiang.utils.OrderUtil;
@ -44,6 +46,13 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
@Autowired @Autowired
private YxUserLevelMapper yxUserLevelMapper; private YxUserLevelMapper yxUserLevelMapper;
@Autowired
private BxgUserMapper bxgUserMapper;
@Autowired
private SystemUserLevelMapper systemUserLevelMapper;
@Autowired @Autowired
private SystemUserTaskMapper yxSystemUserTaskMapper; private SystemUserTaskMapper yxSystemUserTaskMapper;
@ -71,7 +80,15 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
if(nextLevelId == 0) { if(nextLevelId == 0) {
return false; return false;
} }
//获取下个等级所需成长值
int growthValue=systemUserLevelMapper.selectById(nextLevelId).getGrowthValue();
//用户已有成长值
YxUser yxUser=bxgUserMapper.selectById(uid);
int userGrowth=yxUser.getGrowth();
if (userGrowth>=growthValue){
this.setUserLevel(uid,nextLevelId);
return true;
}
Long finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid); Long finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid);
//目前任务固定,如果增加任务需要自己增加逻辑,目前每个会员任务固定3 //目前任务固定,如果增加任务需要自己增加逻辑,目前每个会员任务固定3

18
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserServiceImpl.java

@ -85,7 +85,8 @@ public class YxUserServiceImpl extends BaseServiceImpl<BxgUserMapper, YxUser> im
@Autowired @Autowired
private UserBillMapper userBillMapper; private UserBillMapper userBillMapper;
@Autowired
private YxUserService userService;
@Autowired @Autowired
private YxSystemUserLevelService systemUserLevelService; private YxSystemUserLevelService systemUserLevelService;
@Autowired @Autowired
@ -126,6 +127,21 @@ public class YxUserServiceImpl extends BaseServiceImpl<BxgUserMapper, YxUser> im
yxUserMapper.incPayCount(uid); yxUserMapper.incPayCount(uid);
} }
/**
* 更新会员成长值
* @param uid uid
*/
@Override
public void upGrowth(Long uid) {
//用户累计消费(1元/1成长值)
double sumPrice=storeOrderMapper.sumPrice(uid);
//更新用户当前成长值
YxUser yxUser = new YxUser();
yxUser.setUid(uid);
yxUser.setGrowth((int) Math.round(sumPrice));
userService.updateById(yxUser);
}
/** /**
* 减去用户余额 * 减去用户余额
* @param uid uid * @param uid uid

5
zsw-bxg/src/main/java/co/yixiang/modules/user/vo/YxSystemUserLevelQueryVo.java

@ -36,7 +36,6 @@ public class YxSystemUserLevelQueryVo implements Serializable {
@ApiModelProperty(value = "有效时间") @ApiModelProperty(value = "有效时间")
private Integer validDate; private Integer validDate;
@ApiModelProperty(value = "会员等级") @ApiModelProperty(value = "会员等级")
private Integer grade; private Integer grade;
@ -49,6 +48,10 @@ public class YxSystemUserLevelQueryVo implements Serializable {
@ApiModelProperty(value = "会员图标") @ApiModelProperty(value = "会员图标")
private String icon; private String icon;
/** 达成当前等级所需成长值 */
@ApiModelProperty(value = "所需成长值")
private Integer growthValue;
@ApiModelProperty(value = "规则说明") @ApiModelProperty(value = "规则说明")
private String explain; private String explain;

3
zsw-bxg/src/main/java/co/yixiang/modules/user/vo/YxUserQueryVo.java

@ -102,6 +102,9 @@ public class YxUserQueryVo implements Serializable {
@ApiModelProperty(value = "等级") @ApiModelProperty(value = "等级")
private Integer level; private Integer level;
@ApiModelProperty(value = "拥有的成长值")
private Integer growth;
@ApiModelProperty(value = "推广元id") @ApiModelProperty(value = "推广元id")
private Long spreadUid; private Long spreadUid;

Loading…
Cancel
Save