最新代码
This commit is contained in:
@@ -93,17 +93,10 @@
|
|||||||
<groupId>com.github.binarywang</groupId>
|
<groupId>com.github.binarywang</groupId>
|
||||||
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--weixin-java-pay-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.binarywang</groupId>
|
<groupId>com.github.wxpay</groupId>
|
||||||
<artifactId>weixin-java-pay</artifactId>
|
<artifactId>wxpay-sdk</artifactId>
|
||||||
<!-- <exclusions>-->
|
<version>0.0.3</version>
|
||||||
<!-- <exclusion>-->
|
|
||||||
<!-- <artifactId>guava</artifactId>-->
|
|
||||||
<!-- <groupId>com.google.guava</groupId>-->
|
|
||||||
<!-- </exclusion>-->
|
|
||||||
<!-- </exclusions>-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
@@ -129,9 +122,14 @@
|
|||||||
<groupId>com.tencentcloudapi</groupId>
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
<artifactId>tencentcloud-sdk-java-dnspod</artifactId>
|
<artifactId>tencentcloud-sdk-java-dnspod</artifactId>
|
||||||
<version>3.1.322</version>
|
<version>3.1.322</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>okio</artifactId>
|
||||||
|
<groupId>com.squareup.okio</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -14,5 +14,4 @@ public class Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(Application.class, args);
|
SpringApplication.run(Application.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +34,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void insertFill(MetaObject metaObject) {
|
public void insertFill(MetaObject metaObject) {
|
||||||
log.info("start insert fill ....");
|
log.info("start insert fill ....");
|
||||||
this.setFieldValByName("createdTime", new Date(), metaObject);
|
// this.setFieldValByName("createdTime", getDate(), metaObject);
|
||||||
this.setFieldValByName("deleted", false, metaObject);
|
this.setFieldValByName("deleted", false, metaObject);
|
||||||
this.setFieldValByName("version", 1L, metaObject);
|
this.setFieldValByName("version", 1L, metaObject);
|
||||||
Object createUser = this.getFieldValByName("createdBy", metaObject);
|
Object createUser = this.getFieldValByName("createdBy", metaObject);
|
||||||
@@ -46,13 +48,20 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
log.info("start update fill ....");
|
log.info("start update fill ....");
|
||||||
this.setFieldValByName("updatedTime", new Date(), metaObject);
|
// this.setFieldValByName("updatedTime", getDate(), metaObject);
|
||||||
Object createUser = this.getFieldValByName("updatedBy", metaObject);
|
Object createUser = this.getFieldValByName("updatedBy", metaObject);
|
||||||
if (createUser == null) {
|
if (createUser == null) {
|
||||||
this.setFieldValByName("createdBy", getOperatorId(), metaObject);
|
this.setFieldValByName("createdBy", getOperatorId(), metaObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
// return Date.from(localDateTime.toInstant(ZoneOffset.ofHours(8)));
|
||||||
|
}
|
||||||
|
|
||||||
public String getOperatorId() {
|
public String getOperatorId() {
|
||||||
if (request.getServletPath().startsWith("/wx/")) {
|
if (request.getServletPath().startsWith("/wx/")) {
|
||||||
String tenantKey = request.getHeader("tenantkey");
|
String tenantKey = request.getHeader("tenantkey");
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class OssProperties implements InitializingBean {
|
|||||||
public String bucketName;
|
public String bucketName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() {
|
||||||
ENDPOINT = getEndpoint();
|
ENDPOINT = getEndpoint();
|
||||||
KEY_ID = getAccessKeyId();
|
KEY_ID = getAccessKeyId();
|
||||||
KEY_SECRET = getAccessKeySecret();
|
KEY_SECRET = getAccessKeySecret();
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
public class CommonText {
|
||||||
|
|
||||||
|
public static final String DATA_NOT_EXIST = "数据不存在";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号
|
||||||
|
*/
|
||||||
|
public static final String WECHAT_CONFIG_DOES_NOT_EXIST = "未配置公司微信公众号的相关信息";
|
||||||
|
public static final String WECHAT_PAY_CONFIG_DOES_NOT_EXIST = "未配置公司微信支付的相关信息";
|
||||||
|
public static final String OPENID_DOES_NOT_EXIST = "请上传微信用户openid";
|
||||||
|
public static final String WECHAT_TRADE_TYPE_DOES_NOT_EXIST = "请上传微信支付交易类型";
|
||||||
|
public static final String OPENID_ALREADY_BIND = "该微信号已被其他账号绑定!";
|
||||||
|
public static final String ADMIN_OPENID_DOES_NOT_EXIST = "请上传管理员openid";
|
||||||
|
public static final String OPENID_DOES_NOT_FIND = "未获取到对应微信用户openid";
|
||||||
|
public static final String WECHAT_CODE_DOES_NOT_EXIST = "请上传微信用户code";
|
||||||
|
public static final String WECHAT_USER_TOKEN_DOES_ERR = "获取微信用户token失败";
|
||||||
|
public static final String UNIFIEDORDER_ERR = "统一下单失败";
|
||||||
|
public static final String UNIFIEDORDER_ERR_PREPAY_ID_NOT_FIND = "统一下单失败,未生成PREPAY_ID";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序
|
||||||
|
*/
|
||||||
|
public static final String MINI_OPENID_DOES_NOT_EXIST = "请上传小程序用户openid";
|
||||||
|
public static final String WECHAT_MINI_CONFIG_DOES_NOT_EXIST = "未配置公司微信小程序的相关信息";
|
||||||
|
public static final String WECHAT_MINI_PARAM_NOT_EXIST = "缺少所需小程序参数!";
|
||||||
|
public static final String WECHAT_MINI_IV_NOT_EXIST = "请上传iv参数";
|
||||||
|
public static final String WECHAT_MINI_SESSION_KEY_DOES_NOT_EXIST = "请上传session_key参数";
|
||||||
|
public static final String WECHAT_MINI_ENCRYPTED_DATA_DOES_NOT_EXIST = "请上传encrypted_data参数";
|
||||||
|
public static final String WECHAT_MINI_ENCRYPTED_DATA_PARSE_ERR = "encrypted_data解析失败";
|
||||||
|
public static final String WECHAT_MINI_ENCRYPTED_DATA_NOT_HAVE_PHONE_NUM = "encrypted_data中未解析出电话号码";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付相关
|
||||||
|
*/
|
||||||
|
public static final String ORDER_PAY_TYPE_NOT_EXIST = "请上传支付方式!";
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.ssl.SSLContexts;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class HttpUtils {
|
||||||
|
|
||||||
|
public static JSONObject httpRequest(String requestUrl, String requestMethod, String outputStr) {
|
||||||
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
try {
|
||||||
|
// 创建SSLContext对象,并使用我们指定的信任管理器初始化
|
||||||
|
TrustManager[] tm = {new MyX509TrustManager()};
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
|
||||||
|
sslContext.init(null, tm, new java.security.SecureRandom());
|
||||||
|
// 从上述SSLContext对象中得到SSLSocketFactory对象
|
||||||
|
SSLSocketFactory ssf = sslContext.getSocketFactory();
|
||||||
|
|
||||||
|
URL url = new URL(requestUrl);
|
||||||
|
HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection();
|
||||||
|
httpUrlConn.setSSLSocketFactory(ssf);
|
||||||
|
httpUrlConn.setDoOutput(true);
|
||||||
|
httpUrlConn.setDoInput(true);
|
||||||
|
httpUrlConn.setUseCaches(false);
|
||||||
|
// 设置请求方式(GET/POST)
|
||||||
|
httpUrlConn.setRequestMethod(requestMethod);
|
||||||
|
if ("GET".equalsIgnoreCase(requestMethod)) httpUrlConn.connect();
|
||||||
|
// 当有数据需要提交时
|
||||||
|
if (null != outputStr) {
|
||||||
|
OutputStream outputStream = httpUrlConn.getOutputStream();
|
||||||
|
// 注意编码格式,防止中文乱码
|
||||||
|
outputStream.write(outputStr.getBytes(StandardCharsets.UTF_8));
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
|
// 将返回的输入流转换成字符串
|
||||||
|
InputStream inputStream = httpUrlConn.getInputStream();
|
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||||
|
|
||||||
|
String str;
|
||||||
|
while ((str = bufferedReader.readLine()) != null) {
|
||||||
|
buffer.append(str);
|
||||||
|
}
|
||||||
|
bufferedReader.close();
|
||||||
|
inputStreamReader.close();
|
||||||
|
// 释放资源
|
||||||
|
inputStream.close();
|
||||||
|
httpUrlConn.disconnect();
|
||||||
|
return JSONObject.parseObject(buffer.toString());
|
||||||
|
} catch (ConnectException ce) {
|
||||||
|
log.error("weixin server connection timed out");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("weixin play error", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 向指定 URL 发送POST方法的请求
|
||||||
|
// *
|
||||||
|
// * @param url 发送请求的 URL
|
||||||
|
// * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||||
|
// * @return 所代表远程资源的响应结果
|
||||||
|
// */
|
||||||
|
// public static String sendPost(String url, String param) {
|
||||||
|
// URLConnection conn = getConnection(url);
|
||||||
|
// StringBuilder result = new StringBuilder();
|
||||||
|
// try (PrintWriter out = new PrintWriter(conn.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
|
||||||
|
// out.print(param);
|
||||||
|
// out.flush();
|
||||||
|
// String line;
|
||||||
|
// while ((line = in.readLine()) != null) {
|
||||||
|
// result.append(line);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("sendPost error", e);
|
||||||
|
// }
|
||||||
|
// return result.toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public static String sendPost(String requestUrl, String outputStr) throws IOException {
|
||||||
|
HttpURLConnection conn = getConnection(requestUrl);
|
||||||
|
// 当outputStr不为null时向输出流写数据
|
||||||
|
if (null != outputStr) {
|
||||||
|
OutputStream outputStream = conn.getOutputStream();
|
||||||
|
// 注意编码格式
|
||||||
|
outputStream.write(outputStr.getBytes(StandardCharsets.UTF_8));
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
try (InputStream inputStream = conn.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
||||||
|
// 从输入流读取返回内容
|
||||||
|
String str;
|
||||||
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
while ((str = bufferedReader.readLine()) != null) {
|
||||||
|
buffer.append(str);
|
||||||
|
}
|
||||||
|
// 释放资源
|
||||||
|
conn.disconnect();
|
||||||
|
return buffer.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("sendPost error,url = {},outputStr={}", requestUrl, outputStr, e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要使用证书请求接口
|
||||||
|
*/
|
||||||
|
public static String requestWithCert(String url, String pay_cert, String mchid, String data) throws Exception {
|
||||||
|
KeyStore keyStore = KeyStore.getInstance("PKCS12");
|
||||||
|
try (FileInputStream is = new FileInputStream(pay_cert)) {
|
||||||
|
// 这里写密码..默认是你的MCHID
|
||||||
|
keyStore.load(is, mchid.toCharArray());
|
||||||
|
}
|
||||||
|
// Trust own CA and all self-signed certs
|
||||||
|
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mchid.toCharArray())// 这里也是写密码的
|
||||||
|
.build();
|
||||||
|
// Allow TLSv1 protocol only
|
||||||
|
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslcontext, new String[]{"TLSv1"}, null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
|
||||||
|
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(socketFactory).build()) {
|
||||||
|
HttpPost httpPost = getHttpPost(url, data);
|
||||||
|
try (CloseableHttpResponse response = httpclient.execute(httpPost)) {
|
||||||
|
HttpEntity entity = response.getEntity();
|
||||||
|
String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||||
|
EntityUtils.consume(entity);
|
||||||
|
return jsonStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpPost getHttpPost(String url, String data) {
|
||||||
|
HttpPost httpPost = new HttpPost(url); // 设置响应头信息
|
||||||
|
httpPost.addHeader("Connection", "keep-alive");
|
||||||
|
httpPost.addHeader("Accept", "*/*");
|
||||||
|
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
httpPost.addHeader("Host", "api.mch.weixin.qq.com");
|
||||||
|
httpPost.addHeader("X-Requested-With", "XMLHttpRequest");
|
||||||
|
httpPost.addHeader("Cache-Control", "max-age=0");
|
||||||
|
httpPost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
|
||||||
|
httpPost.setEntity(new StringEntity(data, "UTF-8"));
|
||||||
|
return httpPost;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网络连接
|
||||||
|
*
|
||||||
|
* @param url URL
|
||||||
|
* @return URLConnection
|
||||||
|
*/
|
||||||
|
private static HttpURLConnection getConnection(String url) {
|
||||||
|
try {
|
||||||
|
URL realUrl = new URL(url);
|
||||||
|
// 打开和URL之间的连接
|
||||||
|
URLConnection conn = realUrl.openConnection();
|
||||||
|
// 设置通用的请求属性
|
||||||
|
conn.setRequestProperty("Charset", "UTF-8");
|
||||||
|
conn.setRequestProperty("accept", "*/*");
|
||||||
|
conn.setRequestProperty("connection", "Keep-Alive");
|
||||||
|
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||||
|
// 发送POST请求必须设置如下两行
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
conn.setDoInput(true);
|
||||||
|
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
|
||||||
|
return (HttpURLConnection) conn;
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("getConnection error", e);
|
||||||
|
throw new CustomException("getConnection error," + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对于https请求,我们需要一个证书信任管理器,这个管理器类需要自己定义,但需要实现X509TrustManager接口
|
||||||
|
* 证书信任管理器(用于https请求)
|
||||||
|
* 这个证书管理器的作用就是让它信任我们指定的证书,上面的代码意味着信任所有证书,不管是否权威机构颁发。
|
||||||
|
*
|
||||||
|
* @author jiangyin
|
||||||
|
*/
|
||||||
|
public class MyX509TrustManager implements X509TrustManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
public final class WXPayXmlUtil {
|
||||||
|
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
|
||||||
|
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
|
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||||
|
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
documentBuilderFactory.setXIncludeAware(false);
|
||||||
|
documentBuilderFactory.setExpandEntityReferences(false);
|
||||||
|
|
||||||
|
return documentBuilderFactory.newDocumentBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Document newDocument() throws ParserConfigurationException {
|
||||||
|
return newDocumentBuilder().newDocument();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
public class WeChatConstants {
|
||||||
|
|
||||||
|
public enum SignType {
|
||||||
|
MD5, HMACSHA256
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String FIELD_SIGN = "sign";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付成功回调地址
|
||||||
|
*/
|
||||||
|
public static String NOTIFY_URL = "http://8.142.116.233:8001/pay/wxpay/callback";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付证书路径
|
||||||
|
*/
|
||||||
|
public static String PAY_CERT_LOC = "C:\\CTO\\java\\apache-tomcat-8.0.50\\wxcert\\";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信 trade_type 参数
|
||||||
|
*/
|
||||||
|
public static final String TRADE_TYPE_JSAPI = "JSAPI";//JSAPI支付 例如 : 直接调用微信支付
|
||||||
|
public static final String TRADE_TYPE_NATIVE = "NATIVE";//Native支付 例如 : 扫码支付
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一下单
|
||||||
|
*/
|
||||||
|
public static String UNIFIEDORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
|
||||||
|
/**
|
||||||
|
* 订单支付状态查询
|
||||||
|
*/
|
||||||
|
public static String ORDERQUERY_URL = "https://api.mch.weixin.qq.com/pay/orderquery";
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
*/
|
||||||
|
public static String REFUND_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund";
|
||||||
|
/**
|
||||||
|
* 提现
|
||||||
|
*/
|
||||||
|
public static String TRANSFERS_URL = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "wx.play")
|
||||||
|
@PropertySource(value = {"classpath:play.properties"})
|
||||||
|
public class WxPlayProperties implements InitializingBean {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置微信公众号或者小程序等的appid
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
/**
|
||||||
|
* 微信支付商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证书相对路径
|
||||||
|
*/
|
||||||
|
private String privateKeyPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证书相对路径
|
||||||
|
*/
|
||||||
|
private String privateCertPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单回调地址
|
||||||
|
*/
|
||||||
|
private String returnUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款回调地址
|
||||||
|
*/
|
||||||
|
private String refundUrl;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiV3key
|
||||||
|
*/
|
||||||
|
private String apiV3key;
|
||||||
|
|
||||||
|
|
||||||
|
public static String APP_ID = "";
|
||||||
|
public static String MCH_ID = "";
|
||||||
|
public static String PRIVATE_KEY_PATH = "";
|
||||||
|
public static String PRIVATE_CERT_PATH = "";
|
||||||
|
public static String RETURN_URL = "";
|
||||||
|
public static String REFUND_URL = "";
|
||||||
|
public static String API_V3KEY = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
APP_ID = getAppId();
|
||||||
|
MCH_ID = getMchId();
|
||||||
|
PRIVATE_KEY_PATH = getPrivateKeyPath();
|
||||||
|
PRIVATE_CERT_PATH = getPrivateCertPath();
|
||||||
|
RETURN_URL = getReturnUrl();
|
||||||
|
REFUND_URL = getRefundUrl();
|
||||||
|
API_V3KEY = getApiV3key();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,354 @@
|
|||||||
|
package com.starry.admin.common.play.wx;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class WxPlayUtils {
|
||||||
|
|
||||||
|
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
private static final Random RANDOM = new SecureRandom();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param openId 微信公众号ID
|
||||||
|
* @param appid 用户ID
|
||||||
|
* @param mchId 商户ID
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @param spBillCreateIp 终端设备ID
|
||||||
|
* @param body 商品描述
|
||||||
|
* @param totalFee 商品金额
|
||||||
|
* @param attach 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用(传入租户ID)
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String unifiedOrderJSAPI(String openId, String appid, String mchId, String orderId, String spBillCreateIp, String body, String attach, int totalFee) throws Exception {
|
||||||
|
Map<String, String> playRequestParameters = new HashMap<>();
|
||||||
|
playRequestParameters.put("appid", appid);
|
||||||
|
playRequestParameters.put("mch_id", mchId);
|
||||||
|
playRequestParameters.put("nonce_str", IdUtil.fastSimpleUUID());
|
||||||
|
playRequestParameters.put("body", body);
|
||||||
|
playRequestParameters.put("attach", attach);
|
||||||
|
playRequestParameters.put("out_trade_no", orderId);
|
||||||
|
playRequestParameters.put("total_fee", String.valueOf(totalFee));
|
||||||
|
playRequestParameters.put("spbill_create_ip", spBillCreateIp);
|
||||||
|
playRequestParameters.put("notify_url", WxPlayProperties.RETURN_URL);
|
||||||
|
playRequestParameters.put("trade_type", "JSAPI");
|
||||||
|
playRequestParameters.put("openId", openId);
|
||||||
|
String nonce_str = IdUtil.fastSimpleUUID();
|
||||||
|
//生成签名, 统一下单
|
||||||
|
log.debug("paraMap------------{}", playRequestParameters);
|
||||||
|
String sign = WXPayUtil.generateSignature(playRequestParameters, orderId);
|
||||||
|
log.debug("sign:{}", sign);
|
||||||
|
playRequestParameters.put("sign", sign);
|
||||||
|
String xml = WXPayUtil.mapToXml(playRequestParameters);//将所有参数(map)转xml格式
|
||||||
|
String new_xml = new String(xml.getBytes(StandardCharsets.UTF_8));
|
||||||
|
log.debug("xml:{}", new_xml);
|
||||||
|
//发送post请求"统一下单接口"返回预支付id:prepay_id
|
||||||
|
String xmlStr = HttpUtils.sendPost(WeChatConstants.UNIFIEDORDER_URL, generateSignedXml(playRequestParameters, orderId));
|
||||||
|
// String xmlStr = HttpUtils.sendPost(WeChatConstants.UNIFIEDORDER_URL, generateSignedXml(playRequestParameters, orderId));
|
||||||
|
log.debug("xmlStr:{}", xmlStr);
|
||||||
|
Map<String, String> map = WXPayUtil.xmlToMap(xmlStr);
|
||||||
|
|
||||||
|
// 如果预支付返回状态码为不为SUCCESS,说明预支付接口调用失败(通讯业务失败),抛出异常,业务进行处理
|
||||||
|
if (!map.get("return_code").equals("SUCCESS")) {
|
||||||
|
throw new CustomException(map.get("return_msg"));
|
||||||
|
}
|
||||||
|
// 如果预支付返回状态码为不为SUCCESS,说明预支付接口调用失败(交易业务失败),抛出异常,业务进行处理
|
||||||
|
if (!map.get("result_code ").equals("SUCCESS")) {
|
||||||
|
throw new CustomException(map.get("err_code_des"));
|
||||||
|
}
|
||||||
|
return map.get("prepay_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单支付状态查询
|
||||||
|
*
|
||||||
|
* @param wechat_appid
|
||||||
|
* @param wechat_mchid
|
||||||
|
* @param wechat_seckey
|
||||||
|
* @param out_trade_no
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static Map<String, String> orderQuery(String wechat_appid, String wechat_mchid, String wechat_seckey, String out_trade_no) throws Exception {
|
||||||
|
//拼接 参数
|
||||||
|
Map<String, String> paraMap = new HashMap<String, String>();
|
||||||
|
paraMap.put("appid", wechat_appid);
|
||||||
|
paraMap.put("mch_id", wechat_mchid);
|
||||||
|
paraMap.put("nonce_str", IdUtil.fastSimpleUUID());
|
||||||
|
paraMap.put("out_trade_no", out_trade_no);//订单号
|
||||||
|
String sign = WXPayUtil.generateSignature(paraMap, wechat_seckey);
|
||||||
|
paraMap.put("sign", sign);
|
||||||
|
String xml = WXPayUtil.mapToXml(paraMap);//将所有参数(map)转xml格式
|
||||||
|
String xmlStr = HttpUtils.sendPost(WeChatConstants.ORDERQUERY_URL, xml);//发送post请求"统一下单接口"返回预支付id:prepay_id
|
||||||
|
return WXPayUtil.xmlToMap(xmlStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XML格式字符串转换为Map
|
||||||
|
*
|
||||||
|
* @param strXML XML字符串
|
||||||
|
* @return XML数据转换后的Map
|
||||||
|
*/
|
||||||
|
public static Map<String, String> xmlToMap(String strXML) throws Exception {
|
||||||
|
Map<String, String> data = new HashMap<>();
|
||||||
|
DocumentBuilder documentBuilder = WXPayXmlUtil.newDocumentBuilder();
|
||||||
|
// InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
|
||||||
|
InputStream stream = new ByteArrayInputStream(strXML.getBytes("GBK"));
|
||||||
|
Document doc = documentBuilder.parse(stream);
|
||||||
|
doc.getDocumentElement().normalize();
|
||||||
|
NodeList nodeList = doc.getDocumentElement().getChildNodes();
|
||||||
|
for (int idx = 0; idx < nodeList.getLength(); ++idx) {
|
||||||
|
Node node = nodeList.item(idx);
|
||||||
|
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
Element element = (Element) node;
|
||||||
|
data.put(element.getNodeName(), element.getTextContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将Map转换为XML格式的字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @return XML格式的字符串
|
||||||
|
* @throws Exception 系统异常
|
||||||
|
*/
|
||||||
|
public static String mapToXml(Map<String, String> data) throws Exception {
|
||||||
|
Document document = WXPayXmlUtil.newDocument();
|
||||||
|
Element root = document.createElement("xml");
|
||||||
|
document.appendChild(root);
|
||||||
|
for (String key : data.keySet()) {
|
||||||
|
String value = data.get(key);
|
||||||
|
if (value == null) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
value = value.trim();
|
||||||
|
Element filed = document.createElement(key);
|
||||||
|
filed.appendChild(document.createTextNode(value));
|
||||||
|
root.appendChild(filed);
|
||||||
|
}
|
||||||
|
TransformerFactory tf = TransformerFactory.newInstance();
|
||||||
|
Transformer transformer = tf.newTransformer();
|
||||||
|
DOMSource source = new DOMSource(document);
|
||||||
|
transformer.setOutputProperty(OutputKeys.ENCODING, "GBK");
|
||||||
|
// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
StreamResult result = new StreamResult(writer);
|
||||||
|
transformer.transform(source, result);
|
||||||
|
String output = writer.getBuffer().toString();
|
||||||
|
try {
|
||||||
|
writer.close();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成带有 sign 的 XML 格式字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 含有sign字段的XML
|
||||||
|
*/
|
||||||
|
public static String generateSignedXml(final Map<String, String> data, String key) throws Exception {
|
||||||
|
return generateSignedXml(data, key, WeChatConstants.SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成带有 sign 的 XML 格式字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名类型
|
||||||
|
* @return 含有sign字段的XML
|
||||||
|
*/
|
||||||
|
public static String generateSignedXml(final Map<String, String> data, String key, WeChatConstants.SignType signType) throws Exception {
|
||||||
|
String sign = generateSignature(data, key, signType);
|
||||||
|
data.put(WeChatConstants.FIELD_SIGN, sign);
|
||||||
|
return mapToXml(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确
|
||||||
|
*
|
||||||
|
* @param xmlStr XML格式数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception 系统异常
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(String xmlStr, String key) throws Exception {
|
||||||
|
Map<String, String> data = xmlToMap(xmlStr);
|
||||||
|
if (!data.containsKey(WeChatConstants.FIELD_SIGN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String sign = data.get(WeChatConstants.FIELD_SIGN);
|
||||||
|
return generateSignature(data, key).equals(sign);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确,必须包含sign字段,否则返回false。使用MD5签名。
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception 系统异常
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(Map<String, String> data, String key) throws Exception {
|
||||||
|
return isSignatureValid(data, key, WeChatConstants.SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确,必须包含sign字段,否则返回false。
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名方式
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception 系统异常
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(Map<String, String> data, String key, WeChatConstants.SignType signType) throws Exception {
|
||||||
|
if (!data.containsKey(WeChatConstants.FIELD_SIGN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String sign = data.get(WeChatConstants.FIELD_SIGN);
|
||||||
|
return generateSignature(data, key, signType).equals(sign);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名
|
||||||
|
*
|
||||||
|
* @param data 待签名数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名
|
||||||
|
*/
|
||||||
|
public static String generateSignature(final Map<String, String> data, String key) throws Exception {
|
||||||
|
return generateSignature(data, key, WeChatConstants.SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
|
||||||
|
*
|
||||||
|
* @param data 待签名数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名方式
|
||||||
|
* @return 签名
|
||||||
|
*/
|
||||||
|
public static String generateSignature(final Map<String, String> data, String key, WeChatConstants.SignType signType) throws Exception {
|
||||||
|
Set<String> keySet = data.keySet();
|
||||||
|
String[] keyArray = keySet.toArray(new String[0]);
|
||||||
|
Arrays.sort(keyArray);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String k : keyArray) {
|
||||||
|
if (k.equals(WeChatConstants.FIELD_SIGN)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 参数值为空,则不参与签名
|
||||||
|
if (!data.get(k).trim().isEmpty()) {
|
||||||
|
sb.append(k).append("=").append(data.get(k).trim()).append("&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("key=").append(key);
|
||||||
|
if (WeChatConstants.SignType.MD5.equals(signType)) {
|
||||||
|
return MD5(sb.toString()).toUpperCase();
|
||||||
|
} else if (WeChatConstants.SignType.HMACSHA256.equals(signType)) {
|
||||||
|
return HmacSHA256(sb.toString(), key);
|
||||||
|
} else {
|
||||||
|
throw new Exception(String.format("Invalid sign_type: %s", signType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机字符串 Nonce Str
|
||||||
|
*
|
||||||
|
* @return String 随机字符串
|
||||||
|
*/
|
||||||
|
public static String generateNonceStr() {
|
||||||
|
char[] nonceChars = new char[32];
|
||||||
|
for (int index = 0; index < nonceChars.length; ++index) {
|
||||||
|
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
|
||||||
|
}
|
||||||
|
return new String(nonceChars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成 MD5
|
||||||
|
*
|
||||||
|
* @param data 待处理数据
|
||||||
|
* @return MD5结果
|
||||||
|
*/
|
||||||
|
public static String MD5(String data) throws Exception {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] array = md.digest(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte item : array) {
|
||||||
|
sb.append(Integer.toHexString((item & 0xFF) | 0x100), 1, 3);
|
||||||
|
}
|
||||||
|
return sb.toString().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成 HmacSHA256
|
||||||
|
*
|
||||||
|
* @param data 待处理数据
|
||||||
|
* @param key 密钥
|
||||||
|
* @return 加密结果
|
||||||
|
* @throws NoSuchAlgorithmException,InvalidKeyException 系统异常
|
||||||
|
*/
|
||||||
|
public static String HmacSHA256(String data, String key) throws NoSuchAlgorithmException, InvalidKeyException {
|
||||||
|
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||||
|
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||||
|
sha256_HMAC.init(secret_key);
|
||||||
|
byte[] array = sha256_HMAC.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte item : array) {
|
||||||
|
sb.append(Integer.toHexString((item & 0xFF) | 0x100), 1, 3);
|
||||||
|
}
|
||||||
|
return sb.toString().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前时间戳,单位秒
|
||||||
|
*/
|
||||||
|
public static long getCurrentTimestamp() {
|
||||||
|
return System.currentTimeMillis() / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,9 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.CorsConfigurationSource;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -58,7 +61,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers("/login", "/captcha/get-captcha", "/wx/**").permitAll()
|
.antMatchers("/login", "/captcha/get-captcha", "/wx/**").permitAll()
|
||||||
// 跨域请求会先进行一次options请求
|
// 跨域请求会先进行一次options请求
|
||||||
.antMatchers(HttpMethod.OPTIONS).permitAll().anyRequest()// 除上面外的所有请求全部需要鉴权认证
|
.antMatchers(HttpMethod.OPTIONS).permitAll().anyRequest()// 除上面外的所有请求全部需要鉴权认证
|
||||||
.authenticated();
|
.authenticated().and().cors().configurationSource(this.corsConfigurationSource());
|
||||||
// 禁用缓存
|
// 禁用缓存
|
||||||
httpSecurity.headers().cacheControl();
|
httpSecurity.headers().cacheControl();
|
||||||
// 添加Logout filter
|
// 添加Logout filter
|
||||||
@@ -69,6 +72,18 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
httpSecurity.exceptionHandling().accessDeniedHandler(customAccessDeniedHandler).authenticationEntryPoint(customAuthenticationEntryPoint);
|
httpSecurity.exceptionHandling().accessDeniedHandler(customAccessDeniedHandler).authenticationEntryPoint(customAuthenticationEntryPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CorsConfigurationSource corsConfigurationSource(){
|
||||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
|
corsConfiguration.setAllowCredentials(true);
|
||||||
|
corsConfiguration.addAllowedHeader("*"); // 这个得加上,一些复杂的请求方式会带有header,不加上跨域会失效。
|
||||||
|
corsConfiguration.addAllowedMethod("*");
|
||||||
|
corsConfiguration.addExposedHeader("*");
|
||||||
|
corsConfiguration.addAllowedOriginPattern("*");
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**",corsConfiguration);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||||
auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
|
auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.starry.admin.common.component.JwtToken;
|
import com.starry.admin.common.component.JwtToken;
|
||||||
import com.starry.admin.common.domain.LoginUser;
|
import com.starry.admin.common.domain.LoginUser;
|
||||||
import com.starry.admin.common.exception.CustomException;
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||||
import com.starry.admin.modules.clear.service.impl.PlayClerkUserInfoServiceImpl;
|
import com.starry.admin.modules.clear.service.impl.PlayClerkUserInfoServiceImpl;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
import com.starry.admin.modules.custom.service.impl.PlayCustomUserInfoServiceImpl;
|
import com.starry.admin.modules.custom.service.impl.PlayCustomUserInfoServiceImpl;
|
||||||
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
import com.starry.admin.modules.platform.entity.SysTenantEntity;
|
||||||
import com.starry.admin.modules.platform.service.ISysTenantService;
|
import com.starry.admin.modules.platform.service.ISysTenantService;
|
||||||
@@ -23,11 +25,11 @@ import org.springframework.web.servlet.HandlerExceptionResolver;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.IOException;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author admin
|
* @author admin
|
||||||
@@ -61,29 +63,62 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse, @NotNull FilterChain filterChain) throws ServletException, IOException {
|
protected void doFilterInternal(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse, @NotNull FilterChain filterChain) {
|
||||||
// 微信公众号的请求
|
log.info("url = {}", httpServletRequest.getRequestURI());
|
||||||
if (httpServletRequest.getServletPath().startsWith("/wx/")) {
|
try {
|
||||||
String clerkToken = httpServletRequest.getHeader(Constants.CLERK_USER_LOGIN_TOKEN);
|
|
||||||
String customToken = httpServletRequest.getHeader(Constants.CUSTOM_USER_LOGIN_TOKEN);
|
|
||||||
String tenantKey = httpServletRequest.getHeader("tenantkey");
|
// 微信公众号的请求,必须存在tenantkey,否则抛出异常
|
||||||
String tenantId = getTenantId(clerkToken, customToken, tenantKey);
|
if (httpServletRequest.getServletPath().startsWith("/wx/")) {
|
||||||
if (!checkTenantId(tenantId)) {
|
String tenantKey = httpServletRequest.getHeader("tenantkey");
|
||||||
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("租户信息异常"));
|
if (StrUtil.isBlank(tenantKey)) {
|
||||||
return;
|
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("tenantkey不能为空"));
|
||||||
}
|
return;
|
||||||
SecurityUtils.setTenantId(tenantId);
|
}
|
||||||
} else {
|
Map<String, String> notLoginUrls = new HashMap<>();
|
||||||
// 管理端的请求
|
notLoginUrls.put("/wx/common/area/tree", "1");
|
||||||
LoginUser jwtUser = jwtToken.getNewLoginUser(httpServletRequest);
|
notLoginUrls.put("/wx/common/file/upload", "1");
|
||||||
if (null != jwtUser && null == SecurityContextHolder.getContext().getAuthentication()) {
|
notLoginUrls.put("/wx/common/audio/upload", "1");
|
||||||
jwtToken.verifyToken(jwtUser);
|
notLoginUrls.put("/wx/oauth2/getConfigAddress", "1");
|
||||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
notLoginUrls.put("/clerk/level/queryAll", "1");
|
||||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpServletRequest));
|
notLoginUrls.put("/wx/clerk/class/queryAll", "1");
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
notLoginUrls.put("/wx/clerk/user/queryByPage", "1");
|
||||||
|
notLoginUrls.put("/wx/clerk/user/queryGiftById", "1");
|
||||||
|
notLoginUrls.put("/wx/clerk/user/queryPriceById", "1");
|
||||||
|
notLoginUrls.put("/wx/clerk/user/queryTrendsById", "1");
|
||||||
|
notLoginUrls.put("/wx/clerk/user/queryEvaluateById", "1");
|
||||||
|
if (notLoginUrls.containsKey(httpServletRequest.getServletPath())) {
|
||||||
|
String tenantId = getTenantId(null, null, tenantKey);
|
||||||
|
if (!checkTenantId(tenantId)) {
|
||||||
|
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("租户信息异常"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SecurityUtils.setTenantId(tenantId);
|
||||||
|
} else {
|
||||||
|
String clerkToken = httpServletRequest.getHeader(Constants.CLERK_USER_LOGIN_TOKEN);
|
||||||
|
String customToken = httpServletRequest.getHeader(Constants.CUSTOM_USER_LOGIN_TOKEN);
|
||||||
|
String tenantId = getTenantId(clerkToken, customToken, tenantKey);
|
||||||
|
if (!checkTenantId(tenantId)) {
|
||||||
|
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("租户信息异常"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SecurityUtils.setTenantId(tenantId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 管理端的请求
|
||||||
|
LoginUser jwtUser = jwtToken.getNewLoginUser(httpServletRequest);
|
||||||
|
if (null != jwtUser && null == SecurityContextHolder.getContext().getAuthentication()) {
|
||||||
|
jwtToken.verifyToken(jwtUser);
|
||||||
|
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||||
|
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpServletRequest));
|
||||||
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("系统异常", e);
|
||||||
|
resolver.resolveException(httpServletRequest, httpServletResponse, null, new CustomException("租户及授权验证失败"));
|
||||||
}
|
}
|
||||||
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -98,27 +133,34 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||||||
*/
|
*/
|
||||||
public String getTenantId(String clerkToken, String customToken, String tenantKey) {
|
public String getTenantId(String clerkToken, String customToken, String tenantKey) {
|
||||||
String tenantId = "";
|
String tenantId = "";
|
||||||
//如果用户(陪玩或客户)已登录,从token中获取租户ID
|
try {
|
||||||
if (StrUtil.isNotBlank(clerkToken) || StrUtil.isNotBlank(customToken)) {
|
//如果用户(陪玩或客户)已登录,从token中获取租户ID
|
||||||
String userId;
|
if (StrUtil.isNotBlank(clerkToken) || StrUtil.isNotBlank(customToken)) {
|
||||||
try {
|
String userId = tokenService.getWxUserIdByToken(StrUtil.isNotBlank(clerkToken) ? clerkToken : customToken);
|
||||||
userId = tokenService.getWxUserIdByToken(StrUtil.isNotBlank(clerkToken) ? clerkToken : customToken);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (clerkToken != null) {
|
|
||||||
String redisKey = "TENANT_INFO:" + userId;
|
String redisKey = "TENANT_INFO:" + userId;
|
||||||
SecurityUtils.setTenantId(redisCache.getCacheObject(redisKey));
|
SecurityUtils.setTenantId(redisCache.getCacheObject(redisKey));
|
||||||
tenantId = clerkUserInfoService.selectById(userId).getTenantId();
|
if (clerkToken != null) {
|
||||||
|
PlayClerkUserInfoEntity entity = clerkUserInfoService.selectById(userId);
|
||||||
|
if (entity == null) {
|
||||||
|
log.error("当前登录陪玩不存在,clerkToken={},tenantKey={}", clerkToken, tenantKey);
|
||||||
|
}
|
||||||
|
tenantId = entity != null ? entity.getTenantId() : "";
|
||||||
|
} else {
|
||||||
|
PlayCustomUserInfoEntity entity = customUserInfoService.selectById(userId);
|
||||||
|
if (entity == null) {
|
||||||
|
log.error("当前登录顾客不存在,customToken={},tenantKey={}", customToken, tenantKey);
|
||||||
|
}
|
||||||
|
tenantId = entity != null ? entity.getTenantId() : "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tenantId = customUserInfoService.selectById(userId).getTenantId();
|
// 如果用户未登录,从tenantKey中获取租户ID,然后验证租户ID是否存在,以及租户是否过期等
|
||||||
}
|
SysTenantEntity entity = sysTenantService.selectByTenantKey(tenantKey);
|
||||||
} else {
|
if (entity != null) {
|
||||||
// 如果用户未登录,从tenantKey中获取租户ID,然后验证租户ID是否存在,以及租户是否过期等
|
tenantId = entity.getTenantId();
|
||||||
SysTenantEntity entity = sysTenantService.selectByTenantKey(tenantKey);
|
}
|
||||||
if (entity != null) {
|
|
||||||
tenantId = entity.getTenantId();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取tenantKey异常,clerkToken={},customToken={},tenantKey = {}", clerkToken, customToken, tenantKey, e);
|
||||||
}
|
}
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.starry.admin.modules.article.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayClerkArticleInfoEntity;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleQueryVo;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleReturnVo;
|
||||||
|
import com.starry.admin.modules.article.service.IPlayClerkArticleInfoService;
|
||||||
|
import com.starry.admin.modules.article.service.IPlayCustomArticleInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员动态信息Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/clerk/article")
|
||||||
|
public class PlayClerkArticleInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayClerkArticleInfoService playClerkArticleInfoService;
|
||||||
|
@Resource
|
||||||
|
private IPlayCustomArticleInfoService playCustomArticleInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询店员动态信息列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public R list(PlayClerkArticleQueryVo vo) {
|
||||||
|
IPage<PlayClerkArticleReturnVo> list = playClerkArticleInfoService.selectPlayClerkArticleInfoByPage(vo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店员动态信息详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playClerkArticleInfoService.selectPlayClerkArticleInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增店员动态信息
|
||||||
|
*/
|
||||||
|
@Log(title = "店员动态信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayClerkArticleInfoEntity playClerkArticleInfo) {
|
||||||
|
boolean success = playClerkArticleInfoService.create(playClerkArticleInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改店员动态信息
|
||||||
|
*/
|
||||||
|
@Log(title = "店员动态信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update/{id}")
|
||||||
|
public R update(@PathVariable String id, @RequestBody PlayClerkArticleInfoEntity playClerkArticleInfo) {
|
||||||
|
playClerkArticleInfo.setId(id);
|
||||||
|
boolean success = playClerkArticleInfoService.update(playClerkArticleInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店员动态信息
|
||||||
|
*/
|
||||||
|
@Log(title = "店员动态信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
for (String id : ids) {
|
||||||
|
playClerkArticleInfoService.deletePlayClerkArticleInfoById(id);
|
||||||
|
playCustomArticleInfoService.deleteByArticleId(id);
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.starry.admin.modules.article.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayCustomArticleInfoEntity;
|
||||||
|
import com.starry.admin.modules.article.service.IPlayCustomArticleInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩点赞动态信息Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/custom/article")
|
||||||
|
public class PlayCustomArticleInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayCustomArticleInfoService playCustomArticleInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询陪玩点赞动态信息列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R list(PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
IPage<PlayCustomArticleInfoEntity> list = playCustomArticleInfoService.selectPlayCustomArticleInfoByPage(playCustomArticleInfo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取陪玩点赞动态信息详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playCustomArticleInfoService.selectPlayCustomArticleInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||||
|
@Log(title = "陪玩点赞动态信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
boolean success = playCustomArticleInfoService.create(playCustomArticleInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||||
|
@Log(title = "陪玩点赞动态信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update/{id}")
|
||||||
|
public R update(@PathVariable String id, @RequestBody PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
playCustomArticleInfo.setId(id);
|
||||||
|
boolean success = playCustomArticleInfoService.update(playCustomArticleInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||||
|
@Log(title = "陪玩点赞动态信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
return R.ok(playCustomArticleInfoService.deletePlayCustomArticleInfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.article.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayClerkArticleInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员动态信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface PlayClerkArticleInfoMapper extends MPJBaseMapper<PlayClerkArticleInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.article.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayCustomArticleInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩点赞动态信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface PlayCustomArticleInfoMapper extends BaseMapper<PlayCustomArticleInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.starry.admin.modules.article.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员动态信息对象 play_clerk_article_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_clerk_article_info")
|
||||||
|
public class PlayClerkArticleInfoEntity extends BaseEntity<PlayClerkArticleInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩用户ID
|
||||||
|
*/
|
||||||
|
private String playUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态标题
|
||||||
|
*/
|
||||||
|
private String articleTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态内容类型(0:图片,1:视频)
|
||||||
|
*/
|
||||||
|
private String articleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态内容
|
||||||
|
*/
|
||||||
|
private String articleCon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞人数
|
||||||
|
*/
|
||||||
|
private Long agreedQuantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态(0:未审核:1:审核通过,2:审核不通过)
|
||||||
|
*/
|
||||||
|
private String reviewState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.starry.admin.modules.article.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩点赞动态信息对象 play_custom_article_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_custom_article_info")
|
||||||
|
public class PlayCustomArticleInfoEntity extends BaseEntity<PlayCustomArticleInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态ID
|
||||||
|
*/
|
||||||
|
private String articleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员ID
|
||||||
|
*/
|
||||||
|
private String clerkUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客ID
|
||||||
|
*/
|
||||||
|
private String customUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞时间
|
||||||
|
*/
|
||||||
|
private Date endorseTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.starry.admin.modules.article.module.vo;
|
||||||
|
|
||||||
|
import com.starry.common.domain.BasePageEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* 动态信息查询对象
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PlayClerkArticleQueryVo extends BasePageEntity {
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.starry.admin.modules.article.module.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
* 动态信息查询返回对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PlayClerkArticleReturnVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 陪玩用户ID
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩用户昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩用户头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态标题
|
||||||
|
*/
|
||||||
|
private String articleTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态内容类型(0:图片,1:视频)
|
||||||
|
*/
|
||||||
|
private String articleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态内容
|
||||||
|
*/
|
||||||
|
private String articleCon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞人数
|
||||||
|
*/
|
||||||
|
private Long agreedQuantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态(0:未审核:1:审核通过,2:审核不通过)
|
||||||
|
*/
|
||||||
|
private String reviewState;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.starry.admin.modules.article.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayClerkArticleInfoEntity;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleQueryVo;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleReturnVo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员动态信息Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface IPlayClerkArticleInfoService extends IService<PlayClerkArticleInfoEntity> {
|
||||||
|
/**
|
||||||
|
* 查询店员动态信息
|
||||||
|
*
|
||||||
|
* @param id 店员动态信息主键
|
||||||
|
* @return 店员动态信息
|
||||||
|
*/
|
||||||
|
PlayClerkArticleInfoEntity selectPlayClerkArticleInfoById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询店员动态信息列表
|
||||||
|
*
|
||||||
|
* @param vo 店员动态信息查询对象
|
||||||
|
* @return 店员动态信息集合
|
||||||
|
*/
|
||||||
|
IPage<PlayClerkArticleReturnVo> selectPlayClerkArticleInfoByPage(PlayClerkArticleQueryVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增店员动态信息
|
||||||
|
*
|
||||||
|
* @param playClerkArticleInfo 店员动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayClerkArticleInfoEntity playClerkArticleInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改店员动态信息
|
||||||
|
*
|
||||||
|
* @param playClerkArticleInfo 店员动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayClerkArticleInfoEntity playClerkArticleInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除店员动态信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的店员动态信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayClerkArticleInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店员动态信息信息
|
||||||
|
*
|
||||||
|
* @param id 店员动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayClerkArticleInfoById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.starry.admin.modules.article.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayCustomArticleInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩点赞动态信息Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface IPlayCustomArticleInfoService extends IService<PlayCustomArticleInfoEntity> {
|
||||||
|
/**
|
||||||
|
* 查询陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param id 陪玩点赞动态信息主键
|
||||||
|
* @return 陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
PlayCustomArticleInfoEntity selectPlayCustomArticleInfoById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询陪玩点赞动态信息列表
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 陪玩点赞动态信息集合
|
||||||
|
*/
|
||||||
|
IPage<PlayCustomArticleInfoEntity> selectPlayCustomArticleInfoByPage(PlayCustomArticleInfoEntity playCustomArticleInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayCustomArticleInfoEntity playCustomArticleInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayCustomArticleInfoEntity playCustomArticleInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的陪玩点赞动态信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomArticleInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除陪玩点赞动态信息信息
|
||||||
|
*
|
||||||
|
* @param id 陪玩点赞动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomArticleInfoById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据动态ID删除点赞信息
|
||||||
|
*
|
||||||
|
* @param articleId 动态ID
|
||||||
|
*/
|
||||||
|
void deleteByArticleId(String articleId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.starry.admin.modules.article.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.starry.admin.modules.article.mapper.PlayClerkArticleInfoMapper;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayClerkArticleInfoEntity;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleQueryVo;
|
||||||
|
import com.starry.admin.modules.article.module.vo.PlayClerkArticleReturnVo;
|
||||||
|
import com.starry.admin.modules.article.service.IPlayClerkArticleInfoService;
|
||||||
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员动态信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayClerkArticleInfoServiceImpl extends ServiceImpl<PlayClerkArticleInfoMapper, PlayClerkArticleInfoEntity> implements IPlayClerkArticleInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayClerkArticleInfoMapper playClerkArticleInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询店员动态信息
|
||||||
|
*
|
||||||
|
* @param id 店员动态信息主键
|
||||||
|
* @return 店员动态信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayClerkArticleInfoEntity selectPlayClerkArticleInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询店员动态信息列表
|
||||||
|
*
|
||||||
|
* @param vo 店员动态信息查询对象
|
||||||
|
* @return 店员动态信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayClerkArticleReturnVo> selectPlayClerkArticleInfoByPage(PlayClerkArticleQueryVo vo) {
|
||||||
|
MPJLambdaWrapper<PlayClerkArticleInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayClerkArticleInfoEntity>()
|
||||||
|
//查询主表全部字段
|
||||||
|
.selectAll(PlayClerkArticleInfoEntity.class)
|
||||||
|
//陪玩用户表全部字段
|
||||||
|
.selectAll(PlayClerkUserInfoEntity.class)
|
||||||
|
//陪玩用户表
|
||||||
|
.leftJoin(PlayClerkUserInfoEntity.class, PlayClerkUserInfoEntity::getId, PlayClerkArticleInfoEntity::getPlayUserId);
|
||||||
|
return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayClerkArticleReturnVo.class, lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增店员动态信息
|
||||||
|
*
|
||||||
|
* @param playClerkArticleInfo 店员动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayClerkArticleInfoEntity playClerkArticleInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playClerkArticleInfo.getId())) {
|
||||||
|
playClerkArticleInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playClerkArticleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改店员动态信息
|
||||||
|
*
|
||||||
|
* @param playClerkArticleInfo 店员动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayClerkArticleInfoEntity playClerkArticleInfo) {
|
||||||
|
return updateById(playClerkArticleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除店员动态信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的店员动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayClerkArticleInfoByIds(String[] ids) {
|
||||||
|
return playClerkArticleInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店员动态信息信息
|
||||||
|
*
|
||||||
|
* @param id 店员动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayClerkArticleInfoById(String id) {
|
||||||
|
return playClerkArticleInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.starry.admin.modules.article.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.modules.article.mapper.PlayCustomArticleInfoMapper;
|
||||||
|
import com.starry.admin.modules.article.module.entity.PlayCustomArticleInfoEntity;
|
||||||
|
import com.starry.admin.modules.article.service.IPlayCustomArticleInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩点赞动态信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayCustomArticleInfoServiceImpl extends ServiceImpl<PlayCustomArticleInfoMapper, PlayCustomArticleInfoEntity> implements IPlayCustomArticleInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayCustomArticleInfoMapper playCustomArticleInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param id 陪玩点赞动态信息主键
|
||||||
|
* @return 陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayCustomArticleInfoEntity selectPlayCustomArticleInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询陪玩点赞动态信息列表
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 陪玩点赞动态信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayCustomArticleInfoEntity> selectPlayCustomArticleInfoByPage(PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
Page<PlayCustomArticleInfoEntity> page = new Page<>(1, 10);
|
||||||
|
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playCustomArticleInfo.getId())) {
|
||||||
|
playCustomArticleInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playCustomArticleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param playCustomArticleInfo 陪玩点赞动态信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayCustomArticleInfoEntity playCustomArticleInfo) {
|
||||||
|
return updateById(playCustomArticleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除陪玩点赞动态信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的陪玩点赞动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomArticleInfoByIds(String[] ids) {
|
||||||
|
return playCustomArticleInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除陪玩点赞动态信息信息
|
||||||
|
*
|
||||||
|
* @param id 陪玩点赞动态信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomArticleInfoById(String id) {
|
||||||
|
return playCustomArticleInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByArticleId(String articleId) {
|
||||||
|
LambdaQueryWrapper<PlayCustomArticleInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomArticleInfoEntity::getArticleId, articleId);
|
||||||
|
this.baseMapper.delete(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.starry.admin.modules.balance.controller;
|
||||||
|
|
||||||
|
import com.starry.admin.modules.balance.module.entity.PlayBalanceDetailsInfoEntity;
|
||||||
|
import com.starry.admin.modules.balance.module.vo.PlayBalanceDetailsQueryVo;
|
||||||
|
import com.starry.admin.modules.balance.service.IPlayBalanceDetailsInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额明细Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/balance/details")
|
||||||
|
public class PlayBalanceDetailsInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询余额明细列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public R list(@RequestBody PlayBalanceDetailsQueryVo vo) {
|
||||||
|
return R.ok(playBalanceDetailsInfoService.selectByPage(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取余额明细详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playBalanceDetailsInfoService.selectPlayBalanceDetailsInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增余额明细
|
||||||
|
*/
|
||||||
|
@Log(title = "余额明细", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayBalanceDetailsInfoEntity playBalanceDetailsInfo) {
|
||||||
|
boolean success = playBalanceDetailsInfoService.create(playBalanceDetailsInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改余额明细
|
||||||
|
*/
|
||||||
|
@Log(title = "余额明细", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update/{id}")
|
||||||
|
public R update(@PathVariable String id, @RequestBody PlayBalanceDetailsInfoEntity playBalanceDetailsInfo) {
|
||||||
|
playBalanceDetailsInfo.setId(id);
|
||||||
|
boolean success = playBalanceDetailsInfoService.update(playBalanceDetailsInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除余额明细
|
||||||
|
*/
|
||||||
|
@Log(title = "余额明细", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
return R.ok(playBalanceDetailsInfoService.deletePlayBalanceDetailsInfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.balance.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.starry.admin.modules.balance.module.entity.PlayBalanceDetailsInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额明细Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
public interface PlayBalanceDetailsInfoMapper extends MPJBaseMapper<PlayBalanceDetailsInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.starry.admin.modules.balance.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额明细对象 play_balance_details_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_balance_details_info")
|
||||||
|
public class PlayBalanceDetailsInfoEntity extends BaseEntity<PlayBalanceDetailsInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型[0:陪玩;1:顾客]
|
||||||
|
*/
|
||||||
|
private String userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作前余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceBeforeOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作后余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceAfterOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
private String operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
private Date operationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作金额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.starry.admin.modules.balance.module.vo;
|
||||||
|
|
||||||
|
import com.starry.common.domain.BasePageEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PlayBalanceDetailsQueryVo extends BasePageEntity {
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.starry.admin.modules.balance.module.vo;
|
||||||
|
|
||||||
|
import com.starry.common.domain.BasePageEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PlayBalanceDetailsReturnVo extends BasePageEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作前余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceBeforeOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作后余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceAfterOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
private String operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
private Date operationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作金额
|
||||||
|
*/
|
||||||
|
private BigDecimal balanceMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付方式,0:余额支付,1:微信支付,2:支付宝支付
|
||||||
|
*/
|
||||||
|
private String payMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送金额
|
||||||
|
*/
|
||||||
|
private BigDecimal giftAmount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单最终金额
|
||||||
|
*/
|
||||||
|
private BigDecimal finalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单备注
|
||||||
|
*/
|
||||||
|
private String orderRemark;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客Id
|
||||||
|
*/
|
||||||
|
private String customUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package com.starry.admin.modules.balance.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.balance.module.entity.PlayBalanceDetailsInfoEntity;
|
||||||
|
import com.starry.admin.modules.balance.module.vo.PlayBalanceDetailsQueryVo;
|
||||||
|
import com.starry.admin.modules.balance.module.vo.PlayBalanceDetailsReturnVo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额明细Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
public interface IPlayBalanceDetailsInfoService extends IService<PlayBalanceDetailsInfoEntity> {
|
||||||
|
/**
|
||||||
|
* 查询余额明细
|
||||||
|
*
|
||||||
|
* @param id 余额明细主键
|
||||||
|
* @return 余额明细
|
||||||
|
*/
|
||||||
|
PlayBalanceDetailsInfoEntity selectPlayBalanceDetailsInfoById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询余额明细列表
|
||||||
|
*
|
||||||
|
* @param vo 余额明细查询对象
|
||||||
|
* @return 余额明细集合
|
||||||
|
*/
|
||||||
|
IPage<PlayBalanceDetailsReturnVo> selectByPage(PlayBalanceDetailsQueryVo vo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询余额明细列表
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 余额明细集合
|
||||||
|
*/
|
||||||
|
IPage<PlayBalanceDetailsInfoEntity> selectPlayBalanceDetailsInfoByPage(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增余额明细信息
|
||||||
|
*
|
||||||
|
* @param userType 用户类型[0:陪玩;1:顾客]
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param balanceBeforeOperation 操作前余额
|
||||||
|
* @param balanceAfterOperation 操作后余额
|
||||||
|
* @param operationType 操作类型
|
||||||
|
* @param balanceMoney 操作金额
|
||||||
|
*/
|
||||||
|
void create(String userType, String userId, BigDecimal balanceBeforeOperation, BigDecimal balanceAfterOperation, String operationType, BigDecimal balanceMoney);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增余额明细
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改余额明细
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除余额明细
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的余额明细主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayBalanceDetailsInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除余额明细信息
|
||||||
|
*
|
||||||
|
* @param id 余额明细主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayBalanceDetailsInfoById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package com.starry.admin.modules.balance.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.starry.admin.modules.balance.mapper.PlayBalanceDetailsInfoMapper;
|
||||||
|
import com.starry.admin.modules.balance.module.entity.PlayBalanceDetailsInfoEntity;
|
||||||
|
import com.starry.admin.modules.balance.module.vo.PlayBalanceDetailsQueryVo;
|
||||||
|
import com.starry.admin.modules.balance.module.vo.PlayBalanceDetailsReturnVo;
|
||||||
|
import com.starry.admin.modules.balance.service.IPlayBalanceDetailsInfoService;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额明细Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayBalanceDetailsInfoServiceImpl extends ServiceImpl<PlayBalanceDetailsInfoMapper, PlayBalanceDetailsInfoEntity> implements IPlayBalanceDetailsInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayBalanceDetailsInfoMapper playBalanceDetailsInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询余额明细
|
||||||
|
*
|
||||||
|
* @param id 余额明细主键
|
||||||
|
* @return 余额明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayBalanceDetailsInfoEntity selectPlayBalanceDetailsInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<PlayBalanceDetailsReturnVo> selectByPage(PlayBalanceDetailsQueryVo vo) {
|
||||||
|
MPJLambdaWrapper<PlayBalanceDetailsInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayBalanceDetailsInfoEntity>()
|
||||||
|
//查询主表全部字段
|
||||||
|
.selectAll(PlayBalanceDetailsInfoEntity.class)
|
||||||
|
//查询顾客表
|
||||||
|
.selectAll(PlayCustomUserInfoEntity.class)
|
||||||
|
//查询订单表全部字段
|
||||||
|
.selectAll(PlayOrderInfoEntity.class)
|
||||||
|
.selectAs(PlayOrderInfoEntity::getId, "orderId")
|
||||||
|
.selectAs(PlayOrderInfoEntity::getRemark, "orderId")
|
||||||
|
.leftJoin(PlayOrderInfoEntity.class, PlayOrderInfoEntity::getId, PlayBalanceDetailsInfoEntity::getOrderId)
|
||||||
|
.selectAs(PlayCustomUserInfoEntity::getId, "customUserId")
|
||||||
|
.leftJoin(PlayCustomUserInfoEntity.class, PlayCustomUserInfoEntity::getId, PlayBalanceDetailsInfoEntity::getUserId);
|
||||||
|
lambdaQueryWrapper.orderByDesc(PlayBalanceDetailsInfoEntity::getUserId);
|
||||||
|
lambdaQueryWrapper.orderByDesc(PlayBalanceDetailsInfoEntity::getOperationTime);
|
||||||
|
return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayBalanceDetailsReturnVo.class, lambdaQueryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询余额明细列表
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 余额明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayBalanceDetailsInfoEntity> selectPlayBalanceDetailsInfoByPage(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo) {
|
||||||
|
Page<PlayBalanceDetailsInfoEntity> page = new Page<>(1, 10);
|
||||||
|
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(String userType, String userId, BigDecimal balanceBeforeOperation, BigDecimal balanceAfterOperation, String operationType, BigDecimal balanceMoney) {
|
||||||
|
PlayBalanceDetailsInfoEntity entity = new PlayBalanceDetailsInfoEntity();
|
||||||
|
entity.setId(IdUtil.fastSimpleUUID());
|
||||||
|
entity.setUserType(userType);
|
||||||
|
entity.setUserId(userId);
|
||||||
|
entity.setBalanceBeforeOperation(balanceBeforeOperation);
|
||||||
|
entity.setBalanceAfterOperation(balanceAfterOperation);
|
||||||
|
entity.setOperationType(operationType);
|
||||||
|
entity.setBalanceMoney(balanceMoney);
|
||||||
|
entity.setOperationTime(new Date());
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增余额明细
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playBalanceDetailsInfo.getId())) {
|
||||||
|
playBalanceDetailsInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playBalanceDetailsInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改余额明细
|
||||||
|
*
|
||||||
|
* @param playBalanceDetailsInfo 余额明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayBalanceDetailsInfoEntity playBalanceDetailsInfo) {
|
||||||
|
return updateById(playBalanceDetailsInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除余额明细
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的余额明细主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayBalanceDetailsInfoByIds(String[] ids) {
|
||||||
|
return playBalanceDetailsInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除余额明细信息
|
||||||
|
*
|
||||||
|
* @param id 余额明细主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayBalanceDetailsInfoById(String id) {
|
||||||
|
return playBalanceDetailsInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,14 +2,12 @@ package com.starry.admin.modules.clear.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkCommodityEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkCommodityEntity;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkCommodityEditVo;
|
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkCommodityQueryVo;
|
import com.starry.admin.modules.clear.module.vo.PlayClerkCommodityQueryVo;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
||||||
import com.starry.common.annotation.Log;
|
import com.starry.common.annotation.Log;
|
||||||
import com.starry.common.enums.BusinessType;
|
import com.starry.common.enums.BusinessType;
|
||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -68,14 +66,6 @@ public class PlayClerkCommodityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "启停陪玩服务项目", businessType = BusinessType.UPDATE)
|
|
||||||
@PostMapping(value = "/startStopClerkItem")
|
|
||||||
public R startStopClerkItem(@Validated @RequestBody PlayClerkCommodityEditVo vo) {
|
|
||||||
playClerkCommodityService.startStopClerkItem(vo.getCommodityType(), vo.getEnablingState());
|
|
||||||
return R.ok("成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改陪玩服务项目
|
* 修改陪玩服务项目
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.starry.admin.modules.clear.controller;
|
package com.starry.admin.modules.clear.controller;
|
||||||
|
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelAddVo;
|
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelAddVo;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelEditVo;
|
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelEditVo;
|
||||||
@@ -78,6 +79,9 @@ public class PlayClerkLevelInfoController {
|
|||||||
@DeleteMapping("delMaxLevel")
|
@DeleteMapping("delMaxLevel")
|
||||||
public R remove() {
|
public R remove() {
|
||||||
int level = playClerkLevelInfoService.selectMaxLevel();
|
int level = playClerkLevelInfoService.selectMaxLevel();
|
||||||
|
if (level <= 1) {
|
||||||
|
throw new CustomException("最后一级,不允许删除");
|
||||||
|
}
|
||||||
playClerkLevelInfoService.delMaxLevelByLevel(level);
|
playClerkLevelInfoService.delMaxLevelByLevel(level);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoQueryVo;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoQueryVo;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkLevelQueryReturnVo;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserListResultVo;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkUserAddToWxVo;
|
import com.starry.admin.modules.clear.module.vo.*;
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkUserAddVo;
|
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkUserEditVo;
|
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
||||||
@@ -57,7 +55,7 @@ public class PlayClerkUserInfoController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("listByPage")
|
@PostMapping("listByPage")
|
||||||
public R listByPage(PlayClerkUserInfoQueryVo vo) {
|
public R listByPage(PlayClerkUserInfoQueryVo vo) {
|
||||||
IPage<PlayClerkUserInfoEntity> list = playClerkUserInfoService.selectPlayClerkUserInfoByPage(vo);
|
IPage<PlayClerkUserListResultVo> list = playClerkUserInfoService.selectPlayClerkUserInfoByPage(vo);
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +65,7 @@ public class PlayClerkUserInfoController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R list(PlayClerkUserInfoQueryVo vo) {
|
public R list(PlayClerkUserInfoQueryVo vo) {
|
||||||
IPage<PlayClerkUserInfoEntity> list = playClerkUserInfoService.selectPlayClerkUserInfoByPage(vo);
|
IPage<PlayClerkUserListResultVo> list = playClerkUserInfoService.selectPlayClerkUserInfoByPage(vo);
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +129,21 @@ public class PlayClerkUserInfoController {
|
|||||||
return R.error("修改失败");
|
return R.error("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改店员状态
|
||||||
|
*/
|
||||||
|
@Log(title = "店员", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/updateState")
|
||||||
|
public R updateState(@Validated @RequestBody PlayClerkUserStateEditVo vo) {
|
||||||
|
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||||
|
boolean success = playClerkUserInfoService.update(entity);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除店员
|
* 删除店员
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ public class PlayClarkUserEvaluateInfoEntity {
|
|||||||
*/
|
*/
|
||||||
private String commodityUnit;
|
private String commodityUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞数
|
||||||
|
*/
|
||||||
|
public Integer likeCount;
|
||||||
|
|
||||||
|
|
||||||
public PlayClarkUserEvaluateInfoEntity(String id, String evaluatorId, String evaluatorUsername, String evaluatorAvatar, String con, Date evaluateTime, String orderId, String clarkUsername, String commodityId, String commodityName, String commodityUnit) {
|
public PlayClarkUserEvaluateInfoEntity(String id, String evaluatorId, String evaluatorUsername, String evaluatorAvatar, String con, Date evaluateTime, String orderId, String clarkUsername, String commodityId, String commodityName, String commodityUnit) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -79,4 +84,20 @@ public class PlayClarkUserEvaluateInfoEntity {
|
|||||||
this.commodityName = commodityName;
|
this.commodityName = commodityName;
|
||||||
this.commodityUnit = commodityUnit;
|
this.commodityUnit = commodityUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayClarkUserEvaluateInfoEntity(String id, String evaluatorId, String evaluatorUsername, String evaluatorAvatar, String con, Date evaluateTime, String orderId, String clarkUsername, String commodityId, String commodityName, String commodityUnit, int likeCount) {
|
||||||
|
this.id = id;
|
||||||
|
this.evaluatorId = evaluatorId;
|
||||||
|
this.evaluatorUsername = evaluatorUsername;
|
||||||
|
this.evaluatorAvatar = evaluatorAvatar;
|
||||||
|
this.con = con;
|
||||||
|
this.evaluateTime = evaluateTime;
|
||||||
|
this.orderId = orderId;
|
||||||
|
this.clarkUsername = clarkUsername;
|
||||||
|
this.commodityId = commodityId;
|
||||||
|
this.commodityName = commodityName;
|
||||||
|
this.commodityUnit = commodityUnit;
|
||||||
|
this.likeCount = likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.starry.common.domain.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 陪玩服务项目对象 play_clerk_commodity
|
* 陪玩服务项目对象 play_clerk_commodity
|
||||||
*
|
*
|
||||||
@@ -13,7 +15,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("play_clerk_commodity")
|
@TableName("play_clerk_commodity_info")
|
||||||
public class PlayClerkCommodityEntity extends BaseEntity<PlayClerkCommodityEntity> {
|
public class PlayClerkCommodityEntity extends BaseEntity<PlayClerkCommodityEntity> {
|
||||||
|
|
||||||
|
|
||||||
@@ -50,8 +52,13 @@ public class PlayClerkCommodityEntity extends BaseEntity<PlayClerkCommodityEntit
|
|||||||
/**
|
/**
|
||||||
* 项目价格
|
* 项目价格
|
||||||
*/
|
*/
|
||||||
private String commodityPrice;
|
private BigDecimal commodityPrice;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务时长(文字描述信息,不参与订单计算)
|
||||||
|
*/
|
||||||
|
private String serviceDuration;
|
||||||
/**
|
/**
|
||||||
* 服务启动状态
|
* 服务启动状态
|
||||||
* 0:停用
|
* 0:停用
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ public class PlayClerkDataReviewInfoEntity extends BaseEntity<PlayClerkDataRevie
|
|||||||
*/
|
*/
|
||||||
private String playUserId;
|
private String playUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员头像
|
||||||
|
*/
|
||||||
|
private String clarkAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员名称
|
||||||
|
*/
|
||||||
|
private String clarkNickname;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资料类型[0:店员申请,1:头像;2:相册;3:录音]
|
* 资料类型[0:店员申请,1:头像;2:相册;3:录音]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class PlayClerkUserDetailResultVo {
|
|||||||
* 礼物列表
|
* 礼物列表
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private List<PlayGiftInfoEntity> gifts;
|
private List<PlayGiftInfoVo> gifts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务项目
|
* 服务项目
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.starry.common.domain.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -38,6 +39,11 @@ public class PlayClerkUserInfoEntity extends BaseEntity<PlayClerkUserInfoEntity>
|
|||||||
*/
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信号码
|
||||||
|
*/
|
||||||
|
private String weiChatCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 陪玩用户ID
|
* 陪玩用户ID
|
||||||
*/
|
*/
|
||||||
@@ -58,6 +64,7 @@ public class PlayClerkUserInfoEntity extends BaseEntity<PlayClerkUserInfoEntity>
|
|||||||
*/
|
*/
|
||||||
private String levelId;
|
private String levelId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员类型
|
* 店员类型
|
||||||
*/
|
*/
|
||||||
@@ -120,9 +127,9 @@ public class PlayClerkUserInfoEntity extends BaseEntity<PlayClerkUserInfoEntity>
|
|||||||
private String city;
|
private String city;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户余额(单位分)
|
* 账户余额
|
||||||
*/
|
*/
|
||||||
private String accountBalance;
|
private BigDecimal accountBalance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
@@ -172,10 +179,10 @@ public class PlayClerkUserInfoEntity extends BaseEntity<PlayClerkUserInfoEntity>
|
|||||||
/**
|
/**
|
||||||
* 随机接单状态【1:允许,0:禁止】
|
* 随机接单状态【1:允许,0:禁止】
|
||||||
*/
|
*/
|
||||||
private String randomOrder;
|
private String randomOrderState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员状态(0:不是陪玩,1:陪玩)
|
* 店员状态(0:不是陪玩,1:陪玩,2:资料审核中)
|
||||||
*/
|
*/
|
||||||
private String clerkState;
|
private String clerkState;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public class PlayClerkUserInfoQueryVo extends BasePageEntity {
|
|||||||
*/
|
*/
|
||||||
private String levelId;
|
private String levelId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员类型
|
* 店员类型
|
||||||
*/
|
*/
|
||||||
@@ -45,10 +44,15 @@ public class PlayClerkUserInfoQueryVo extends BasePageEntity {
|
|||||||
*/
|
*/
|
||||||
private String listingState;
|
private String listingState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推荐状态(1:已推荐,0:未推荐)
|
||||||
|
*/
|
||||||
|
private String recommendationState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工状态【1:是陪玩,0:不是陪玩】
|
* 员工状态【1:是陪玩,0:不是陪玩】
|
||||||
*/
|
*/
|
||||||
private String clerkState;
|
private String clerkState = "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号码
|
* 手机号码
|
||||||
@@ -56,5 +60,4 @@ public class PlayClerkUserInfoQueryVo extends BasePageEntity {
|
|||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ public class PlayClerkUserListResultVo {
|
|||||||
*/
|
*/
|
||||||
private String audio;
|
private String audio;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 星座
|
||||||
|
*/
|
||||||
|
private String constellation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签
|
* 标签
|
||||||
*/
|
*/
|
||||||
@@ -65,6 +71,16 @@ public class PlayClerkUserListResultVo {
|
|||||||
*/
|
*/
|
||||||
private Integer age;
|
private Integer age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在省份
|
||||||
|
*/
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在城市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关注(0:未关注,1:已关注)
|
* 关注(0:未关注,1:已关注)
|
||||||
@@ -76,9 +92,43 @@ public class PlayClerkUserListResultVo {
|
|||||||
*/
|
*/
|
||||||
private String onlineState;
|
private String onlineState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架状态【1:上架,0:下架】
|
||||||
|
*/
|
||||||
|
private String listingState;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名状态【1:已实名,0:未实名】
|
||||||
|
*/
|
||||||
|
private String realState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必须实名【1:必须实名,0:非必须实名,2:跟随店铺设置】
|
||||||
|
*/
|
||||||
|
private String mandatoryRealState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机接单状态【1:允许,0:禁止】
|
||||||
|
*/
|
||||||
|
private String randomOrderState;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务项目
|
* 服务项目
|
||||||
*/
|
*/
|
||||||
private List<String> commodity;
|
private List<String> commodity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最低消费
|
||||||
|
*/
|
||||||
|
private String latestConsumption = "最低1船票";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PlayGiftInfoEntity {
|
public class PlayGiftInfoVo {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +37,7 @@ public class PlayGiftInfoEntity {
|
|||||||
*/
|
*/
|
||||||
private String state;
|
private String state;
|
||||||
|
|
||||||
public PlayGiftInfoEntity(String id, String name, String url, Integer number, String state) {
|
public PlayGiftInfoVo(String id, String name, String url, Integer number, String state) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
@@ -97,4 +97,5 @@ public class PlayClerkUserAddVo {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.starry.admin.modules.clear.module.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlayClerkUserStateEditVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "id不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推荐状态(1:已推荐,0:未推荐)
|
||||||
|
*/
|
||||||
|
private String recommendationState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否置顶状态(1:已置顶,0:未置顶)
|
||||||
|
*/
|
||||||
|
private String pinToTopState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线状态【1:在线,0:离线】
|
||||||
|
*/
|
||||||
|
private String onlineState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架状态【1:上架,0:下架】
|
||||||
|
*/
|
||||||
|
private String listingState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示状态【1:显示,0:隐藏】
|
||||||
|
*/
|
||||||
|
private String displayState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名状态【1:已实名,0:未实名】
|
||||||
|
*/
|
||||||
|
private String realState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||||
|
*/
|
||||||
|
private String mandatoryRealState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机接单状态【1:允许,0:禁止】
|
||||||
|
*/
|
||||||
|
private String randomOrderState;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,22 @@ public interface IPlayClerkCommodityService extends IService<PlayClerkCommodityE
|
|||||||
void initClerkCommodity(String playUserId);
|
void initClerkCommodity(String playUserId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID,查询当前用户的服务项目类型
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 服务项目类型
|
||||||
|
*/
|
||||||
|
List<String> getClerkCommodityList(String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID,查询当前用户的服务项目类型
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return List<PlayClerkCommodityEntity>
|
||||||
|
*/
|
||||||
|
List<PlayClerkCommodityEntity> selectCommodityTypeByUser(String userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID,查询当前用户的服务项目
|
* 根据用户ID,查询当前用户的服务项目
|
||||||
*
|
*
|
||||||
@@ -42,8 +58,9 @@ public interface IPlayClerkCommodityService extends IService<PlayClerkCommodityE
|
|||||||
*
|
*
|
||||||
* @param type 项目名称
|
* @param type 项目名称
|
||||||
* @param enablingState 启停状态
|
* @param enablingState 启停状态
|
||||||
|
* @param clerkUserId 陪玩ID
|
||||||
*/
|
*/
|
||||||
void startStopClerkItem(String type, String enablingState);
|
void startStopClerkItem(String type, String enablingState, String clerkUserId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,15 @@ import java.util.List;
|
|||||||
* @since 2024-03-30
|
* @since 2024-03-30
|
||||||
*/
|
*/
|
||||||
public interface IPlayClerkLevelInfoService extends IService<PlayClerkLevelInfoEntity> {
|
public interface IPlayClerkLevelInfoService extends IService<PlayClerkLevelInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取新增陪玩时,默认最低等级ID
|
||||||
|
* @return PlayClerkLevelInfoEntity
|
||||||
|
*/
|
||||||
|
PlayClerkLevelInfoEntity getDefaultLevel();
|
||||||
|
/**
|
||||||
|
*
|
||||||
* 查询店员等级
|
* 查询店员等级
|
||||||
*
|
*
|
||||||
* @param id 店员等级主键
|
* @param id 店员等级主键
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoQueryVo;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoQueryVo;
|
||||||
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserListResultVo;
|
||||||
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员Service接口
|
* 店员Service接口
|
||||||
@@ -48,7 +51,7 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
|
|||||||
PlayClerkUserLoginResponseVo getVo(PlayClerkUserInfoEntity vo);
|
PlayClerkUserLoginResponseVo getVo(PlayClerkUserInfoEntity vo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟新token
|
* 更新token
|
||||||
*
|
*
|
||||||
* @param id 用户ID
|
* @param id 用户ID
|
||||||
* @param token token
|
* @param token token
|
||||||
@@ -57,13 +60,33 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
|
|||||||
**/
|
**/
|
||||||
void updateTokenById(String id, String token);
|
void updateTokenById(String id, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新账号余额
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param accountBalance 账户余额
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/4/9 14:33
|
||||||
|
**/
|
||||||
|
void updateAccountBalanceById(String id, BigDecimal accountBalance);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询店员列表
|
||||||
|
*
|
||||||
|
* @param vo 店员查询对象
|
||||||
|
* @param customUserId 顾客ID
|
||||||
|
* @return 店员列表
|
||||||
|
*/
|
||||||
|
IPage<PlayClerkUserListResultVo> selectByPage(PlayClerkUserInfoQueryVo vo, String customUserId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询店员列表
|
* 查询店员列表
|
||||||
*
|
*
|
||||||
* @param vo 店员查询对象
|
* @param vo 店员查询对象
|
||||||
* @return 店员集合
|
* @return 店员集合
|
||||||
*/
|
*/
|
||||||
IPage<PlayClerkUserInfoEntity> selectPlayClerkUserInfoByPage(PlayClerkUserInfoQueryVo vo);
|
IPage<PlayClerkUserListResultVo> selectPlayClerkUserInfoByPage(PlayClerkUserInfoQueryVo vo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增店员
|
* 新增店员
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 陪玩服务项目Service业务层处理
|
* 陪玩服务项目Service业务层处理
|
||||||
@@ -35,14 +35,20 @@ public class PlayClerkCommodityServiceImpl extends ServiceImpl<PlayClerkCommodit
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initClerkCommodity(String playUserId) {
|
public void initClerkCommodity(String userId) {
|
||||||
|
//删除当前陪玩的所有服务项目
|
||||||
|
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, userId);
|
||||||
|
this.baseMapper.delete(lambdaQueryWrapper);
|
||||||
|
//根据当前租户的服务项目,生成陪玩项目数据
|
||||||
for (PlayCommodityInfoEntity commodityInfo : playCommodityInfoService.selectAll()) {
|
for (PlayCommodityInfoEntity commodityInfo : playCommodityInfoService.selectAll()) {
|
||||||
PlayClerkCommodityEntity entity = new PlayClerkCommodityEntity();
|
PlayClerkCommodityEntity entity = new PlayClerkCommodityEntity();
|
||||||
entity.setPlayUserId(playUserId);
|
entity.setPlayUserId(userId);
|
||||||
entity.setCommodityId(commodityInfo.getId());
|
entity.setCommodityId(commodityInfo.getId());
|
||||||
entity.setCommodityType(commodityInfo.getItemType());
|
entity.setCommodityType(commodityInfo.getItemType());
|
||||||
entity.setCommodityName(commodityInfo.getItemName());
|
entity.setCommodityName(commodityInfo.getItemName());
|
||||||
entity.setCommodityPrice(commodityInfo.getPrice());
|
entity.setCommodityPrice(commodityInfo.getPrice());
|
||||||
|
entity.setServiceDuration(commodityInfo.getServiceDuration());
|
||||||
entity.setEnablingState("1");
|
entity.setEnablingState("1");
|
||||||
this.create(entity);
|
this.create(entity);
|
||||||
}
|
}
|
||||||
@@ -51,10 +57,23 @@ public class PlayClerkCommodityServiceImpl extends ServiceImpl<PlayClerkCommodit
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayClerkCommodityEntity> selectByUser(String playUserId) {
|
public List<String> getClerkCommodityList(String userId) {
|
||||||
|
List<PlayClerkCommodityEntity> list = this.selectCommodityTypeByUser(userId);
|
||||||
|
return list.stream().map(PlayClerkCommodityEntity::getCommodityType).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayClerkCommodityEntity> selectCommodityTypeByUser(String userId) {
|
||||||
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.groupBy(PlayClerkCommodityEntity::getCommodityType);
|
lambdaQueryWrapper.groupBy(PlayClerkCommodityEntity::getCommodityType);
|
||||||
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, playUserId);
|
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, userId);
|
||||||
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayClerkCommodityEntity> selectByUser(String userId) {
|
||||||
|
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, userId);
|
||||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,11 +84,11 @@ public class PlayClerkCommodityServiceImpl extends ServiceImpl<PlayClerkCommodit
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startStopClerkItem(String type, String enablingState) {
|
public void startStopClerkItem(String type, String enablingState,String clerkUserId) {
|
||||||
PlayClerkCommodityEntity entity = new PlayClerkCommodityEntity();
|
PlayClerkCommodityEntity entity = new PlayClerkCommodityEntity();
|
||||||
entity.setEnablingState(enablingState);
|
entity.setEnablingState(enablingState);
|
||||||
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PlayClerkCommodityEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, "1");
|
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getPlayUserId, clerkUserId);
|
||||||
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getCommodityType, type);
|
lambdaQueryWrapper.eq(PlayClerkCommodityEntity::getCommodityType, type);
|
||||||
this.baseMapper.update(entity, lambdaQueryWrapper);
|
this.baseMapper.update(entity, lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
import com.starry.admin.modules.clear.mapper.PlayClerkLevelInfoMapper;
|
import com.starry.admin.modules.clear.mapper.PlayClerkLevelInfoMapper;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
import com.starry.admin.modules.clear.service.IPlayClerkLevelInfoService;
|
||||||
@@ -27,6 +28,15 @@ public class PlayClerkLevelInfoServiceImpl extends ServiceImpl<PlayClerkLevelInf
|
|||||||
@Resource
|
@Resource
|
||||||
private PlayClerkLevelInfoMapper playClerkLevelInfoMapper;
|
private PlayClerkLevelInfoMapper playClerkLevelInfoMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayClerkLevelInfoEntity getDefaultLevel() {
|
||||||
|
List<PlayClerkLevelInfoEntity> list = this.selectAll();
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
throw new CustomException("系统错误,等级数据未初始化");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询店员等级
|
* 查询店员等级
|
||||||
*
|
*
|
||||||
@@ -41,7 +51,7 @@ public class PlayClerkLevelInfoServiceImpl extends ServiceImpl<PlayClerkLevelInf
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayClerkLevelInfoEntity> selectAll() {
|
public List<PlayClerkLevelInfoEntity> selectAll() {
|
||||||
LambdaQueryWrapper<PlayClerkLevelInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper();
|
LambdaQueryWrapper<PlayClerkLevelInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.orderByAsc(PlayClerkLevelInfoEntity::getLevel);
|
lambdaQueryWrapper.orderByAsc(PlayClerkLevelInfoEntity::getLevel);
|
||||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,19 +8,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.starry.admin.modules.clear.mapper.PlayClerkUserInfoMapper;
|
import com.starry.admin.modules.clear.mapper.PlayClerkUserInfoMapper;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkDataReviewInfoEntity;
|
import com.starry.admin.modules.clear.module.entity.*;
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkLevelInfoEntity;
|
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
|
||||||
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoQueryVo;
|
|
||||||
import com.starry.admin.modules.clear.module.vo.PlayClerkCommodityQueryVo;
|
import com.starry.admin.modules.clear.module.vo.PlayClerkCommodityQueryVo;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
import com.starry.admin.modules.clear.service.IPlayClerkCommodityService;
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkDataReviewInfoService;
|
|
||||||
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
||||||
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||||
|
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||||
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -46,7 +45,7 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
private IPlayClerkCommodityService playClerkCommodityService;
|
private IPlayClerkCommodityService playClerkCommodityService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayClerkDataReviewInfoService playClerkDataReviewInfoService;
|
private IPlayCustomFollowInfoService customFollowInfoService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +58,7 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
@Override
|
@Override
|
||||||
public PlayClerkUserInfoEntity selectByOpenid(String openId) {
|
public PlayClerkUserInfoEntity selectByOpenid(String openId) {
|
||||||
LambdaQueryWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getPlayUserId, openId);
|
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getOpenid, openId);
|
||||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,12 +73,13 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
return this.baseMapper.selectById(id);
|
return this.baseMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PlayClerkUserLoginResponseVo getVo(PlayClerkUserInfoEntity userInfo) {
|
public PlayClerkUserLoginResponseVo getVo(PlayClerkUserInfoEntity userInfo) {
|
||||||
PlayClerkUserLoginResponseVo result = ConvertUtil.entityToVo(userInfo, PlayClerkUserLoginResponseVo.class);
|
PlayClerkUserLoginResponseVo result = ConvertUtil.entityToVo(userInfo, PlayClerkUserLoginResponseVo.class);
|
||||||
|
|
||||||
// 判断头像、音频、相册是否可以编辑,如果存在未审核的数据,则不允许编辑
|
// 判断头像、音频、相册是否可以编辑,如果存在未审核的数据,则不允许编辑
|
||||||
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
||||||
dataReviewInfo.setPlayUserId(userInfo.getOpenid());
|
dataReviewInfo.setPlayUserId(userInfo.getId());
|
||||||
dataReviewInfo.setState("0");
|
dataReviewInfo.setState("0");
|
||||||
List<PlayClerkDataReviewInfoEntity> list = dataReviewInfoService.queryList(dataReviewInfo);
|
List<PlayClerkDataReviewInfoEntity> list = dataReviewInfoService.queryList(dataReviewInfo);
|
||||||
Map<String, PlayClerkDataReviewInfoEntity> map = list.stream().collect(Collectors.toMap(PlayClerkDataReviewInfoEntity::getDataType, account -> account));
|
Map<String, PlayClerkDataReviewInfoEntity> map = list.stream().collect(Collectors.toMap(PlayClerkDataReviewInfoEntity::getDataType, account -> account));
|
||||||
@@ -92,10 +92,10 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
if (map.containsKey("3")) {
|
if (map.containsKey("3")) {
|
||||||
result.setAudioAllowEdit(false);
|
result.setAudioAllowEdit(false);
|
||||||
}
|
}
|
||||||
if (map.containsKey("0") || ("1").equals(result.getClerkState())) {
|
if (map.containsKey("0") || "1".equals(result.getClerkState())) {
|
||||||
result.setClerkAllowEdit(false);
|
result.setClerkAllowEdit(false);
|
||||||
}
|
}
|
||||||
result.setCommodity(ConvertUtil.entityToVoList(playClerkCommodityService.selectAll(), PlayClerkCommodityQueryVo.class));
|
result.setCommodity(ConvertUtil.entityToVoList(playClerkCommodityService.selectCommodityTypeByUser(userInfo.getId()), PlayClerkCommodityQueryVo.class));
|
||||||
result.setArea(userInfo.getProvince() + "-" + userInfo.getCity());
|
result.setArea(userInfo.getProvince() + "-" + userInfo.getCity());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -109,6 +109,16 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
this.baseMapper.updateById(entity);
|
this.baseMapper.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAccountBalanceById(String id, BigDecimal accountBalance) {
|
||||||
|
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||||
|
entity.setAccountBalance(accountBalance);
|
||||||
|
entity.setId(id);
|
||||||
|
this.baseMapper.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询店员列表
|
* 查询店员列表
|
||||||
*
|
*
|
||||||
@@ -116,17 +126,17 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
* @return 店员
|
* @return 店员
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<PlayClerkUserInfoEntity> selectPlayClerkUserInfoByPage(PlayClerkUserInfoQueryVo vo) {
|
public IPage<PlayClerkUserListResultVo> selectPlayClerkUserInfoByPage(PlayClerkUserInfoQueryVo vo) {
|
||||||
Page<PlayClerkUserInfoEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
Page<PlayClerkUserListResultVo> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
||||||
|
|
||||||
MPJLambdaWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayClerkUserInfoEntity>()
|
MPJLambdaWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayClerkUserInfoEntity>()
|
||||||
//查询主表全部字段
|
//查询主表全部字段
|
||||||
.selectAll(PlayClerkUserInfoEntity.class)
|
.selectAll(PlayClerkUserInfoEntity.class).selectAs(PlayClerkUserInfoEntity::getCity, "address")
|
||||||
//等级表
|
//等级表
|
||||||
.selectAs(PlayClerkLevelInfoEntity::getName, "levelName").leftJoin(PlayClerkLevelInfoEntity.class, PlayClerkLevelInfoEntity::getId, PlayClerkUserInfoEntity::getLevelId);
|
.selectAs(PlayClerkLevelInfoEntity::getName, "levelName").leftJoin(PlayClerkLevelInfoEntity.class, PlayClerkLevelInfoEntity::getId, PlayClerkUserInfoEntity::getLevelId);
|
||||||
|
|
||||||
|
|
||||||
//服务项目表
|
//服务项目表
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(vo.getNickname())) {
|
if (StrUtil.isNotBlank(vo.getNickname())) {
|
||||||
lambdaQueryWrapper.like(PlayClerkUserInfoEntity::getNickname, vo.getNickname());
|
lambdaQueryWrapper.like(PlayClerkUserInfoEntity::getNickname, vo.getNickname());
|
||||||
}
|
}
|
||||||
@@ -145,9 +155,32 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
if (StrUtil.isNotBlank(vo.getClerkState())) {
|
if (StrUtil.isNotBlank(vo.getClerkState())) {
|
||||||
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getClerkState, vo.getClerkState());
|
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getClerkState, vo.getClerkState());
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(vo.getRecommendationState())) {
|
||||||
|
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getRecommendationState, vo.getRecommendationState());
|
||||||
|
}
|
||||||
|
return this.baseMapper.selectJoinPage(page, PlayClerkUserListResultVo.class, lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
return this.baseMapper.selectJoinPage(page, PlayClerkUserInfoEntity.class, lambdaQueryWrapper);
|
|
||||||
// return this.baseMapper.selectPage(page, lambdaQueryWrapper);
|
@Override
|
||||||
|
public IPage<PlayClerkUserListResultVo> selectByPage(PlayClerkUserInfoQueryVo vo, String customUserId) {
|
||||||
|
IPage<PlayClerkUserListResultVo> voIPage = this.selectPlayClerkUserInfoByPage(vo);
|
||||||
|
// 如果当前顾客已登录,查询是否关注
|
||||||
|
if (StrUtil.isNotBlank(customUserId)) {
|
||||||
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
||||||
|
List<PlayCustomFollowInfoEntity> customFollowInfoEntities = customFollowInfoService.list(lambdaQueryWrapper);
|
||||||
|
Map<String, String> customFollows = customFollowInfoEntities.stream().collect(Collectors.toMap(PlayCustomFollowInfoEntity::getClerkUserId, PlayCustomFollowInfoEntity::getFollowState));
|
||||||
|
for (PlayClerkUserListResultVo record : voIPage.getRecords()) {
|
||||||
|
if (customFollows.containsKey(record.getId())) {
|
||||||
|
record.setFollowState(customFollows.get(record.getId()));
|
||||||
|
record.setCommodity(playClerkCommodityService.getClerkCommodityList(record.getId()));
|
||||||
|
record.setAddress(record.getCity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return voIPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.starry.admin.modules.custom.controller;
|
||||||
|
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||||
|
import com.starry.admin.modules.custom.module.vo.PlayCustomLevelAddVo;
|
||||||
|
import com.starry.admin.modules.custom.module.vo.PlayCustomLevelEditVo;
|
||||||
|
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import com.starry.common.utils.ConvertUtil;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客等级Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/custom/level")
|
||||||
|
public class PlayCustomLevelInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayCustomLevelInfoService playCustomLevelInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/listAll")
|
||||||
|
public R listAll() {
|
||||||
|
List<PlayCustomLevelInfoEntity> list = playCustomLevelInfoService.selectPlayCustomLevelInfoByPage();
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取顾客等级详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playCustomLevelInfoService.selectPlayCustomLevelInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客等级
|
||||||
|
*/
|
||||||
|
@Log(title = "店员等级", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayCustomLevelAddVo vo) {
|
||||||
|
PlayCustomLevelInfoEntity entity = ConvertUtil.entityToVo(vo, PlayCustomLevelInfoEntity.class);
|
||||||
|
int level = playCustomLevelInfoService.selectMaxLevel();
|
||||||
|
entity.setLevel(level + 1);
|
||||||
|
boolean success = playCustomLevelInfoService.create(entity);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客等级
|
||||||
|
*/
|
||||||
|
@Log(title = "顾客等级", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update")
|
||||||
|
public R update(@RequestBody PlayCustomLevelEditVo vo) {
|
||||||
|
if (playCustomLevelInfoService.selectPlayCustomLevelInfoById(vo.getId()) == null) {
|
||||||
|
throw new CustomException("对象不存在");
|
||||||
|
}
|
||||||
|
PlayCustomLevelInfoEntity entity = ConvertUtil.entityToVo(vo, PlayCustomLevelInfoEntity.class);
|
||||||
|
boolean success = playCustomLevelInfoService.update(entity);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店员等级
|
||||||
|
*/
|
||||||
|
@Log(title = "店员等级", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("delMaxLevel")
|
||||||
|
public R remove() {
|
||||||
|
int level = playCustomLevelInfoService.selectMaxLevel();
|
||||||
|
if (level <= 1) {
|
||||||
|
throw new CustomException("最后一级,不允许删除");
|
||||||
|
}
|
||||||
|
playCustomLevelInfoService.delMaxLevelByLevel(level);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +1,34 @@
|
|||||||
package com.starry.admin.modules.custom.controller;
|
package com.starry.admin.modules.custom.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
|
import com.starry.admin.modules.custom.module.vo.PlayCustomUserStateEditVo;
|
||||||
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
import com.starry.common.enums.BusinessType;
|
import com.starry.common.enums.BusinessType;
|
||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
|
import com.starry.common.utils.ConvertUtil;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import com.starry.common.annotation.Log;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 顾客Controller
|
* 顾客Controller
|
||||||
*
|
*
|
||||||
* @author admin
|
* @author admin
|
||||||
* @since 2024-04-08
|
* @since 2024-04-08
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/play/info")
|
@RequestMapping("/custom/user")
|
||||||
public class PlayCustomUserInfoController {
|
public class PlayCustomUserInfoController {
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayCustomUserInfoService playCustomUserInfoService;
|
private IPlayCustomUserInfoService playCustomUserInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询顾客列表
|
* 查询顾客列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
@GetMapping("/list")
|
||||||
@GetMapping("/list")
|
|
||||||
public R list(PlayCustomUserInfoEntity playCustomUserInfo) {
|
public R list(PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||||
IPage<PlayCustomUserInfoEntity> list = playCustomUserInfoService.selectPlayCustomUserInfoByPage(playCustomUserInfo);
|
IPage<PlayCustomUserInfoEntity> list = playCustomUserInfoService.selectPlayCustomUserInfoByPage(playCustomUserInfo);
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
@@ -45,7 +37,6 @@ public class PlayCustomUserInfoController {
|
|||||||
/**
|
/**
|
||||||
* 获取顾客详细信息
|
* 获取顾客详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public R getInfo(@PathVariable("id") String id) {
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
return R.ok(playCustomUserInfoService.selectById(id));
|
return R.ok(playCustomUserInfoService.selectById(id));
|
||||||
@@ -54,7 +45,6 @@ public class PlayCustomUserInfoController {
|
|||||||
/**
|
/**
|
||||||
* 新增顾客
|
* 新增顾客
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
|
||||||
@Log(title = "顾客", businessType = BusinessType.INSERT)
|
@Log(title = "顾客", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public R create(@RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
|
public R create(@RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||||
@@ -65,10 +55,23 @@ public class PlayCustomUserInfoController {
|
|||||||
return R.error("添加失败");
|
return R.error("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客状态
|
||||||
|
*/
|
||||||
|
@Log(title = "顾客", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/updateState")
|
||||||
|
public R updateState(@Validated @RequestBody PlayCustomUserStateEditVo vo) {
|
||||||
|
PlayCustomUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayCustomUserInfoEntity.class);
|
||||||
|
boolean success = playCustomUserInfoService.update(entity);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改顾客
|
* 修改顾客
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
|
||||||
@Log(title = "顾客", businessType = BusinessType.UPDATE)
|
@Log(title = "顾客", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping(value = "/update/{id}")
|
@PostMapping(value = "/update/{id}")
|
||||||
public R update(@PathVariable String id, @RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
|
public R update(@PathVariable String id, @RequestBody PlayCustomUserInfoEntity playCustomUserInfo) {
|
||||||
@@ -83,7 +86,6 @@ public class PlayCustomUserInfoController {
|
|||||||
/**
|
/**
|
||||||
* 删除顾客
|
* 删除顾客
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
|
||||||
@Log(title = "顾客", businessType = BusinessType.DELETE)
|
@Log(title = "顾客", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R remove(@PathVariable String[] ids) {
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.custom.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客等级Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface PlayCustomLevelInfoMapper extends BaseMapper<PlayCustomLevelInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.starry.admin.modules.custom.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客等级对象 play_custom_level_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_custom_level_info")
|
||||||
|
public class PlayCustomLevelInfoEntity extends BaseEntity<PlayCustomLevelInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级数字(排序字段)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一级消费金额
|
||||||
|
*/
|
||||||
|
private String consumptionAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减比例
|
||||||
|
*/
|
||||||
|
private Integer discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像框地址
|
||||||
|
*/
|
||||||
|
private String avatarFrameAddress;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.starry.common.domain.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,12 +42,12 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
|||||||
private String unionid;
|
private String unionid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员昵称
|
* 顾客昵称
|
||||||
*/
|
*/
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店员性别(0:位置;1:男,2:女)
|
* 顾客性别(0:位置;1:男,2:女)
|
||||||
*/
|
*/
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
|
||||||
@@ -60,6 +61,11 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
|||||||
*/
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信号码
|
||||||
|
*/
|
||||||
|
private String weiChatCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等级
|
* 等级
|
||||||
*/
|
*/
|
||||||
@@ -81,9 +87,9 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
|||||||
private String city;
|
private String city;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户余额(单位分)
|
* 账户余额
|
||||||
*/
|
*/
|
||||||
private String accountBalance;
|
private BigDecimal accountBalance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额状态[0:不存在余额,1:存在余额]
|
* 余额状态[0:不存在余额,1:存在余额]
|
||||||
@@ -96,12 +102,12 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
|||||||
private String subscribeState;
|
private String subscribeState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 黑名单状态[0:黑名单,1:非黑名单]
|
* 黑名单状态[0:非黑名单,1:黑名单]
|
||||||
*/
|
*/
|
||||||
private String blacklistState;
|
private String blacklistState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 违规状态[0:违规,1:未违规]
|
* 违规状态[0:未违规,1:违规]
|
||||||
*/
|
*/
|
||||||
private String violationState;
|
private String violationState;
|
||||||
|
|
||||||
@@ -115,6 +121,17 @@ public class PlayCustomUserInfoEntity extends BaseEntity<PlayCustomUserInfoEntit
|
|||||||
*/
|
*/
|
||||||
private String mobilePhoneState;
|
private String mobilePhoneState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名状态【1:已实名,0:未实名】
|
||||||
|
*/
|
||||||
|
private String realState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||||
|
*/
|
||||||
|
private String mandatoryRealState;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册时间
|
* 注册时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.starry.admin.modules.custom.module.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlayCustomLevelAddVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "等级名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一级消费金额
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "消费金额不能为空")
|
||||||
|
private String consumptionAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减比例
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "满减比例不能为空")
|
||||||
|
private Integer discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像框地址
|
||||||
|
*/
|
||||||
|
private String avatarFrameAddress;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.starry.admin.modules.custom.module.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlayCustomLevelEditVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "ID不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "等级名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一级消费金额
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "消费金额不能为空")
|
||||||
|
private String consumptionAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减比例
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "满减比例不能为空")
|
||||||
|
private Integer discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像框地址
|
||||||
|
*/
|
||||||
|
private String avatarFrameAddress;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.starry.admin.modules.custom.module.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlayCustomUserStateEditVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "id不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额状态[0:不存在余额,1:存在余额]
|
||||||
|
*/
|
||||||
|
private String accountState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注状态[0:未关注,1:已关注]
|
||||||
|
*/
|
||||||
|
private String subscribeState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 黑名单状态[0:非黑名单,1:黑名单]
|
||||||
|
*/
|
||||||
|
private String blacklistState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违规状态[0:未违规,1:违规]
|
||||||
|
*/
|
||||||
|
private String violationState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否下单状态[0:未未下单,1:下单过]
|
||||||
|
*/
|
||||||
|
private String purchaseState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定手机状态[0:未绑定,1:绑定]
|
||||||
|
*/
|
||||||
|
private String mobilePhoneState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名状态【1:已实名,0:未实名】
|
||||||
|
*/
|
||||||
|
private String realState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否必须实名【1:必须实名,0:非必须实名】
|
||||||
|
*/
|
||||||
|
private String mandatoryRealState;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.starry.admin.modules.custom.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客等级Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
public interface IPlayCustomLevelInfoService extends IService<PlayCustomLevelInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新增顾客时,默认最低等级ID
|
||||||
|
*
|
||||||
|
* @return PlayCustomLevelInfoEntity
|
||||||
|
*/
|
||||||
|
PlayCustomLevelInfoEntity getDefaultLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级列表
|
||||||
|
*
|
||||||
|
* @return 顾客等级集合
|
||||||
|
*/
|
||||||
|
List<PlayCustomLevelInfoEntity> selectAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级
|
||||||
|
*
|
||||||
|
* @param id 顾客等级主键
|
||||||
|
* @return 顾客等级
|
||||||
|
*/
|
||||||
|
PlayCustomLevelInfoEntity selectPlayCustomLevelInfoById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级列表
|
||||||
|
*
|
||||||
|
* @return 顾客等级集合
|
||||||
|
*/
|
||||||
|
List<PlayCustomLevelInfoEntity> selectPlayCustomLevelInfoByPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客等级
|
||||||
|
*
|
||||||
|
* @param playCustomLevelInfo 顾客等级
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayCustomLevelInfoEntity playCustomLevelInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客等级
|
||||||
|
*
|
||||||
|
* @param playCustomLevelInfo 顾客等级
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayCustomLevelInfoEntity playCustomLevelInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除顾客等级
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的顾客等级主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomLevelInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除顾客等级信息
|
||||||
|
*
|
||||||
|
* @param id 顾客等级主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomLevelInfoById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询最大等级
|
||||||
|
*
|
||||||
|
* @return 最大等级
|
||||||
|
*/
|
||||||
|
int selectMaxLevel();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除最大等级
|
||||||
|
*/
|
||||||
|
void delMaxLevelByLevel(Integer level);
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 顾客Service接口
|
* 顾客Service接口
|
||||||
*
|
*
|
||||||
@@ -21,7 +23,6 @@ public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoE
|
|||||||
*/
|
*/
|
||||||
PlayCustomUserInfoEntity selectByOpenid(String openId);
|
PlayCustomUserInfoEntity selectByOpenid(String openId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询顾客
|
* 查询顾客
|
||||||
*
|
*
|
||||||
@@ -47,15 +48,25 @@ public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoE
|
|||||||
boolean create(PlayCustomUserInfoEntity playCustomUserInfo);
|
boolean create(PlayCustomUserInfoEntity playCustomUserInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟新token
|
* 更新token
|
||||||
*
|
*
|
||||||
* @param id UUID
|
* @param id 账户余额
|
||||||
* @param token TOKEN
|
* @param token TOKEN
|
||||||
* @author admin
|
* @author admin
|
||||||
* @since 2024/4/9 14:33
|
* @since 2024/4/9 14:33
|
||||||
**/
|
**/
|
||||||
void updateTokenById(String id, String token);
|
void updateTokenById(String id, String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新账号余额
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param accountBalance 账户余额
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/4/9 14:33
|
||||||
|
**/
|
||||||
|
void updateAccountBalanceById(String id, BigDecimal accountBalance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改顾客
|
* 修改顾客
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
package com.starry.admin.modules.custom.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import com.starry.admin.modules.custom.mapper.PlayCustomLevelInfoMapper;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomLevelInfoEntity;
|
||||||
|
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客等级Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-05-04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayCustomLevelInfoServiceImpl extends ServiceImpl<PlayCustomLevelInfoMapper, PlayCustomLevelInfoEntity> implements IPlayCustomLevelInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayCustomLevelInfoMapper playCustomLevelInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayCustomLevelInfoEntity getDefaultLevel() {
|
||||||
|
List<PlayCustomLevelInfoEntity> list = this.selectAll();
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
throw new CustomException("系统错误,等级数据未初始化");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayCustomLevelInfoEntity> selectAll() {
|
||||||
|
LambdaQueryWrapper<PlayCustomLevelInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.orderByAsc(PlayCustomLevelInfoEntity::getLevel);
|
||||||
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级
|
||||||
|
*
|
||||||
|
* @param id 顾客等级主键
|
||||||
|
* @return 顾客等级
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayCustomLevelInfoEntity selectPlayCustomLevelInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客等级列表
|
||||||
|
*
|
||||||
|
* @return 顾客等级
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PlayCustomLevelInfoEntity> selectPlayCustomLevelInfoByPage() {
|
||||||
|
LambdaQueryWrapper<PlayCustomLevelInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.orderByAsc(PlayCustomLevelInfoEntity::getLevel);
|
||||||
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客等级
|
||||||
|
*
|
||||||
|
* @param playCustomLevelInfo 顾客等级
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayCustomLevelInfoEntity playCustomLevelInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playCustomLevelInfo.getId())) {
|
||||||
|
playCustomLevelInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playCustomLevelInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客等级
|
||||||
|
*
|
||||||
|
* @param playCustomLevelInfo 顾客等级
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayCustomLevelInfoEntity playCustomLevelInfo) {
|
||||||
|
return updateById(playCustomLevelInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除顾客等级
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的顾客等级主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomLevelInfoByIds(String[] ids) {
|
||||||
|
return playCustomLevelInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除顾客等级信息
|
||||||
|
*
|
||||||
|
* @param id 顾客等级主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomLevelInfoById(String id) {
|
||||||
|
return playCustomLevelInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectMaxLevel() {
|
||||||
|
QueryWrapper<PlayCustomLevelInfoEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.select("max(level) as level ");
|
||||||
|
PlayCustomLevelInfoEntity entity = this.baseMapper.selectOne(queryWrapper);
|
||||||
|
return entity == null ? 0 : entity.getLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delMaxLevelByLevel(Integer level) {
|
||||||
|
LambdaQueryWrapper<PlayCustomLevelInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(PlayCustomLevelInfoEntity::getLevel, level);
|
||||||
|
this.baseMapper.delete(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +33,6 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
|||||||
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getOpenid, openId);
|
lambdaQueryWrapper.eq(PlayCustomUserInfoEntity::getOpenid, openId);
|
||||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询顾客
|
* 查询顾客
|
||||||
*
|
*
|
||||||
@@ -79,6 +79,15 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
|||||||
this.baseMapper.updateById(entity);
|
this.baseMapper.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAccountBalanceById(String id, BigDecimal accountBalance) {
|
||||||
|
PlayCustomUserInfoEntity entity = new PlayCustomUserInfoEntity();
|
||||||
|
entity.setId(id);
|
||||||
|
entity.setAccountBalance(accountBalance);
|
||||||
|
this.baseMapper.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改顾客
|
* 修改顾客
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.starry.admin.modules.follow.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||||
|
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客关注陪玩信息Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/play/follow")
|
||||||
|
public class PlayCustomFollowInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayCustomFollowInfoService playCustomFollowInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客关注陪玩信息列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R list(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
IPage<PlayCustomFollowInfoEntity> list = playCustomFollowInfoService.selectPlayCustomFollowInfoByPage(playCustomFollowInfo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取顾客关注陪玩信息详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playCustomFollowInfoService.selectPlayCustomFollowInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||||
|
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
boolean success = playCustomFollowInfoService.create(playCustomFollowInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||||
|
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update/{id}")
|
||||||
|
public R update(@PathVariable String id, @RequestBody PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
playCustomFollowInfo.setId(id);
|
||||||
|
boolean success = playCustomFollowInfoService.update(playCustomFollowInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||||
|
@Log(title = "顾客关注陪玩信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
return R.ok(playCustomFollowInfoService.deletePlayCustomFollowInfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.follow.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客关注陪玩信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
public interface PlayCustomFollowInfoMapper extends BaseMapper<PlayCustomFollowInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.starry.admin.modules.follow.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客关注陪玩信息对象 play_custom_follow_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_custom_follow_info")
|
||||||
|
public class PlayCustomFollowInfoEntity extends BaseEntity<PlayCustomFollowInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客ID
|
||||||
|
*/
|
||||||
|
private String customUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 陪玩ID
|
||||||
|
*/
|
||||||
|
private String clerkUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注时间
|
||||||
|
*/
|
||||||
|
private Date followTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消关注时间
|
||||||
|
*/
|
||||||
|
private Date unfollowTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注状态[0:未关注,1:已关注]
|
||||||
|
*/
|
||||||
|
private String followState;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.starry.admin.modules.follow.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客关注陪玩信息Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
public interface IPlayCustomFollowInfoService extends IService<PlayCustomFollowInfoEntity> {
|
||||||
|
/**
|
||||||
|
* 查询顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param id 顾客关注陪玩信息主键
|
||||||
|
* @return 顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
PlayCustomFollowInfoEntity selectPlayCustomFollowInfoById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改关注状态
|
||||||
|
*
|
||||||
|
* @param customUserId 顾客ID
|
||||||
|
* @param clarkUserId 陪玩ID
|
||||||
|
* @return 关注状态[0:未关注,1:已关注]
|
||||||
|
*/
|
||||||
|
String queryFollowState(String customUserId, String clarkUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改关注状态
|
||||||
|
*
|
||||||
|
* @param customUserId 顾客ID
|
||||||
|
* @param clarkUserId 陪玩ID
|
||||||
|
* @param followState 关注状态[0:未关注,1:已关注]
|
||||||
|
*/
|
||||||
|
void updateFollowState(String customUserId, String clarkUserId, String followState);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客关注陪玩信息列表
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 顾客关注陪玩信息集合
|
||||||
|
*/
|
||||||
|
IPage<PlayCustomFollowInfoEntity> selectPlayCustomFollowInfoByPage(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayCustomFollowInfoEntity playCustomFollowInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的顾客关注陪玩信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomFollowInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除顾客关注陪玩信息信息
|
||||||
|
*
|
||||||
|
* @param id 顾客关注陪玩信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayCustomFollowInfoById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.starry.admin.modules.follow.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.modules.follow.mapper.PlayCustomFollowInfoMapper;
|
||||||
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
||||||
|
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客关注陪玩信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollowInfoMapper, PlayCustomFollowInfoEntity> implements IPlayCustomFollowInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayCustomFollowInfoMapper playCustomFollowInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param id 顾客关注陪玩信息主键
|
||||||
|
* @return 顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayCustomFollowInfoEntity selectPlayCustomFollowInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String queryFollowState(String customUserId, String clarkUserId) {
|
||||||
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clarkUserId);
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
||||||
|
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
return entity == null ? "0" : entity.getFollowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFollowState(String customUserId, String clarkUserId, String followState) {
|
||||||
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clarkUserId);
|
||||||
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
||||||
|
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
if (entity == null) {
|
||||||
|
entity = new PlayCustomFollowInfoEntity();
|
||||||
|
entity.setCustomUserId(customUserId);
|
||||||
|
entity.setFollowState(followState);
|
||||||
|
entity.setClerkUserId(clarkUserId);
|
||||||
|
entity.setFollowTime(new Date());
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
} else {
|
||||||
|
entity.setFollowState(followState);
|
||||||
|
this.baseMapper.updateById(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询顾客关注陪玩信息列表
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 顾客关注陪玩信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayCustomFollowInfoEntity> selectPlayCustomFollowInfoByPage(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
Page<PlayCustomFollowInfoEntity> page = new Page<>(1, 10);
|
||||||
|
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playCustomFollowInfo.getId())) {
|
||||||
|
playCustomFollowInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playCustomFollowInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param playCustomFollowInfo 顾客关注陪玩信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
||||||
|
return updateById(playCustomFollowInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除顾客关注陪玩信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的顾客关注陪玩信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomFollowInfoByIds(String[] ids) {
|
||||||
|
return playCustomFollowInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除顾客关注陪玩信息信息
|
||||||
|
*
|
||||||
|
* @param id 顾客关注陪玩信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayCustomFollowInfoById(String id) {
|
||||||
|
return playCustomFollowInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.starry.admin.modules.gift.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
|
||||||
|
import com.starry.admin.modules.gift.service.IPlayGiftInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物Controller
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-25
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/play/giff")
|
||||||
|
public class PlayGiftInfoController {
|
||||||
|
@Resource
|
||||||
|
private IPlayGiftInfoService playGiftInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼物列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R list(PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
IPage<PlayGiftInfoEntity> list = playGiftInfoService.selectPlayGiftInfoByPage(playGiftInfo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取礼物详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
|
return R.ok(playGiftInfoService.selectPlayGiftInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增礼物
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||||
|
@Log(title = "礼物", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/create")
|
||||||
|
public R create(@RequestBody PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
boolean success = playGiftInfoService.create(playGiftInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改礼物
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||||
|
@Log(title = "礼物", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/update/{id}")
|
||||||
|
public R update(@PathVariable String id, @RequestBody PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
playGiftInfo.setId(id);
|
||||||
|
boolean success = playGiftInfoService.update(playGiftInfo);
|
||||||
|
if (success) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除礼物
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||||
|
@Log(title = "礼物", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R remove(@PathVariable String[] ids) {
|
||||||
|
return R.ok(playGiftInfoService.deletePlayGiftInfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.gift.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-25
|
||||||
|
*/
|
||||||
|
public interface PlayGiftInfoMapper extends BaseMapper<PlayGiftInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.starry.admin.modules.gift.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物对象 play_gift_info
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("play_gift_info")
|
||||||
|
public class PlayGiftInfoEntity extends BaseEntity<PlayGiftInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物类型(0:盲盒,1:普通礼物)
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物图片地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0:正常,1:下架)
|
||||||
|
*/
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架时间
|
||||||
|
*/
|
||||||
|
private Date listingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下架时间
|
||||||
|
*/
|
||||||
|
private Date delintingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.starry.admin.modules.gift.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-25
|
||||||
|
*/
|
||||||
|
public interface IPlayGiftInfoService extends IService<PlayGiftInfoEntity> {
|
||||||
|
/**
|
||||||
|
* 查询礼物
|
||||||
|
*
|
||||||
|
* @param id 礼物主键
|
||||||
|
* @return 礼物
|
||||||
|
*/
|
||||||
|
PlayGiftInfoEntity selectPlayGiftInfoById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有礼物
|
||||||
|
*
|
||||||
|
* @return List<com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity>
|
||||||
|
* @author admin
|
||||||
|
* @since 2024/4/25 15:56
|
||||||
|
**/
|
||||||
|
List<PlayGiftInfoEntity> listByAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼物列表
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 礼物集合
|
||||||
|
*/
|
||||||
|
IPage<PlayGiftInfoEntity> selectPlayGiftInfoByPage(PlayGiftInfoEntity playGiftInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增礼物
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayGiftInfoEntity playGiftInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改礼物
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayGiftInfoEntity playGiftInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除礼物
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的礼物主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayGiftInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除礼物信息
|
||||||
|
*
|
||||||
|
* @param id礼物主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deletePlayGiftInfoById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.starry.admin.modules.gift.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.starry.admin.modules.gift.mapper.PlayGiftInfoMapper;
|
||||||
|
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
|
||||||
|
import com.starry.admin.modules.gift.service.IPlayGiftInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 礼物Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-04-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayGiftInfoServiceImpl extends ServiceImpl<PlayGiftInfoMapper, PlayGiftInfoEntity> implements IPlayGiftInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayGiftInfoMapper playGiftInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼物
|
||||||
|
*
|
||||||
|
* @param id 礼物主键
|
||||||
|
* @return 礼物
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayGiftInfoEntity selectPlayGiftInfoById(String id) {
|
||||||
|
return this.baseMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlayGiftInfoEntity> listByAll() {
|
||||||
|
return this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询礼物列表
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 礼物
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayGiftInfoEntity> selectPlayGiftInfoByPage(PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
Page<PlayGiftInfoEntity> page = new Page<>(1, 10);
|
||||||
|
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayGiftInfoEntity>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增礼物
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(playGiftInfo.getId())) {
|
||||||
|
playGiftInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
return save(playGiftInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改礼物
|
||||||
|
*
|
||||||
|
* @param playGiftInfo 礼物
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayGiftInfoEntity playGiftInfo) {
|
||||||
|
return updateById(playGiftInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除礼物
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的礼物主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayGiftInfoByIds(String[] ids) {
|
||||||
|
return playGiftInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除礼物信息
|
||||||
|
*
|
||||||
|
* @param id 礼物主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deletePlayGiftInfoById(String id) {
|
||||||
|
return playGiftInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,9 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import com.starry.admin.common.exception.CustomException;
|
import com.starry.admin.common.exception.CustomException;
|
||||||
import com.starry.admin.modules.coupon.module.entity.CouponInfoEntity;
|
import com.starry.admin.modules.coupon.module.entity.CouponInfoEntity;
|
||||||
import com.starry.admin.modules.coupon.service.ICouponInfoService;
|
import com.starry.admin.modules.coupon.service.ICouponInfoService;
|
||||||
import com.starry.admin.modules.order.module.entity.OrderDetailsInfoEntity;
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
import com.starry.admin.modules.order.module.entity.OrderInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.module.vo.*;
|
import com.starry.admin.modules.order.module.vo.*;
|
||||||
import com.starry.admin.modules.order.service.IOrderDetailsInfoService;
|
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||||
import com.starry.admin.modules.order.service.IOrderInfoService;
|
|
||||||
import com.starry.admin.modules.order.service.IOrderLogInfoService;
|
|
||||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||||
import com.starry.common.annotation.Log;
|
import com.starry.common.annotation.Log;
|
||||||
@@ -21,7 +17,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,30 +26,24 @@ import java.util.Date;
|
|||||||
* @since 2024-03-20
|
* @since 2024-03-20
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/order/info")
|
@RequestMapping("/order/order/")
|
||||||
public class OrderInfoController {
|
public class PlayOrderInfoController {
|
||||||
@Resource
|
@Resource
|
||||||
private IOrderInfoService orderInfoService;
|
private IPlayOrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IOrderDetailsInfoService orderDetailsInfoService;
|
|
||||||
@Resource
|
@Resource
|
||||||
private ICouponInfoService couponInfoService;
|
private ICouponInfoService couponInfoService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IOrderLogInfoService orderLogInfoService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayUserInfoService playUserInfoService;
|
private IPlayUserInfoService playUserInfoService;
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "取消订单", businessType = BusinessType.UPDATE)
|
@Log(title = "取消订单", businessType = BusinessType.UPDATE)
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/cancellation')")
|
|
||||||
public R cancellationOrder(@RequestBody OrderInfoCancellationVo vo) {
|
public R cancellationOrder(@RequestBody OrderInfoCancellationVo vo) {
|
||||||
|
|
||||||
// 判断操作人是否是陪玩本身
|
// 判断操作人是否是陪玩本身
|
||||||
OrderInfoEntity entity = orderInfoService.selectOrderInfoById(vo.getId());
|
PlayOrderInfoEntity entity = orderInfoService.selectOrderInfoById(vo.getId());
|
||||||
|
|
||||||
// 校验通过
|
// 校验通过
|
||||||
orderInfoService.orderRefund(vo.getId(), "2", null, false);
|
orderInfoService.orderRefund(vo.getId(), "2", null, false);
|
||||||
@@ -79,11 +68,11 @@ public class OrderInfoController {
|
|||||||
// 减少用户余额
|
// 减少用户余额
|
||||||
|
|
||||||
// 新增订单记录(订单信息需完善)
|
// 新增订单记录(订单信息需完善)
|
||||||
OrderInfoEntity entity = ConvertUtil.entityToVo(addVo, OrderInfoEntity.class);
|
PlayOrderInfoEntity entity = ConvertUtil.entityToVo(addVo, PlayOrderInfoEntity.class);
|
||||||
orderInfoService.create(entity);
|
orderInfoService.create(entity);
|
||||||
// 新增订单处理日志(打赏单,订单直接完成)
|
// 新增订单处理日志(打赏单,订单直接完成)
|
||||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "1", new Date()));
|
// orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "1", new Date()));
|
||||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "4", new Date()));
|
// orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "4", new Date()));
|
||||||
return R.ok("成功");
|
return R.ok("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,20 +106,20 @@ public class OrderInfoController {
|
|||||||
// throw new CustomException("余额不足,无法下单");
|
// throw new CustomException("余额不足,无法下单");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
OrderInfoEntity entity = ConvertUtil.entityToVo(addVo, OrderInfoEntity.class);
|
PlayOrderInfoEntity entity = ConvertUtil.entityToVo(addVo, PlayOrderInfoEntity.class);
|
||||||
entity.setId(IdUtil.fastSimpleUUID());
|
entity.setId(IdUtil.fastSimpleUUID());
|
||||||
entity.setFirstOrder(true);
|
entity.setFirstOrder(true);
|
||||||
entity.setOrderMoney(String.valueOf(orderTotalMoney));
|
// entity.setOrderMoney(String.valueOf(orderTotalMoney));
|
||||||
|
|
||||||
orderInfoService.create(entity);
|
orderInfoService.create(entity);
|
||||||
|
|
||||||
// 记录订单日志
|
// 记录订单日志
|
||||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "0", new Date()));
|
// orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "0", new Date()));
|
||||||
// 记录订单详细信息
|
// 记录订单详细信息
|
||||||
orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), addVo.getPlayUserId(), "0"));
|
// orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), addVo.getPlayUserId(), "0"));
|
||||||
for (String commodityInfoId : addVo.getCouponIds()) {
|
// for (String commodityInfoId : addVo.getCouponIds()) {
|
||||||
orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), commodityInfoId, "1"));
|
// orderDetailsInfoService.create(new OrderDetailsInfoEntity(entity.getId(), commodityInfoId, "1"));
|
||||||
}
|
// }
|
||||||
// 发送通知给陪玩,等待陪玩接单
|
// 发送通知给陪玩,等待陪玩接单
|
||||||
|
|
||||||
return R.ok("下单成功,等待接单");
|
return R.ok("下单成功,等待接单");
|
||||||
@@ -140,7 +129,6 @@ public class OrderInfoController {
|
|||||||
/**
|
/**
|
||||||
* 分页查询订单列表
|
* 分页查询订单列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/list')")
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R list(OrderInfoQueryVo vo) {
|
public R list(OrderInfoQueryVo vo) {
|
||||||
return R.ok(orderInfoService.selectOrderInfoList(vo));
|
return R.ok(orderInfoService.selectOrderInfoList(vo));
|
||||||
@@ -150,7 +138,6 @@ public class OrderInfoController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID查询订单
|
* 根据ID查询订单
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public R getInfo(@PathVariable("id") String id) {
|
public R getInfo(@PathVariable("id") String id) {
|
||||||
return R.ok(orderInfoService.selectOrderInfoById(id));
|
return R.ok(orderInfoService.selectOrderInfoById(id));
|
||||||
@@ -160,10 +147,9 @@ public class OrderInfoController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID修改订单信息
|
* 根据ID修改订单信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/edit')")
|
|
||||||
@Log(title = "修改普通订单", businessType = BusinessType.UPDATE)
|
@Log(title = "修改普通订单", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping(value = "/update/{id}")
|
@PostMapping(value = "/update/{id}")
|
||||||
public R update(@PathVariable String id, @RequestBody OrderInfoEntity orderInfoEntity) {
|
public R update(@PathVariable String id, @RequestBody PlayOrderInfoEntity orderInfoEntity) {
|
||||||
orderInfoEntity.setId(id);
|
orderInfoEntity.setId(id);
|
||||||
boolean success = orderInfoService.update(orderInfoEntity);
|
boolean success = orderInfoService.update(orderInfoEntity);
|
||||||
if (success) {
|
if (success) {
|
||||||
@@ -175,7 +161,7 @@ public class OrderInfoController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID进行订单退款
|
* 根据ID进行订单退款
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/edit')")
|
|
||||||
@Log(title = "用户发起订单退款申请", businessType = BusinessType.UPDATE)
|
@Log(title = "用户发起订单退款申请", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping(value = "/refund/{id}")
|
@PostMapping(value = "/refund/{id}")
|
||||||
public R refund(@RequestBody OrderInfoRefundVo vo) {
|
public R refund(@RequestBody OrderInfoRefundVo vo) {
|
||||||
@@ -187,7 +173,6 @@ public class OrderInfoController {
|
|||||||
/**
|
/**
|
||||||
* 删除订单
|
* 删除订单
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@customSs.hasPermission('order/info/remove')")
|
|
||||||
@Log(title = "删除订单", businessType = BusinessType.DELETE)
|
@Log(title = "删除订单", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R remove(@PathVariable String[] ids) {
|
public R remove(@PathVariable String[] ids) {
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.starry.admin.modules.order.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardQueryVo;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardReturnVo;
|
||||||
|
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||||
|
import com.starry.common.annotation.Log;
|
||||||
|
import com.starry.common.enums.BusinessType;
|
||||||
|
import com.starry.common.result.R;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏订单
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-03-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order/reward/")
|
||||||
|
public class PlayOrderRewardInfoController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPlayOrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "查询打赏订单", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/list")
|
||||||
|
public R queryRewardOrder(@RequestBody PlayOrderRewardQueryVo vo) {
|
||||||
|
IPage<PlayOrderRewardReturnVo> page = orderInfoService.selectRewardOrderInfoByPage(vo);
|
||||||
|
return R.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderDetailsInfoEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单详细Mapper接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
public interface OrderDetailsInfoMapper extends BaseMapper<OrderDetailsInfoEntity> {
|
|
||||||
/**
|
|
||||||
* 查询订单详细
|
|
||||||
*
|
|
||||||
* @param id 订单详细主键
|
|
||||||
* @return 订单详细
|
|
||||||
*/
|
|
||||||
OrderDetailsInfoEntity selectOrderDetailsInfoById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单详细列表
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 订单详细集合
|
|
||||||
*/
|
|
||||||
List<OrderDetailsInfoEntity> selectOrderDetailsInfoList(OrderDetailsInfoEntity orderDetailsInfo);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderInfoEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单Mapper接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
|
||||||
/**
|
|
||||||
* 查询订单
|
|
||||||
*
|
|
||||||
* @param id 订单主键
|
|
||||||
* @return 订单
|
|
||||||
*/
|
|
||||||
OrderInfoEntity selectOrderInfoById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单列表
|
|
||||||
*
|
|
||||||
* @param orderInfoEntity 订单
|
|
||||||
* @return 订单集合
|
|
||||||
*/
|
|
||||||
List<OrderInfoEntity> selectOrderInfoList(OrderInfoEntity orderInfoEntity);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单日志Mapper接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-22
|
|
||||||
*/
|
|
||||||
public interface OrderLogInfoMapper extends BaseMapper<OrderLogInfoEntity> {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.starry.admin.modules.order.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单Mapper接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-03-20
|
||||||
|
*/
|
||||||
|
public interface PlayOrderInfoMapper extends MPJBaseMapper<PlayOrderInfoEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.module.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.starry.common.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单详细对象 order_details_info
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@TableName("order_details_info")
|
|
||||||
public class OrderDetailsInfoEntity extends BaseEntity<OrderDetailsInfoEntity> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UUID
|
|
||||||
*/
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单ID
|
|
||||||
*/
|
|
||||||
private String orderId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品ID(陪玩用户ID or 优惠券)
|
|
||||||
*/
|
|
||||||
private String commodityId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品类型【0:1】
|
|
||||||
* 0:服务
|
|
||||||
* 1:优惠券
|
|
||||||
*/
|
|
||||||
private String commodityType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remake;
|
|
||||||
|
|
||||||
|
|
||||||
public OrderDetailsInfoEntity(String orderId, String commodityId, String commodityType) {
|
|
||||||
this.orderId = orderId;
|
|
||||||
this.commodityId = commodityId;
|
|
||||||
this.commodityType = commodityType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.module.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.starry.common.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@TableName("order_log_info")
|
|
||||||
public class OrderLogInfoEntity extends BaseEntity<OrderLogInfoEntity> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* uuid
|
|
||||||
*/
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户ID
|
|
||||||
*/
|
|
||||||
private String tenantId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单ID
|
|
||||||
*/
|
|
||||||
private String orderId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作类型
|
|
||||||
* 0:下单
|
|
||||||
* 1:审核
|
|
||||||
* 2:接单
|
|
||||||
* 3:服务
|
|
||||||
* 4:退款
|
|
||||||
* 4:完成
|
|
||||||
* 6:取消
|
|
||||||
*/
|
|
||||||
private String operType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作时间
|
|
||||||
*/
|
|
||||||
private Date operTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
public OrderLogInfoEntity(String orderId, String operType, Date operTime) {
|
|
||||||
this.orderId = orderId;
|
|
||||||
this.operType = operType;
|
|
||||||
this.operTime = operTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.starry.admin.modules.order.module.entity;
|
package com.starry.admin.modules.order.module.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.starry.admin.common.conf.StringTypeHandler;
|
||||||
import com.starry.common.domain.BaseEntity;
|
import com.starry.common.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单对象 order_info
|
* 订单对象 order_info
|
||||||
@@ -16,8 +21,8 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
|
||||||
@TableName("order_info")
|
@TableName("play_order_info")
|
||||||
public class OrderInfoEntity extends BaseEntity<OrderInfoEntity> {
|
public class PlayOrderInfoEntity extends BaseEntity<PlayOrderInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +57,7 @@ public class OrderInfoEntity extends BaseEntity<OrderInfoEntity> {
|
|||||||
private String placeType;
|
private String placeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是首单【0:不是。1:是】
|
* 是否是首单【0:不是,1:是】
|
||||||
*/
|
*/
|
||||||
private Boolean firstOrder;
|
private Boolean firstOrder;
|
||||||
|
|
||||||
@@ -61,16 +66,47 @@ public class OrderInfoEntity extends BaseEntity<OrderInfoEntity> {
|
|||||||
*/
|
*/
|
||||||
private String refundType;
|
private String refundType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private String commodityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型[0:礼物,1:服务]
|
||||||
|
*/
|
||||||
|
private String commodityType;
|
||||||
|
/**
|
||||||
|
* 商品单价
|
||||||
|
*/
|
||||||
|
private BigDecimal commodityPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品数量
|
||||||
|
*/
|
||||||
|
private String commodityNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券列表
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringTypeHandler.class)
|
||||||
|
private List<String> couponIds = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付方式,0:余额支付,1:微信支付,2:支付宝支付
|
||||||
|
*/
|
||||||
|
private String payMethod;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单金额
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
private String orderMoney;
|
private BigDecimal orderMoney;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单最终金额
|
* 订单最终金额
|
||||||
*/
|
*/
|
||||||
private String finalAmount;
|
private BigDecimal finalAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下单人
|
* 下单人
|
||||||
@@ -82,6 +118,11 @@ public class OrderInfoEntity extends BaseEntity<OrderInfoEntity> {
|
|||||||
*/
|
*/
|
||||||
private Date purchaserTime;
|
private Date purchaserTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要审核,0:不需要,1:需要
|
||||||
|
*/
|
||||||
|
private String reviewRequired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核人
|
* 审核人
|
||||||
*/
|
*/
|
||||||
@@ -97,5 +138,21 @@ public class OrderInfoEntity extends BaseEntity<OrderInfoEntity> {
|
|||||||
*/
|
*/
|
||||||
private String reviewedRemark;
|
private String reviewedRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接单人
|
||||||
|
*/
|
||||||
|
private String acceptBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接单时间
|
||||||
|
*/
|
||||||
|
private Date acceptTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.starry.admin.modules.order.module.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.starry.common.domain.BasePageEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏订单查询对象
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PlayOrderRewardQueryVo extends BasePageEntity {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.starry.admin.modules.order.module.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏订单查询返回信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PlayOrderRewardReturnVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private String customUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String customUserNickname;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String customUserAvatar;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员ID
|
||||||
|
*/
|
||||||
|
private String clerkUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员昵称
|
||||||
|
*/
|
||||||
|
private String clerkUserNickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店员头像
|
||||||
|
*/
|
||||||
|
private String clerkUserAvatar;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏类型
|
||||||
|
*/
|
||||||
|
private String rewardType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private String orderMoney;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private String finalAmount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏留言
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打赏时间
|
||||||
|
*/
|
||||||
|
private Date purchaserTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderDetailsInfoEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单详细Service接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public interface IOrderDetailsInfoService extends IService<OrderDetailsInfoEntity> {
|
|
||||||
/**
|
|
||||||
* 查询订单详细
|
|
||||||
*
|
|
||||||
* @param id 订单详细主键
|
|
||||||
* @return 订单详细
|
|
||||||
*/
|
|
||||||
OrderDetailsInfoEntity selectOrderDetailsInfoById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单详细列表
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 订单详细集合
|
|
||||||
*/
|
|
||||||
List<OrderDetailsInfoEntity> selectOrderDetailsInfoList(OrderDetailsInfoEntity orderDetailsInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单详细
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean create(OrderDetailsInfoEntity orderDetailsInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单详细
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean update(OrderDetailsInfoEntity orderDetailsInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单详细
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单详细主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderDetailsInfoByIds(String[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单详细信息
|
|
||||||
*
|
|
||||||
* @param id 订单详细主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderDetailsInfoById(String id);
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.module.vo.OrderInfoQueryVo;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单Service接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public interface IOrderInfoService extends IService<OrderInfoEntity> {
|
|
||||||
/**
|
|
||||||
* 查询订单
|
|
||||||
*
|
|
||||||
* @param id 订单主键
|
|
||||||
* @return 订单
|
|
||||||
*/
|
|
||||||
OrderInfoEntity selectOrderInfoById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单列表
|
|
||||||
*
|
|
||||||
* @param orderInfoEntity 订单
|
|
||||||
* @return 订单集合
|
|
||||||
*/
|
|
||||||
IPage<OrderInfoEntity> selectOrderInfoList(OrderInfoQueryVo orderInfoEntity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单
|
|
||||||
*
|
|
||||||
* @param orderInfoEntity 订单
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean create(OrderInfoEntity orderInfoEntity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单
|
|
||||||
*
|
|
||||||
* @param orderInfoEntity 订单
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean update(OrderInfoEntity orderInfoEntity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderInfoByIds(String[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单信息
|
|
||||||
*
|
|
||||||
* @param id 订单主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderInfoById(String id);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单退款
|
|
||||||
*
|
|
||||||
* @param id 订单ID
|
|
||||||
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
|
||||||
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
|
||||||
* @param examine 是否需要审核
|
|
||||||
*/
|
|
||||||
void orderRefund(String id, String refundType, String refundMoney, boolean examine);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单日志Service接口
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-22
|
|
||||||
*/
|
|
||||||
public interface IOrderLogInfoService extends IService<OrderLogInfoEntity> {
|
|
||||||
/**
|
|
||||||
* 查询订单日志
|
|
||||||
*
|
|
||||||
* @param id 订单日志主键
|
|
||||||
* @return 订单日志
|
|
||||||
*/
|
|
||||||
OrderLogInfoEntity selectOrderLogInfoById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单日志列表
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 订单日志集合
|
|
||||||
*/
|
|
||||||
IPage<OrderLogInfoEntity> selectOrderLogInfoByPage(OrderLogInfoEntity orderLogInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单日志
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean create(OrderLogInfoEntity orderLogInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单日志
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
boolean update(OrderLogInfoEntity orderLogInfo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单日志
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单日志主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderLogInfoByIds(String[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单日志信息
|
|
||||||
*
|
|
||||||
* @param id 订单日志主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteOrderLogInfoById(String id);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.starry.admin.modules.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
|
import com.starry.admin.modules.order.module.vo.OrderInfoQueryVo;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardQueryVo;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardReturnVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单Service接口
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-03-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public interface IPlayOrderInfoService extends IService<PlayOrderInfoEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增充值单
|
||||||
|
*
|
||||||
|
* @param orderMoney 订单金额
|
||||||
|
* @param finalAmount 订单最终金额(支付金额)
|
||||||
|
* @param purchaserBy 下单人ID
|
||||||
|
*/
|
||||||
|
void createRechargeOrder(BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增打赏单
|
||||||
|
*
|
||||||
|
* @param orderMoney 订单金额
|
||||||
|
* @param finalAmount 订单最终金额(支付金额)
|
||||||
|
* @param purchaserBy 下单人ID
|
||||||
|
*/
|
||||||
|
void createRewardOrder(BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增赠送礼物订单
|
||||||
|
*
|
||||||
|
* @param commodityId 商品ID(礼物ID)
|
||||||
|
* @param commodityPrice 商品单价(礼物单价)
|
||||||
|
* @param commodityNumber 商品数量(礼物数量)
|
||||||
|
* @param orderMoney 订单金额
|
||||||
|
* @param finalAmount 订单最终金额(支付金额)
|
||||||
|
* @param purchaserBy 下单人ID
|
||||||
|
*/
|
||||||
|
void createGiftOrder(String commodityId, BigDecimal commodityPrice, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增普通订单
|
||||||
|
*
|
||||||
|
* @param orderStatus 订单状态【0:1:2:3:4:5】
|
||||||
|
* * 0:已下单
|
||||||
|
* * 1:已审核(退款 或者 提现需要审核,其余不需要)
|
||||||
|
* * 2:已接单
|
||||||
|
* * 3:已开始
|
||||||
|
* * 4:已完成
|
||||||
|
* * 5:已取消
|
||||||
|
* @param placeType 下单类型(0:指定单,1:随机单。2:打赏单)
|
||||||
|
* @param commodityId 商品ID
|
||||||
|
* @param commodityPrice 商品单价
|
||||||
|
* @param commodityNumber 商品数量
|
||||||
|
* @param orderMoney 订单金额
|
||||||
|
* @param finalAmount 订单最终金额(支付金额)
|
||||||
|
* @param purchaserBy 下单人ID
|
||||||
|
*/
|
||||||
|
void createOrdinaryOrder(String orderStatus, String placeType, String commodityId, BigDecimal commodityPrice, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询打赏订单
|
||||||
|
*
|
||||||
|
* @param vo 打赏订单查询对象
|
||||||
|
* @return 打赏订单
|
||||||
|
*/
|
||||||
|
IPage<PlayOrderRewardReturnVo> selectRewardOrderInfoByPage(PlayOrderRewardQueryVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单
|
||||||
|
*
|
||||||
|
* @param id 订单主键
|
||||||
|
* @return 订单
|
||||||
|
*/
|
||||||
|
PlayOrderInfoEntity selectOrderInfoById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单列表
|
||||||
|
*
|
||||||
|
* @param orderInfoEntity 订单
|
||||||
|
* @return 订单集合
|
||||||
|
*/
|
||||||
|
IPage<PlayOrderInfoEntity> selectOrderInfoList(OrderInfoQueryVo orderInfoEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单
|
||||||
|
*
|
||||||
|
* @param orderInfoEntity 订单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean create(PlayOrderInfoEntity orderInfoEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单
|
||||||
|
*
|
||||||
|
* @param orderInfoEntity 订单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean update(PlayOrderInfoEntity orderInfoEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除订单
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的订单主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOrderInfoByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单信息
|
||||||
|
*
|
||||||
|
* @param id 订单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOrderInfoById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款
|
||||||
|
*
|
||||||
|
* @param id 订单ID
|
||||||
|
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
||||||
|
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
||||||
|
* @param examine 是否需要审核
|
||||||
|
*/
|
||||||
|
void orderRefund(String id, String refundType, String refundMoney, boolean examine);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.starry.admin.modules.order.mapper.OrderDetailsInfoMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderDetailsInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.service.IOrderDetailsInfoService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单详细Service业务层处理
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderDetailsInfoServiceImpl extends ServiceImpl<OrderDetailsInfoMapper, OrderDetailsInfoEntity> implements IOrderDetailsInfoService {
|
|
||||||
@Resource
|
|
||||||
private OrderDetailsInfoMapper orderDetailsInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单详细
|
|
||||||
*
|
|
||||||
* @param id 订单详细主键
|
|
||||||
* @return 订单详细
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public OrderDetailsInfoEntity selectOrderDetailsInfoById(String id) {
|
|
||||||
return orderDetailsInfoMapper.selectOrderDetailsInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单详细列表
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 订单详细
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<OrderDetailsInfoEntity> selectOrderDetailsInfoList(OrderDetailsInfoEntity orderDetailsInfo) {
|
|
||||||
return orderDetailsInfoMapper.selectOrderDetailsInfoList(orderDetailsInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单详细
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean create(OrderDetailsInfoEntity orderDetailsInfo) {
|
|
||||||
if (StrUtil.isBlankIfStr(orderDetailsInfo.getId())) {
|
|
||||||
orderDetailsInfo.setId(IdUtil.fastSimpleUUID());
|
|
||||||
}
|
|
||||||
return save(orderDetailsInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单详细
|
|
||||||
*
|
|
||||||
* @param orderDetailsInfo 订单详细
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean update(OrderDetailsInfoEntity orderDetailsInfo) {
|
|
||||||
return updateById(orderDetailsInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单详细
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单详细主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderDetailsInfoByIds(String[] ids) {
|
|
||||||
return orderDetailsInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单详细信息
|
|
||||||
*
|
|
||||||
* @param id 订单详细主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderDetailsInfoById(String id) {
|
|
||||||
return orderDetailsInfoMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.starry.admin.common.exception.CustomException;
|
|
||||||
import com.starry.admin.modules.order.mapper.OrderInfoMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.module.vo.OrderInfoQueryVo;
|
|
||||||
import com.starry.admin.modules.order.service.IOrderInfoService;
|
|
||||||
import com.starry.admin.modules.order.service.IOrderLogInfoService;
|
|
||||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单Service业务层处理
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfoEntity> implements IOrderInfoService {
|
|
||||||
@Resource
|
|
||||||
private OrderInfoMapper orderInfoMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IOrderLogInfoService orderLogInfoService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlayUserInfoService playUserInfoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算退款金额
|
|
||||||
*
|
|
||||||
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
|
||||||
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
|
||||||
* @param entity 订单信息
|
|
||||||
* @return 最终退款金额
|
|
||||||
*/
|
|
||||||
private static long getFinalAmount(String refundType, String refundMoney, OrderInfoEntity entity) {
|
|
||||||
long finalAmount = 0;
|
|
||||||
// 部分退款,计算退款金额是否小于订单金额
|
|
||||||
if ("1".equals(refundType)) {
|
|
||||||
// 退款金额
|
|
||||||
long refundMoneyLong = Long.getLong(refundMoney);
|
|
||||||
// 订单金额
|
|
||||||
long orderMoney = Long.getLong(entity.getOrderMoney());
|
|
||||||
if (refundMoneyLong <= 0) {
|
|
||||||
throw new CustomException("退款金额必须大于0");
|
|
||||||
}
|
|
||||||
if (orderMoney < refundMoneyLong) {
|
|
||||||
throw new CustomException("退款金额必须小于订单总金额");
|
|
||||||
}
|
|
||||||
finalAmount = orderMoney - refundMoneyLong;
|
|
||||||
}
|
|
||||||
return finalAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单
|
|
||||||
*
|
|
||||||
* @param id 订单主键
|
|
||||||
* @return 订单
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public OrderInfoEntity selectOrderInfoById(String id) {
|
|
||||||
return orderInfoMapper.selectOrderInfoById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询订单信息
|
|
||||||
*
|
|
||||||
* @param vo 订单分页查询对象
|
|
||||||
* @return 订单分页查询结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<OrderInfoEntity> selectOrderInfoList(OrderInfoQueryVo vo) {
|
|
||||||
Page<OrderInfoEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
|
||||||
LambdaQueryWrapper<OrderInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
return this.baseMapper.selectPage(page, queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单
|
|
||||||
*
|
|
||||||
* @param orderInfo 订单
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean create(OrderInfoEntity orderInfo) {
|
|
||||||
if (StrUtil.isBlankIfStr(orderInfo.getId())) {
|
|
||||||
orderInfo.setId(IdUtil.fastSimpleUUID());
|
|
||||||
}
|
|
||||||
orderInfo.setPurchaserBy("sysadmin");
|
|
||||||
orderInfo.setPurchaserTime(new Date());
|
|
||||||
orderInfo.setReviewedBy("sysadmin");
|
|
||||||
orderInfo.setReviewedTime(new Date());
|
|
||||||
return save(orderInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单
|
|
||||||
*
|
|
||||||
* @param orderInfo 订单
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean update(OrderInfoEntity orderInfo) {
|
|
||||||
return updateById(orderInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderInfoByIds(String[] ids) {
|
|
||||||
return orderInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单信息
|
|
||||||
*
|
|
||||||
* @param id 订单主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderInfoById(String id) {
|
|
||||||
return orderInfoMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void orderRefund(String id, String refundType, String refundMoney, boolean examine) {
|
|
||||||
OrderInfoEntity entity = this.selectOrderInfoById(id);
|
|
||||||
if (entity == null) {
|
|
||||||
throw new CustomException("订单不存在");
|
|
||||||
}
|
|
||||||
if (!"0".equals(entity.getRefundType())) {
|
|
||||||
throw new CustomException("订单已退款,无法二次退款");
|
|
||||||
}
|
|
||||||
// 最终退款金额
|
|
||||||
long finalAmount = getFinalAmount(refundType, refundMoney, entity);
|
|
||||||
|
|
||||||
// 减少陪玩余额
|
|
||||||
// playUserInfoService.editAccountBalance(id, String.valueOf(finalAmount), "reduce");
|
|
||||||
// 新增用户余额
|
|
||||||
|
|
||||||
// 修改订单信息
|
|
||||||
entity.setFinalAmount(String.valueOf(finalAmount));
|
|
||||||
entity.setRefundType(refundType);
|
|
||||||
entity.setOrderStatus("5");
|
|
||||||
this.update(entity);
|
|
||||||
// 增加订单处理日志
|
|
||||||
orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "4", new Date()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
package com.starry.admin.modules.order.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.starry.admin.modules.order.mapper.OrderLogInfoMapper;
|
|
||||||
import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
|
||||||
import com.starry.admin.modules.order.service.IOrderLogInfoService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单日志Service业务层处理
|
|
||||||
*
|
|
||||||
* @author admin
|
|
||||||
* @since 2024-03-22
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderLogInfoServiceImpl extends ServiceImpl<OrderLogInfoMapper, OrderLogInfoEntity> implements IOrderLogInfoService {
|
|
||||||
@Resource
|
|
||||||
private OrderLogInfoMapper orderLogInfoMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单日志
|
|
||||||
*
|
|
||||||
* @param id 订单日志主键
|
|
||||||
* @return 订单日志
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public OrderLogInfoEntity selectOrderLogInfoById(String id) {
|
|
||||||
return this.baseMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订单日志列表
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 订单日志
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<OrderLogInfoEntity> selectOrderLogInfoByPage(OrderLogInfoEntity orderLogInfo) {
|
|
||||||
Page<OrderLogInfoEntity> page = new Page<>(1, 10);
|
|
||||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增订单日志
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean create(OrderLogInfoEntity orderLogInfo) {
|
|
||||||
if (StrUtil.isBlankIfStr(orderLogInfo.getId())) {
|
|
||||||
orderLogInfo.setId(IdUtil.fastSimpleUUID());
|
|
||||||
}
|
|
||||||
return save(orderLogInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单日志
|
|
||||||
*
|
|
||||||
* @param orderLogInfo 订单日志
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean update(OrderLogInfoEntity orderLogInfo) {
|
|
||||||
return updateById(orderLogInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除订单日志
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的订单日志主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderLogInfoByIds(String[] ids) {
|
|
||||||
return orderLogInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单日志信息
|
|
||||||
*
|
|
||||||
* @param id 订单日志主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteOrderLogInfoById(String id) {
|
|
||||||
return orderLogInfoMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
package com.starry.admin.modules.order.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.starry.admin.common.exception.CustomException;
|
||||||
|
import com.starry.admin.modules.clear.module.entity.PlayClerkUserInfoEntity;
|
||||||
|
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||||
|
import com.starry.admin.modules.order.mapper.PlayOrderInfoMapper;
|
||||||
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
|
import com.starry.admin.modules.order.module.vo.OrderInfoQueryVo;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardQueryVo;
|
||||||
|
import com.starry.admin.modules.order.module.vo.PlayOrderRewardReturnVo;
|
||||||
|
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单Service业务层处理
|
||||||
|
*
|
||||||
|
* @author admin
|
||||||
|
* @since 2024-03-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, PlayOrderInfoEntity> implements IPlayOrderInfoService {
|
||||||
|
@Resource
|
||||||
|
private PlayOrderInfoMapper orderInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createRechargeOrder(BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy) {
|
||||||
|
PlayOrderInfoEntity entity = new PlayOrderInfoEntity();
|
||||||
|
entity.setOrderStatus("4");
|
||||||
|
entity.setOrderType("0");
|
||||||
|
entity.setOrderMoney(orderMoney);
|
||||||
|
entity.setFinalAmount(finalAmount);
|
||||||
|
entity.setPurchaserBy(purchaserBy);
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增打赏单
|
||||||
|
* 打赏订单直接完成
|
||||||
|
*
|
||||||
|
* @param orderMoney 订单金额
|
||||||
|
* @param finalAmount 订单最终金额(支付金额)
|
||||||
|
* @param purchaserBy 下单人ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void createRewardOrder(BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy) {
|
||||||
|
PlayOrderInfoEntity entity = new PlayOrderInfoEntity();
|
||||||
|
entity.setOrderStatus("4");
|
||||||
|
entity.setOrderType("2");
|
||||||
|
entity.setPlaceType("2");
|
||||||
|
entity.setOrderMoney(orderMoney);
|
||||||
|
entity.setFinalAmount(finalAmount);
|
||||||
|
entity.setPurchaserBy(purchaserBy);
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createGiftOrder(String commodityId, BigDecimal commodityPrice, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy) {
|
||||||
|
PlayOrderInfoEntity entity = new PlayOrderInfoEntity();
|
||||||
|
entity.setOrderStatus("4");
|
||||||
|
entity.setOrderType("2");
|
||||||
|
entity.setPlaceType("2");
|
||||||
|
entity.setCommodityId(commodityId);
|
||||||
|
entity.setCommodityPrice(commodityPrice);
|
||||||
|
entity.setCommodityType("0");
|
||||||
|
entity.setOrderMoney(orderMoney);
|
||||||
|
entity.setFinalAmount(finalAmount);
|
||||||
|
entity.setPurchaserBy(purchaserBy);
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createOrdinaryOrder(String orderStatus, String placeType, String commodityId, BigDecimal commodityPrice, String commodityNumber, BigDecimal orderMoney, BigDecimal finalAmount, String purchaserBy) {
|
||||||
|
PlayOrderInfoEntity entity = new PlayOrderInfoEntity();
|
||||||
|
entity.setOrderStatus(orderStatus);
|
||||||
|
entity.setOrderType("2");
|
||||||
|
entity.setPlaceType(placeType);
|
||||||
|
entity.setCommodityId(commodityId);
|
||||||
|
entity.setCommodityPrice(commodityPrice);
|
||||||
|
entity.setCommodityNumber(commodityNumber);
|
||||||
|
entity.setCommodityType("0");
|
||||||
|
entity.setOrderMoney(orderMoney);
|
||||||
|
entity.setFinalAmount(finalAmount);
|
||||||
|
entity.setPurchaserBy(purchaserBy);
|
||||||
|
this.baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算退款金额
|
||||||
|
*
|
||||||
|
* @param refundType 退款类型【1:部分退款,2:全部退款】
|
||||||
|
* @param refundMoney 退款金额,单位分(仅部分退款有效)
|
||||||
|
* @param entity 订单信息
|
||||||
|
* @return 最终退款金额
|
||||||
|
*/
|
||||||
|
private static long getFinalAmount(String refundType, String refundMoney, PlayOrderInfoEntity entity) {
|
||||||
|
long finalAmount = 0;
|
||||||
|
// // 部分退款,计算退款金额是否小于订单金额
|
||||||
|
// if ("1".equals(refundType)) {
|
||||||
|
// // 退款金额
|
||||||
|
// long refundMoneyLong = Long.getLong(refundMoney);
|
||||||
|
// // 订单金额
|
||||||
|
// long orderMoney = Long.getLong(entity.getOrderMoney());
|
||||||
|
// if (refundMoneyLong <= 0) {
|
||||||
|
// throw new CustomException("退款金额必须大于0");
|
||||||
|
// }
|
||||||
|
// if (orderMoney < refundMoneyLong) {
|
||||||
|
// throw new CustomException("退款金额必须小于订单总金额");
|
||||||
|
// }
|
||||||
|
// finalAmount = orderMoney - refundMoneyLong;
|
||||||
|
// }
|
||||||
|
return finalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<PlayOrderRewardReturnVo> selectRewardOrderInfoByPage(PlayOrderRewardQueryVo vo) {
|
||||||
|
MPJLambdaWrapper<PlayOrderInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayOrderInfoEntity>()
|
||||||
|
//查询主表全部字段
|
||||||
|
.selectAll(PlayOrderInfoEntity.class)
|
||||||
|
//查询顾客表
|
||||||
|
.selectAs(PlayCustomUserInfoEntity::getId, "customUserId").selectAs(PlayCustomUserInfoEntity::getAvatar, "customUserAvatar").selectAs(PlayCustomUserInfoEntity::getNickname, "customUserNickname")
|
||||||
|
//查询陪玩表
|
||||||
|
.selectAs(PlayClerkUserInfoEntity::getId, "clerkUserId").selectAs(PlayClerkUserInfoEntity::getAvatar, "clerkUserAvatar").selectAs(PlayClerkUserInfoEntity::getNickname, "clerkUserNickname")
|
||||||
|
//子表
|
||||||
|
.leftJoin(PlayCustomUserInfoEntity.class, PlayCustomUserInfoEntity::getId, PlayOrderInfoEntity::getPurchaserBy)
|
||||||
|
.leftJoin(PlayClerkUserInfoEntity.class, PlayClerkUserInfoEntity::getId, PlayOrderInfoEntity::getAcceptBy);
|
||||||
|
lambdaQueryWrapper.eq(PlayOrderInfoEntity::getPlaceType, "2");
|
||||||
|
lambdaQueryWrapper.orderByDesc(PlayOrderInfoEntity::getPurchaserTime);
|
||||||
|
return this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayOrderRewardReturnVo.class, lambdaQueryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单
|
||||||
|
*
|
||||||
|
* @param id 订单主键
|
||||||
|
* @return 订单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlayOrderInfoEntity selectOrderInfoById(String id) {
|
||||||
|
return orderInfoMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询订单信息
|
||||||
|
*
|
||||||
|
* @param vo 订单分页查询对象
|
||||||
|
* @return 订单分页查询结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<PlayOrderInfoEntity> selectOrderInfoList(OrderInfoQueryVo vo) {
|
||||||
|
Page<PlayOrderInfoEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
||||||
|
LambdaQueryWrapper<PlayOrderInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return this.baseMapper.selectPage(page, queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单
|
||||||
|
*
|
||||||
|
* @param orderInfo 订单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean create(PlayOrderInfoEntity orderInfo) {
|
||||||
|
if (StrUtil.isBlankIfStr(orderInfo.getId())) {
|
||||||
|
orderInfo.setId(IdUtil.fastSimpleUUID());
|
||||||
|
}
|
||||||
|
orderInfo.setPurchaserBy("sysadmin");
|
||||||
|
orderInfo.setPurchaserTime(new Date());
|
||||||
|
orderInfo.setReviewedBy("sysadmin");
|
||||||
|
orderInfo.setReviewedTime(new Date());
|
||||||
|
return save(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单
|
||||||
|
*
|
||||||
|
* @param orderInfo 订单
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean update(PlayOrderInfoEntity orderInfo) {
|
||||||
|
return updateById(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除订单
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的订单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOrderInfoByIds(String[] ids) {
|
||||||
|
return orderInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单信息
|
||||||
|
*
|
||||||
|
* @param id 订单主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOrderInfoById(String id) {
|
||||||
|
return orderInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void orderRefund(String id, String refundType, String refundMoney, boolean examine) {
|
||||||
|
PlayOrderInfoEntity entity = this.selectOrderInfoById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new CustomException("订单不存在");
|
||||||
|
}
|
||||||
|
if (!"0".equals(entity.getRefundType())) {
|
||||||
|
throw new CustomException("订单已退款,无法二次退款");
|
||||||
|
}
|
||||||
|
// 最终退款金额
|
||||||
|
long finalAmount = getFinalAmount(refundType, refundMoney, entity);
|
||||||
|
|
||||||
|
// 减少陪玩余额
|
||||||
|
// playUserInfoService.editAccountBalance(id, String.valueOf(finalAmount), "reduce");
|
||||||
|
// 新增用户余额
|
||||||
|
|
||||||
|
// 修改订单信息
|
||||||
|
// entity.setFinalAmount(String.valueOf(finalAmount));
|
||||||
|
entity.setRefundType(refundType);
|
||||||
|
entity.setOrderStatus("5");
|
||||||
|
this.update(entity);
|
||||||
|
// 增加订单处理日志
|
||||||
|
// orderLogInfoService.create(new OrderLogInfoEntity(entity.getId(), "4", new Date()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,11 +10,11 @@ import com.starry.common.enums.BusinessType;
|
|||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,7 @@ public class SysTenantController {
|
|||||||
@PreAuthorize("@customSs.hasPermission('platform:tenant:create')")
|
@PreAuthorize("@customSs.hasPermission('platform:tenant:create')")
|
||||||
@Log(title = "租户表", businessType = BusinessType.INSERT)
|
@Log(title = "租户表", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public R create(@Valid @RequestBody SysTenantAddVo vo) {
|
public R create(@Validated @RequestBody SysTenantAddVo vo) {
|
||||||
SysTenantEntity entity = ConvertUtil.entityToVo(vo, SysTenantEntity.class);
|
SysTenantEntity entity = ConvertUtil.entityToVo(vo, SysTenantEntity.class);
|
||||||
return sysTenantService.addTenant(entity);
|
return sysTenantService.addTenant(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ public class SysTenantEntity extends BaseEntity<SysTenantEntity> {
|
|||||||
*/
|
*/
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信商户ID
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信公众号的app secret
|
* 微信公众号的app secret
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import com.starry.common.enums.BusinessType;
|
|||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告Controller
|
* 公告Controller
|
||||||
@@ -62,7 +62,7 @@ public class PlayNoticeInfoController {
|
|||||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||||
@Log(title = "公告", businessType = BusinessType.INSERT)
|
@Log(title = "公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public R create(@Valid @RequestBody PlayNoticeInfoAddVo vo) {
|
public R create(@Validated @RequestBody PlayNoticeInfoAddVo vo) {
|
||||||
PlayNoticeInfoEntity entity = ConvertUtil.entityToVo(vo, PlayNoticeInfoEntity.class);
|
PlayNoticeInfoEntity entity = ConvertUtil.entityToVo(vo, PlayNoticeInfoEntity.class);
|
||||||
boolean success = playNoticeInfoService.create(entity);
|
boolean success = playNoticeInfoService.create(entity);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.starry.common.domain.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务项目对象 play_commodity_info
|
* 服务项目对象 play_commodity_info
|
||||||
*
|
*
|
||||||
@@ -45,7 +47,7 @@ public class PlayCommodityInfoEntity extends BaseEntity<PlayCommodityInfoEntity>
|
|||||||
/**
|
/**
|
||||||
* 服务单价
|
* 服务单价
|
||||||
*/
|
*/
|
||||||
private String price;
|
private BigDecimal price;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class SysMenuController {
|
|||||||
return R.error("修改失败");
|
return R.error("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("删除菜单")
|
@ApiOperation("删除菜单")
|
||||||
@PreAuthorize("@customSs.hasPermission('system:menu:delete')")
|
@PreAuthorize("@customSs.hasPermission('system:menu:delete')")
|
||||||
@PostMapping(value = "/delete/{id}")
|
@PostMapping(value = "/delete/{id}")
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -51,7 +51,7 @@ public class SysRoleController {
|
|||||||
@ApiOperation("添加角色")
|
@ApiOperation("添加角色")
|
||||||
@PreAuthorize("@customSs.hasPermission('system:role:create')")
|
@PreAuthorize("@customSs.hasPermission('system:role:create')")
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public R create(@Valid @RequestBody SysRoleAddVo roleAddVo) {
|
public R create(@Validated @RequestBody SysRoleAddVo roleAddVo) {
|
||||||
SysRoleEntity role = new SysRoleEntity();
|
SysRoleEntity role = new SysRoleEntity();
|
||||||
BeanUtils.copyProperties(roleAddVo, role);
|
BeanUtils.copyProperties(roleAddVo, role);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class SysAdministrativeAreaDictInfoServiceImpl extends ServiceImpl<SysAdm
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdministrativeAreaQueryReturnVo> selectTree(String level) {
|
public List<AdministrativeAreaQueryReturnVo> selectTree(String level) {
|
||||||
List<AdministrativeAreaQueryReturnVo> result = new ArrayList<>();
|
|
||||||
LambdaQueryWrapper<SysAdministrativeAreaDictInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysAdministrativeAreaDictInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.le(SysAdministrativeAreaDictInfoEntity::getLevel, level);
|
lambdaQueryWrapper.le(SysAdministrativeAreaDictInfoEntity::getLevel, level);
|
||||||
List<SysAdministrativeAreaDictInfoEntity> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
List<SysAdministrativeAreaDictInfoEntity> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
|||||||
@@ -20,21 +20,19 @@ import com.starry.admin.modules.clear.service.IPlayClerkUserInfoService;
|
|||||||
import com.starry.admin.modules.clear.service.impl.PlayClerkDataReviewInfoServiceImpl;
|
import com.starry.admin.modules.clear.service.impl.PlayClerkDataReviewInfoServiceImpl;
|
||||||
import com.starry.admin.modules.clear.service.impl.PlayClerkUserInfoServiceImpl;
|
import com.starry.admin.modules.clear.service.impl.PlayClerkUserInfoServiceImpl;
|
||||||
import com.starry.admin.modules.weichat.entity.*;
|
import com.starry.admin.modules.weichat.entity.*;
|
||||||
|
import com.starry.admin.modules.weichat.service.WxCustomUserService;
|
||||||
import com.starry.admin.utils.SecurityUtils;
|
import com.starry.admin.utils.SecurityUtils;
|
||||||
import com.starry.common.redis.RedisCache;
|
import com.starry.common.redis.RedisCache;
|
||||||
import com.starry.common.result.R;
|
import com.starry.common.result.R;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import com.starry.common.utils.VerificationCodeUtils;
|
import com.starry.common.utils.VerificationCodeUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author admin
|
* @author admin
|
||||||
@@ -67,6 +65,9 @@ public class WxClerkController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IPlayClerkCommodityService playClerkCommodityService;
|
private IPlayClerkCommodityService playClerkCommodityService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxCustomUserService customUserService;
|
||||||
|
|
||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@GetMapping("/user/queryById")
|
@GetMapping("/user/queryById")
|
||||||
@@ -94,7 +95,7 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/sendCode")
|
@PostMapping("/user/sendCode")
|
||||||
public R sendCode(@Valid @RequestBody PlayClerkUserSendCodeVo vo) {
|
public R sendCode(@Validated @RequestBody PlayClerkUserSendCodeVo vo) {
|
||||||
String codeKey = "login_codes:" + SecurityUtils.getTenantId() + "_" + SecureUtil.md5(vo.getAreaCode() + vo.getPhone());
|
String codeKey = "login_codes:" + SecurityUtils.getTenantId() + "_" + SecureUtil.md5(vo.getAreaCode() + vo.getPhone());
|
||||||
String code = VerificationCodeUtils.getVerificationCode(4);
|
String code = VerificationCodeUtils.getVerificationCode(4);
|
||||||
redisCache.setCacheObject(codeKey, code, 5L, TimeUnit.MINUTES);
|
redisCache.setCacheObject(codeKey, code, 5L, TimeUnit.MINUTES);
|
||||||
@@ -104,7 +105,7 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/bindCode")
|
@PostMapping("/user/bindCode")
|
||||||
public R bindCode(@Valid @RequestBody PlayClerkUserBindCodeVo vo) {
|
public R bindCode(@Validated @RequestBody PlayClerkUserBindCodeVo vo) {
|
||||||
String codeKey = "login_codes:" + SecurityUtils.getTenantId() + "_" + SecureUtil.md5(vo.getAreaCode() + vo.getPhone());
|
String codeKey = "login_codes:" + SecurityUtils.getTenantId() + "_" + SecureUtil.md5(vo.getAreaCode() + vo.getPhone());
|
||||||
String code = redisCache.getCacheObject(codeKey);
|
String code = redisCache.getCacheObject(codeKey);
|
||||||
if (code == null || !code.equals(vo.getCode())) {
|
if (code == null || !code.equals(vo.getCode())) {
|
||||||
@@ -124,13 +125,13 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/add")
|
@PostMapping("/user/add")
|
||||||
public R userAdd(@Valid @RequestBody PlayClerkUserByWxAddVo vo) {
|
public R userAdd(@Validated @RequestBody PlayClerkUserByWxAddVo vo) {
|
||||||
String playUserId = ThreadLocalRequestDetail.getClerkUserInfo().getId();
|
String playUserId = ThreadLocalRequestDetail.getClerkUserInfo().getId();
|
||||||
PlayClerkUserInfoEntity userInfo = playClerkUserInfoService.selectById(playUserId);
|
PlayClerkUserInfoEntity userInfo = playClerkUserInfoService.selectById(playUserId);
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
throw new CustomException("系统错误,用户不存在");
|
throw new CustomException("系统错误,用户不存在");
|
||||||
}
|
}
|
||||||
if (userInfo.getClerkState().equals("1")) {
|
if ("1".equals(userInfo.getClerkState())) {
|
||||||
throw new CustomException("当前用户已经是店员");
|
throw new CustomException("当前用户已经是店员");
|
||||||
}
|
}
|
||||||
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
||||||
@@ -141,6 +142,8 @@ public class WxClerkController {
|
|||||||
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
||||||
throw new CustomException("已有申请未审核");
|
throw new CustomException("已有申请未审核");
|
||||||
}
|
}
|
||||||
|
dataReviewInfo.setClarkAvatar(userInfo.getAvatar());
|
||||||
|
dataReviewInfo.setClarkNickname(userInfo.getNickname());
|
||||||
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
||||||
dataReviewInfo.setAddTime(new Date());
|
dataReviewInfo.setAddTime(new Date());
|
||||||
dataReviewInfoService.create(dataReviewInfo);
|
dataReviewInfoService.create(dataReviewInfo);
|
||||||
@@ -150,7 +153,7 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateAvatar")
|
@PostMapping("/user/updateAvatar")
|
||||||
public R updateAvatar(@Valid @RequestBody PlayClerkUserAvatarVo vo) {
|
public R updateAvatar(@Validated @RequestBody PlayClerkUserAvatarVo vo) {
|
||||||
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
||||||
|
|
||||||
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
||||||
@@ -161,6 +164,8 @@ public class WxClerkController {
|
|||||||
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
||||||
throw new CustomException("已有申请未审核");
|
throw new CustomException("已有申请未审核");
|
||||||
}
|
}
|
||||||
|
dataReviewInfo.setClarkAvatar(userInfo.getAvatar());
|
||||||
|
dataReviewInfo.setClarkNickname(userInfo.getNickname());
|
||||||
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
||||||
dataReviewInfo.setAddTime(new Date());
|
dataReviewInfo.setAddTime(new Date());
|
||||||
dataReviewInfoService.create(dataReviewInfo);
|
dataReviewInfoService.create(dataReviewInfo);
|
||||||
@@ -169,7 +174,7 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateAlbum")
|
@PostMapping("/user/updateAlbum")
|
||||||
public R updateAlbum(@Valid @RequestBody PlayClerkUserAlbumVo vo) {
|
public R updateAlbum(@Validated @RequestBody PlayClerkUserAlbumVo vo) {
|
||||||
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
||||||
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
||||||
dataReviewInfo.setPlayUserId(userInfo.getId());
|
dataReviewInfo.setPlayUserId(userInfo.getId());
|
||||||
@@ -178,14 +183,17 @@ public class WxClerkController {
|
|||||||
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
||||||
throw new CustomException("已有申请未审核");
|
throw new CustomException("已有申请未审核");
|
||||||
}
|
}
|
||||||
|
dataReviewInfo.setClarkAvatar(userInfo.getAvatar());
|
||||||
|
dataReviewInfo.setClarkNickname(userInfo.getNickname());
|
||||||
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
||||||
|
dataReviewInfo.setAddTime(new Date());
|
||||||
dataReviewInfoService.create(dataReviewInfo);
|
dataReviewInfoService.create(dataReviewInfo);
|
||||||
return R.ok("申请成功");
|
return R.ok("申请成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateAudio")
|
@PostMapping("/user/updateAudio")
|
||||||
public R updateAudio(@Valid @RequestBody PlayClerkUserAudioVo vo) {
|
public R updateAudio(@Validated @RequestBody PlayClerkUserAudioVo vo) {
|
||||||
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
||||||
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
PlayClerkDataReviewInfoEntity dataReviewInfo = new PlayClerkDataReviewInfoEntity();
|
||||||
dataReviewInfo.setPlayUserId(userInfo.getId());
|
dataReviewInfo.setPlayUserId(userInfo.getId());
|
||||||
@@ -194,6 +202,9 @@ public class WxClerkController {
|
|||||||
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
if (!dataReviewInfoService.queryList(dataReviewInfo).isEmpty()) {
|
||||||
throw new CustomException("已有申请未审核");
|
throw new CustomException("已有申请未审核");
|
||||||
}
|
}
|
||||||
|
dataReviewInfo.setAddTime(new Date());
|
||||||
|
dataReviewInfo.setClarkAvatar(userInfo.getAvatar());
|
||||||
|
dataReviewInfo.setClarkNickname(userInfo.getNickname());
|
||||||
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
dataReviewInfo.setContent(JSONObject.toJSONString(vo));
|
||||||
dataReviewInfoService.create(dataReviewInfo);
|
dataReviewInfoService.create(dataReviewInfo);
|
||||||
return R.ok("申请成功");
|
return R.ok("申请成功");
|
||||||
@@ -202,7 +213,7 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateOnlineState")
|
@PostMapping("/user/updateOnlineState")
|
||||||
public R updateAudio(@Valid @RequestBody PlayClerkUserOnlineStateVo vo) {
|
public R updateAudio(@Validated @RequestBody PlayClerkUserOnlineStateVo vo) {
|
||||||
String userId = ThreadLocalRequestDetail.getClerkUserInfo().getId();
|
String userId = ThreadLocalRequestDetail.getClerkUserInfo().getId();
|
||||||
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
PlayClerkUserInfoEntity entity = new PlayClerkUserInfoEntity();
|
||||||
entity.setOnlineState(vo.getOnlineState());
|
entity.setOnlineState(vo.getOnlineState());
|
||||||
@@ -213,15 +224,15 @@ public class WxClerkController {
|
|||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateCommodity")
|
@PostMapping("/user/updateCommodity")
|
||||||
public R updateAudio(@Valid @RequestBody PlayClerkCommodityEditVo vo) {
|
public R updateAudio(@Validated @RequestBody PlayClerkCommodityEditVo vo) {
|
||||||
playClerkCommodityService.startStopClerkItem(vo.getCommodityType(), vo.getEnablingState());
|
playClerkCommodityService.startStopClerkItem(vo.getCommodityType(), vo.getEnablingState(), ThreadLocalRequestDetail.getClerkUserInfo().getId());
|
||||||
return R.ok("成功");
|
return R.ok("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ClerkUserLogin
|
@ClerkUserLogin
|
||||||
@PostMapping("/user/updateOther")
|
@PostMapping("/user/updateOther")
|
||||||
public R updateOther(@Valid @RequestBody PlayClerkUserOtherVo vo) {
|
public R updateOther(@Validated @RequestBody PlayClerkUserOtherVo vo) {
|
||||||
PlayClerkUserInfoEntity userInfo = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
PlayClerkUserInfoEntity userInfo = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||||
userInfo.setId(ThreadLocalRequestDetail.getClerkUserInfo().getId());
|
userInfo.setId(ThreadLocalRequestDetail.getClerkUserInfo().getId());
|
||||||
playClerkUserInfoService.update(userInfo);
|
playClerkUserInfoService.update(userInfo);
|
||||||
@@ -242,27 +253,28 @@ public class WxClerkController {
|
|||||||
* 分页获取店员列表
|
* 分页获取店员列表
|
||||||
*
|
*
|
||||||
* @param vo PlayClerkUserInfoQueryVo
|
* @param vo PlayClerkUserInfoQueryVo
|
||||||
* @return 店员礼列表
|
* @return 店员列表
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@PostMapping("/user/queryByPage")
|
@PostMapping("/user/queryByPage")
|
||||||
public R queryByPage(@RequestBody PlayClerkUserInfoQueryVo vo) {
|
public R queryByPage(@RequestBody PlayClerkUserInfoQueryVo vo) {
|
||||||
IPage<PlayClerkUserInfoEntity> page = playClerkUserInfoService.selectPlayClerkUserInfoByPage(vo);
|
IPage<PlayClerkUserListResultVo> page = playClerkUserInfoService.selectByPage(vo, customUserService.getLoginUserId());
|
||||||
List<PlayClerkUserListResultVo> resultVos = new ArrayList<>();
|
return R.ok(page);
|
||||||
for (PlayClerkUserInfoEntity record : page.getRecords()) {
|
}
|
||||||
PlayClerkUserListResultVo item = ConvertUtil.entityToVo(record, PlayClerkUserListResultVo.class);
|
|
||||||
List<String> list = playClerkCommodityService.selectByUser(record.getId()).stream().map(PlayClerkCommodityEntity::getCommodityType).collect(Collectors.toList());
|
|
||||||
item.setCommodity(list);
|
|
||||||
resultVos.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPage<PlayClerkUserListResultVo> resultPage = new Page<>();
|
|
||||||
resultPage.setRecords(resultVos);
|
/**
|
||||||
// 设置分页参数
|
* 获取推荐用户列表
|
||||||
resultPage.setCurrent(page.getCurrent());
|
*
|
||||||
resultPage.setSize(page.getSize());
|
* @return 店员列表
|
||||||
resultPage.setTotal(resultVos.size()); // 假设total和实际情况一致
|
*/
|
||||||
return R.ok(resultPage);
|
@PostMapping("/user/queryByRecommend")
|
||||||
|
public R queryByRecommend() {
|
||||||
|
PlayClerkUserInfoQueryVo vo = new PlayClerkUserInfoQueryVo();
|
||||||
|
vo.setPageNum(10);
|
||||||
|
vo.setPageSize(9999);
|
||||||
|
vo.setRecommendationState("1");
|
||||||
|
IPage<PlayClerkUserListResultVo> page = playClerkUserInfoService.selectByPage(vo, "");
|
||||||
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,14 +290,17 @@ public class WxClerkController {
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new CustomException("用户不存在");
|
throw new CustomException("用户不存在");
|
||||||
}
|
}
|
||||||
List<PlayGiftInfoEntity> list = new ArrayList<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
list.add(new PlayGiftInfoEntity(IdUtil.fastSimpleUUID(), "礼物1", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 0, "0"));
|
List<PlayGiftInfoVo> list = new ArrayList<>();
|
||||||
list.add(new PlayGiftInfoEntity(IdUtil.fastSimpleUUID(), "礼物2", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 1, "0"));
|
list.add(new PlayGiftInfoVo(IdUtil.fastSimpleUUID(), "礼物1", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 0, "0"));
|
||||||
list.add(new PlayGiftInfoEntity(IdUtil.fastSimpleUUID(), "礼物3", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 2, "1"));
|
list.add(new PlayGiftInfoVo(IdUtil.fastSimpleUUID(), "礼物2", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 1, "0"));
|
||||||
list.add(new PlayGiftInfoEntity(IdUtil.fastSimpleUUID(), "礼物4", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 3, "1"));
|
list.add(new PlayGiftInfoVo(IdUtil.fastSimpleUUID(), "礼物3", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 2, "1"));
|
||||||
list.add(new PlayGiftInfoEntity(IdUtil.fastSimpleUUID(), "礼物5", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 4, "1"));
|
list.add(new PlayGiftInfoVo(IdUtil.fastSimpleUUID(), "礼物4", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 3, "1"));
|
||||||
|
list.add(new PlayGiftInfoVo(IdUtil.fastSimpleUUID(), "礼物5", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", 4, "1"));
|
||||||
return R.ok(list);
|
result.put("list", list);
|
||||||
|
result.put("obtainedGift", list.size() - 1);
|
||||||
|
result.put("totalGift", list.size());
|
||||||
|
return R.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,6 +371,7 @@ public class WxClerkController {
|
|||||||
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人3昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人3昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
||||||
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人4昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人4昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
||||||
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人5昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人5昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时"));
|
||||||
|
entities.add(new PlayClarkUserEvaluateInfoEntity(IdUtil.fastSimpleUUID(), IdUtil.fastSimpleUUID(), "评价人5昵称", "https://live-cloud-cvoon.oss-cn-hangzhou.aliyuncs.com/d8e929c041e94075b93cfc6338a83d4c/2024/04/15/fc09da2f923d46e6951292ff8f34f6aa.png", "评价内容", new Date(), IdUtil.fastSimpleUUID(), "店员昵称", IdUtil.fastSimpleUUID(), "文字语音条", "一小时", 5));
|
||||||
|
|
||||||
IPage<PlayClarkUserEvaluateInfoEntity> resultPage = new Page<>();
|
IPage<PlayClarkUserEvaluateInfoEntity> resultPage = new Page<>();
|
||||||
resultPage.setRecords(entities);
|
resultPage.setRecords(entities);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user