feat(work): 添加关注和作品收藏功能
- 新增 TpFollow 和 TpWorks 表及相关实体类 - 实现关注和作品收藏的 CRUD 接口和业务逻辑 - 添加相关控制器和 Mapper 接口 - 更新 TpOrder 表,增加备用字段
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanhai
|
||||||
|
*/
|
||||||
|
public class HttpContextUtils {
|
||||||
|
|
||||||
|
public static HttpServletRequest getHttpServletRequest() {
|
||||||
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDomain(){
|
||||||
|
HttpServletRequest request = getHttpServletRequest();
|
||||||
|
StringBuffer url = request.getRequestURL();
|
||||||
|
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getOrigin(){
|
||||||
|
HttpServletRequest request = getHttpServletRequest();
|
||||||
|
return request.getHeader("Origin");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 菠萝凤梨
|
||||||
|
* @date 2022/3/28 14:32
|
||||||
|
*/
|
||||||
|
public interface OauthCacheNames {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* oauth 授权相关key
|
||||||
|
*/
|
||||||
|
String OAUTH_PREFIX = "mall4j_oauth:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token 授权相关key
|
||||||
|
*/
|
||||||
|
String OAUTH_TOKEN_PREFIX = OAUTH_PREFIX + "token:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存token 缓存使用key
|
||||||
|
*/
|
||||||
|
String ACCESS = OAUTH_TOKEN_PREFIX + "access:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新token 缓存使用key
|
||||||
|
*/
|
||||||
|
String REFRESH_TO_ACCESS = OAUTH_TOKEN_PREFIX + "refresh_to_access:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据uid获取保存的token key缓存使用的key
|
||||||
|
*/
|
||||||
|
String UID_TO_ACCESS = OAUTH_TOKEN_PREFIX + "uid_to_access:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存token的用户信息使用的key
|
||||||
|
*/
|
||||||
|
String USER_INFO = OAUTH_TOKEN_PREFIX + "user_info:";
|
||||||
|
}
|
||||||
128
ruoyi-admin/src/main/java/org/dromara/web/common/PageParam.java
Normal file
128
ruoyi-admin/src/main/java/org/dromara/web/common/PageParam.java
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanhai
|
||||||
|
*/
|
||||||
|
@Schema
|
||||||
|
@ParameterObject
|
||||||
|
public class PageParam<T> extends Page<T> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页显示条数,默认 10
|
||||||
|
*/
|
||||||
|
@Schema(description = "每页大小,默认10")
|
||||||
|
private long size = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前页
|
||||||
|
*/
|
||||||
|
@Schema(description = "当前页,默认1")
|
||||||
|
private long current = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据列表
|
||||||
|
*/
|
||||||
|
@Hidden
|
||||||
|
private List<T> records;
|
||||||
|
/**
|
||||||
|
* 总数
|
||||||
|
*/
|
||||||
|
@Hidden
|
||||||
|
private long total = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否进行 count 查询
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private boolean isSearchCount = true;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private String countId;
|
||||||
|
@JsonIgnore
|
||||||
|
private Long maxLimit;
|
||||||
|
@JsonIgnore
|
||||||
|
private boolean optimizeCountSql;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<T> getRecords() {
|
||||||
|
return this.records;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> setRecords(List<T> records) {
|
||||||
|
this.records = records;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTotal() {
|
||||||
|
return this.total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> setTotal(long total) {
|
||||||
|
this.total = total;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean getSearchCount() {
|
||||||
|
if (total < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return isSearchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> setSearchCount(boolean isSearchCount) {
|
||||||
|
this.isSearchCount = isSearchCount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> setSize(long size) {
|
||||||
|
int maxSize = 100;
|
||||||
|
if (size > maxSize) {
|
||||||
|
this.size = maxSize;
|
||||||
|
} else {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCurrent() {
|
||||||
|
return this.current;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<T> setCurrent(long current) {
|
||||||
|
this.current = current;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.symmetric.AES;
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 菠萝凤梨
|
||||||
|
* @date 2022/1/19 16:02
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class PasswordManager {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(PasswordManager.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于aes签名的key,16位
|
||||||
|
*/
|
||||||
|
@Value("${auth.password.signKey:-mall4j-password}")
|
||||||
|
public String passwordSignKey;
|
||||||
|
|
||||||
|
public String decryptPassword(String data) {
|
||||||
|
// 在使用oracle的JDK时,JAR包必须签署特殊的证书才能使用。
|
||||||
|
// 解决方案 1.使用openJDK或者非oracle的JDK(建议) 2.添加证书
|
||||||
|
// hutool的aes报错可以打开下面那段代码
|
||||||
|
SecureUtil.disableBouncyCastle();
|
||||||
|
AES aes = new AES(passwordSignKey.getBytes(StandardCharsets.UTF_8));
|
||||||
|
String decryptStr;
|
||||||
|
String decryptPassword;
|
||||||
|
try {
|
||||||
|
decryptStr = aes.decryptStr(data);
|
||||||
|
decryptPassword = decryptStr.substring(13);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Exception:", e);
|
||||||
|
throw new UserException("AES解密错误", e);
|
||||||
|
}
|
||||||
|
return decryptPassword;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FrozenWatermelon
|
||||||
|
* @date 2020/7/9
|
||||||
|
*/
|
||||||
|
public enum ResponseEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ok
|
||||||
|
*/
|
||||||
|
OK("00000", "ok"),
|
||||||
|
SHOW_FAIL("A00001", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于直接显示提示用户的错误,内容由输入内容决定
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于直接显示提示系统的成功,内容由输入内容决定
|
||||||
|
*/
|
||||||
|
SHOW_SUCCESS("A00002", ""),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未授权
|
||||||
|
*/
|
||||||
|
UNAUTHORIZED("A00004", "Unauthorized"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器出了点小差
|
||||||
|
*/
|
||||||
|
EXCEPTION("A00005", "服务器出了点小差"),
|
||||||
|
/**
|
||||||
|
* 方法参数没有校验,内容由输入内容决定
|
||||||
|
*/
|
||||||
|
METHOD_ARGUMENT_NOT_VALID("A00014", "方法参数没有校验");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResponseEnum(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + "} " + super.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author LGH
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
public class SecurityUtils {
|
||||||
|
|
||||||
|
private static final String USER_REQUEST = "/api/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户
|
||||||
|
*/
|
||||||
|
public YamiUser getUser() {
|
||||||
|
if (!HttpContextUtils.getHttpServletRequest().getRequestURI().startsWith(USER_REQUEST)) {
|
||||||
|
// 用户相关的请求,应该以/p开头!!!
|
||||||
|
throw new RuntimeException("登录过期或已失效");
|
||||||
|
}
|
||||||
|
|
||||||
|
String accessToken = HttpContextUtils.getHttpServletRequest().getHeader("accessToken");
|
||||||
|
TokenStore tokenStore = new TokenStore();
|
||||||
|
UserInfoInTokenBO userInfoInTokenBO = tokenStore.getUserInfoByAccessToken(accessToken,false);
|
||||||
|
|
||||||
|
YamiUser yamiUser = new YamiUser();
|
||||||
|
yamiUser.setUserId(userInfoInTokenBO.getUserId());
|
||||||
|
yamiUser.setBizUserId(userInfoInTokenBO.getBizUserId());
|
||||||
|
yamiUser.setEnabled(userInfoInTokenBO.getEnabled());
|
||||||
|
yamiUser.setShopId(userInfoInTokenBO.getShopId());
|
||||||
|
yamiUser.setStationId(userInfoInTokenBO.getOtherId());
|
||||||
|
return yamiUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户ID
|
||||||
|
*/
|
||||||
|
public Long getUserInfo() {
|
||||||
|
Long userId = null;
|
||||||
|
try {
|
||||||
|
userId = getUser().getUserId();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
// 处理异常
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanhai
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class ServerResponseEntity<T> implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private Long timestamp;
|
||||||
|
|
||||||
|
/* private String sign;
|
||||||
|
|
||||||
|
public String getSign() {
|
||||||
|
return sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSign(String sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerResponseEntity setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(Long timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return Objects.equals(ResponseEnum.OK.value(), this.code);
|
||||||
|
}
|
||||||
|
public boolean isFail() {
|
||||||
|
return !Objects.equals(ResponseEnum.OK.value(), this.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerResponseEntity() {
|
||||||
|
// 版本号
|
||||||
|
this.version = "1.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(T data) {
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setData(data);
|
||||||
|
serverResponseEntity.setCode(ResponseEnum.OK.value());
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
serverResponseEntity.setMsg("success");
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success() {
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setCode(ResponseEnum.OK.value());
|
||||||
|
serverResponseEntity.setMsg(ResponseEnum.OK.getMsg());
|
||||||
|
serverResponseEntity.setMsg("success");
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(Integer code, T data) {
|
||||||
|
return success(String.valueOf(code), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(String code, T data) {
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setCode(code);
|
||||||
|
serverResponseEntity.setData(data);
|
||||||
|
serverResponseEntity.setMsg("success");
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端显示失败消息
|
||||||
|
* @param msg 失败消息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static <T> ServerResponseEntity<T> showFailMsg(String msg) {
|
||||||
|
log.error(msg);
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setMsg(msg);
|
||||||
|
serverResponseEntity.setCode(ResponseEnum.SHOW_FAIL.value());
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum) {
|
||||||
|
log.error(responseEnum.toString());
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setMsg(responseEnum.getMsg());
|
||||||
|
serverResponseEntity.setCode(responseEnum.value());
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum, T data) {
|
||||||
|
log.error(responseEnum.toString());
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setMsg(responseEnum.getMsg());
|
||||||
|
serverResponseEntity.setCode(responseEnum.value());
|
||||||
|
serverResponseEntity.setData(data);
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(String code, String msg, T data) {
|
||||||
|
log.error(msg);
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setMsg(msg);
|
||||||
|
serverResponseEntity.setCode(code);
|
||||||
|
serverResponseEntity.setData(data);
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(String code, String msg) {
|
||||||
|
return fail(code, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(Integer code, T data) {
|
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>();
|
||||||
|
serverResponseEntity.setCode(String.valueOf(code));
|
||||||
|
serverResponseEntity.setData(data);
|
||||||
|
serverResponseEntity.setTimestamp(System.currentTimeMillis());
|
||||||
|
return serverResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ServerResponseEntity{" +
|
||||||
|
"code='" + code + '\'' +
|
||||||
|
", msg='" + msg + '\'' +
|
||||||
|
", data=" + data +
|
||||||
|
", version='" + version + '\'' +
|
||||||
|
", timestamp=" + timestamp +
|
||||||
|
// ", sign='" + sign + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token信息,该信息存在redis中
|
||||||
|
*
|
||||||
|
* @author 菠萝凤梨
|
||||||
|
* @date 2022/3/25 17:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TokenInfoBO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存在token信息里面的用户信息
|
||||||
|
*/
|
||||||
|
private UserInfoInTokenBO userInfoInToken;
|
||||||
|
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
private String refreshToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在多少秒后过期
|
||||||
|
*/
|
||||||
|
private Integer expiresIn;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token信息,该信息用户返回给前端,前端请求携带accessToken进行用户校验
|
||||||
|
*
|
||||||
|
* @author FrozenWatermelon
|
||||||
|
* @date 2020/7/2
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TokenInfoVO {
|
||||||
|
|
||||||
|
@Schema(description = "accessToken" )
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
@Schema(description = "refreshToken" )
|
||||||
|
private String refreshToken;
|
||||||
|
|
||||||
|
@Schema(description = "在多少秒后过期" )
|
||||||
|
private Integer expiresIn;
|
||||||
|
}
|
||||||
171
ruoyi-admin/src/main/java/org/dromara/web/common/TokenStore.java
Normal file
171
ruoyi-admin/src/main/java/org/dromara/web/common/TokenStore.java
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.dromara.common.redis.utils.RedisUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* token管理 1. 登陆返回token 2. 刷新token 3. 清除用户过去token 4. 校验token
|
||||||
|
*
|
||||||
|
* @author FrozenWatermelon
|
||||||
|
* @date 2020/7/2
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class TokenStore {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TokenStore.class);
|
||||||
|
|
||||||
|
// private final RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
/*public TokenStore(RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
this.redisTemplate = redisTemplate;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以Sa-Token技术生成token,并返回token信息
|
||||||
|
* @param userInfoInToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TokenInfoBO storeAccessSaToken(UserInfoInTokenBO userInfoInToken) {
|
||||||
|
//生成过期时间
|
||||||
|
int timeoutSecond = getExpiresIn(userInfoInToken.getSysType());
|
||||||
|
Duration accessTokenExpires = Duration.ofSeconds(timeoutSecond);
|
||||||
|
|
||||||
|
String uid = this.getUid(userInfoInToken.getSysType().toString(), userInfoInToken.getUserId());
|
||||||
|
StpUtil.login(uid, timeoutSecond);
|
||||||
|
String token = StpUtil.getTokenValue();
|
||||||
|
// 用户信息存入缓存 token生成
|
||||||
|
String keyName = OauthCacheNames.USER_INFO + token;
|
||||||
|
RedisUtils.deleteObject(keyName);
|
||||||
|
RedisUtils.setCacheObject(keyName, userInfoInToken, accessTokenExpires);
|
||||||
|
// 数据封装返回(token不用加密)
|
||||||
|
TokenInfoBO tokenInfoBO = new TokenInfoBO();
|
||||||
|
tokenInfoBO.setUserInfoInToken(userInfoInToken);
|
||||||
|
tokenInfoBO.setExpiresIn(timeoutSecond);
|
||||||
|
tokenInfoBO.setAccessToken(token);
|
||||||
|
tokenInfoBO.setRefreshToken(token);
|
||||||
|
return tokenInfoBO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算过期时间(单位:秒)
|
||||||
|
* @param sysType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getExpiresIn(int sysType) {
|
||||||
|
// 3600秒
|
||||||
|
int expiresIn = 3600;
|
||||||
|
// 普通用户token过期时间
|
||||||
|
if (Objects.equals(sysType, 0)) {
|
||||||
|
expiresIn = expiresIn * 24 * 30;
|
||||||
|
}
|
||||||
|
// 系统管理员的token过期时间
|
||||||
|
if (Objects.equals(sysType, 1)) {
|
||||||
|
expiresIn = expiresIn * 24 * 30;
|
||||||
|
}
|
||||||
|
return expiresIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据accessToken 获取用户信息
|
||||||
|
* @param accessToken accessToken
|
||||||
|
* @param needDecrypt 是否需要解密
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
public UserInfoInTokenBO getUserInfoByAccessToken(String accessToken, boolean needDecrypt) {
|
||||||
|
if (StrUtil.isBlank(accessToken)) {
|
||||||
|
throw new UserException("accessToken is blank");
|
||||||
|
}
|
||||||
|
String keyName = OauthCacheNames.USER_INFO + accessToken;
|
||||||
|
Object redisCache = RedisUtils.getCacheObject(keyName);
|
||||||
|
if (redisCache == null) {
|
||||||
|
throw new UserException("-2","登录过期,请重新登录");
|
||||||
|
}
|
||||||
|
return (UserInfoInTokenBO) redisCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新token,并返回新的token
|
||||||
|
* @param refreshToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TokenInfoBO refreshToken(String refreshToken) {
|
||||||
|
if (StrUtil.isBlank(refreshToken)) {
|
||||||
|
throw new UserException("refreshToken is blank");
|
||||||
|
}
|
||||||
|
// 删除旧token
|
||||||
|
UserInfoInTokenBO userInfoInTokenBO = getUserInfoByAccessToken(refreshToken, false);
|
||||||
|
this.deleteCurrentToken(refreshToken);
|
||||||
|
// 保存一份新的token
|
||||||
|
return storeAccessSaToken(userInfoInTokenBO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定用户的全部的token
|
||||||
|
*/
|
||||||
|
public void deleteAllToken(String sysType, Long userId) {
|
||||||
|
// 删除用户缓存
|
||||||
|
String uid = this.getUid(sysType, userId);
|
||||||
|
List<String> tokens = StpUtil.getTokenValueListByLoginId(uid);
|
||||||
|
if (!CollectionUtils.isEmpty(tokens)) {
|
||||||
|
List<String> keyNames = new ArrayList<>();
|
||||||
|
for (String token : tokens) {
|
||||||
|
keyNames.add(OauthCacheNames.USER_INFO + token);
|
||||||
|
}
|
||||||
|
RedisUtils.deleteObject(keyNames);
|
||||||
|
}
|
||||||
|
// 移除token
|
||||||
|
StpUtil.logout(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成token,并返回token展示信息
|
||||||
|
* @param userInfoInToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TokenInfoVO storeAndGetVo(UserInfoInTokenBO userInfoInToken) {
|
||||||
|
if (!userInfoInToken.getEnabled()){
|
||||||
|
// 用户已禁用,请联系客服
|
||||||
|
throw new UserException("用户已禁用,请联系客服");
|
||||||
|
}
|
||||||
|
TokenInfoBO tokenInfoBO = storeAccessSaToken(userInfoInToken);
|
||||||
|
// 数据封装返回
|
||||||
|
TokenInfoVO tokenInfoVO = new TokenInfoVO();
|
||||||
|
tokenInfoVO.setAccessToken(tokenInfoBO.getAccessToken());
|
||||||
|
tokenInfoVO.setRefreshToken(tokenInfoBO.getRefreshToken());
|
||||||
|
tokenInfoVO.setExpiresIn(tokenInfoBO.getExpiresIn());
|
||||||
|
return tokenInfoVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除当前登录的token
|
||||||
|
* @param accessToken 令牌
|
||||||
|
*/
|
||||||
|
public void deleteCurrentToken(String accessToken) {
|
||||||
|
// 删除用户缓存
|
||||||
|
String keyName = OauthCacheNames.USER_INFO + accessToken;
|
||||||
|
RedisUtils.deleteObject(keyName);
|
||||||
|
// 移除token
|
||||||
|
StpUtil.logoutByTokenValue(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成各系统唯一uid
|
||||||
|
* @param sysType 系统类型
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getUid(String sysType, Long userId) {
|
||||||
|
return sysType + ":" + userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存在token信息里面的用户信息
|
||||||
|
*
|
||||||
|
* @author 菠萝凤梨
|
||||||
|
* @date 2022/3/25 17:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserInfoInTokenBO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户在自己系统的用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id (商家id)
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统类型 0:普通用户 1:系统管理员
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer sysType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是管理员
|
||||||
|
*/
|
||||||
|
private Integer isAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务系统用户id
|
||||||
|
*/
|
||||||
|
private String bizUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限列表
|
||||||
|
*/
|
||||||
|
private Set<String> perms;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 正常 0 无效
|
||||||
|
*/
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他Id
|
||||||
|
*/
|
||||||
|
private Long otherId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lh
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "用户登录信息")
|
||||||
|
public class UserRegisterParam {
|
||||||
|
|
||||||
|
@Schema(description = "密码")
|
||||||
|
private String passWord;
|
||||||
|
|
||||||
|
@Schema(description = "邮箱")
|
||||||
|
private String userMail;
|
||||||
|
|
||||||
|
@Schema(description = "昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
@Schema(description = "用户名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "手机号")
|
||||||
|
@NotBlank(message = "手机号码不能为空", groups = { AddGroup.class})
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "头像")
|
||||||
|
private String img;
|
||||||
|
|
||||||
|
@Schema(description = "校验登陆注册验证码成功的标识")
|
||||||
|
private String checkRegisterSmsFlag;
|
||||||
|
|
||||||
|
@Schema(description = "当账户未绑定时,临时的uid")
|
||||||
|
private String tempUid;
|
||||||
|
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "微信openId")
|
||||||
|
private String openId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Maosw
|
||||||
|
*/
|
||||||
|
public class WxXcxUtils {
|
||||||
|
|
||||||
|
static String appid = "wxf1d78a0b58fc890c";
|
||||||
|
static String secret = "e1a3e888471d48addf1a23e4c9ea7f84";
|
||||||
|
|
||||||
|
public static String getAccessToken(){
|
||||||
|
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appid+"&secret="+secret;
|
||||||
|
String result = HttpUtil.get(url);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
return jsonObject.get("access_token").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getUserPhoneNumber(String code){
|
||||||
|
String accessToken = getAccessToken();
|
||||||
|
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="+accessToken;
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("code", code);
|
||||||
|
String result = HttpRequest.post(url).body(json.toString()).execute().body();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
package org.dromara.web.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户详细信息
|
||||||
|
* @author LGH
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YamiUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String bizUserId;
|
||||||
|
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自提点Id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
}
|
||||||
@@ -26,10 +26,7 @@ import org.dromara.system.service.ISysPictureService;
|
|||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.dromara.web.utils.WxXcxUtils;
|
import org.dromara.web.utils.WxXcxUtils;
|
||||||
import org.dromara.work.domain.TpReceipt;
|
import org.dromara.work.domain.TpReceipt;
|
||||||
import org.dromara.work.domain.bo.OrderRankingBo;
|
import org.dromara.work.domain.bo.*;
|
||||||
import org.dromara.work.domain.bo.TpProdBo;
|
|
||||||
import org.dromara.work.domain.bo.TpReceiptBo;
|
|
||||||
import org.dromara.work.domain.bo.TpWechatBo;
|
|
||||||
import org.dromara.work.domain.vo.*;
|
import org.dromara.work.domain.vo.*;
|
||||||
import org.dromara.work.service.*;
|
import org.dromara.work.service.*;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -73,6 +70,10 @@ public class IndexController {
|
|||||||
|
|
||||||
private final ITpProdService tpProdService;
|
private final ITpProdService tpProdService;
|
||||||
|
|
||||||
|
private final ITpFollowService tpFollowService;
|
||||||
|
|
||||||
|
private final ITpWorksService tpWorksService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问首页,提示语
|
* 访问首页,提示语
|
||||||
*/
|
*/
|
||||||
@@ -123,6 +124,106 @@ public class IndexController {
|
|||||||
return R.ok(WxXcxUtils.generateSignature(url));
|
return R.ok(WxXcxUtils.generateSignature(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取我的关注列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/follow")
|
||||||
|
public R<TableDataInfo<TpFollowVo>> list(TpFollowBo bo, PageQuery pageQuery) {
|
||||||
|
return R.ok(tpFollowService.queryPageList(bo, pageQuery));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注
|
||||||
|
*/
|
||||||
|
@PostMapping("/AddFollow")
|
||||||
|
public R<Boolean> insert(@RequestBody TpFollowBo bo) {
|
||||||
|
//判断是否已经关注
|
||||||
|
TpFollowVo tpFollow = tpFollowService.queryByTpFollow(bo);
|
||||||
|
if(tpFollow != null){
|
||||||
|
return R.fail("已关注");
|
||||||
|
}
|
||||||
|
return R.ok(tpFollowService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消关注
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delFollow")
|
||||||
|
public R<Boolean> delete(@RequestBody TpFollowBo bo) {
|
||||||
|
if(bo.getId() != null){
|
||||||
|
return R.ok(tpFollowService.deleteWithValidByIds(List.of(bo.getId()), false));
|
||||||
|
}
|
||||||
|
TpFollowVo tpFollow = tpFollowService.queryByTpFollow(bo);
|
||||||
|
return R.ok(tpFollowService.deleteWithValidByIds(List.of(tpFollow.getId()), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我是否关注此用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/isFollow")
|
||||||
|
public R<Boolean> isFollow(@RequestBody TpFollowBo bo) {
|
||||||
|
return R.ok(tpFollowService.queryByTpFollow(bo) != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取我的收藏作品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/tpWorks")
|
||||||
|
public R<TableDataInfo<TpWorksVo>> list(TpWorksBo bo, PageQuery pageQuery) {
|
||||||
|
return R.ok(tpWorksService.queryPageList(bo, pageQuery));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏作品
|
||||||
|
*/
|
||||||
|
@PostMapping("/AddWorks")
|
||||||
|
public R<Boolean> insert(@RequestBody TpWorksBo bo) {
|
||||||
|
//查询我是否已经收藏了此作品
|
||||||
|
TpWorksVo tpWorks = tpWorksService.queryByTpWorks(bo);
|
||||||
|
if(tpWorks != null){
|
||||||
|
return R.fail("已收藏");
|
||||||
|
}
|
||||||
|
return R.ok(tpWorksService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消收藏
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delWorks")
|
||||||
|
public R<Boolean> delete(@RequestBody TpWorksBo bo) {
|
||||||
|
if(bo.getId() != null){
|
||||||
|
return R.ok(tpWorksService.deleteWithValidByIds(List.of(bo.getId()), false));
|
||||||
|
}
|
||||||
|
TpWorksVo tpWorks = tpWorksService.queryByTpWorks(bo);
|
||||||
|
return R.ok(tpWorksService.deleteWithValidByIds(List.of(tpWorks.getId()), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我是否收藏此作品
|
||||||
|
*/
|
||||||
|
@PostMapping("/isWorks")
|
||||||
|
public R<Boolean> isWorks(@RequestBody TpWorksBo bo) {
|
||||||
|
return R.ok(tpWorksService.queryByTpWorks(bo) != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取表现师列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/tpSysUser")
|
||||||
|
public R<TableDataInfo<SysUserVo>> list(SysUserBo bo, PageQuery pageQuery) {
|
||||||
|
bo.setIdentity(2);
|
||||||
|
return R.ok(sysUserService.selectPageList(bo, pageQuery));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/sysUser/{id}")
|
||||||
|
public R<SysUserVo> getSysUserInfo(@NotNull(message = "用户ID不能为空") @PathVariable Long id) {
|
||||||
|
return R.ok(sysUserService.selectUserById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 银盛支付回调
|
* 银盛支付回调
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package org.dromara.web.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.secure.BCrypt;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
import org.dromara.work.domain.vo.TzUserVo;
|
||||||
|
import org.dromara.work.service.ITzUserService;
|
||||||
|
import org.dromara.web.common.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Maosw
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/user/login")
|
||||||
|
@Tag(name = "登录接口")
|
||||||
|
public class LoginController {
|
||||||
|
|
||||||
|
private final ITzUserService tzUserService;
|
||||||
|
|
||||||
|
private final TokenStore tokenStore;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/getUserPhoneNumber")
|
||||||
|
@Operation(summary = "微信接口获取手机号码" , description = "微信接口获取手机号码")
|
||||||
|
@Parameter(name = "code", description = "code", required = true)
|
||||||
|
public ServerResponseEntity<JSONObject> getUserPhoneNumber(@RequestParam(value = "code") String code) {
|
||||||
|
// String phone = WxXcxUtils.getUserPhoneNumber(code);
|
||||||
|
return ServerResponseEntity.success(WxXcxUtils.getUserPhoneNumber(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
@Operation(summary = "注册登录" , description = "用户绑定手机号注册登录")
|
||||||
|
public ServerResponseEntity<TokenInfoVO> register(@Valid @RequestBody UserRegisterParam userRegisterParam) {
|
||||||
|
if (StrUtil.isBlank(userRegisterParam.getNickName())) {
|
||||||
|
userRegisterParam.setNickName(userRegisterParam.getUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
TzUser tzUser = tzUserService.getOne(new LambdaQueryWrapper<TzUser>().eq(TzUser::getUserMobile, userRegisterParam.getMobile()));
|
||||||
|
if (ObjectUtil.isNotEmpty(tzUser)) {
|
||||||
|
//登录
|
||||||
|
UserInfoInTokenBO userInfoInTokenBO = new UserInfoInTokenBO();
|
||||||
|
userInfoInTokenBO.setUserId(tzUser.getUserId());
|
||||||
|
userInfoInTokenBO.setSysType(0);
|
||||||
|
userInfoInTokenBO.setEnabled(true);
|
||||||
|
return ServerResponseEntity.success(tokenStore.storeAndGetVo(userInfoInTokenBO));
|
||||||
|
}else {
|
||||||
|
//注册并登录
|
||||||
|
Date now = new Date();
|
||||||
|
TzUser user = new TzUser();
|
||||||
|
user.setModifyTime(now);
|
||||||
|
user.setUserRegtime(now);
|
||||||
|
user.setStatus(1);
|
||||||
|
user.setUserMobile(userRegisterParam.getMobile());
|
||||||
|
user.setNickName(userRegisterParam.getNickName());
|
||||||
|
user.setUserMail(userRegisterParam.getUserMail());
|
||||||
|
user.setPic(userRegisterParam.getImg());
|
||||||
|
user.setLoginPassword(BCrypt.hashpw(userRegisterParam.getPassWord()));
|
||||||
|
user.setOpenId(userRegisterParam.getOpenId());
|
||||||
|
tzUserService.save(user);
|
||||||
|
// 2. 登录
|
||||||
|
UserInfoInTokenBO userInfoInTokenBO = new UserInfoInTokenBO();
|
||||||
|
userInfoInTokenBO.setUserId(user.getUserId());
|
||||||
|
userInfoInTokenBO.setSysType(0);
|
||||||
|
userInfoInTokenBO.setEnabled(true);
|
||||||
|
return ServerResponseEntity.success(tokenStore.storeAndGetVo(userInfoInTokenBO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/updatePwd")
|
||||||
|
@Operation(summary = "修改密码" , description = "修改密码")
|
||||||
|
public ServerResponseEntity<Boolean> updatePwd(@Valid @RequestBody UserRegisterParam userPwdUpdateParam) {
|
||||||
|
Long userId = SecurityUtils.getUser().getUserId();
|
||||||
|
TzUserVo user = tzUserService.queryById(userId);
|
||||||
|
if (user == null) {
|
||||||
|
// 无法获取用户信息
|
||||||
|
throw new ServiceException("无法获取用户信息");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(userPwdUpdateParam.getPassWord())) {
|
||||||
|
// 新密码不能为空
|
||||||
|
throw new ServiceException("新密码不能为空");
|
||||||
|
}
|
||||||
|
String password = BCrypt.hashpw(userPwdUpdateParam.getPassWord());
|
||||||
|
if (StrUtil.equals(password, user.getLoginPassword())) {
|
||||||
|
// 新密码不能与原密码相同
|
||||||
|
throw new ServiceException("新密码不能与原密码相同");
|
||||||
|
}
|
||||||
|
user.setModifyTime(new Date());
|
||||||
|
user.setLoginPassword(password);
|
||||||
|
|
||||||
|
TzUser tzUser = MapstructUtils.convert(user, TzUser.class);
|
||||||
|
return ServerResponseEntity.success(tzUserService.updateById(tzUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/info")
|
||||||
|
@Operation(summary = "获取登录用户信息" , description = "获取登录用户信息")
|
||||||
|
public ServerResponseEntity<TzUserVo> info() {
|
||||||
|
Long userId = SecurityUtils.getUser().getUserId();
|
||||||
|
TzUserVo user = tzUserService.queryById(userId);
|
||||||
|
return ServerResponseEntity.success(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class WxXcxUtils {
|
public class WxXcxUtils {
|
||||||
|
|
||||||
private static final String APPID = "wx35c33a8a60d06fa9";
|
private static final String APPID = "wxf1d78a0b58fc890c";
|
||||||
private static final String SECRET = "0c96a172d7bbe2bd8aa7dcee4ccbfb46";
|
private static final String SECRET = "e1a3e888471d48addf1a23e4c9ea7f84";
|
||||||
private static final String TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
|
private static final String TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
|
||||||
private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token";
|
private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token";
|
||||||
|
|
||||||
|
|||||||
@@ -47,41 +47,27 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://erp9.52o.site:13308/erp20241208?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: erp20241208
|
# username: sjzx0618
|
||||||
password: a2aLeLYbzfZY4MZH
|
# password: 2b1%Hk3#1Uolol
|
||||||
# url: jdbc:mysql://erp9.52o.site:13308/sjzxerp-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
# username: sjzxerp-test
|
url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# password: EYpxAtdHmzHrTNGL
|
username: hmsj
|
||||||
|
password: s4xjHffmwG58RADk
|
||||||
|
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: false
|
lazy: false
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# url: jdbc:mysql://124.223.56.113:13306/erp2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# username: erp2024
|
# username: sjzx0618
|
||||||
# password: KYrWzcXSaNDAC4pw
|
# password: 2b1%Hk3#1Uolol
|
||||||
url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
username: root
|
url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
password: root
|
username: hmsj
|
||||||
# oracle:
|
password: s4xjHffmwG58RADk
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: oracle.jdbc.OracleDriver
|
|
||||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
|
||||||
# username: ROOT
|
|
||||||
# password: root
|
|
||||||
# postgres:
|
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: org.postgresql.Driver
|
|
||||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
|
||||||
# username: root
|
|
||||||
# password: root
|
|
||||||
# sqlserver:
|
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
|
||||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
|
||||||
# username: SA
|
|
||||||
# password: root
|
|
||||||
hikari:
|
hikari:
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
maxPoolSize: 20
|
maxPoolSize: 20
|
||||||
@@ -102,13 +88,13 @@ spring:
|
|||||||
spring.data:
|
spring.data:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: sh-crs-2xoizlg8.sql.tencentcdb.com
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 22002
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 1
|
database: 1
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
password: Huitu123
|
password: Songhaihua999
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|||||||
@@ -50,41 +50,26 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://erp9.52o.site:13308/erp20241208?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: erp20241208
|
# username: sjzx0618
|
||||||
password: a2aLeLYbzfZY4MZH
|
# password: 2b1%Hk3#1Uolol
|
||||||
# url: jdbc:mysql://erp9.52o.site:13308/sjzxerp-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
# username: sjzxerp-test
|
url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# password: EYpxAtdHmzHrTNGL
|
username: hmsj
|
||||||
|
password: s4xjHffmwG58RADk
|
||||||
|
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: false
|
lazy: false
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://124.223.56.113:13306/erp2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: erp2024
|
# username: sjzx0618
|
||||||
password: KYrWzcXSaNDAC4pw
|
# password: 2b1%Hk3#1Uolol
|
||||||
# url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
# username: root
|
url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# password: root
|
username: hmsj
|
||||||
# oracle:
|
password: s4xjHffmwG58RADk
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: oracle.jdbc.OracleDriver
|
|
||||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
|
||||||
# username: ROOT
|
|
||||||
# password: root
|
|
||||||
# postgres:
|
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: org.postgresql.Driver
|
|
||||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
|
||||||
# username: root
|
|
||||||
# password: root
|
|
||||||
# sqlserver:
|
|
||||||
# type: ${spring.datasource.type}
|
|
||||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
|
||||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
|
||||||
# username: SA
|
|
||||||
# password: root
|
|
||||||
hikari:
|
hikari:
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
maxPoolSize: 20
|
maxPoolSize: 20
|
||||||
@@ -105,13 +90,13 @@ spring:
|
|||||||
spring.data:
|
spring.data:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: sh-crs-2xoizlg8.sql.tencentcdb.com
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 22002
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 5
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
password: Huitu123
|
password: Songhaihua999
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ security:
|
|||||||
- /system/dict/data/**
|
- /system/dict/data/**
|
||||||
- /work/panorama/listByOrderId
|
- /work/panorama/listByOrderId
|
||||||
- /wx/jssdk
|
- /wx/jssdk
|
||||||
|
- /api/user/**
|
||||||
|
|
||||||
# 多租户配置
|
# 多租户配置
|
||||||
tenant:
|
tenant:
|
||||||
|
|||||||
@@ -83,4 +83,19 @@ public class SysPicture extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer tenant;
|
private Integer tenant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种ID
|
||||||
|
*/
|
||||||
|
private Long work;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种名称
|
||||||
|
*/
|
||||||
|
private String workName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,4 +89,23 @@ public class SysPictureBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String flags;
|
private String flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种ID
|
||||||
|
*/
|
||||||
|
private Long work;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种名称
|
||||||
|
*/
|
||||||
|
private String workName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片集
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,4 +109,19 @@ public class SysPictureVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer tenant;
|
private Integer tenant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种ID
|
||||||
|
*/
|
||||||
|
private Long work;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工种名称
|
||||||
|
*/
|
||||||
|
private String workName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,4 +192,14 @@ public class SysUserVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long num;
|
private Long num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品数量
|
||||||
|
*/
|
||||||
|
private Long workNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该用户作品集
|
||||||
|
*/
|
||||||
|
private List<SysPictureVo> pictures;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,4 +239,12 @@ public interface ISysUserService {
|
|||||||
List<Long> getOrderTypeIds();
|
List<Long> getOrderTypeIds();
|
||||||
|
|
||||||
TableDataInfo<SysUserVo> getJSList(SysUserBo user, PageQuery pageQuery);
|
TableDataInfo<SysUserVo> getJSList(SysUserBo user, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户列表
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysUserVo> selectPageList(SysUserBo bo, PageQuery pageQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,8 +92,11 @@ public class SysPictureServiceImpl implements ISysPictureService {
|
|||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<SysPicture> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<SysPicture> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(bo.getType() != null, SysPicture::getType, bo.getType());
|
lqw.eq(bo.getType() != null, SysPicture::getType, bo.getType());
|
||||||
|
lqw.eq(bo.getUserId() != null, SysPicture::getUserId, bo.getUserId());
|
||||||
|
lqw.eq(bo.getWork() != null, SysPicture::getWork, bo.getWork());
|
||||||
lqw.eq(bo.getTenant() != null, SysPicture::getTenant, bo.getTenant());
|
lqw.eq(bo.getTenant() != null, SysPicture::getTenant, bo.getTenant());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getTitle()), SysPicture::getTitle, bo.getTitle());
|
lqw.like(StringUtils.isNotBlank(bo.getTitle()), SysPicture::getTitle, bo.getTitle());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getWorkName()), SysPicture::getWorkName, bo.getWorkName());
|
||||||
lqw.eq(bo.getStatus() != null, SysPicture::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, SysPicture::getStatus, bo.getStatus());
|
||||||
lqw.eq(bo.getSort() != null, SysPicture::getSort, bo.getSort());
|
lqw.eq(bo.getSort() != null, SysPicture::getSort, bo.getSort());
|
||||||
lqw.in(bo.getFlags() != null, SysPicture::getFlag, Arrays.asList(bo.getFlags().split(",")));
|
lqw.in(bo.getFlags() != null, SysPicture::getFlag, Arrays.asList(bo.getFlags().split(",")));
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
private final SysPostMapper postMapper;
|
private final SysPostMapper postMapper;
|
||||||
private final SysUserRoleMapper userRoleMapper;
|
private final SysUserRoleMapper userRoleMapper;
|
||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper userPostMapper;
|
||||||
|
private final SysPictureMapper pictureMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
||||||
@@ -86,6 +87,27 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户列表
|
||||||
|
*
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysUserVo> selectPageList(SysUserBo bo, PageQuery pageQuery) {
|
||||||
|
Page<SysUserVo> page = baseMapper.selectPageUserList2(pageQuery.build(), this.buildQueryWrapper1(bo));
|
||||||
|
//统计该用户作品数量
|
||||||
|
page.getRecords().forEach(r -> r.setWorkNum(pictureMapper.selectCount(new LambdaQueryWrapper<SysPicture>().eq(SysPicture::getUserId, r.getUserId()))));
|
||||||
|
|
||||||
|
//获取该用户最新的两个作品对象
|
||||||
|
page.getRecords().forEach(r -> {
|
||||||
|
List<SysPictureVo> pictures = pictureMapper.selectVoList(new LambdaQueryWrapper<SysPicture>().eq(SysPicture::getUserId, r.getUserId()).orderByDesc(SysPicture::getCreateTime).last("limit 3"));
|
||||||
|
r.setPictures(pictures);
|
||||||
|
});
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package org.dromara.work.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.work.domain.vo.TpFollowVo;
|
||||||
|
import org.dromara.work.domain.bo.TpFollowBo;
|
||||||
|
import org.dromara.work.service.ITpFollowService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/work/follow")
|
||||||
|
public class TpFollowController extends BaseController {
|
||||||
|
|
||||||
|
private final ITpFollowService tpFollowService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关注列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<TpFollowVo> list(TpFollowBo bo, PageQuery pageQuery) {
|
||||||
|
return tpFollowService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出关注列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:export")
|
||||||
|
@Log(title = "关注", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(TpFollowBo bo, HttpServletResponse response) {
|
||||||
|
List<TpFollowVo> list = tpFollowService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "关注", TpFollowVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取关注详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<TpFollowVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(tpFollowService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增关注
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:add")
|
||||||
|
@Log(title = "关注", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody TpFollowBo bo) {
|
||||||
|
return toAjax(tpFollowService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改关注
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:edit")
|
||||||
|
@Log(title = "关注", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TpFollowBo bo) {
|
||||||
|
return toAjax(tpFollowService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除关注
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:follow:remove")
|
||||||
|
@Log(title = "关注", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(tpFollowService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package org.dromara.work.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.work.domain.vo.TpWorksVo;
|
||||||
|
import org.dromara.work.domain.bo.TpWorksBo;
|
||||||
|
import org.dromara.work.service.ITpWorksService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/work/works")
|
||||||
|
public class TpWorksController extends BaseController {
|
||||||
|
|
||||||
|
private final ITpWorksService tpWorksService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品收藏列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<TpWorksVo> list(TpWorksBo bo, PageQuery pageQuery) {
|
||||||
|
return tpWorksService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出作品收藏列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:export")
|
||||||
|
@Log(title = "作品收藏", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(TpWorksBo bo, HttpServletResponse response) {
|
||||||
|
List<TpWorksVo> list = tpWorksService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "作品收藏", TpWorksVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取作品收藏详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<TpWorksVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(tpWorksService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增作品收藏
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:add")
|
||||||
|
@Log(title = "作品收藏", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody TpWorksBo bo) {
|
||||||
|
return toAjax(tpWorksService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改作品收藏
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:edit")
|
||||||
|
@Log(title = "作品收藏", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TpWorksBo bo) {
|
||||||
|
return toAjax(tpWorksService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除作品收藏
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("work:works:remove")
|
||||||
|
@Log(title = "作品收藏", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(tpWorksService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package org.dromara.work.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.work.domain.bo.TzUserBo;
|
||||||
|
import org.dromara.work.domain.vo.TzUserVo;
|
||||||
|
import org.dromara.work.service.ITzUserService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2024-07-30
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mall/user")
|
||||||
|
public class TzUserController extends BaseController {
|
||||||
|
|
||||||
|
private final ITzUserService tzUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<TzUserVo> list(TzUserBo bo, PageQuery pageQuery) {
|
||||||
|
return tzUserService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:export")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(TzUserBo bo, HttpServletResponse response) {
|
||||||
|
List<TzUserVo> list = tzUserService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "用户", TzUserVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户详细信息
|
||||||
|
*
|
||||||
|
* @param userId 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:query")
|
||||||
|
@GetMapping("/{userId}")
|
||||||
|
public R<TzUserVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long userId) {
|
||||||
|
return R.ok(tzUserService.queryById(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启设计师开关
|
||||||
|
*
|
||||||
|
* @param userPhone 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:switch")
|
||||||
|
@PostMapping("/switch")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "userPhone", description = "手机号码", required = true),
|
||||||
|
@Parameter(name = "status", description = "状态 1-开启 2-关闭", required = true)
|
||||||
|
})
|
||||||
|
public R<Void> getInfo(@RequestParam(value = "userPhone") String userPhone, @RequestParam(value = "status") Integer status) {
|
||||||
|
return toAjax(tzUserService.queryByUserPhone(userPhone,status));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:add")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody TzUserBo bo) {
|
||||||
|
return toAjax(tzUserService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:edit")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TzUserBo bo) {
|
||||||
|
return toAjax(tzUserService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*
|
||||||
|
* @param userIds 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("mall:user:remove")
|
||||||
|
@Log(title = "用户", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{userIds}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable String[] userIds) {
|
||||||
|
return toAjax(tzUserService.deleteWithValidByIds(List.of(userIds), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.dromara.work.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注对象 tp_follow
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("tp_follow")
|
||||||
|
public class TpFollow {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被关注用户ID
|
||||||
|
*/
|
||||||
|
private Long toUserId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -220,6 +220,21 @@ public class TpOrder {
|
|||||||
*/
|
*/
|
||||||
private Long skid;
|
private Long skid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String byOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String byTwo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String byThree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接待客服名称
|
* 接待客服名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.dromara.work.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏对象 tp_works
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("tp_works")
|
||||||
|
public class TpWorks {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品ID
|
||||||
|
*/
|
||||||
|
private Long pictureId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
package org.dromara.work.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象 tz_user
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2024-12-09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("tz_user")
|
||||||
|
public class TzUser {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
|
private String userMail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
private String loginPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付密码
|
||||||
|
*/
|
||||||
|
private String payPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String userMobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证号码
|
||||||
|
*/
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证正面
|
||||||
|
*/
|
||||||
|
private String frontCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证反面
|
||||||
|
*/
|
||||||
|
private String reverseCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抵扣金额
|
||||||
|
*/
|
||||||
|
private BigDecimal deductionFee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册时间
|
||||||
|
*/
|
||||||
|
private Date userRegtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册IP
|
||||||
|
*/
|
||||||
|
private String userRegip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录时间
|
||||||
|
*/
|
||||||
|
private Date userLasttime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录IP
|
||||||
|
*/
|
||||||
|
private String userLastip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String userMemo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M(男) or F(女)
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 例如:2009-11-27
|
||||||
|
*/
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像图片路径
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 正常 0 无效
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分
|
||||||
|
*/
|
||||||
|
private Long score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否设计师 1:是 0:否
|
||||||
|
*/
|
||||||
|
private Integer isDesigner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师认证信息
|
||||||
|
*/
|
||||||
|
private String sjsJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
private Integer sjsFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
private Integer examineFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格开关是否打开 1:打开 0:关闭
|
||||||
|
*/
|
||||||
|
private Integer priceFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是会员 1:是 0:否
|
||||||
|
*/
|
||||||
|
private Integer isMember;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员有效期结束
|
||||||
|
*/
|
||||||
|
private Date validTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调价比例
|
||||||
|
*/
|
||||||
|
private String ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉卡拉用户ID
|
||||||
|
*/
|
||||||
|
private String custId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件起止日期
|
||||||
|
*/
|
||||||
|
private String certExpirationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.dromara.work.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.TpFollow;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注业务对象 tp_follow
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = TpFollow.class, reverseConvertGenerate = false)
|
||||||
|
public class TpFollowBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被关注用户ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "被关注用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long toUserId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -301,4 +301,19 @@ public class TpOrderBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private int kfOrjs;
|
private int kfOrjs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String byOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String byTwo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String byThree;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.dromara.work.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.TpWorks;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏业务对象 tp_works
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = TpWorks.class, reverseConvertGenerate = false)
|
||||||
|
public class TpWorksBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "作品ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long pictureId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
package org.dromara.work.domain.bo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户业务对象 tz_user
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2024-12-09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@AutoMapper(target = TzUser.class, reverseConvertGenerate = false)
|
||||||
|
public class TzUserBo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
|
private String userMail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
private String loginPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付密码
|
||||||
|
*/
|
||||||
|
private String payPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String userMobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证号码
|
||||||
|
*/
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证正面
|
||||||
|
*/
|
||||||
|
private String frontCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证反面
|
||||||
|
*/
|
||||||
|
private String reverseCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抵扣金额
|
||||||
|
*/
|
||||||
|
private BigDecimal deductionFee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册时间
|
||||||
|
*/
|
||||||
|
private Date userRegtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册IP
|
||||||
|
*/
|
||||||
|
private String userRegip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录时间
|
||||||
|
*/
|
||||||
|
private Date userLasttime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录IP
|
||||||
|
*/
|
||||||
|
private String userLastip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String userMemo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M(男) or F(女)
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 例如:2009-11-27
|
||||||
|
*/
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像图片路径
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 正常 0 无效
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分
|
||||||
|
*/
|
||||||
|
private Long score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否设计师 1:是 0:否
|
||||||
|
*/
|
||||||
|
private Integer isDesigner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师认证信息
|
||||||
|
*/
|
||||||
|
private String sjsJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
private Integer sjsFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
private Integer examineFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格开关是否打开 1:打开 0:关闭
|
||||||
|
*/
|
||||||
|
private Integer priceFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是会员 1:是 0:否
|
||||||
|
*/
|
||||||
|
private Integer isMember;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员码
|
||||||
|
*/
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员有效期结束
|
||||||
|
*/
|
||||||
|
private Date validTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调价比例
|
||||||
|
*/
|
||||||
|
private String ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉卡拉用户ID
|
||||||
|
*/
|
||||||
|
private String custId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件起止日期
|
||||||
|
*/
|
||||||
|
private String certExpirationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数
|
||||||
|
*/
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Map<String, Object> params = new HashMap<>();
|
||||||
|
}
|
||||||
@@ -252,4 +252,19 @@ public class CustomerOrderVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal gpay;
|
private BigDecimal gpay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String byOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String byTwo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String byThree;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,4 +194,19 @@ public class SkillOrderVo implements Serializable {
|
|||||||
@ExcelProperty(value = "技术已付款")
|
@ExcelProperty(value = "技术已付款")
|
||||||
private BigDecimal jsPayPrice;
|
private BigDecimal jsPayPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String byOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String byTwo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String byThree;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package org.dromara.work.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysUser;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.work.domain.TpFollow;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注视图对象 tp_follow
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = TpFollow.class)
|
||||||
|
public class TpFollowVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被关注用户ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "被关注用户ID")
|
||||||
|
private Long toUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被关注用户对象
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "被关注用户对象")
|
||||||
|
private SysUser toUser;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -307,4 +307,19 @@ public class TpOrderVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String timestamp;
|
private String timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String byOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String byTwo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String byThree;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.dromara.work.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysPicture;
|
||||||
|
import org.dromara.work.domain.TpWorks;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏视图对象 tp_works
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = TpWorks.class)
|
||||||
|
public class TpWorksVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "作品ID")
|
||||||
|
private Long pictureId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品对象
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "作品对象")
|
||||||
|
private SysPicture picture;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
package org.dromara.work.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户视图对象 tz_user
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2024-12-09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = TzUser.class)
|
||||||
|
public class TzUserVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "真实姓名")
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户邮箱")
|
||||||
|
private String userMail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "登录密码")
|
||||||
|
private String loginPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付密码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "支付密码")
|
||||||
|
private String payPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "手机号码")
|
||||||
|
private String userMobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证号码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "身份证号码")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证正面
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "身份证正面")
|
||||||
|
private String frontCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证反面
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "身份证反面")
|
||||||
|
private String reverseCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "余额")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抵扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "抵扣金额")
|
||||||
|
private BigDecimal deductionFee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "修改时间")
|
||||||
|
private Date modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "注册时间")
|
||||||
|
private Date userRegtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册IP
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "注册IP")
|
||||||
|
private String userRegip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "最后登录时间")
|
||||||
|
private Date userLasttime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录IP
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "最后登录IP")
|
||||||
|
private String userLastip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String userMemo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* M(男) or F(女)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "M(男) or F(女)")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 例如:2009-11-27
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "例如:2009-11-27")
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像图片路径
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "头像图片路径")
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 1 正常 0 无效
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态 1 正常 0 无效")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户积分")
|
||||||
|
private Long score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信openId
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "微信openId")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否设计师 1:是 0:否
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否设计师 1:是 0:否")
|
||||||
|
private Integer isDesigner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师认证信息
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设计师认证信息")
|
||||||
|
private String sjsJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计师审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设计师审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝")
|
||||||
|
private Integer sjsFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "实名审核状态 1:未认证 2:待审核 3:已通过 4:已拒绝")
|
||||||
|
private Integer examineFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格开关是否打开 1:打开 0:关闭
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "价格开关是否打开 1:打开 0:关闭")
|
||||||
|
private Integer priceFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是会员 1:是 0:否
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否是会员 1:是 0:否")
|
||||||
|
private Integer isMember;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员有效期结束
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "会员有效期结束")
|
||||||
|
private Date validTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调价比例
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "调价比例")
|
||||||
|
private String ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉卡拉用户ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "拉卡拉用户ID")
|
||||||
|
private String custId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件起止日期
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "证件起止日期")
|
||||||
|
private String certExpirationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单数量")
|
||||||
|
private Long orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal orderTotal;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.work.mapper;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.TpFollow;
|
||||||
|
import org.dromara.work.domain.vo.TpFollowVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注Mapper接口
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
public interface TpFollowMapper extends BaseMapperPlus<TpFollow, TpFollowVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.work.mapper;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.TpWorks;
|
||||||
|
import org.dromara.work.domain.vo.TpWorksVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏Mapper接口
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
public interface TpWorksMapper extends BaseMapperPlus<TpWorks, TpWorksVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.dromara.work.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
import org.dromara.work.domain.vo.TzUserVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2024-07-30
|
||||||
|
*/
|
||||||
|
public interface TzUserMapper extends BaseMapperPlus<TzUser, TzUserVo>, MPJBaseMapper<TzUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package org.dromara.work.service;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.vo.TpFollowVo;
|
||||||
|
import org.dromara.work.domain.bo.TpFollowBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注Service接口
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
public interface ITpFollowService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关注
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 关注
|
||||||
|
*/
|
||||||
|
TpFollowVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询关注列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 关注分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<TpFollowVo> queryPageList(TpFollowBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的关注列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 关注列表
|
||||||
|
*/
|
||||||
|
List<TpFollowVo> queryList(TpFollowBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增关注
|
||||||
|
*
|
||||||
|
* @param bo 关注
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(TpFollowBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改关注
|
||||||
|
*
|
||||||
|
* @param bo 关注
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(TpFollowBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除关注信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关注
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 关注
|
||||||
|
*/
|
||||||
|
TpFollowVo queryByTpFollow(TpFollowBo bo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package org.dromara.work.service;
|
||||||
|
|
||||||
|
import org.dromara.work.domain.vo.TpWorksVo;
|
||||||
|
import org.dromara.work.domain.bo.TpWorksBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏Service接口
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
public interface ITpWorksService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品收藏
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 作品收藏
|
||||||
|
*/
|
||||||
|
TpWorksVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询作品收藏列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 作品收藏分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<TpWorksVo> queryPageList(TpWorksBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的作品收藏列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 作品收藏列表
|
||||||
|
*/
|
||||||
|
List<TpWorksVo> queryList(TpWorksBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 作品收藏
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(TpWorksBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 作品收藏
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(TpWorksBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除作品收藏信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件查询作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 作品收藏
|
||||||
|
*/
|
||||||
|
TpWorksVo queryByTpWorks(TpWorksBo bo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package org.dromara.work.service;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseService;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
import org.dromara.work.domain.bo.TzUserBo;
|
||||||
|
import org.dromara.work.domain.vo.TzUserVo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2024-07-30
|
||||||
|
*/
|
||||||
|
public interface ITzUserService extends MPJBaseService<TzUser> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
*
|
||||||
|
* @param userId 主键
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
TzUserVo queryById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 用户分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<TzUserVo> queryPageList(TzUserBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的用户列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 用户列表
|
||||||
|
*/
|
||||||
|
List<TzUserVo> queryList(TzUserBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*
|
||||||
|
* @param bo 用户
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(TzUserBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*
|
||||||
|
* @param bo 用户
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(TzUserBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除用户信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启设计师开关
|
||||||
|
* @param userPhone
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean queryByUserPhone(String userPhone, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交实名认证
|
||||||
|
*
|
||||||
|
* @param bo 用户认证信息
|
||||||
|
* @return 是否提交成功
|
||||||
|
*/
|
||||||
|
Boolean submitAuth(TzUserBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交设计师认证
|
||||||
|
*/
|
||||||
|
Boolean submitSjsAuth(TzUserBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户下单排行榜列表
|
||||||
|
*/
|
||||||
|
// TableDataInfo<TzUserVo> queryPageListChart(TzUserBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -194,6 +194,14 @@ public class TpClientServiceImpl extends MPJBaseServiceImpl<TpClientMapper,TpCli
|
|||||||
}
|
}
|
||||||
TpClient client = baseMapper.selectOne(new LambdaQueryWrapper<TpClient>().eq(TpClient::getPhone,bo.getPhone()));
|
TpClient client = baseMapper.selectOne(new LambdaQueryWrapper<TpClient>().eq(TpClient::getPhone,bo.getPhone()));
|
||||||
|
|
||||||
|
if(ObjectUtil.isNotNull(client)){
|
||||||
|
//判断客服是否已经绑定了客户
|
||||||
|
boolean exist = staffMapper.exists(new LambdaQueryWrapper<TpClientStaff>().eq(TpClientStaff::getSid,loginUser.getUserId()).eq(TpClientStaff::getKid,client.getId()));
|
||||||
|
if(exist){
|
||||||
|
throw new ServiceException("此客户您已添加,请勿重复添加");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(LoginHelper.isSuperAdmin()){
|
if(LoginHelper.isSuperAdmin()){
|
||||||
if(ObjectUtil.isNotNull(client)){
|
if(ObjectUtil.isNotNull(client)){
|
||||||
throw new ServiceException("手机号码已存在");
|
throw new ServiceException("手机号码已存在");
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package org.dromara.work.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.work.domain.bo.TpFollowBo;
|
||||||
|
import org.dromara.work.domain.vo.TpFollowVo;
|
||||||
|
import org.dromara.work.domain.TpFollow;
|
||||||
|
import org.dromara.work.mapper.TpFollowMapper;
|
||||||
|
import org.dromara.work.service.ITpFollowService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class TpFollowServiceImpl implements ITpFollowService {
|
||||||
|
|
||||||
|
private final TpFollowMapper baseMapper;
|
||||||
|
|
||||||
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关注
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 关注
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TpFollowVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询关注列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 关注分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<TpFollowVo> queryPageList(TpFollowBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<TpFollow> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<TpFollowVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
//获取用户对象
|
||||||
|
result.getRecords().forEach(
|
||||||
|
r -> r.setToUser(sysUserMapper.selectById(r.getToUserId()))
|
||||||
|
);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的关注列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 关注列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TpFollowVo> queryList(TpFollowBo bo) {
|
||||||
|
LambdaQueryWrapper<TpFollow> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<TpFollow> buildQueryWrapper(TpFollowBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<TpFollow> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(TpFollow::getId);
|
||||||
|
lqw.eq(bo.getUserId() != null, TpFollow::getUserId, bo.getUserId());
|
||||||
|
lqw.eq(bo.getToUserId() != null, TpFollow::getToUserId, bo.getToUserId());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增关注
|
||||||
|
*
|
||||||
|
* @param bo 关注
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(TpFollowBo bo) {
|
||||||
|
TpFollow add = MapstructUtils.convert(bo, TpFollow.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改关注
|
||||||
|
*
|
||||||
|
* @param bo 关注
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(TpFollowBo bo) {
|
||||||
|
TpFollow update = MapstructUtils.convert(bo, TpFollow.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(TpFollow entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除关注信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关注
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 关注
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TpFollowVo queryByTpFollow(TpFollowBo bo) {
|
||||||
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<TpFollow>().eq(TpFollow::getUserId, bo.getUserId()).eq(TpFollow::getToUserId, bo.getToUserId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -273,10 +273,10 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|||||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||||
}else {
|
}else {
|
||||||
if (loginUser.getIdentity() == 3 || loginUser.getIdentity() == 1){
|
if (loginUser.getIdentity() == 3 || loginUser.getIdentity() == 1){
|
||||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid);
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||||
}else {
|
}else {
|
||||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime);
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
|||||||
if(LoginHelper.isSuperAdmin()){
|
if(LoginHelper.isSuperAdmin()){
|
||||||
wrapper.selectAll(TpOrder.class);
|
wrapper.selectAll(TpOrder.class);
|
||||||
}else {
|
}else {
|
||||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime);
|
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||||
}
|
}
|
||||||
wrapper.selectAs("s.nick_name",SkillOrderVo::getSname)
|
wrapper.selectAs("s.nick_name",SkillOrderVo::getSname)
|
||||||
.selectAs("f.nick_name",SkillOrderVo::getFname)
|
.selectAs("f.nick_name",SkillOrderVo::getFname)
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package org.dromara.work.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.system.mapper.SysPictureMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.work.domain.bo.TpWorksBo;
|
||||||
|
import org.dromara.work.domain.vo.TpWorksVo;
|
||||||
|
import org.dromara.work.domain.TpWorks;
|
||||||
|
import org.dromara.work.mapper.TpWorksMapper;
|
||||||
|
import org.dromara.work.service.ITpWorksService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作品收藏Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Maosw
|
||||||
|
* @date 2025-07-23
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class TpWorksServiceImpl implements ITpWorksService {
|
||||||
|
|
||||||
|
private final TpWorksMapper baseMapper;
|
||||||
|
|
||||||
|
private final SysPictureMapper sysPictureMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品收藏
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 作品收藏
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TpWorksVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询作品收藏列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 作品收藏分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<TpWorksVo> queryPageList(TpWorksBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<TpWorks> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<TpWorksVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
|
||||||
|
//作品对象
|
||||||
|
result.getRecords().forEach(r -> r.setPicture(sysPictureMapper.selectById(r.getPictureId())));
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的作品收藏列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 作品收藏列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TpWorksVo> queryList(TpWorksBo bo) {
|
||||||
|
LambdaQueryWrapper<TpWorks> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<TpWorks> buildQueryWrapper(TpWorksBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<TpWorks> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(TpWorks::getId);
|
||||||
|
lqw.eq(bo.getUserId() != null, TpWorks::getUserId, bo.getUserId());
|
||||||
|
lqw.eq(bo.getPictureId() != null, TpWorks::getPictureId, bo.getPictureId());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 作品收藏
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(TpWorksBo bo) {
|
||||||
|
TpWorks add = MapstructUtils.convert(bo, TpWorks.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 作品收藏
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(TpWorksBo bo) {
|
||||||
|
TpWorks update = MapstructUtils.convert(bo, TpWorks.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(TpWorks entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除作品收藏信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件查询作品收藏
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 作品收藏
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TpWorksVo queryByTpWorks(TpWorksBo bo) {
|
||||||
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<TpWorks>().eq(TpWorks::getUserId, bo.getUserId()).eq(TpWorks::getPictureId, bo.getPictureId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
package org.dromara.work.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.work.domain.TzUser;
|
||||||
|
import org.dromara.work.domain.bo.TzUserBo;
|
||||||
|
import org.dromara.work.domain.vo.TzUserVo;
|
||||||
|
import org.dromara.work.mapper.TzUserMapper;
|
||||||
|
import org.dromara.work.service.ITzUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2024-07-30
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class TzUserServiceImpl extends MPJBaseServiceImpl<TzUserMapper, TzUser> implements ITzUserService {
|
||||||
|
|
||||||
|
private final TzUserMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
*
|
||||||
|
* @param userId 主键
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TzUserVo queryById(Long userId){
|
||||||
|
return baseMapper.selectVoById(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询用户列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 用户分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<TzUserVo> queryPageList(TzUserBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<TzUser> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<TzUserVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
|
||||||
|
// 获取用户列表
|
||||||
|
/*List<TzUserVo> userList = result.getRecords();
|
||||||
|
|
||||||
|
// 遍历用户列表,查询每个用户的已完成订单数量
|
||||||
|
for (TzUserVo user : userList) {
|
||||||
|
LambdaQueryWrapper<HyOrderItem> orderWrapper = Wrappers.lambdaQuery();
|
||||||
|
orderWrapper.eq(HyOrderItem::getUserId, user.getUserId());
|
||||||
|
orderWrapper.eq(HyOrderItem::getStatus, 6);
|
||||||
|
Long orderCount = hyOrderItemMapper.selectCount(orderWrapper);
|
||||||
|
user.setOrderNum(orderCount);
|
||||||
|
}*/
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的用户列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 用户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TzUserVo> queryList(TzUserBo bo) {
|
||||||
|
LambdaQueryWrapper<TzUser> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<TzUser> buildQueryWrapper(TzUserBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<TzUser> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getNickName()), TzUser::getNickName, bo.getNickName());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getRealName()), TzUser::getRealName, bo.getRealName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getUserMail()), TzUser::getUserMail, bo.getUserMail());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLoginPassword()), TzUser::getLoginPassword, bo.getLoginPassword());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getPayPassword()), TzUser::getPayPassword, bo.getPayPassword());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getUserMobile()), TzUser::getUserMobile, bo.getUserMobile());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIdCard()), TzUser::getIdCard, bo.getIdCard());
|
||||||
|
lqw.eq(bo.getModifyTime() != null, TzUser::getModifyTime, bo.getModifyTime());
|
||||||
|
lqw.eq(bo.getUserRegtime() != null, TzUser::getUserRegtime, bo.getUserRegtime());
|
||||||
|
lqw.eq(bo.getIsMember() != null, TzUser::getIsMember, bo.getIsMember());
|
||||||
|
lqw.eq(bo.getExamineFlag() != null, TzUser::getExamineFlag, bo.getExamineFlag());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getUserRegip()), TzUser::getUserRegip, bo.getUserRegip());
|
||||||
|
lqw.eq(bo.getUserLasttime() != null, TzUser::getUserLasttime, bo.getUserLasttime());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getUserLastip()), TzUser::getUserLastip, bo.getUserLastip());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getUserMemo()), TzUser::getUserMemo, bo.getUserMemo());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getSex()), TzUser::getSex, bo.getSex());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getBirthDate()), TzUser::getBirthDate, bo.getBirthDate());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getPic()), TzUser::getPic, bo.getPic());
|
||||||
|
lqw.eq(bo.getStatus() != null, TzUser::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(bo.getScore() != null, TzUser::getScore, bo.getScore());
|
||||||
|
lqw.between(params.get("beginModifyTime") != null && params.get("endModifyTime") != null, TzUser::getModifyTime, params.get("beginModifyTime"), params.get("endModifyTime"));
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*
|
||||||
|
* @param bo 用户
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(TzUserBo bo) {
|
||||||
|
TzUser add = MapstructUtils.convert(bo, TzUser.class);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setUserId(add.getUserId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*
|
||||||
|
* @param bo 用户
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(TzUserBo bo) {
|
||||||
|
TzUser update = MapstructUtils.convert(bo, TzUser.class);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启设计师开关
|
||||||
|
*
|
||||||
|
* @param userPhone
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean queryByUserPhone(String userPhone, Integer status) {
|
||||||
|
TzUser user = baseMapper.selectOne(Wrappers.<TzUser>lambdaQuery().eq(TzUser::getUserMobile, userPhone));
|
||||||
|
if (user == null){
|
||||||
|
throw new ServiceException("该用户未注册");
|
||||||
|
} else{
|
||||||
|
if(status == 1){
|
||||||
|
user.setIsDesigner(1);
|
||||||
|
} else if (status == 2) {
|
||||||
|
user.setIsDesigner(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baseMapper.updateById(user) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除用户信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交实名认证
|
||||||
|
*
|
||||||
|
* @param bo 用户认证信息
|
||||||
|
* @return 是否提交成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean submitAuth(TzUserBo bo) {
|
||||||
|
// 检查是否已提交过认证
|
||||||
|
TzUser user = baseMapper.selectById(bo.getUserId());
|
||||||
|
if (user == null) {
|
||||||
|
throw new ServiceException("用户不存在");
|
||||||
|
}
|
||||||
|
if (user.getExamineFlag() == 2 || user.getExamineFlag() == 3) {
|
||||||
|
throw new ServiceException("已提交过认证申请");
|
||||||
|
}
|
||||||
|
TzUser update = MapstructUtils.convert(bo, TzUser.class);
|
||||||
|
update.setExamineFlag(2);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交设计师认证
|
||||||
|
*
|
||||||
|
* @param bo 设计师认证信息
|
||||||
|
* @return 是否提交成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean submitSjsAuth(TzUserBo bo) {
|
||||||
|
// 检查是否已提交过认证
|
||||||
|
TzUser user = baseMapper.selectById(bo.getUserId());
|
||||||
|
if (user == null) {
|
||||||
|
throw new ServiceException("用户不存在");
|
||||||
|
}
|
||||||
|
if (user.getSjsFlag() == 2 || user.getSjsFlag() == 3) {
|
||||||
|
throw new ServiceException("已提交过设计师认证申请");
|
||||||
|
}
|
||||||
|
TzUser update = MapstructUtils.convert(bo, TzUser.class);
|
||||||
|
update.setSjsFlag(2);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public TableDataInfo<TzUserVo> queryPageListChart(TzUserBo bo, PageQuery pageQuery) {
|
||||||
|
// 使用MPJLambdaWrapper构建多表关联查询
|
||||||
|
MPJLambdaWrapper<TzUser> wrapper = new MPJLambdaWrapper<TzUser>()
|
||||||
|
.selectAs(TzUser::getUserId, "userId")
|
||||||
|
.selectAs(TzUser::getRealName, "realName")
|
||||||
|
.selectCount(HyOrderItem::getId, "orderNum")
|
||||||
|
.selectSum(HyOrderItem::getTotal, "orderTotal")
|
||||||
|
.leftJoin(HyOrderItem.class, HyOrderItem::getUserId, TzUser::getUserId)
|
||||||
|
.groupBy(TzUser::getUserId)
|
||||||
|
.orderByDesc("orderTotal");
|
||||||
|
|
||||||
|
// 添加查询条件
|
||||||
|
if (bo != null) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
wrapper.eq(HyOrderItem::getDelFlag, 1);
|
||||||
|
wrapper.ne(HyOrderItem::getPayState, 1);
|
||||||
|
wrapper.like(StringUtils.isNotBlank(bo.getNickName()), TzUser::getNickName, bo.getNickName());
|
||||||
|
wrapper.like(StringUtils.isNotBlank(bo.getRealName()),TzUser::getRealName, bo.getRealName());
|
||||||
|
wrapper.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||||
|
HyOrderItem::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||||
|
}
|
||||||
|
// 执行分页查询
|
||||||
|
Page<TzUserVo> page = baseMapper.selectJoinPage(pageQuery.build(), TzUserVo.class, wrapper);
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.work.mapper.TpFollowMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.work.mapper.TpWorksMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.work.mapper.TzUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user