package com.ruoyi.account.controller;
|
|
|
import cn.hutool.http.HttpResponse;
|
import com.alibaba.fastjson2.JSONObject;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.account.api.model.*;
|
import com.ruoyi.account.dto.ApplyForAdmissionDTO;
|
import com.ruoyi.account.dto.ChangeAppUserInfo;
|
import com.ruoyi.account.mapper.AppUserMapper;
|
import com.ruoyi.account.service.*;
|
import com.ruoyi.account.util.ObsUploadUtil;
|
import com.ruoyi.account.util.weChat.EnvVersion;
|
import com.ruoyi.account.util.weChat.WeChatUtil;
|
import com.ruoyi.account.vo.*;
|
import com.ruoyi.common.core.constant.CacheConstants;
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.page.PageInfo;
|
import com.ruoyi.common.redis.service.RedisService;
|
import com.ruoyi.common.security.service.TokenService;
|
import com.ruoyi.order.feignClient.OrderClient;
|
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
|
import com.ruoyi.order.model.Order;
|
import com.ruoyi.other.api.domain.Shop;
|
import com.ruoyi.other.api.feignClient.ShopClient;
|
import com.ruoyi.system.api.domain.SysConfig;
|
import com.ruoyi.system.api.domain.SysUser;
|
import com.ruoyi.system.api.feignClient.SysConfigClient;
|
import com.ruoyi.system.api.feignClient.SysUserClient;
|
import com.ruoyi.system.api.model.LoginUser;
|
import io.swagger.annotations.*;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.ibatis.annotations.Param;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.util.CollectionUtils;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
import java.math.BigDecimal;
|
import java.time.LocalDateTime;
|
import java.time.temporal.ChronoUnit;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
import java.util.stream.Stream;
|
|
/**
|
* <p>
|
* 前端控制器
|
* </p>
|
*
|
* @author luodangjia
|
* @since 2024-11-21
|
*/
|
@Api(tags = {"用户端-小程序"})
|
@RestController
|
@RequestMapping("/app-user")
|
@Slf4j
|
public class AppUserController extends BaseController {
|
|
@Resource
|
private TokenService tokenService;
|
@Resource
|
private AppUserService appUserService;
|
@Resource
|
private AppUserMapper appUserMapper;
|
@Resource
|
private ShopClient shopClient;
|
@Resource
|
private RemoteOrderGoodsClient remoteOrderGoodsClient;
|
@Resource
|
private SysUserClient sysUserClient;
|
@Resource
|
private OrderClient orderClient;
|
@Resource
|
private SysConfigClient sysConfigClient;
|
@Resource
|
private AppUserShopService appUserShopService;
|
|
@Resource
|
private UserCancellationLogService userCancellationLogService;
|
@Resource
|
private RedisService redisService;
|
|
@Resource
|
private WeChatUtil weChatUtil;
|
|
@Value("${file.upload.location}")
|
private String filePath;
|
|
|
@ResponseBody
|
@PostMapping("/mobileLogin")
|
@ApiOperation(value = "手机号登录")
|
public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin) {
|
return appUserService.mobileLogin(mobileLogin);
|
}
|
|
|
@GetMapping("/logout")
|
@ApiOperation(value = "登出")
|
public R logout() {
|
Long userId = tokenService.getLoginUserApplet().getUserid();
|
loginout(userId);
|
return R.ok();
|
}
|
|
|
@ResponseBody
|
@PostMapping("/appletLogin")
|
@ApiOperation(value = "小程序一键登录")
|
public R<LoginVo> appletLogin(@RequestBody AppletLogin appletLogin) {
|
return appUserService.appletLogin(appletLogin);
|
}
|
|
|
@PostMapping("/getAppUserById")
|
public AppUser getAppUserById(@RequestParam("id") Long id) {
|
System.out.println("根据id获取用户:"+id);
|
return appUserService.getById(id);
|
}
|
|
@PostMapping("/getBaseUserById")
|
public R<Map<String, Object>> getBaseUserById(@RequestParam("id") Long id) {
|
AppUser appUser = appUserService.getById(id);
|
Map<String, Object> map = new HashMap<>();
|
map.put("id", appUser.getId());
|
map.put("name", appUser.getName());
|
map.put("phone", appUser.getPhone());
|
return R.ok(map);
|
}
|
|
|
@ResponseBody
|
@PostMapping("/editAppUserById")
|
public R<Void> editAppUserById(@RequestBody AppUser appUser) {
|
appUserService.updateById(appUser);
|
appUserService.update(new LambdaUpdateWrapper<AppUser>().eq(AppUser::getId, appUser.getId())
|
.set(AppUser::getLastShopTime, appUser.getLastShopTime()));
|
return R.ok();
|
|
}
|
|
|
|
|
|
@ResponseBody
|
@PostMapping("/getSMSCode")
|
@ApiOperation(value = "获取短信验证码")
|
public R getSMSCode(@RequestBody SMSCode smsCode) {
|
return appUserService.getSMSCode(smsCode);
|
}
|
|
|
|
|
|
@ResponseBody
|
@GetMapping("/unregis")
|
@ApiOperation(value = "注销", tags = {"小程序-个人中心首页-我的资料"})
|
public R unregis() {
|
Long userId = tokenService.getLoginUserApplet().getUserid();
|
AppUser user = appUserService.getById(userId);
|
//添加注销记录
|
UserCancellationLog userCancellationLog = new UserCancellationLog();
|
userCancellationLog.setAppUserId(user.getId());
|
userCancellationLogService.save(userCancellationLog);
|
user.setStatus(3);
|
appUserService.updateById(user);
|
return R.ok();
|
}
|
|
@ResponseBody
|
@GetMapping("/getServicePhone")
|
@ApiOperation(value = "获取客服电话", tags = {"小程序-个人中心首页-客服"})
|
public R getServicePhone() {
|
SysConfig data = sysConfigClient.getInfo(7L).getData();
|
List<String> phoneList = null;
|
if (data != null) {
|
phoneList = Arrays.stream(data.getConfigValue().split(";"))
|
.map(String::trim) // 去除每个号码前后的空格
|
.filter(s -> !s.isEmpty()) // 过滤空字符串
|
.collect(Collectors.toList());
|
}
|
return R.ok(phoneList);
|
}
|
|
|
|
|
|
|
|
@GetMapping("/index")
|
@ApiOperation(value = "个人信息", tags = {"小程序-个人中心首页"})
|
public R<AppUser> index() {
|
return R.ok(appUserService.index());
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/index/change")
|
@ApiOperation(value = "修改个人资料", tags = {"小程序-个人中心首页"})
|
public R<AppUser> indexchange(@RequestBody ChangeAppUserInfo changeAppInfo) {
|
Long userId = tokenService.getLoginUserApplet().getUserid();
|
//当前用户信息
|
AppUser user = appUserService.getById(userId);
|
if (null != changeAppInfo.getName()){
|
user.setName(changeAppInfo.getName());
|
}
|
if (null != changeAppInfo.getAvatar()){
|
user.setAvatar(changeAppInfo.getAvatar());
|
}
|
appUserService.updateById(user);
|
return R.ok();
|
}
|
|
|
|
/**
|
* 根据用户名称模糊搜索用户列表
|
*
|
* @param name
|
* @return
|
*/
|
@PostMapping("/getAppUserByName")
|
public R<List<AppUser>> getAppUserByName(@RequestParam("name") String name) {
|
List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1)
|
.like(AppUser::getName, name));
|
return R.ok(list);
|
}
|
/**
|
* 根据用户名称模糊搜索用户列表,不过滤状态
|
*/
|
@GetMapping("/getAppUserByNameNoFilter")
|
public R<List<AppUser>> getAppUserByNameNoFilter(@RequestParam("name") String name) {
|
List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>()
|
.like(AppUser::getName, name));
|
return R.ok(list);
|
}
|
|
|
/**
|
* 根据用户电话模糊搜索用户列表
|
*
|
* @param phone
|
* @return
|
*/
|
@PostMapping("/getAppUserByPhone")
|
public R<List<AppUser>> getAppUserByPhone(@RequestParam("phone") String phone) {
|
List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1)
|
.like(AppUser::getPhone, phone));
|
return R.ok(list);
|
}
|
|
/**
|
* 更具用户电话模糊查询用户列表,不过滤状态
|
*/
|
@GetMapping("/getAppUserByPhoneNoFilter")
|
public R<List<AppUser>> getAppUserByPhoneNoFilter(@RequestParam("phone") String phone) {
|
List<AppUser> list = appUserService.getAppUserByPhoneNoFilter(phone);
|
return R.ok(list);
|
}
|
|
|
@GetMapping("/getUserPointsPage")
|
@ApiOperation(value = "用户列表", tags = {"管理后台"})
|
public R<IPage<AppUser>> getUserPointsPage(@ApiParam("页码") @RequestParam Integer pageNum,
|
@ApiParam("每一页数据大小") Integer pageSize,
|
AppUser appUser) {
|
|
Long userId = tokenService.getLoginUser().getUserid();
|
SysUser data = sysUserClient.getSysUser(userId).getData();
|
|
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
if (data.getRoleType() == 2) {
|
Integer shopId = data.getObjectId();
|
List<Order> orders = orderClient.getRedeemedOrdersByShop(shopId).getData();
|
List<Long> userIds = orders.stream().map(Order::getAppUserId).collect(Collectors.toList());
|
//门店作为服务商的用户
|
/* Set<Long> shopServerUser = getShopServerUser(shopId);
|
userIds.addAll(shopServerUser);*/
|
queryWrapper.in(!CollectionUtils.isEmpty(userIds), "id", userIds)
|
.like(StringUtils.isNotEmpty( appUser.getName()),"name", appUser.getName());
|
}
|
queryWrapper.eq("del_flag", 0);
|
queryWrapper.ne("status", 3);
|
|
List<AppUser> appUserList = appUserService.list(queryWrapper);
|
Page<AppUser> objectPage = Page.of(pageNum, pageSize);
|
objectPage.setRecords(appUserList);
|
return R.ok(objectPage);
|
|
}
|
|
/**
|
* 获取用户列表
|
*/
|
@GetMapping("/getAppuserPage")
|
public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum,
|
@ApiParam("每一页数据大小") Integer pageSize,
|
AppUser appUser){
|
Integer shopId = null;
|
Set<Long> userId = null;
|
IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser, shopId, userId);
|
|
return R.ok(appuserPage);
|
}
|
|
|
/**
|
* 获取用户积分列表
|
*/
|
@GetMapping("/getUserPotPage")
|
public R<IPage<AppUser>> getUserPotPage(@ApiParam("页码") @RequestParam Integer pageNum,
|
@ApiParam("每一页数据大小") Integer pageSize,
|
AppUser appUser) {
|
Long userid = tokenService.getLoginUser().getUserid();
|
SysUser sysUser = sysUserClient.getSysUser(userid).getData();
|
Integer shopId = null;
|
Set<Long> userId = null;
|
if(sysUser.getRoleType() == 2){
|
shopId = sysUser.getObjectId();
|
userId = orderClient.getAppUserByShoppingShop(shopId).getData();
|
}
|
IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser, shopId, userId);
|
for (AppUser record : appuserPage.getRecords()) {
|
/* if (record.getInviteUserId() != null) {
|
AppUser byId1 = appUserService.getById(record.getInviteUserId());
|
if (byId1!=null) {
|
record.setInviteUserName(byId1.getName());
|
}
|
}*/
|
if (record.getShopId()!=null){
|
R<Shop> shopById = shopClient.getShopById(record.getShopId());
|
if (shopById.getData()!=null){
|
record.setShopName(shopById.getData().getName());
|
}
|
}
|
|
}
|
return R.ok(appuserPage);
|
}
|
|
|
@GetMapping("/shop/getAppuserPage")
|
@ApiOperation(value = "用户列表-在门店下过单的", tags = {"门店后台"})
|
public R<IPage<AppUser>> shopGetAppuserPage(@ApiParam("页码") @RequestParam Integer pageCurr,
|
@ApiParam("每一页数据大小") Integer pageSize,
|
AppUser appUser) {
|
Long userid = tokenService.getLoginUser().getUserid();
|
R<SysUser> sysUserR = sysUserClient.getSysUser(userid);
|
SysUser sysUser = sysUserR.getData();
|
|
List<Long> userIds = new ArrayList<>();
|
userIds.add(-1L);
|
//获取在该本店下单的用户ids
|
Integer objectId = sysUser.getObjectId();
|
R<List<Order>> listR = remoteOrderGoodsClient.byShopId(objectId);
|
if (listR.getData()!=null){
|
for (Order datum : listR.getData()) {
|
userIds.add(datum.getAppUserId());
|
}
|
/* Set<Long> shopServerUser = getShopServerUser(objectId);
|
userIds.addAll(shopServerUser);*/
|
}
|
IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, userIds);
|
return R.ok(appuserPage);
|
}
|
|
|
|
@GetMapping("/frozen")
|
@ApiOperation(value = "用户列表-冻结解冻", tags = {"管理后台"})
|
public R frozen(Long id, @ApiParam("1=正常,2=冻结") Integer status) {
|
AppUser byId = appUserService.getById(id);
|
byId.setStatus(status);
|
appUserService.updateById(byId);
|
if (status == 2){
|
loginout(id);
|
}
|
return R.ok();
|
}
|
|
private void loginout(Long userId) {
|
// 获取所有符合模式的缓存键
|
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
if (CollectionUtils.isEmpty(keys)) {
|
return; // 如果没有匹配的键,直接返回
|
}
|
|
// 遍历所有键并删除与指定用户ID相关的登录信息
|
for (String key : keys) {
|
LoginUser user = redisService.getCacheObject(key);
|
if (user != null && userId.equals(user.getUserid())) {
|
redisService.deleteObject(key);
|
}
|
}
|
}
|
|
@GetMapping("/change/shop")
|
@ApiOperation(value = "用户列表-更换门店", tags = {"管理后台"})
|
public R<AppUser> shop(Long id, Integer shopId) {
|
AppUser byId = appUserService.getById(id);
|
byId.setShopId(shopId);
|
appUserService.updateById(byId);
|
return R.ok();
|
}
|
|
|
|
|
@GetMapping("/detail")
|
@ApiOperation(value = "用户列表-详情", tags = {"管理后台"})
|
public R<AppUser> detail(Long id) {
|
AppUser byId = appUserService.getById(id);
|
//获取店铺名称
|
List<String> shopNames=shopClient.getServiceProvider(byId.getId()).getData();
|
if(null != shopNames){
|
byId.setShopNames(shopNames);
|
}
|
//消费总金额
|
Integer customPoint =(byId.getExchangePoint()==null?0:byId.getExchangePoint())+
|
(byId.getTransferableOutPoint()==null?0:byId.getTransferableOutPoint())-
|
(byId.getCancelPoint()==null?0:byId.getCancelPoint());
|
byId.setCustomPoint(customPoint);
|
|
return R.ok(byId);
|
}
|
|
|
|
@GetMapping("/orders")
|
@ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"})
|
public R<JSONObject> orders(Long id,Integer pageNum, Integer pageSize) {
|
Long userid = tokenService.getLoginUser().getUserid();
|
SysUser sysUser = sysUserClient.getSysUser(userid).getData();
|
Integer shopId = -1;
|
if(sysUser.getRoleType() == 2){
|
shopId = sysUser.getObjectId();
|
}
|
R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId);
|
List<Order> data = listR.getData();
|
Integer total = data.size();
|
// 手动分页
|
if (data != null && data.size() > 0) {
|
if (pageNum == null || pageNum == 0) {
|
pageNum = 1;
|
}
|
if (pageSize == null || pageSize == 0) {
|
pageSize = 10;
|
}
|
data = data.stream()
|
.skip((pageNum - 1) * pageSize)
|
.limit(pageSize)
|
.collect(Collectors.toList());
|
}
|
JSONObject jsonObject = new JSONObject();
|
jsonObject.put("records", data);
|
jsonObject.put("total", total);
|
jsonObject.put("size", pageSize);
|
jsonObject.put("current", pageNum);
|
return R.ok(jsonObject);
|
}
|
|
|
@PostMapping("/listByIds")
|
public List<AppUser> listByIds(@RequestParam("ids") List<Long> ids) {
|
if(ids.size() == 0){
|
return new ArrayList<>();
|
}
|
List<AppUser> appUsers = appUserService.listByIds(ids);
|
return appUsers;
|
}
|
|
|
@PostMapping("/getAppUserByPhone1")
|
public R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone) {
|
AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 3)
|
.eq(AppUser::getPhone, phone));
|
return R.ok(appUser);
|
}
|
|
|
|
|
/**
|
* 工作台-顶部
|
*/
|
@GetMapping("/statistics")
|
@ApiOperation(value = "统计", tags = {"后台-工作台-顶部"})
|
public R<UserStatistics> statistics() {
|
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("del_flag", 0);
|
queryWrapper.ne("status", 3);//没有注销的
|
|
List<AppUser> appUserList = appUserService.list(queryWrapper);
|
long consumerUser = appUserList.stream()
|
.filter(user -> user.getLastShopTime() != null)
|
.count();//消费者总数
|
|
UserStatistics userStatistics = new UserStatistics();
|
userStatistics.setTotalUser(appUserList.size());//总用户数
|
userStatistics.setConsumerUser((int) consumerUser);//消费过的用户
|
|
//用户类型统计门店
|
long shopUserCount = appUserList.stream()
|
.filter(appUser -> appUser.getUserType() == 2)
|
.count();
|
userStatistics.setShopUser((int) shopUserCount);
|
|
//门店总数
|
long shopNum = shopClient.getAllShop().getData().size();
|
userStatistics.setShopNum((int) shopNum);
|
return R.ok(userStatistics);
|
}
|
|
/**
|
* 工作台-用户分析
|
*/
|
@GetMapping("/homeStatistics/userAnalysis")
|
@ApiOperation(value = "用户分析", tags = {"后台-工作台-用户分析"})
|
public R<UserStatisticsDetail> userAnalysis(@ApiParam(value = "用户id") @RequestParam(value = "userId",required = false) Long userId) {
|
UserStatisticsDetail userStatistics = new UserStatisticsDetail();
|
|
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
// 条件构造 统计充值积分
|
queryWrapper.select("SUM(recharge_point) as total_points");
|
queryWrapper.eq("del_flag", 0);//未删除的
|
queryWrapper.ne("status", 3);//未注销的
|
if (userId != null) {
|
queryWrapper.eq("id", userId);
|
}
|
//统计充值积分
|
Map<String, Object> result = appUserService.getMap(queryWrapper);
|
if (result == null || result.get("total_points") == null) {
|
userStatistics.setTotalScore(0L);
|
}else {
|
userStatistics.setTotalScore((Long) result.get("total_points"));
|
}
|
|
//统计消费积分和现金支付数
|
Map<String, Object> data = orderClient.getConsumeScoreAndPayAmount(userId).getData();
|
|
if (data == null || data.get("total_points") == null) {
|
userStatistics.setConsumeScore(0L);
|
}else {
|
userStatistics.setConsumeScore(Long.valueOf(data.get("total_points").toString()) );
|
}
|
|
if (data == null || data.get("payment_amounts") == null) {
|
userStatistics.setShopAmount(BigDecimal.ZERO);
|
}else {
|
userStatistics.setShopAmount(new BigDecimal(data.get("payment_amounts").toString()));
|
}
|
|
|
return R.ok(userStatistics);
|
}
|
|
/**
|
* 用户统计详情
|
*/
|
@GetMapping("/statistics/detail")
|
@ApiOperation(value = "用户统计详情", tags = {"管理后台-首页统计-用户统计详情"})
|
public R<UserStatisticsDetail> statisticsDetail(@ApiParam(value = "用户id") Long userId) {
|
Long userid = tokenService.getLoginUser().getUserid();
|
SysUser data = sysUserClient.getSysUser(userid).getData();
|
Integer shopId = null;
|
Set<Long> userIds = null;
|
if(null != userId){
|
userIds = new HashSet<>();
|
userIds.add(userId);
|
}
|
if(data.getRoleType() == 2){
|
shopId = data.getObjectId();
|
if(null == userId){
|
userIds = orderClient.getAppUserByShoppingShop(shopId).getData();
|
/* Set<Long> shopServerUser = getShopServerUser(shopId);
|
userIds.addAll(shopServerUser);*/
|
}else{
|
userIds = new HashSet<>();
|
userIds.add(userId);
|
}
|
|
}
|
UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(null, userIds);
|
return R.ok(userStatisticsDetail);
|
}
|
|
|
|
/**
|
* 上传图片
|
* @param file
|
* @return
|
*/
|
@PostMapping("/upload")
|
public R upload(MultipartFile file){
|
String s = null;
|
try {
|
s = ObsUploadUtil.obsUpload(file);
|
} catch (IOException e) {
|
throw new RuntimeException(e);
|
}
|
return R.ok(s);
|
}
|
|
|
|
/**
|
* 清空绑定门店的用户门店数据
|
* @param shopId
|
* @return
|
*/
|
@PostMapping("/clearBindShop")
|
public R clearBindShop(@RequestParam("shopId") Integer shopId){
|
appUserService.update(new LambdaUpdateWrapper<AppUser>().eq(AppUser::getShopId, shopId).set(AppUser::getShopId, null)
|
.set(AppUser::getUserType,1));
|
return R.ok();
|
}
|
|
|
/**
|
* 获取所有用户积分列表
|
*/
|
@ResponseBody
|
@GetMapping("/getUserPointPageList")
|
@ApiOperation(value = "所有用户积分列表", tags = "后台-财务统计-用户积分统计")
|
public R<PageInfo<UserPointStatisticsVO>> getUserPointPageList(@RequestParam(value = "name",required = false) String name,
|
@ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr,
|
@ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) {
|
PageInfo<UserPointStatisticsVO> pageInfo=appUserService.getUserPointPageList(name,pageCurr,pageSize);
|
|
return R.ok(pageInfo);
|
}
|
|
/**
|
* 导出用户积分列表
|
*/
|
@ResponseBody
|
@GetMapping("/exportUserPoint")
|
@ApiOperation(value = "导出用户积分列表", tags = "后台-财务统计-用户积分统计")
|
public void exportUserPoint(HttpServletResponse response, @RequestParam(value = "name",required = false) String name) {
|
|
List<UserPointStatisticsVO> exportList=appUserMapper.exportUserPoint(name);
|
ExcelUtil<UserPointStatisticsVO> util = new ExcelUtil<UserPointStatisticsVO>(UserPointStatisticsVO.class);
|
util.exportExcel(response, exportList, "用户积分汇总");
|
}
|
|
|
@PostMapping("/saveOrUpdateAppUser")
|
Long saveOrUpdateAppUser(@RequestBody AppUser appuser){
|
if (appuser.getId() == null) {
|
//保存用户
|
appUserService.save(appuser);
|
}else {
|
appUserService.updateById(appuser);
|
}
|
return appuser.getId();
|
|
}
|
|
@GetMapping("/getAllUser")
|
@ApiOperation(value = "获取所有用户")
|
public R<List<AppUser>> getAllUser() {
|
LambdaQueryWrapper<AppUser> queryWrapper=new LambdaQueryWrapper<>();
|
queryWrapper.select(AppUser::getId,AppUser::getName);
|
queryWrapper.eq(AppUser::getDelFlag,0);//未删除的
|
queryWrapper.ne(AppUser::getStatus, 3);//未注销的
|
List<AppUser> list = appUserService.list(queryWrapper);
|
return R.ok(list);
|
}
|
|
}
|