修复积分获取接口
This commit is contained in:
@@ -18,6 +18,8 @@ import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.entity.Users;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -45,6 +47,8 @@ public class IntegralController extends BaseController {
|
||||
private IntegralService integralService;
|
||||
@Resource
|
||||
private ConfigProperties configProperties;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
|
||||
@ApiOperation("分页查询签到积分")
|
||||
@GetMapping("/page")
|
||||
@@ -67,8 +71,8 @@ public class IntegralController extends BaseController {
|
||||
if(loginUser == null){
|
||||
return fail("请先登录");
|
||||
}
|
||||
String message = integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,getLoginUser().getUserId()).eq(Integral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
||||
final List<Integral> list = integralService.list(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,loginUser.getUserId()).like(Integral::getDateTime, param.getDateTime()));
|
||||
String message = integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getPhone,loginUser.getPhone()).eq(Integral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
||||
final List<Integral> list = integralService.list(new LambdaUpdateWrapper<Integral>().eq(Integral::getPhone,loginUser.getPhone()).like(Integral::getDateTime, param.getDateTime()));
|
||||
return success(message,list);
|
||||
}
|
||||
|
||||
@@ -83,36 +87,40 @@ public class IntegralController extends BaseController {
|
||||
@ApiOperation("添加签到积分")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Integral integral, HttpServletRequest request) {
|
||||
final Users users = usersService.getById(integral.getId());
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
integral.setUserId(loginUser.getUserId());
|
||||
integral.setUsername(loginUser.getNickname());
|
||||
integral.setPhone(loginUser.getPhone());
|
||||
integral.setUid(users.getId());
|
||||
integral.setUsername(users.getUsername());
|
||||
integral.setPhone(users.getPhone());
|
||||
integral.setIntegral(new BigDecimal("1"));
|
||||
integral.setDateTime(DateUtil.today());
|
||||
integral.setDay(DateUtil.thisDayOfMonth());
|
||||
integral.setCreateTime(DateUtil.currentSeconds());
|
||||
|
||||
if (integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getUserId,getLoginUser().getUserId()).eq(Integral::getDateTime, DateUtil.today())) > 0) {
|
||||
// return fail("您今天已经签到过了.");
|
||||
if (integralService.count(new LambdaUpdateWrapper<Integral>().eq(Integral::getId,users.getId()).eq(Integral::getDateTime, DateUtil.today())) > 0) {
|
||||
return fail("您今天已经签到过了.");
|
||||
}
|
||||
if (integralService.save(integral)) {
|
||||
// 累计积分
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
Claims claims = JwtUtil.parseToken(access_token, configProperties.getTokenKey());
|
||||
JwtSubject jwtSubject = JwtUtil.getJwtSubject(claims);
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("userId", loginUser.getUserId());
|
||||
map.put("points",loginUser.getPoints() + 1);
|
||||
map.put("tenantId", jwtSubject.getTenantId());
|
||||
// 链式构建请求
|
||||
String result = HttpRequest.post("https://server.gxwebsoft.com/api/system/user/update")
|
||||
.header("Authorization", access_token)
|
||||
.header("Tenantid", jwtSubject.getTenantId().toString())
|
||||
.body(JSONUtil.toJSONString(map))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
users.setIntegral(users.getIntegral().add(integral.getIntegral()));
|
||||
usersService.updateById(users);
|
||||
|
||||
// String access_token = JwtUtil.getAccessToken(request);
|
||||
// Claims claims = JwtUtil.parseToken(access_token, configProperties.getTokenKey());
|
||||
// JwtSubject jwtSubject = JwtUtil.getJwtSubject(claims);
|
||||
// HashMap<String, Object> map = new HashMap<>();
|
||||
// map.put("userId", loginUser.getUserId());
|
||||
// map.put("points",loginUser.getPoints() + 1);
|
||||
// map.put("tenantId", jwtSubject.getTenantId());
|
||||
// // 链式构建请求
|
||||
// String result = HttpRequest.post("https://server.gxwebsoft.com/api/system/user/update")
|
||||
// .header("Authorization", access_token)
|
||||
// .header("Tenantid", jwtSubject.getTenantId().toString())
|
||||
// .body(JSONUtil.toJSONString(map))//表单内容
|
||||
// .timeout(20000)//超时,毫秒
|
||||
// .execute().body();
|
||||
return success("签到成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,10 @@ public class UserCardController extends BaseController {
|
||||
}
|
||||
// 查询可用的会员卡
|
||||
LambdaUpdateWrapper<UserCard> wrapper = new LambdaUpdateWrapper<>();
|
||||
|
||||
if(param.getPayPrice() != null){
|
||||
System.out.println("param = " + param);
|
||||
wrapper.ge(UserCard::getRemainingMoney,param.getPayPrice());
|
||||
}
|
||||
wrapper.eq(UserCard::getUserId, loginUser.getUserId())
|
||||
.eq(UserCard::getPayStatus,1)
|
||||
.like(UserCard::getSid, param.getSid())
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Integral implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "微信昵称")
|
||||
private String username;
|
||||
|
||||
@@ -57,6 +57,6 @@ public class IntegralLog implements Serializable {
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
private Integer createTime;
|
||||
private Long createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -198,4 +198,8 @@ public class UserCardParam extends BaseParam {
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> cardIds;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
}
|
||||
|
||||
@@ -382,6 +382,8 @@ public class WebsiteController extends BaseController {
|
||||
final String siteInfo = redisUtil.get(key);
|
||||
if(StrUtil.isNotBlank(siteInfo)){
|
||||
redisUtil.delete(key);
|
||||
// 选择支付方式
|
||||
redisUtil.delete("SelectPayment:".concat(getTenantId().toString()));
|
||||
return success("清除成功");
|
||||
}
|
||||
return success("清除失败");
|
||||
|
||||
@@ -27,10 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -52,27 +49,34 @@ public class UserController extends BaseController {
|
||||
@Resource
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<User>> page(UserParam param) {
|
||||
return success(userService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||
@ApiOperation("查询全部用户")
|
||||
@GetMapping()
|
||||
public ApiResult<List<User>> list(UserParam param) {
|
||||
return success(userService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||
@ApiOperation("根据id查询用户")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<User> get(@PathVariable("id") Integer id) {
|
||||
return success(userService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||
@ApiOperation("根据手机号码查询用户")
|
||||
@GetMapping("/getByPhone/{phone}")
|
||||
public ApiResult<User> getByPhone(@PathVariable("phone") String phone) {
|
||||
return success(userService.getByPhone(phone));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:save')")
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping()
|
||||
@@ -80,7 +84,7 @@ public class UserController extends BaseController {
|
||||
user.setStatus(0);
|
||||
user.setPassword(userService.encodePassword(user.getPassword()));
|
||||
if (userService.saveUser(user)) {
|
||||
return success("添加成功");
|
||||
return success("添加成功",user.getUserId());
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
@@ -89,23 +93,46 @@ public class UserController extends BaseController {
|
||||
@ApiOperation("批量添加用户")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<User> userList) {
|
||||
userList.forEach(d -> {
|
||||
d.setStatus(0);
|
||||
if (d.getPassword() != null) {
|
||||
d.setPassword(userService.encodePassword(d.getPassword()));
|
||||
}
|
||||
});
|
||||
if (userService.saveBatch(userList)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:save')")
|
||||
@ApiOperation("批量添加用户并返回userId")
|
||||
@PostMapping("/batchBackUserId")
|
||||
public ApiResult<?> saveBatchBackUserId(@RequestBody List<User> userList) {
|
||||
userList.forEach(d -> {
|
||||
d.setStatus(0);
|
||||
d.setPassword(userService.encodePassword(d.getPassword()));
|
||||
});
|
||||
final Set<String> phones = userList.stream().map(User::getPhone).collect(Collectors.toSet());
|
||||
if (userService.saveBatch(userList)) {
|
||||
final UserParam userParam = new UserParam();
|
||||
userParam.setPhones(phones);
|
||||
userParam.setLimit(500L);
|
||||
final PageResult<User> result = userService.pageRel(userParam);
|
||||
final Set<Integer> collect = result.getList().stream().map(User::getUserId).collect(Collectors.toSet());
|
||||
return success("添加成功",collect);
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody User user) {
|
||||
user.setStatus(null);
|
||||
user.setUsername(null);
|
||||
user.setPassword(null);
|
||||
// 前端请求限制仅可以修改自己的用户信息
|
||||
if (getAppId() != null) {
|
||||
user.setUserId(getLoginUserId());
|
||||
}
|
||||
if (userService.updateUser(user)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
@@ -113,6 +140,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
@@ -123,6 +151,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改用户")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<User> batchParam) {
|
||||
@@ -133,6 +162,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "id数组", required = true, dataType = "string", dataTypeClass = String.class)
|
||||
@@ -147,6 +177,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改用户状态")
|
||||
@PutMapping("/status")
|
||||
public ApiResult<?> updateStatus(@RequestBody User user) {
|
||||
@@ -163,6 +194,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改推荐状态")
|
||||
@PutMapping("/recommend")
|
||||
public ApiResult<?> updateRecommend(@RequestBody User user) {
|
||||
@@ -172,7 +204,6 @@ public class UserController extends BaseController {
|
||||
User u = new User();
|
||||
u.setUserId(user.getUserId());
|
||||
u.setRecommend(user.getRecommend());
|
||||
// 同步修改资料表
|
||||
if (userService.updateById(u)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
@@ -180,6 +211,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改用户状态")
|
||||
@PutMapping("/status/batch")
|
||||
public ApiResult<?> updateStatusBatch(@RequestBody BatchParam<Integer> batchParam) {
|
||||
@@ -195,6 +227,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("重置密码")
|
||||
@PutMapping("/password")
|
||||
public ApiResult<?> resetPassword(@RequestBody User user) {
|
||||
@@ -212,6 +245,7 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量重置密码")
|
||||
@PutMapping("/password/batch")
|
||||
public ApiResult<?> resetPasswordBatch(@RequestBody BatchParam<String> batchParam) {
|
||||
@@ -230,7 +264,6 @@ public class UserController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@ApiOperation("检查用户是否存在")
|
||||
@GetMapping("/existence")
|
||||
public ApiResult<?> existence(ExistenceParam<User> param) {
|
||||
@@ -322,7 +355,32 @@ public class UserController extends BaseController {
|
||||
return fail("更新失败");
|
||||
}
|
||||
|
||||
@PostMapping("/updatePointsBySign")
|
||||
@ApiOperation("签到成功累加积分")
|
||||
public ApiResult<?> updatePointsBySign(){
|
||||
final User loginUser = getLoginUser();
|
||||
loginUser.setPoints(loginUser.getPoints() + 1);
|
||||
if (userService.updateUser(loginUser)) {
|
||||
return success("签到成功");
|
||||
}
|
||||
return fail("签到失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||
@PutMapping("/updateUserBalance")
|
||||
@ApiOperation("更新用户余额")
|
||||
public ApiResult<?> updateUserBalance(@RequestBody User user){
|
||||
if (getLoginUser() == null) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (userService.updateUser(user)) {
|
||||
return success("操作成功");
|
||||
}
|
||||
return fail("操作失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("统计用户余额")
|
||||
@GetMapping("/countUserBalance")
|
||||
public ApiResult<?> countUserBalance(User param) {
|
||||
|
||||
@@ -3,14 +3,13 @@ package com.gxwebsoft.common.system.entity;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gxwebsoft.oa.entity.Company;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,7 +29,7 @@ public class User implements UserDetails {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("用户类型, 0普通用户 6开发者 10企业用户")
|
||||
@ApiModelProperty("用户类型, 0普通用户")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("用户编码")
|
||||
@@ -51,7 +50,7 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("头像")
|
||||
private String bgImage;
|
||||
|
||||
@ApiModelProperty("性别, 1男 2女")
|
||||
@ApiModelProperty("性别, 字典标识")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty("手机号")
|
||||
@@ -60,15 +59,28 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty("支付密码")
|
||||
private String payPassword;
|
||||
|
||||
@ApiModelProperty("职务")
|
||||
private String position;
|
||||
|
||||
@ApiModelProperty("邮箱是否验证, 0否, 1是")
|
||||
private Integer emailVerified;
|
||||
|
||||
@ApiModelProperty("别名")
|
||||
private String alias;
|
||||
|
||||
@ApiModelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
@ApiModelProperty("身份证号(脱敏)")
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
@TableField(exist = false)
|
||||
private String idCardNo;
|
||||
|
||||
@ApiModelProperty("出生日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
@@ -118,13 +130,54 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("机构ID")
|
||||
private Integer organizationId;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
@ApiModelProperty("会员分组ID")
|
||||
private Integer groupId;
|
||||
|
||||
@ApiModelProperty("会员分组")
|
||||
@TableField(exist = false)
|
||||
private Integer merchantId;
|
||||
private String groupName;
|
||||
|
||||
@ApiModelProperty("客户ID")
|
||||
@TableField(exist = false)
|
||||
private Integer customerId;
|
||||
|
||||
@ApiModelProperty("企业ID")
|
||||
@TableField(exist = false)
|
||||
private Integer companyId;
|
||||
|
||||
@ApiModelProperty("注册来源客户端")
|
||||
private String platform;
|
||||
|
||||
@ApiModelProperty("是否下线会员")
|
||||
private Integer offline;
|
||||
|
||||
@ApiModelProperty("关注数")
|
||||
private Integer followers;
|
||||
|
||||
@ApiModelProperty("粉丝数")
|
||||
private Integer fans;
|
||||
|
||||
@ApiModelProperty("获赞数")
|
||||
private Integer likes;
|
||||
|
||||
@ApiModelProperty("客户端ID")
|
||||
private String clientId;
|
||||
|
||||
@ApiModelProperty(value = "可管理的商户")
|
||||
private String merchants;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
private Integer merchantId;
|
||||
|
||||
@ApiModelProperty(value = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@ApiModelProperty(value = "是否管理员")
|
||||
private Boolean isAdmin;
|
||||
|
||||
@ApiModelProperty("评论数")
|
||||
private Integer commentNumbers;
|
||||
|
||||
@ApiModelProperty("是否推荐")
|
||||
private Integer recommend;
|
||||
|
||||
@@ -141,9 +194,23 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "租户名称")
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
@ApiModelProperty(value = "最后结算时间")
|
||||
private Date settlementTime;
|
||||
|
||||
@ApiModelProperty("注册时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("公司名称")
|
||||
@TableField(exist = false)
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty("是否已实名认证")
|
||||
private Integer certification;
|
||||
|
||||
@@ -179,36 +246,39 @@ public class User implements UserDetails {
|
||||
@TableField(exist = false)
|
||||
private Integer dealerId;
|
||||
|
||||
@ApiModelProperty("用户唯一小程序id")
|
||||
@ApiModelProperty("微信openid")
|
||||
private String openid;
|
||||
|
||||
@ApiModelProperty("微信unionid")
|
||||
private String unionid;
|
||||
|
||||
@ApiModelProperty("ico文件")
|
||||
@TableField(exist = false)
|
||||
private String logo;
|
||||
|
||||
@ApiModelProperty("创建的应用数量")
|
||||
@TableField(exist = false)
|
||||
private Double apps;
|
||||
|
||||
@ApiModelProperty("租户设置信息")
|
||||
@TableField(exist = false)
|
||||
private String setting;
|
||||
|
||||
@ApiModelProperty("手机号(脱敏)")
|
||||
@TableField(exist = false)
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "小程序用户秘钥")
|
||||
private String sessionKey;
|
||||
@ApiModelProperty("当期登录的商户账号")
|
||||
@TableField(exist = false)
|
||||
private MerchantAccount merchantAccount;
|
||||
|
||||
@ApiModelProperty(value = "头像地址")
|
||||
private String avatarUrl;
|
||||
// @ApiModelProperty("企业信息")
|
||||
// @TableField(exist = false)
|
||||
// private Company companyInfo;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "是否管理员:1是;0否")
|
||||
private Boolean isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
@ApiModelProperty(value = "可管理的商户")
|
||||
private String merchants;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
// @ApiModelProperty("系统配置信息")
|
||||
// @TableField(exist = false)
|
||||
// private Object system;
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
@@ -229,16 +299,13 @@ public class User implements UserDetails {
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
//
|
||||
// public String getRealName(){
|
||||
// return DesensitizedUtil.chineseName(this.realName);
|
||||
// }
|
||||
//
|
||||
// public String getIdCard(){
|
||||
// return DesensitizedUtil.idCardNum(this.idCard,1,2);
|
||||
// }
|
||||
|
||||
public String getMobile(){
|
||||
return DesensitizedUtil.mobilePhone(this.phone);
|
||||
}
|
||||
|
||||
public String getIdCardNo(){
|
||||
return DesensitizedUtil.idCardNum(this.idCard,4,4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,6 +80,10 @@ public class UserParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer organizationId;
|
||||
|
||||
@ApiModelProperty("用户分组ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer groupId;
|
||||
|
||||
@ApiModelProperty("注册来源客户端")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String platform;
|
||||
@@ -103,6 +107,10 @@ public class UserParam extends BaseParam {
|
||||
@TableField(exist = false)
|
||||
private Integer roleId;
|
||||
|
||||
@ApiModelProperty("角色标识")
|
||||
@TableField(exist = false)
|
||||
private String roleCode;
|
||||
|
||||
@ApiModelProperty(value = "所在省份")
|
||||
private String province;
|
||||
|
||||
@@ -112,6 +120,18 @@ public class UserParam extends BaseParam {
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty("关注数")
|
||||
private Integer followers;
|
||||
|
||||
@ApiModelProperty("粉丝数")
|
||||
private Integer fans;
|
||||
|
||||
@ApiModelProperty("获赞数")
|
||||
private Integer likes;
|
||||
|
||||
@ApiModelProperty("评论数")
|
||||
private Integer commentNumbers;
|
||||
|
||||
@ApiModelProperty(value = "择偶区域")
|
||||
@TableField(exist = false)
|
||||
private String cityMate;
|
||||
@@ -178,6 +198,10 @@ public class UserParam extends BaseParam {
|
||||
@TableField(exist = false)
|
||||
private Boolean isStaff;
|
||||
|
||||
@ApiModelProperty(value = "是否管理员")
|
||||
@TableField(exist = false)
|
||||
private Boolean isAdmin;
|
||||
|
||||
@ApiModelProperty("最后结算时间")
|
||||
@TableField(exist = false)
|
||||
private Date settlementTime;
|
||||
@@ -198,15 +222,18 @@ public class UserParam extends BaseParam {
|
||||
@TableField(exist = false)
|
||||
private Boolean showProfile;
|
||||
|
||||
@ApiModelProperty("关注数")
|
||||
private Integer followers;
|
||||
@ApiModelProperty("openId")
|
||||
@TableField(exist = false)
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty("粉丝数")
|
||||
private Integer fans;
|
||||
@ApiModelProperty(value = "可管理的商户")
|
||||
@QueryField(type = QueryType.LIKE)
|
||||
private String merchants;
|
||||
|
||||
@ApiModelProperty("获赞数")
|
||||
private Integer likes;
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer merchantId;
|
||||
|
||||
@ApiModelProperty("评论数")
|
||||
private Integer commentNumbers;
|
||||
@ApiModelProperty(value = "商户名称")
|
||||
private String merchantName;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import com.gxwebsoft.shop.entity.Users;
|
||||
import com.gxwebsoft.shop.param.UsersParam;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import okhttp3.FormBody;
|
||||
@@ -24,40 +27,39 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户控制器
|
||||
* 控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
@Api(tags = "用户管理")
|
||||
@Api(tags = "会员管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/users")
|
||||
public class UsersController extends BaseController {
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Users>> page(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.pageRel(param));
|
||||
}
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Users>> page(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:users:list')")
|
||||
@ApiOperation("查询全部用户")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Users>> list(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.listRel(param));
|
||||
}
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Users>> list(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:users:list')")
|
||||
@ApiOperation("根据id查询用户")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Users> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(usersService.getByIdRel(id));
|
||||
}
|
||||
@PreAuthorize("hasAuthority('shop:users:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Users> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(usersService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:users:list')")
|
||||
@ApiOperation("根据手机查询用户")
|
||||
@@ -70,17 +72,14 @@ public class UsersController extends BaseController {
|
||||
final Users addUsers = new Users();
|
||||
addUsers.setPhone(param.getPhone());
|
||||
addUsers.setUsername("微信用户");
|
||||
addUsers.setOpenid("");
|
||||
addUsers.setOpenId("");
|
||||
addUsers.setAvatarUrl("");
|
||||
addUsers.setSex(0);
|
||||
addUsers.setGender(0);
|
||||
addUsers.setIsAdmin(2);
|
||||
addUsers.setCountry("");
|
||||
addUsers.setProvince("");
|
||||
addUsers.setCity("");
|
||||
addUsers.setRegion("");
|
||||
long longValue = System.currentTimeMillis() / 1000;
|
||||
addUsers.setAddTime((int) longValue);
|
||||
addUsers.setSortNumber(0);
|
||||
usersService.save(addUsers);
|
||||
result = addUsers;
|
||||
} else {
|
||||
@@ -98,41 +97,41 @@ public class UsersController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Users users) {
|
||||
if (usersService.updateById(users)) {
|
||||
return success("修改成功");
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Users users) {
|
||||
if (usersService.updateById(users)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (usersService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (usersService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加用户")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Users> list) {
|
||||
if (usersService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Users> list) {
|
||||
if (usersService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改用户")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Users> batchParam) {
|
||||
if (batchParam.update(usersService, "user_id")) {
|
||||
return success("修改成功");
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Users> batchParam) {
|
||||
if (batchParam.update(usersService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户")
|
||||
@DeleteMapping("/batch")
|
||||
|
||||
@@ -15,11 +15,13 @@ import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.entity.Order;
|
||||
import com.gxwebsoft.shop.entity.OrderInfo;
|
||||
import com.gxwebsoft.shop.entity.Payment;
|
||||
import com.gxwebsoft.shop.service.OrderInfoService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
import com.wechat.pay.java.core.notification.RSANotificationConfig;
|
||||
@@ -52,6 +54,8 @@ public class WxPayNotifyController extends BaseController {
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private UserCardService userCardService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@@ -139,6 +143,8 @@ public class WxPayNotifyController extends BaseController {
|
||||
userCard.setPayStatus(1);
|
||||
userCardService.updateById(userCard);
|
||||
}
|
||||
// 8.发放积分
|
||||
usersService.addIntegral(order);
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,34 +4,30 @@ import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Users对象", description = "用户")
|
||||
@ApiModel(value = "Users对象", description = "")
|
||||
@TableName("shop_users")
|
||||
public class Users implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "uid", type = IdType.AUTO)
|
||||
private Integer uid;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户唯一小程序id")
|
||||
private String openid;
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty(value = "小程序用户秘钥")
|
||||
private String sessionKey;
|
||||
@@ -43,7 +39,7 @@ public class Users implements Serializable {
|
||||
private String avatarUrl;
|
||||
|
||||
@ApiModelProperty(value = "1男,2女")
|
||||
private Integer sex;
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty(value = "国家")
|
||||
private String country;
|
||||
@@ -54,65 +50,26 @@ public class Users implements Serializable {
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "邮箱是否验证, 0否, 1是")
|
||||
private Integer emailVerified;
|
||||
|
||||
@ApiModelProperty(value = "积分")
|
||||
private BigDecimal points;
|
||||
private BigDecimal integral;
|
||||
|
||||
@ApiModelProperty(value = "余额")
|
||||
private BigDecimal balance;
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Integer addTime;
|
||||
private Integer createTime;
|
||||
|
||||
@ApiModelProperty(value = "身份证号码")
|
||||
private String idCard;
|
||||
private String idcard;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
private String truename;
|
||||
|
||||
@ApiModelProperty(value = "是否管理员:1是;2否")
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
@ApiModelProperty(value = "注册来源客户端 (APP、H5、小程序等)")
|
||||
private String platform;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户Mapper
|
||||
* Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
public interface UsersMapper extends BaseMapper<Users> {
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
SELECT a.*
|
||||
FROM shop_users a
|
||||
<where>
|
||||
<if test="param.uid != null">
|
||||
AND a.uid = #{param.uid}
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.openid != null">
|
||||
AND a.openid LIKE CONCAT('%', #{param.openid}, '%')
|
||||
<if test="param.openId != null">
|
||||
AND a.open_id LIKE CONCAT('%', #{param.openId}, '%')
|
||||
</if>
|
||||
<if test="param.sessionKey != null">
|
||||
AND a.session_key LIKE CONCAT('%', #{param.sessionKey}, '%')
|
||||
@@ -22,8 +22,8 @@
|
||||
<if test="param.avatarUrl != null">
|
||||
AND a.avatar_url LIKE CONCAT('%', #{param.avatarUrl}, '%')
|
||||
</if>
|
||||
<if test="param.sex != null">
|
||||
AND a.sex = #{param.sex}
|
||||
<if test="param.gender != null">
|
||||
AND a.gender = #{param.gender}
|
||||
</if>
|
||||
<if test="param.country != null">
|
||||
AND a.country LIKE CONCAT('%', #{param.country}, '%')
|
||||
@@ -34,62 +34,14 @@
|
||||
<if test="param.city != null">
|
||||
AND a.city LIKE CONCAT('%', #{param.city}, '%')
|
||||
</if>
|
||||
<if test="param.region != null">
|
||||
AND a.region LIKE CONCAT('%', #{param.region}, '%')
|
||||
</if>
|
||||
<if test="param.longitude != null">
|
||||
AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%')
|
||||
</if>
|
||||
<if test="param.latitude != null">
|
||||
AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%')
|
||||
</if>
|
||||
<if test="param.phone != null">
|
||||
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||
</if>
|
||||
<if test="param.email != null">
|
||||
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
||||
<if test="param.integral != null">
|
||||
AND a.integral = #{param.integral}
|
||||
</if>
|
||||
<if test="param.emailVerified != null">
|
||||
AND a.email_verified = #{param.emailVerified}
|
||||
</if>
|
||||
<if test="param.points != null">
|
||||
AND a.points = #{param.points}
|
||||
</if>
|
||||
<if test="param.balance != null">
|
||||
AND a.balance = #{param.balance}
|
||||
</if>
|
||||
<if test="param.addTime != null">
|
||||
AND a.add_time = #{param.addTime}
|
||||
</if>
|
||||
<if test="param.idCard != null">
|
||||
AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%')
|
||||
</if>
|
||||
<if test="param.realName != null">
|
||||
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
||||
</if>
|
||||
<if test="param.isAdmin != null">
|
||||
AND a.is_admin = #{param.isAdmin}
|
||||
</if>
|
||||
<if test="param.clientId != null">
|
||||
AND a.client_id LIKE CONCAT('%', #{param.clientId}, '%')
|
||||
</if>
|
||||
<if test="param.platform != null">
|
||||
AND a.platform LIKE CONCAT('%', #{param.platform}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
<if test="param.money != null">
|
||||
AND a.money = #{param.money}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
@@ -97,15 +49,19 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.username LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.province LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.city LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.region LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
<if test="param.idcard != null">
|
||||
AND a.idcard LIKE CONCAT('%', #{param.idcard}, '%')
|
||||
</if>
|
||||
<if test="param.truename != null">
|
||||
AND a.truename LIKE CONCAT('%', #{param.truename}, '%')
|
||||
</if>
|
||||
<if test="param.isAdmin != null">
|
||||
AND a.is_admin = #{param.isAdmin}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -11,23 +11,23 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户查询参数
|
||||
* 查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "UsersParam对象", description = "用户查询参数")
|
||||
@ApiModel(value = "UsersParam对象", description = "查询参数")
|
||||
public class UsersParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer uid;
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户唯一小程序id")
|
||||
private String openid;
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty(value = "小程序用户秘钥")
|
||||
private String sessionKey;
|
||||
@@ -40,7 +40,7 @@ public class UsersParam extends BaseParam {
|
||||
|
||||
@ApiModelProperty(value = "1男,2女")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sex;
|
||||
private Boolean gender;
|
||||
|
||||
@ApiModelProperty(value = "国家")
|
||||
private String country;
|
||||
@@ -51,66 +51,23 @@ public class UsersParam extends BaseParam {
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "邮箱是否验证, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer emailVerified;
|
||||
|
||||
@ApiModelProperty(value = "积分")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal points;
|
||||
private BigDecimal integral;
|
||||
|
||||
@ApiModelProperty(value = "余额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal balance;
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer addTime;
|
||||
private String idcard;
|
||||
|
||||
@ApiModelProperty(value = "身份证号码")
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
private String truename;
|
||||
|
||||
@ApiModelProperty(value = "是否管理员:1是;2否")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
@ApiModelProperty(value = "注册来源客户端 (APP、H5、小程序等)")
|
||||
private String platform;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
private Boolean isAdmin;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,16 +2,17 @@ package com.gxwebsoft.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.entity.Order;
|
||||
import com.gxwebsoft.shop.entity.Users;
|
||||
import com.gxwebsoft.shop.param.UsersParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户Service
|
||||
* Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
public interface UsersService extends IService<Users> {
|
||||
|
||||
@@ -34,9 +35,10 @@ public interface UsersService extends IService<Users> {
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param userId
|
||||
* @param id
|
||||
* @return Users
|
||||
*/
|
||||
Users getByIdRel(Integer userId);
|
||||
Users getByIdRel(Integer id);
|
||||
|
||||
void addIntegral(Order order);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.gxwebsoft.shop.service.impl;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -17,24 +16,17 @@ import com.gxwebsoft.cms.entity.Website;
|
||||
import com.gxwebsoft.cms.entity.WebsiteField;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.mapper.OrderMapper;
|
||||
import com.gxwebsoft.shop.param.OrderInfoParam;
|
||||
import com.gxwebsoft.shop.service.OrderGoodsService;
|
||||
import com.gxwebsoft.shop.service.OrderInfoService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import com.gxwebsoft.shop.param.OrderParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.service.UserBalanceLogService;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.mapper.OrderMapper;
|
||||
import com.gxwebsoft.shop.param.OrderParam;
|
||||
import com.gxwebsoft.shop.service.*;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAConfig;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
@@ -42,23 +34,12 @@ import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import com.wechat.pay.java.service.payments.nativepay.NativePayService;
|
||||
import com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.beans.Beans;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -87,6 +68,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private UserCardService userCardService;
|
||||
@Resource
|
||||
private UserCardLogService userCardLogService;
|
||||
@@ -326,6 +309,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
userCard.setPayStatus(1);
|
||||
userCardService.updateById(userCard);
|
||||
}
|
||||
// 发放积分
|
||||
usersService.addIntegral(order);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -377,7 +362,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
order.setPayTime(DateUtil.date());
|
||||
order.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.YEAR, 10));
|
||||
orderService.updateById(order);
|
||||
// 更新订单信息表的支付状态
|
||||
orderInfoService.update(new LambdaUpdateWrapper<OrderInfo>().eq(OrderInfo::getOrderId,order.getOrderId()).set(OrderInfo::getPayStatus,1));
|
||||
// 发放积分
|
||||
usersService.addIntegral(order);
|
||||
return true;
|
||||
}
|
||||
//
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.gxwebsoft.shop.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.booking.entity.IntegralLog;
|
||||
import com.gxwebsoft.booking.service.IntegralLogService;
|
||||
import com.gxwebsoft.shop.entity.Order;
|
||||
import com.gxwebsoft.shop.mapper.UsersMapper;
|
||||
import com.gxwebsoft.shop.service.UsersService;
|
||||
import com.gxwebsoft.shop.entity.Users;
|
||||
@@ -9,20 +14,25 @@ import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户Service实现
|
||||
* Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-07 16:25:11
|
||||
* @since 2024-07-12 01:10:04
|
||||
*/
|
||||
@Service
|
||||
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
|
||||
@Resource
|
||||
private IntegralLogService integralLogService;
|
||||
|
||||
@Override
|
||||
public PageResult<Users> pageRel(UsersParam param) {
|
||||
PageParam<Users, UsersParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, add_time desc, create_time desc");
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Users> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
@@ -32,15 +42,39 @@ public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements
|
||||
List<Users> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Users, UsersParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, add_time desc, create_time desc");
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Users getByIdRel(Integer uid) {
|
||||
public Users getByIdRel(Integer id) {
|
||||
UsersParam param = new UsersParam();
|
||||
param.setUid(uid);
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIntegral(Order order) {
|
||||
final Users users = getOne(new LambdaUpdateWrapper<Users>().eq(Users::getPhone, order.getPhone()).last("limit 1"));
|
||||
final BigDecimal old = users.getIntegral();
|
||||
final BigDecimal news = users.getIntegral().add(order.getPayPrice());
|
||||
users.setIntegral(news);
|
||||
updateById(users);
|
||||
// 记录明细
|
||||
final IntegralLog integralLog = new IntegralLog();
|
||||
integralLog.setOrderNum(order.getOrderNo());
|
||||
integralLog.setOid(order.getOrderId());
|
||||
integralLog.setSiteName(order.getMerchantName());
|
||||
integralLog.setUsername(order.getRealName());
|
||||
integralLog.setPhone(users.getPhone());
|
||||
integralLog.setIntegral(order.getPayPrice());
|
||||
integralLog.setOldMoney(old);
|
||||
integralLog.setNewMoney(news);
|
||||
integralLog.setCreateTime(DateUtil.currentSeconds());
|
||||
if (order.getType().equals(1)) {
|
||||
integralLog.setInfo("预订场地获得积分");
|
||||
}
|
||||
integralLogService.save(integralLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class BookingGenerator {
|
||||
// "booking_integral_log"
|
||||
// "booking_order"
|
||||
// "booking_emergency",
|
||||
// "booking_user",
|
||||
// "booking_user_coupon",
|
||||
// "booking_user_invoice",
|
||||
// "booking_user_card",
|
||||
@@ -69,7 +70,7 @@ public class BookingGenerator {
|
||||
// "booking_cooperate_log",
|
||||
// "booking_match",
|
||||
// "booking_match_order",
|
||||
"booking_coupon"
|
||||
// "booking_coupon"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ShopGenerator {
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "modules";
|
||||
private static final String DB_PASSWORD = "FYJGx7s8yt7K8xDH";
|
||||
private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
@@ -72,9 +72,9 @@ public class ShopGenerator {
|
||||
// "shop_order_info_log",
|
||||
// "shop_order_goods",
|
||||
// "shop_wechat_deposit",
|
||||
// "shop_users",
|
||||
"shop_users",
|
||||
// "shop_user_address",
|
||||
"shop_user_balance_log"
|
||||
// "shop_user_balance_log"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
|
||||
Reference in New Issue
Block a user