最新代码
This commit is contained in:
@@ -8,6 +8,7 @@ import com.starry.admin.modules.custom.service.IPlayCustomLeaveMsgService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -27,8 +28,8 @@ public class PlayCustomLeaveMsgController {
|
||||
/**
|
||||
* 分页查询顾客留言列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public R list(@RequestBody PlayCustomLeaveMsgQueryVo vo) {
|
||||
@PostMapping("/listByPage")
|
||||
public R list(@Validated @RequestBody PlayCustomLeaveMsgQueryVo vo) {
|
||||
IPage<PlayCustomLeaveMsgReturnVo> list = playCustomLeaveMsgService.selectByPage(vo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomLevelAddVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomLevelEditVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomLevelReturnVo;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
@@ -32,7 +33,7 @@ public class PlayCustomLevelInfoController {
|
||||
@PostMapping("/listAll")
|
||||
public R listAll() {
|
||||
List<PlayCustomLevelInfoEntity> list = playCustomLevelInfoService.selectPlayCustomLevelInfoByPage();
|
||||
return R.ok(list);
|
||||
return R.ok(ConvertUtil.entityToVoList(list, PlayCustomLevelReturnVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.starry.admin.modules.custom.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingReturnVo;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 顾客Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/custom/ranking")
|
||||
public class PlayCustomRankingController {
|
||||
@Resource
|
||||
private IPlayCustomUserInfoService playCustomUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询顾客排名列表
|
||||
*/
|
||||
@PostMapping("/listByPage")
|
||||
public R list(@Validated @RequestBody PlayCustomRankingQueryVo vo) {
|
||||
IPage<PlayCustomRankingReturnVo> list = playCustomUserInfoService.selectRankingByPage(vo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.starry.admin.modules.custom.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserReturnVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserStateEditVo;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
@@ -28,9 +30,9 @@ public class PlayCustomUserInfoController {
|
||||
/**
|
||||
* 查询顾客列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R list(PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||
IPage<PlayCustomUserInfoEntity> list = playCustomUserInfoService.selectPlayCustomUserInfoByPage(playCustomUserInfo);
|
||||
@PostMapping("/listByPage")
|
||||
public R list(@Validated @RequestBody PlayCustomUserQueryVo vo) {
|
||||
IPage<PlayCustomUserReturnVo> list = playCustomUserInfoService.selectByPage(vo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.starry.admin.modules.custom.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
* @author admin
|
||||
* @since 2024-04-08
|
||||
*/
|
||||
public interface PlayCustomUserInfoMapper extends BaseMapper<PlayCustomUserInfoEntity> {
|
||||
public interface PlayCustomUserInfoMapper extends MPJBaseMapper<PlayCustomUserInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 顾客性别(0:位置;1:男,2:女)
|
||||
* 顾客性别(0:未知;1:男,2:女)
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 电话号码
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
@@ -66,8 +66,9 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
*/
|
||||
private String weiChatCode;
|
||||
|
||||
|
||||
/**
|
||||
* 等级
|
||||
* 等级ID
|
||||
*/
|
||||
private String levelId;
|
||||
|
||||
@@ -112,7 +113,7 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
private String violationState;
|
||||
|
||||
/**
|
||||
* 是否下单状态[0:未未下单,1:下单过]
|
||||
* 是否下单状态[0:未下单过,1:下单过]
|
||||
*/
|
||||
private String purchaseState;
|
||||
|
||||
@@ -127,11 +128,10 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
private String realState;
|
||||
|
||||
/**
|
||||
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||
* 是否必须实名【2:跟随店铺设置,1:必须实名,0:非必须实名】
|
||||
*/
|
||||
private String mandatoryRealState;
|
||||
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
@@ -152,6 +152,17 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
*/
|
||||
private Date lastPurchaseTime;
|
||||
|
||||
/**
|
||||
* 隐藏等级[0:不隐藏;1:隐藏]
|
||||
*/
|
||||
private String hideLevelState;
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏排名[0:不隐藏;1:隐藏]
|
||||
*/
|
||||
private String hideRankingState;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -163,5 +174,11 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
||||
@JsonIgnore
|
||||
private String token;
|
||||
|
||||
public PlayCustomUserInfoEntity() {
|
||||
}
|
||||
|
||||
public PlayCustomUserInfoEntity(String id, BigDecimal accountBalance) {
|
||||
this.id = id;
|
||||
this.accountBalance = accountBalance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.starry.admin.common.conf.StringTypeHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客留言查询返回对象
|
||||
@@ -27,7 +30,8 @@ public class PlayCustomLeaveMsgReturnVo {
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String images;
|
||||
@TableField(typeHandler = StringTypeHandler.class)
|
||||
private List<String> images;
|
||||
|
||||
/**
|
||||
* 留言时间
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 顾客等级查询对象
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class PlayCustomLevelReturnVo {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 等级数字(排序字段)
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 上一级消费金额
|
||||
*/
|
||||
private String consumptionAmount;
|
||||
|
||||
/**
|
||||
* 满减比例
|
||||
*/
|
||||
private Integer discount;
|
||||
|
||||
/**
|
||||
* 头像框地址
|
||||
*/
|
||||
private String avatarFrameAddress;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import com.starry.common.domain.BasePageEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客排名分页查询对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/14 下午7:47
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PlayCustomRankingQueryVo extends BasePageEntity {
|
||||
/**
|
||||
* userId
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
private List<String> purchaserTime;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客分页查询返回对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/14 下午7:47
|
||||
**/
|
||||
@Data
|
||||
public class PlayCustomRankingReturnVo {
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 顾客昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 排名
|
||||
*/
|
||||
private Integer rankingIndex;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
@JsonIgnore
|
||||
private List<PlayOrderInfoEntity> orderInfos;
|
||||
|
||||
/**
|
||||
* 下单时间-起始时间
|
||||
*/
|
||||
private String beginPurchaserTime;
|
||||
|
||||
/**
|
||||
* 下单时间-终止时间
|
||||
*/
|
||||
private String endPurchaserTime;
|
||||
|
||||
/**
|
||||
* 订单总数
|
||||
*/
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 续单总数
|
||||
*/
|
||||
private String orderContinueNumber;
|
||||
|
||||
/**
|
||||
* 订单单价
|
||||
*/
|
||||
private String orderPrice;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
private BigDecimal orderTotalAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
private String statisticalTime = LocalDate.now().toString();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import com.starry.common.domain.BasePageEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客分页查询对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/14 下午7:47
|
||||
**/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PlayCustomUserQueryVo extends BasePageEntity {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
/**
|
||||
* 用户的标识,对当前公众号唯一
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
|
||||
/**
|
||||
* 顾客昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 顾客性别(0:未知;1:男,2:女)
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
|
||||
/**
|
||||
* 微信号
|
||||
*/
|
||||
private String weiChatCode;
|
||||
|
||||
/**
|
||||
* 绑定手机状态[0:未绑定,1:绑定]
|
||||
*/
|
||||
private String mobilePhoneState;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
|
||||
/**
|
||||
* 等级ID
|
||||
*/
|
||||
private String levelId;
|
||||
|
||||
|
||||
/**
|
||||
* 余额状态[0:不存在余额,1:存在余额]
|
||||
*/
|
||||
private String accountState;
|
||||
|
||||
|
||||
/**
|
||||
* 关注状态[0:未关注,1:已关注]
|
||||
*/
|
||||
private String subscribeState;
|
||||
|
||||
/**
|
||||
* 违规状态[0:未违规,1:违规]
|
||||
*/
|
||||
private String violationState;
|
||||
|
||||
/**
|
||||
* 是否下单状态[0:未下单过,1:下单过]
|
||||
*/
|
||||
private String purchaseState;
|
||||
|
||||
/**
|
||||
* 黑名单状态[0:非黑名单,1:黑名单]
|
||||
*/
|
||||
private String blacklistState;
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
private List<String> registrationTime;
|
||||
|
||||
|
||||
/**
|
||||
* 首次下单时间
|
||||
*/
|
||||
private List<String> firstPurchaseTime;
|
||||
|
||||
/**
|
||||
* 最后一次下单时间
|
||||
*/
|
||||
private List<String> lastPurchaseTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String sort;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.starry.admin.modules.custom.module.vo;
|
||||
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顾客分页查询返回对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024/5/14 下午7:47
|
||||
**/
|
||||
@Data
|
||||
public class PlayCustomUserReturnVo {
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 用户的标识,对当前公众号唯一
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 顾客昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 顾客性别(0:未知;1:男,2:女)
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 微信号码
|
||||
*/
|
||||
private String weiChatCode;
|
||||
|
||||
/**
|
||||
* 所在国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private BigDecimal accountBalance;
|
||||
|
||||
/**
|
||||
* 余额状态[0:不存在余额,1:存在余额]
|
||||
*/
|
||||
private String accountState;
|
||||
|
||||
/**
|
||||
* 关注状态[0:未关注,1:已关注]
|
||||
*/
|
||||
private String subscribeState;
|
||||
|
||||
/**
|
||||
* 黑名单状态[0:非黑名单,1:黑名单]
|
||||
*/
|
||||
private String blacklistState;
|
||||
|
||||
/**
|
||||
* 违规状态[0:未违规,1:违规]
|
||||
*/
|
||||
private String violationState;
|
||||
|
||||
/**
|
||||
* 是否下单状态[0:未下单过,1:下单过]
|
||||
*/
|
||||
private String purchaseState;
|
||||
|
||||
/**
|
||||
* 绑定手机状态[0:未绑定,1:绑定]
|
||||
*/
|
||||
private String mobilePhoneState;
|
||||
|
||||
/**
|
||||
* 实名状态【1:已实名,0:未实名】
|
||||
*/
|
||||
private String realState;
|
||||
|
||||
/**
|
||||
* 是否必须实名【2:跟随店铺设置,1:必须实名,0:非必须实名】
|
||||
*/
|
||||
private String mandatoryRealState;
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
private Date registrationTime;
|
||||
|
||||
/**
|
||||
* 上次登录时间
|
||||
*/
|
||||
private Date lastLoginTime;
|
||||
|
||||
/**
|
||||
* 首次下单时间
|
||||
*/
|
||||
private Date firstPurchaseTime;
|
||||
|
||||
/**
|
||||
* 最后一次下单时间
|
||||
*/
|
||||
private Date lastPurchaseTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 等级ID
|
||||
*/
|
||||
private String levelId;
|
||||
|
||||
/**
|
||||
* 等级名称
|
||||
*/
|
||||
private String levelName;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
private List<PlayOrderInfoEntity> orderInfos;
|
||||
/**
|
||||
* 订单总数
|
||||
*/
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单单价
|
||||
*/
|
||||
private String orderPrice;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
private BigDecimal orderTotalAmount;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class PlayCustomUserStateEditVo {
|
||||
|
||||
@@ -51,7 +54,7 @@ public class PlayCustomUserStateEditVo {
|
||||
private String realState;
|
||||
|
||||
/**
|
||||
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||
* 是否必须实名【0:非必须实名;1:必须实名;2:跟随店铺设置】
|
||||
*/
|
||||
private String mandatoryRealState;
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ package com.starry.admin.modules.custom.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingReturnVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserReturnVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -32,12 +36,22 @@ public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoE
|
||||
PlayCustomUserInfoEntity selectById(String id);
|
||||
|
||||
/**
|
||||
* 查询顾客列表
|
||||
* 分页查询顾客列表
|
||||
*
|
||||
* @param playCustomUserInfo 顾客
|
||||
* @param vo 顾客查询对象
|
||||
* @return 顾客集合
|
||||
*/
|
||||
IPage<PlayCustomUserInfoEntity> selectPlayCustomUserInfoByPage(PlayCustomUserInfoEntity playCustomUserInfo);
|
||||
IPage<PlayCustomUserReturnVo> selectByPage(PlayCustomUserQueryVo vo);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询顾客排名列表
|
||||
*
|
||||
* @param vo 顾客查询对象
|
||||
* @return 顾客集合
|
||||
*/
|
||||
IPage<PlayCustomRankingReturnVo> selectRankingByPage(PlayCustomRankingQueryVo vo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增顾客
|
||||
@@ -67,6 +81,19 @@ public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoE
|
||||
**/
|
||||
void updateAccountBalanceById(String id, BigDecimal accountBalance);
|
||||
|
||||
/**
|
||||
* 更新顾客账户余额信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param balanceBeforeOperation 操作前余额
|
||||
* @param balanceAfterOperation 操作后余额
|
||||
* @param operationType 操作类型(0:充值;1:消费;2:服务)
|
||||
* @param operationAction 操作动作
|
||||
* @param balanceMoney 操作金额
|
||||
* @param orderId 订单ID
|
||||
*/
|
||||
void updateAccountBalanceById(String userId, BigDecimal balanceBeforeOperation, BigDecimal balanceAfterOperation, String operationType, String operationAction, BigDecimal balanceMoney, String orderId);
|
||||
|
||||
/**
|
||||
* 修改顾客
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.starry.admin.modules.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -40,7 +40,7 @@ public class PlayCustomLeaveMsgServiceImpl extends ServiceImpl<PlayCustomLeaveMs
|
||||
// 查询主表全部字段
|
||||
.selectAll(PlayCustomLeaveMsgEntity.class)
|
||||
// 查询顾客表
|
||||
.selectAs(PlayCustomUserInfoEntity::getId, "customUId").selectAs(PlayCustomUserInfoEntity::getAvatar, "customAvatar").selectAs(PlayCustomUserInfoEntity::getNickname, "customNickname")
|
||||
.selectAs(PlayCustomUserInfoEntity::getId, "customId").selectAs(PlayCustomUserInfoEntity::getAvatar, "customAvatar").selectAs(PlayCustomUserInfoEntity::getNickname, "customNickname")
|
||||
// 子表
|
||||
.leftJoin(PlayCustomUserInfoEntity.class, PlayCustomUserInfoEntity::getId, PlayCustomLeaveMsgEntity::getCustomId);
|
||||
return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayCustomLeaveMsgReturnVo.class, lambdaQueryWrapper);
|
||||
@@ -106,7 +106,7 @@ public class PlayCustomLeaveMsgServiceImpl extends ServiceImpl<PlayCustomLeaveMs
|
||||
throw new CustomException(noMessagesAllowedReason);
|
||||
}
|
||||
if (StrUtil.isBlankIfStr(playCustomLeaveMsg.getId())) {
|
||||
playCustomLeaveMsg.setId(IdUtil.fastSimpleUUID());
|
||||
playCustomLeaveMsg.setId(IdUtils.getUuid());
|
||||
}
|
||||
return save(playCustomLeaveMsg);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.starry.admin.modules.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -76,7 +76,7 @@ public class PlayCustomLevelInfoServiceImpl extends ServiceImpl<PlayCustomLevelI
|
||||
@Override
|
||||
public boolean create(PlayCustomLevelInfoEntity playCustomLevelInfo) {
|
||||
if (StrUtil.isBlankIfStr(playCustomLevelInfo.getId())) {
|
||||
playCustomLevelInfo.setId(IdUtil.fastSimpleUUID());
|
||||
playCustomLevelInfo.setId(IdUtils.getUuid());
|
||||
}
|
||||
return save(playCustomLevelInfo);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
package com.starry.admin.modules.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.balance.service.IPlayBalanceDetailsInfoService;
|
||||
import com.starry.admin.modules.custom.mapper.PlayCustomUserInfoMapper;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingReturnVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserQueryVo;
|
||||
import com.starry.admin.modules.custom.module.vo.PlayCustomUserReturnVo;
|
||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||
import com.starry.admin.modules.order.service.impl.PlayOrderInfoServiceImpl;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 顾客Service业务层处理
|
||||
@@ -27,6 +40,13 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
@Resource
|
||||
private PlayCustomUserInfoMapper playCustomUserInfoMapper;
|
||||
|
||||
@Resource
|
||||
private PlayOrderInfoServiceImpl playOrderInfoService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public PlayCustomUserInfoEntity selectByOpenid(String openId) {
|
||||
@@ -50,16 +70,138 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询顾客列表
|
||||
*
|
||||
* @param playCustomUserInfo 顾客
|
||||
* @return 顾客
|
||||
*/
|
||||
|
||||
@Override
|
||||
public IPage<PlayCustomUserInfoEntity> selectPlayCustomUserInfoByPage(PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||
Page<PlayCustomUserInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
public IPage<PlayCustomRankingReturnVo> selectRankingByPage(PlayCustomRankingQueryVo vo) {
|
||||
MPJLambdaWrapper<PlayCustomUserInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaQueryWrapper.selectCollection(PlayOrderInfoEntity.class, PlayCustomRankingReturnVo::getOrderInfos).leftJoin(PlayOrderInfoEntity.class, PlayOrderInfoEntity::getPurchaserBy, PlayCustomUserInfoEntity::getId);
|
||||
if (StrUtil.isNotBlank(vo.getId())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getId, vo.getId());
|
||||
}
|
||||
if (vo.getPurchaserTime() != null && vo.getPurchaserTime().size() == 2) {
|
||||
lambdaQueryWrapper.between(PlayOrderInfoEntity::getPurchaserTime, vo.getPurchaserTime().get(0), vo.getPurchaserTime().get(1));
|
||||
}
|
||||
|
||||
IPage<PlayCustomRankingReturnVo> page = this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayCustomRankingReturnVo.class, lambdaQueryWrapper);
|
||||
int index = 1;
|
||||
for (PlayCustomRankingReturnVo record : page.getRecords()) {
|
||||
record.setRankingIndex((vo.getPageNum() - 1) * vo.getPageSize() + index);
|
||||
if (vo.getPurchaserTime() != null && vo.getPurchaserTime().size() == 2) {
|
||||
record.setBeginPurchaserTime(vo.getPurchaserTime().get(0));
|
||||
record.setEndPurchaserTime(vo.getPurchaserTime().get(1));
|
||||
}
|
||||
BigDecimal orderTotalAmount = new BigDecimal("0");
|
||||
int orderContinueNumber = 0;
|
||||
int orderNumber = 0;
|
||||
for (PlayOrderInfoEntity orderInfo : record.getOrderInfos()) {
|
||||
if (orderInfo.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
if ("0".equals(orderInfo.getFirstOrder())) {
|
||||
orderContinueNumber++;
|
||||
}
|
||||
orderNumber++;
|
||||
if (!"4".equals(orderInfo.getOrderStatus())) {
|
||||
orderTotalAmount = orderTotalAmount.add(orderInfo.getFinalAmount());
|
||||
}
|
||||
}
|
||||
record.setOrderTotalAmount(orderTotalAmount);
|
||||
record.setOrderNumber(String.valueOf(orderNumber));
|
||||
record.setOrderContinueNumber(String.valueOf(orderContinueNumber));
|
||||
if (orderNumber != 0) {
|
||||
record.setOrderPrice(String.valueOf(orderTotalAmount.divide(new BigDecimal(orderNumber), 2, RoundingMode.HALF_UP)));
|
||||
} else {
|
||||
record.setOrderPrice("0");
|
||||
}
|
||||
index++;
|
||||
}
|
||||
//按照订单顺序进行排序
|
||||
page.setRecords(page.getRecords().stream().sorted(Comparator.comparing(PlayCustomRankingReturnVo::getOrderNumber).reversed()).collect(Collectors.toList()));
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<PlayCustomUserReturnVo> selectByPage(PlayCustomUserQueryVo vo) {
|
||||
MPJLambdaWrapper<PlayCustomUserInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<>();
|
||||
lambdaQueryWrapper.selectAll(PlayCustomUserInfoEntity.class);
|
||||
lambdaQueryWrapper.selectAs(PlayCustomLevelInfoEntity::getName, "levelName");
|
||||
lambdaQueryWrapper.leftJoin(PlayCustomLevelInfoEntity.class, PlayCustomLevelInfoEntity::getId, PlayCustomUserInfoEntity::getLevelId);
|
||||
if (StrUtil.isNotBlank(vo.getId())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getId, vo.getId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getNickname())) {
|
||||
lambdaQueryWrapper.like(PlayCustomUserInfoEntity::getNickname, vo.getNickname());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getRemark())) {
|
||||
lambdaQueryWrapper.like(PlayCustomUserInfoEntity::getRemark, vo.getRemark());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getWeiChatCode())) {
|
||||
lambdaQueryWrapper.like(PlayCustomUserInfoEntity::getWeiChatCode, vo.getWeiChatCode());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getPhone())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getPhone, vo.getPhone());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getSex())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getSex, vo.getSex());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getLevelId())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getLevelId, vo.getLevelId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getSubscribeState())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getSubscribeState, vo.getSubscribeState());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getBlacklistState())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getBlacklistState, vo.getBlacklistState());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getViolationState())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getViolationState, vo.getViolationState());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getPurchaseState())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getPurchaseState, vo.getPurchaseState());
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getMobilePhoneState())) {
|
||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getMobilePhoneState, vo.getMobilePhoneState());
|
||||
}
|
||||
if (vo.getRegistrationTime() != null && vo.getRegistrationTime().size() == 2) {
|
||||
lambdaQueryWrapper.between(PlayCustomUserInfoEntity::getRegistrationTime, vo.getRegistrationTime().get(0), vo.getRegistrationTime().get(1));
|
||||
}
|
||||
if (vo.getFirstPurchaseTime() != null && vo.getFirstPurchaseTime().size() == 2) {
|
||||
lambdaQueryWrapper.between(PlayCustomUserInfoEntity::getFirstPurchaseTime, vo.getFirstPurchaseTime().get(0), vo.getFirstPurchaseTime().get(1));
|
||||
}
|
||||
if (vo.getLastPurchaseTime() != null && vo.getLastPurchaseTime().size() == 2) {
|
||||
lambdaQueryWrapper.between(PlayCustomUserInfoEntity::getLastPurchaseTime, vo.getLastPurchaseTime().get(0), vo.getLastPurchaseTime().get(1));
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getSort())) {
|
||||
if ("levelId".equals(vo.getSort())) {
|
||||
lambdaQueryWrapper.orderByDesc(PlayCustomUserInfoEntity::getLevelId);
|
||||
}
|
||||
if ("accountBalance".equals(vo.getSort())) {
|
||||
lambdaQueryWrapper.orderByDesc(PlayCustomUserInfoEntity::getAccountBalance);
|
||||
}
|
||||
if ("lastPurchaseTime".equals(vo.getSort())) {
|
||||
lambdaQueryWrapper.orderByDesc(PlayCustomUserInfoEntity::getLastPurchaseTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IPage<PlayCustomUserReturnVo> page = this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayCustomUserReturnVo.class, lambdaQueryWrapper);
|
||||
for (PlayCustomUserReturnVo record : page.getRecords()) {
|
||||
List<PlayOrderInfoEntity> orderInfoEntities = playOrderInfoService.customSelectOrderInfoByList(record.getId());
|
||||
BigDecimal orderTotalAmount = new BigDecimal("0");
|
||||
for (PlayOrderInfoEntity orderInfoEntity : orderInfoEntities) {
|
||||
orderTotalAmount = orderTotalAmount.add(orderInfoEntity.getFinalAmount());
|
||||
}
|
||||
record.setOrderNumber(String.valueOf(orderInfoEntities.size()));
|
||||
record.setOrderTotalAmount(orderTotalAmount);
|
||||
if (!orderInfoEntities.isEmpty()) {
|
||||
record.setOrderPrice(String.valueOf(orderTotalAmount.divide(new BigDecimal(orderInfoEntities.size()), 2, RoundingMode.HALF_UP)));
|
||||
} else {
|
||||
record.setProvince("0");
|
||||
}
|
||||
|
||||
}
|
||||
return page;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +213,7 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
@Override
|
||||
public boolean create(PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||
if (StrUtil.isBlankIfStr(playCustomUserInfo.getId())) {
|
||||
playCustomUserInfo.setId(IdUtil.fastSimpleUUID());
|
||||
playCustomUserInfo.setId(IdUtils.getUuid());
|
||||
}
|
||||
return save(playCustomUserInfo);
|
||||
}
|
||||
@@ -88,10 +230,17 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
|
||||
@Override
|
||||
public void updateAccountBalanceById(String id, BigDecimal accountBalance) {
|
||||
PlayCustomUserInfoEntity entity = new PlayCustomUserInfoEntity();
|
||||
entity.setId(id);
|
||||
entity.setAccountBalance(accountBalance);
|
||||
this.baseMapper.updateById(entity);
|
||||
//更新余额
|
||||
this.baseMapper.updateById(new PlayCustomUserInfoEntity(id, accountBalance));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateAccountBalanceById(String userId, BigDecimal balanceBeforeOperation, BigDecimal balanceAfterOperation, String operationType, String operationAction,BigDecimal balanceMoney,String orderId) {
|
||||
//更新余额
|
||||
this.baseMapper.updateById(new PlayCustomUserInfoEntity(userId, balanceAfterOperation));
|
||||
//记录余额变更记录
|
||||
playBalanceDetailsInfoService.create("1", userId, balanceBeforeOperation, balanceAfterOperation, operationType, operationAction,balanceMoney,orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user