diff --git a/.idea/compiler.xml b/.idea/compiler.xml index f95f763..298ce25 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -12,10 +12,12 @@ - + + + diff --git a/admin-pc/.env.development b/admin-pc/.env.development index 88972f6..9d58881 100644 --- a/admin-pc/.env.development +++ b/admin-pc/.env.development @@ -1,5 +1,5 @@ NODE_ENV=development -VUE_APP_API_BASE_URL=http://localhost:8000/jewelry-admin/ +VUE_APP_API_BASE_URL=http://localhost:8001/jewelry-admin/ VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview diff --git a/admin-pc/.env.production b/admin-pc/.env.production index 3067156..2bdc95e 100644 --- a/admin-pc/.env.production +++ b/admin-pc/.env.production @@ -1,4 +1,4 @@ NODE_ENV=production -VUE_APP_API_BASE_URL=http://localhost:8000/jewelry-admin/ +VUE_APP_API_BASE_URL=http://localhost:8001/jewelry-admin/ VUE_APP_CAS_BASE_URL=http://localhost:8888/cas VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview \ No newline at end of file diff --git a/module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index 7503329..0a1fb52 100644 --- a/module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -79,10 +79,10 @@ public class ShiroConfig { filterChainDefinitionMap.put("/config_common/**", "anon"); - //三只青蛙 - filterChainDefinitionMap.put("/rice_vip/**", "anon"); - filterChainDefinitionMap.put("/rice_info/**", "anon"); - filterChainDefinitionMap.put("/rice_index/**", "anon"); + //珠宝项目 + filterChainDefinitionMap.put("/index_common/**", "anon"); + filterChainDefinitionMap.put("/info_common/**", "anon"); + diff --git a/module-common/pom.xml b/module-common/pom.xml index edf1622..71b3544 100644 --- a/module-common/pom.xml +++ b/module-common/pom.xml @@ -38,6 +38,22 @@ org.jeecgframework.boot base-core - + + com.vaadin.external.google + android-json + 0.0.20131108.vaadin1 + compile + + + org.jeecgframework.boot + module-pay + 3.2.0 + compile + + + commons-fileupload + commons-fileupload + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/api/bean/HttpClientUtil.java b/module-common/src/main/java/org/jeecg/api/bean/HttpClientUtil.java new file mode 100644 index 0000000..20c873c --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/bean/HttpClientUtil.java @@ -0,0 +1,1122 @@ +package org.jeecg.api.bean; + + + + +import com.alibaba.fastjson.JSON; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.NameValuePair; +import org.apache.http.client.CookieStore; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.client.utils.HttpClientUtils; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.BasicCookieStore; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.net.URI; +import java.nio.charset.Charset; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 通过url获取数据 + * + * @author zc + * + */ +public class HttpClientUtil { + + /** + * 设置可访问https + * @return + */ + public static CloseableHttpClient createSSLClientDefault() { + try { + SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() { + //信任所有 + public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return true; + } + }).build(); + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + + return HttpClients.custom().setSSLSocketFactory(sslsf).build(); + } catch (KeyManagementException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (KeyStoreException e) { + e.printStackTrace(); + } + return HttpClients.createDefault(); + } +/*************************************Get**********************************************/ + /** + * 一般查询用doget + * @param url + * @param param + * @param + * @return + */ + public static String doGet(String url, Map param) { + // 创建Httpclient对象 + CloseableHttpClient httpclient = createSSLClientDefault();//调用createSSLClientDefault + String resultString = ""; + CloseableHttpResponse response = null; + try { + + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + CookieStore cookieStore = new BasicCookieStore(); + httpclient = HttpClients.custom().setDefaultCookieStore(cookieStore).build(); + // 创建http GET请求 + HttpGet httpGet = new HttpGet(uri); + //设置请求头 +// if (parameter != null) { +// //签名 +// httpGet.addHeader("Sign",parameter.getSign()); +// //用户ID +// httpGet.addHeader("User_ID",parameter.getUserId()+""); +// //用户角色ID +// httpGet.addHeader("User_RID",parameter.getRId()); +// //用户单位ID +// httpGet.addHeader("Dept_ID",parameter.getDeptId()+""); +// //用户科室ID +// httpGet.addHeader("Unit_ID",parameter.getUnitid()+""); +// httpGet.addHeader("CacheKey",parameter.getCacheKey()); +// httpGet.addHeader("Org_id", parameter.getOrg_id() + ""); +// httpGet.addHeader("Product_id", parameter.getProduct_id() + ""); +// httpGet.addHeader("Timestamp", parameter.getTimestamp()); +// } + + // 执行请求 + response = httpclient.execute(httpGet); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), + "UTF-8"); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + public static String doGet(String url) { + return doGet(url, null); + } + + public static String doGet3(String url, Map param) { + // 创建Httpclient对象 + //调用createSSLClientDefault + CloseableHttpClient httpclient = createSSLClientDefault(); + String resultString = ""; + CloseableHttpResponse response = null; + try { + + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + + // 创建http GET请求 + HttpGet httpGet = new HttpGet(uri); + //设置请求头 +// if (parameter != null) { +// //签名 +// httpGet.addHeader("Sign",parameter.getSign()); +// //用户ID +// httpGet.addHeader("User_ID",parameter.getUserId()+""); +// //用户角色ID +// httpGet.addHeader("User_RID",parameter.getRId()); +// //用户单位ID +// httpGet.addHeader("Dept_ID",parameter.getDeptId()+""); +// //用户科室ID +// httpGet.addHeader("Unit_ID",parameter.getUnitid()+""); +// httpGet.addHeader("CacheKey",parameter.getCacheKey()); +// httpGet.addHeader("Org_id", parameter.getOrg_id() + ""); +// httpGet.addHeader("Product_id", parameter.getProduct_id() + ""); +// httpGet.addHeader("Timestamp", parameter.getTimestamp()); +// } + + // 执行请求 + response = httpclient.execute(httpGet); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), + "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + /** + * 上传文件的doGet + * @param url + * @param param + * @param + * @return + */ + public static String doGet2(String url, Map param) { + + // 创建Httpclient对象 + CloseableHttpClient httpclient = createSSLClientDefault(); + String resultString = ""; + CloseableHttpResponse response = null; + try { + + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建http GET请求 + HttpGet httpGet = new HttpGet(uri); +// if (parameter != null) { +// //用户ID +// httpGet.addHeader("User_ID",parameter.getUserId()+""); +// //用户角色ID +// httpGet.addHeader("User_RID",parameter.getRId()); +// //用户单位ID +// httpGet.addHeader("Dept_ID",parameter.getDeptId()+""); +// //用户科室ID +// httpGet.addHeader("Unit_ID",parameter.getUnitid()+""); +// httpGet.addHeader("CacheKey",parameter.getCacheKey()); +// httpGet.addHeader("Org_id", parameter.getOrg_id()); +// httpGet.addHeader("Product_id", parameter.getProduct_id()); +// httpGet.addHeader("Sign", parameter.getSign()); +// httpGet.addHeader("requestCode", parameter.getRequestCode()); +// httpGet.addHeader("Content-Type", "application/json;charset=UTF-8"); +// httpGet.addHeader("Timestamp", parameter.getTimestamp()); +// } + // 执行请求 + response = httpclient.execute(httpGet); + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), + "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + public static String doGet2(String url) { + return doGet2(url, null); + + } + + public static String doGet4(String url, Map param) { + // 创建Httpclient对象 + //调用createSSLClientDefault + CloseableHttpClient httpclient = createSSLClientDefault(); + String resultString = ""; + CloseableHttpResponse response = null; + try { + + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + + // 创建http GET请求 + HttpGet httpGet = new HttpGet(uri); + //设置请求头 +// httpGet.addHeader(""); +// if (parameter != null) { +// //签名 +// httpGet.addHeader("Sign",parameter.getSign()); +// //用户ID +// httpGet.addHeader("User_ID",parameter.getUserId()+""); +// //用户角色ID +// httpGet.addHeader("User_RID",parameter.getRId()); +// //用户单位ID +// httpGet.addHeader("Dept_ID",parameter.getDeptId()+""); +// //用户科室ID +// httpGet.addHeader("Unit_ID",parameter.getUnitid()+""); +// httpGet.addHeader("CacheKey",parameter.getCacheKey()); +// httpGet.addHeader("Org_id", parameter.getOrg_id() + ""); +// httpGet.addHeader("Product_id", parameter.getProduct_id() + ""); +// httpGet.addHeader("Timestamp", parameter.getTimestamp()); +// } + + // 执行请求 + response = httpclient.execute(httpGet); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), + "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + public static String doGet5(String url, Map param) { + // 创建Httpclient对象 + //调用createSSLClientDefault + CloseableHttpClient httpclient = createSSLClientDefault(); + String resultString = ""; + CloseableHttpResponse response = null; + try { + + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + + // 创建http GET请求 + HttpGet httpGet = new HttpGet(uri); + //设置请求头 +// httpGet.addHeader(""); +// if (parameter != null) { +// httpGet.addHeader("Accept","application/json, text/javascript, */*; q=0.01"); +// httpGet.addHeader("Accept-Encoding","gzip, deflate, br"); +// httpGet.addHeader("Accept-Language","zh-CN,zh;q=0.9"); +// httpGet.addHeader("Connection","keep-alive"); + httpGet.addHeader("Cookie","PHPSESSID=b1epvn4gilmvlqd63gb71sgb4m"); +// httpGet.addHeader("Host","www.5577yc.com"); +// httpGet.addHeader("Referer","https://www.5577yc.com/pc/member/index.html"); +// httpGet.addHeader("Sec-Fetch-Mode","cors"); +// httpGet.addHeader("Sec-Fetch-Site","same-origin"); +// httpGet.addHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"); + httpGet.addHeader("X-Requested-With","XMLHttpRequest"); +// httpGet.addHeader("Org_id", parameter.getOrg_id() + ""); +// httpGet.addHeader("Product_id", parameter.getProduct_id() + ""); +// httpGet.addHeader("Timestamp", parameter.getTimestamp()); +// } + + // 执行请求 + response = httpclient.execute(httpGet); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + resultString = EntityUtils.toString(response.getEntity(), + "UTF-8"); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + public static String doGet5(String url) { + return doGet5(url, null); + + } + /*************************************Get**********************************************/ + + /*************************************Post**********************************************/ + /** + * 原始doPost 基本不用 + * @param url + * @param param + * @param + * @return + */ + public static String doPost(String url, Map param) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList); + httpPost.setEntity(entity); + } + // 执行http请求 + response = httpClient.execute(httpPost); + + + + + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + /** + * 项目经常用的doPost2 + * @param url + * @param param + * @param + * @return + */ + public static String doPost2(String url, Map param){ + + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(uri); + httpPost.setHeader("Content-type", "application/x-www-form-urlencoded"); +// httpPost.setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList,"UTF-8"); + entity.setContentEncoding("UTF-8"); + entity.setContentType("application/x-www-form-urlencoded"); + httpPost.setEntity(entity); + + } + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + /** + * .net登录post + * @param url + * @param param + * @param + * @return + */ + public static String doPost3(String url, Map param){ + + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(uri); + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList, Charset.forName("UTF-8")); + entity.setContentEncoding("UTF-8"); + httpPost.setEntity(entity); + } + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + + + /** + * 微信文件上传 + * @param url + * @param content + * @param fileName + * @return + */ + public static String doPost6(String url, byte[] content,String fileName){ + + String resultString = null; + //创建HttpClient + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + org.apache.http.entity.mime.MultipartEntityBuilder builder = org.apache.http.entity.mime.MultipartEntityBuilder.create(); + /*绑定文件参数,传入文件流和contenttype,此处也可以继续添加其他formdata参数*/ + builder.addBinaryBody("file",content, ContentType.MULTIPART_FORM_DATA,fileName); + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + HttpResponse response = null; + //执行提交 + try{ + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + HttpClientUtils.closeQuietly(httpClient); + HttpClientUtils.closeQuietly(response); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + + /** + * 微信公众号文件上传 + * @param url + * @param content + * @param fileName + * @return + */ + public static String doPost7(String url, byte[] content,String fileName){ + + String resultString = null; + //创建HttpClient + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + org.apache.http.entity.mime.MultipartEntityBuilder builder = org.apache.http.entity.mime.MultipartEntityBuilder.create(); + /*绑定文件参数,传入文件流和contenttype,此处也可以继续添加其他formdata参数*/ + builder.addBinaryBody("media",content, ContentType.MULTIPART_FORM_DATA,fileName); + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + HttpResponse response = null; + //执行提交 + try{ + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + HttpClientUtils.closeQuietly(httpClient); + HttpClientUtils.closeQuietly(response); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + /** + * 项目经常用的doPost4 + * @param url + * @param param + * @return + */ + public static String doPost4(String url, Map param){ + + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + StringBuffer cookie = new StringBuffer(); + Map map = new HashMap<>(); + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(uri); + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + httpPost.addHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList, Charset.forName("UTF-8")); + httpPost.setEntity(entity); + } + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return resultString; + } + + + /** + * 项目经常用的doPost4 + * @param url + * @param param + * @param parameter + * @return + */ + public static String doPost5(String url, Map param,String parameter){ + + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + StringBuffer cookie = new StringBuffer(); + Map map = new HashMap<>(); + try { + // 创建uri + CookieStore cookieStore = new BasicCookieStore(); + httpClient = HttpClients.custom().setDefaultCookieStore(cookieStore).build(); + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(uri); + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + httpPost.addHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); + httpPost.addHeader("Host","www.www7945.com"); + httpPost.addHeader("Origin","https://www.www7945.com"); + httpPost.addHeader("Referer","https://www.www7945.com/mobile/"); + httpPost.addHeader("User-Agent:","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"); + httpPost.addHeader("Connection","keep-alive"); + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList, Charset.forName("UTF-8")); + entity.setContentEncoding("UTF-8"); + httpPost.setEntity(entity); + } + if(parameter!=null){ + httpPost.addHeader("Cookie",parameter); + } + // 执行http请求 + response = httpClient.execute(httpPost); + String tokenStr = null; + + if (response != null) { + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode == HttpStatus.SC_OK) { + // 获得Cookies + List cookies = cookieStore.getCookies(); + for (org.apache.http.cookie.Cookie c : cookies) { + cookie.append(c.getName()).append("=").append(c.getValue()).append(";"); + if (c.getName().contains("token")) { + tokenStr = c.getValue(); + } + } + } + } + map.put("token",tokenStr); + map.put("cookie",cookie.toString()); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + map.put("resultString",JSON.parse(resultString)); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if(parameter!=null){ + return resultString; + } + return JSON.toJSONString(map); + } + + + + public static String doPost5(String url) { + return doPost5(url, null,null); + } + + public static String doPost4(String url) { + return doPost4(url, null); + } + + public static String doPost2(String url) { + return doPost2(url); + } + + + public static String doPost(String url) { + return doPost(url, null); + } + + /** + * 当数据需要以JSON格式传输 + * @param url + * @param json + * @param + * @return + */ + public static String doPostJson(String url, String json) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + // 创建请求内容 + StringEntity entity = new StringEntity(json, + ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return resultString; + } + + + public static String doPostJson3(String url, String json) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + // 创建请求内容 + StringEntity entity = new StringEntity(json, + ContentType.APPLICATION_FORM_URLENCODED); + httpPost.setEntity(entity); + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return resultString; + } + + /** + * 文件上传 + * @param url + * @param json + * @param + * @return + */ + public static String doPostJson2(String url, String json) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + try { + // 创建Http Post请求 + HttpPost httpPost = new HttpPost(url); + // 创建请求内容 + StringEntity entity = new StringEntity(json, + ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + /*************************************Post**********************************************/ + + + + + + + + + /*************************************Delete**********************************************/ + /** + * 原始删除 基本不怎么用 + * @param url + * @return + */ + public static String doDelete(String url) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建Http Post请求 + HttpDelete httpPost = new HttpDelete(url); + // 执行http请求 + response = httpClient.execute(httpPost); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + /** + * 常用删除 + * @param url + * @param param + * @param + * @return + */ + public static String doDelete2(String url,Map param) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Delete请求 + HttpDelete httpDelete = new HttpDelete(uri); + // 执行http请求 + response = httpClient.execute(httpDelete); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + /** + * 上传文件删除 + * @param url + * @param param + * @param + * @return + */ + public static String doDelete3(String url,Map param) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Delete请求 + HttpDelete httpDelete = new HttpDelete(uri); + // 执行http请求 + response = httpClient.execute(httpDelete); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return resultString; + } + + /*************************************Delete**********************************************/ + + + + + + + + + + /*************************************Put**********************************************/ + public static String doPut(String url) { + return doPut(url, null); + } + + /** + * 修改 + * @param url + * @param param + * @param + * @return + */ + public static String doPut(String url, Map param) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + + try { + // 创建uri + URIBuilder builder = new URIBuilder(url); + if (param != null) { + for (String key : param.keySet()) { + builder.addParameter(key, param.get(key)); + } + } + URI uri = builder.build(); + // 创建Http Put请求 + HttpPut httpPut = new HttpPut(uri); + // 创建参数列表 + if (param != null) { + List paramList = new ArrayList<>(); + for (String key : param.keySet()) { + paramList.add(new BasicNameValuePair(key, param.get(key))); + } + // 模拟表单 + UrlEncodedFormEntity entity = new UrlEncodedFormEntity( + paramList, Charset.forName("UTF-8"));//Charset.forName("UTF-8")解决乱码 + entity.setContentEncoding("UTF-8"); + httpPut.setEntity(entity); + } + // 执行http请求 + response = httpClient.execute(httpPut); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return resultString; + } + + /** + * 以JSON格式修改 + * @param url + * @param json + * @param parameter + * @return + */ + public static String doPutJson(String url, String json) { + // 创建Httpclient对象 + CloseableHttpClient httpClient = createSSLClientDefault(); + CloseableHttpResponse response = null; + String resultString = ""; + try { + // 创建Http Post请求 + HttpPut httpPut = new HttpPut(url); + // 创建请求内容 + StringEntity entity = new StringEntity(json, + ContentType.APPLICATION_JSON); + httpPut.setEntity(entity); + // 执行http请求 + response = httpClient.execute(httpPut); + resultString = EntityUtils.toString(response.getEntity(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + response.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return resultString; + } + + + +} + diff --git a/module-common/src/main/java/org/jeecg/api/bean/PageBean.java b/module-common/src/main/java/org/jeecg/api/bean/PageBean.java new file mode 100644 index 0000000..ce83d4f --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/bean/PageBean.java @@ -0,0 +1,20 @@ +package org.jeecg.api.bean; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PageBean { + + /**显示条数*/ + @ApiModelProperty(value = "显示条数" ) + private Integer pageSize; + /**当前页*/ + @ApiModelProperty(value = "当前页" ) + private Integer pageNo; + + public PageBean() { + this.pageNo = 1; + this.pageSize = 1000; + } +} diff --git a/module-common/src/main/java/org/jeecg/api/bean/WxQrCodeVo.java b/module-common/src/main/java/org/jeecg/api/bean/WxQrCodeVo.java new file mode 100644 index 0000000..e8aff14 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/bean/WxQrCodeVo.java @@ -0,0 +1,14 @@ +package org.jeecg.api.bean; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WxQrCodeVo { + /**图片地址*/ + @ApiModelProperty(value = "图片地址") + private String url; + + @ApiModelProperty(value = "加油站名称") + private String name; +} diff --git a/module-common/src/main/java/org/jeecg/api/controller/AppletIndexController.java b/module-common/src/main/java/org/jeecg/api/controller/AppletIndexController.java new file mode 100644 index 0000000..c892ffb --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/controller/AppletIndexController.java @@ -0,0 +1,217 @@ +package org.jeecg.api.controller; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.api.bean.PageBean; +import org.jeecg.api.service.AppletIndexService; +import org.jeecg.common.api.vo.Result; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 集中所有登录接口 + */ + +@Api(tags="珠宝项目-首页接口") +@RestController +@RequestMapping("/index_common") +@Slf4j +public class AppletIndexController { + + + + @Resource + private AppletIndexService apiRiceService; + + + //获取首页轮播图 + @ApiOperation(value="获取首页轮播图", notes="获取首页轮播图") + @GetMapping(value = "/getRiceBanner") + public Result> getRiceBanner() { + return apiRiceService.getRiceBanner(); + } + + //获取首页公告列表 + @ApiOperation(value="获取首页公告列表", notes="获取首页公告列表") + @GetMapping(value = "/getRiceNoticeList") + public Result> getRiceNoticeList() { + return apiRiceService.getRiceNoticeList(); + } + + + + + + //获取会员信息 + @ApiOperation(value="获取会员信息", notes="获取会员信息") + @GetMapping(value = "/getVipInfoList") + public Result> getVipInfoList(){ + return apiRiceService.getVipInfoList(); + } + + + + + + + + + + //获取首页跳转图标 + @ApiOperation(value="获取首页跳转图标", notes="获取首页跳转图标") + @GetMapping(value = "/getRiceIconList") + public Result> getRiceIconList() { + return apiRiceService.getRiceIconList(); + } + + + + + //获取首页广告列表 + @ApiOperation(value="获取首页广告列表", notes="获取首页广告列表") + @GetMapping(value = "/getRiceAdList") + public Result> getRiceAdList(PageBean pageBean) { + return apiRiceService.getRiceAdList(pageBean); + } + + + + + + + //获取分类分页商品列表接口 + @ApiOperation(value="获取分类分页商品列表接口", notes="获取分类分页商品列表接口") + @GetMapping(value = "/getClassShopPageList") + public Result> getClassShopPageList(PageBean pageBean, String classId) { + return apiRiceService.getClassShopPageList(pageBean,classId); + } + + + + //获取首页商品详情 + @ApiOperation(value="获取首页商品详情", notes="获取首页商品详情") + @GetMapping(value = "/getRiceProductDetail") + public Result> getRiceProductDetail(String id) { + return apiRiceService.getRiceProductDetail(id); + } + + //获取首页新闻列表 + @ApiOperation(value="获取首页新闻列表", notes="获取首页新闻列表") + @GetMapping(value = "/getRiceNewsList") + public Result> getRiceNewsList() { + return apiRiceService.getRiceNewsList(); + } + + + + + + + + + + + + + + + + + + //加入购物车 传入token shopId num + @ApiOperation(value="加入购物车 传入token shopId num", notes="加入购物车 传入token shopId num") + @GetMapping(value = "/addCart") + public Result> addCart(@RequestHeader("X-Access-Token") String token, String shopId, Integer num){ + return apiRiceService.addCart(token,shopId,num); + } + + + //删除购物车信息 + @ApiOperation(value="删除购物车信息", notes="删除购物车信息") + @DeleteMapping(value = "/deleteCart") + public Result> deleteCart(@RequestHeader("X-Access-Token") String token,String ids){ + return apiRiceService.deleteCart(token,ids); + } + + + //修改购物车信息数量 + @ApiOperation(value="修改购物车信息数量", notes="修改购物车信息数量") + @PostMapping(value = "/updateCartNum") + public Result> updateCartNum(@RequestHeader("X-Access-Token") String token,String id,Integer num){ + return apiRiceService.updateCartNum(token,id,num); + } + + + + //查询分类接口 + @ApiOperation(value="查询分类接口", notes="查询分类接口") + @GetMapping(value = "/getCategoryList") + private Result> getCategoryList(){ + return apiRiceService.getCategoryList(); + } + + + + + + + + + //创建订单 + @ApiOperation(value="创建订单", notes="创建订单") + @GetMapping(value = "/createOrder") + public Result> createOrder(@RequestHeader("X-Access-Token") String token, String shopId, Integer num,String addressId) { + return apiRiceService.createOrder(token,shopId,num,addressId); + } + + + //创建订单 + @ApiOperation(value="创建订单-再次支付", notes="创建订单-再次支付") + @GetMapping(value = "/createOrderTwo") + public Result> createOrderTwo(@RequestHeader("X-Access-Token") String token,String orderId) { + return apiRiceService.createOrderTwo(token,orderId); + } + + + //商城-加入购物车之后一次下多个订单 + @ApiOperation(value="商城-加入购物车之后一次下多个订单", notes="商城-加入购物车之后一次下多个订单") + @PostMapping("/createSumOrder") + public Result> createSumOrder(@RequestHeader("X-Access-Token") String token,String list,String addressId){ + return apiRiceService.createSumOrder(token,list,addressId); + } + + + + //商城-加入购物车之后一次下多个订单 - 再次下单 + @ApiOperation(value="商城-加入购物车之后一次下多个订单 - 再次下单", notes="商城-加入购物车之后一次下多个订单 - 再次下单") + @PostMapping("/createSumOrderAgain") + public Result> createSumOrderAgain(@RequestHeader("X-Access-Token") String token,String orderId){ + return apiRiceService.createSumOrderAgain(token,orderId); + } + + + + + + @PostMapping("/payNotify") + public Object payNotify(@RequestBody String requestBody){ + return apiRiceService.payNotify(requestBody); + } + + + + //确认收货 + @ApiOperation(value="确认收货", notes="确认收货") + @GetMapping(value = "/confirmOrder") + public Result> confirmOrder(@RequestHeader("X-Access-Token") String token,String orderId) { + return apiRiceService.confirmOrder(token,orderId); + } + + + + + +} diff --git a/module-common/src/main/java/org/jeecg/api/controller/AppletInfoController.java b/module-common/src/main/java/org/jeecg/api/controller/AppletInfoController.java new file mode 100644 index 0000000..944802c --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/controller/AppletInfoController.java @@ -0,0 +1,156 @@ +package org.jeecg.api.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.api.bean.PageBean; +import org.jeecg.api.service.AppletIndexService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.commonAddress.entity.CommonAddress; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; + +@Api(tags="珠宝项目-个人中心接口") +@RestController +@RequestMapping("/info_common") +@Slf4j +public class AppletInfoController { + + + @Resource + private AppletIndexService apiRiceService; + + //获取优惠券信息 + @ApiOperation(value="获取优惠券信息", notes="获取优惠券信息") + @GetMapping(value = "/getRiceCouponList") + public Result> getRiceCouponList(@RequestHeader("X-Access-Token") String token,PageBean pageBean) { + return apiRiceService.getRiceCouponList(token,pageBean); + } + + + //获取流水记录带分页 + @ApiOperation(value="获取流水记录带分页", notes="获取流水记录带分页") + @GetMapping(value = "/getWaterPageList") + public Result> getWaterPageList(@RequestHeader("X-Access-Token") String token, PageBean pageBean){ + return apiRiceService.getWaterPageList(token,pageBean); + } + + //获取订单列表带分页 + @ApiOperation(value="获取订单列表带分页", notes="获取订单列表带分页") + @GetMapping(value = "/getOrderPageList") + public Result> getOrderPageList(@RequestHeader("X-Access-Token") String token, PageBean pageBean,Integer state){ + return apiRiceService.getOrderPageList(token,pageBean,state); + } + + + + //获取订单详情 + @ApiOperation(value="获取订单详情", notes="获取订单详情") + @GetMapping(value = "/getOrderDetail") + public Result> getOrderDetail(@RequestHeader("X-Access-Token") String token,String id){ + return apiRiceService.getOrderDetail(token,id); + } + + + + + + + + + //获取地址列表带分页 + @ApiOperation(value="获取地址列表带分页", notes="获取地址列表带分页") + @GetMapping(value = "/getAddressPageList") + public Result> getAddressPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ + return apiRiceService.getAddressPageList(token,pageBean); + } + + //获取粉丝列表带分页 + @ApiOperation(value="获取粉丝列表带分页", notes="获取粉丝列表带分页") + @GetMapping(value = "/getFansPageList") + public Result> getFansPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean,String title){ + return apiRiceService.getFansPageList(token,pageBean,title); + } + + //获取个人邀请码 + @ApiOperation(value="获取个人邀请码", notes="获取个人邀请码") + @GetMapping(value = "/getInviteCode") + public Result> getInviteCode(@RequestHeader("X-Access-Token") String token){ + return apiRiceService.getInviteCode(token); + } + + //获取购物车信息列表带分页 + @ApiOperation(value="获取购物车信息列表带分页", notes="获取购物车信息列表带分页") + @GetMapping(value = "/getCartPageList") + public Result> getCartPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ + return apiRiceService.getCartPageList(token,pageBean); + } + + + //获取相关介绍 + @ApiOperation(value="获取相关介绍", notes="获取相关介绍") + @GetMapping(value = "/getInfoIntroduce") + public Result> getInfoIntroduce(String type){ + return apiRiceService.getInfoIntroduce(type); + } + + + + //增加或修改地址信息 + @ApiOperation(value="增加或修改地址信息", notes="增加或修改地址信息") + @PostMapping(value = "/addOrUpdateAddress") + public Result> addOrUpdateAddress(@RequestHeader("X-Access-Token") String token, CommonAddress commonAddress){ + return apiRiceService.addOrUpdateAddress(token,commonAddress); + } + + + + //删除地址 + @ApiOperation(value="删除地址", notes="删除地址") + @GetMapping(value = "/deleteAddress") + public Result> deleteAddress(@RequestHeader("X-Access-Token") String token,String id){ + return apiRiceService.deleteAddress(token,id); + } + + + //修改默认地址 + @ApiOperation(value="修改默认地址", notes="修改默认地址") + @GetMapping(value = "/updateDefaultAddress") + public Result> updateDefaultAddress(@RequestHeader("X-Access-Token") String token,String id){ + return apiRiceService.updateDefaultAddress(token,id); + } + + + + //查询个人信息相关 + @ApiOperation(value="查询个人信息相关", notes="查询个人信息相关") + @GetMapping(value = "/getRiceInfo") + public Result> getRiceInfo(String token){ + return apiRiceService.getRiceInfo(token); + } + + + + //充值 + @ApiOperation(value="充值", notes="充值") + @GetMapping(value = "/recharge") + public Result> recharge(@RequestHeader("X-Access-Token") String token, BigDecimal money){ + return apiRiceService.recharge(token,money); + } + + + + + + //提现 + @ApiOperation(value="提现", notes="提现") + @GetMapping(value = "/withdraw") + public Result> withdraw(@RequestHeader("X-Access-Token") String token,BigDecimal money,String bankName,String bankNo){ + return apiRiceService.withdraw(token,money,bankName,bankNo); + } + + + +} diff --git a/module-common/src/main/java/org/jeecg/api/controller/AppletLoginController.java b/module-common/src/main/java/org/jeecg/api/controller/AppletLoginController.java index 4f00a29..19d8df9 100644 --- a/module-common/src/main/java/org/jeecg/api/controller/AppletLoginController.java +++ b/module-common/src/main/java/org/jeecg/api/controller/AppletLoginController.java @@ -34,6 +34,13 @@ public class AppletLoginController { + //绑定手机号码 + @ApiOperation(value="绑定手机号码", notes="绑定手机号码") + @GetMapping(value = "/bindPhone") + public Result bindPhone(String phoneCode){ + return appletLoginService.bindPhone(phoneCode); + } + diff --git a/module-common/src/main/java/org/jeecg/api/controller/AppletMyInfoController.java b/module-common/src/main/java/org/jeecg/api/controller/AppletMyInfoController.java index c5bab1c..2910b55 100644 --- a/module-common/src/main/java/org/jeecg/api/controller/AppletMyInfoController.java +++ b/module-common/src/main/java/org/jeecg/api/controller/AppletMyInfoController.java @@ -22,18 +22,18 @@ public class AppletMyInfoController { //权限验证 @Resource private ShiroRealm shiroRealm; - //修改个人信息 @PostMapping(value = "/updateInfo") @ApiOperation(value="修改个人信息", notes="修改个人信息") - public Result> updateInfo(@RequestHeader("X-Access-Token") String token, String nickName, String avatarUrl){ + public Result> updateInfo(@RequestHeader("X-Access-Token") String token, String nickName, String avatarUrl,String phone){ HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); HanHaiMember member = new HanHaiMember(); member.setId(hanHaiMember.getId()); member.setNickName(nickName); member.setHeadImage(avatarUrl); - hanHaiMemberService.updateById(member); - return Result.ok("修改成功"); + member.setPhone(phone); + hanHaiMemberService.updateById(member); + return Result.ok("修改成功"); } //获取个人信息 diff --git a/module-common/src/main/java/org/jeecg/api/service/AppletIndexService.java b/module-common/src/main/java/org/jeecg/api/service/AppletIndexService.java new file mode 100644 index 0000000..e119011 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/service/AppletIndexService.java @@ -0,0 +1,131 @@ +package org.jeecg.api.service; + +import org.jeecg.api.bean.PageBean; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.commonAddress.entity.CommonAddress; +import org.springframework.web.bind.annotation.RequestHeader; + +import java.math.BigDecimal; + +public interface AppletIndexService { + + + + //获取首页轮播图 + Result> getRiceBanner(); + + //获取首页公告列表 + Result> getRiceNoticeList(); + + //获取首页跳转图标 + Result> getRiceIconList(); + + + //获取会员信息 + Result> getVipInfoList(); + + //获取首页广告列表 + Result> getRiceAdList(PageBean pageBean); + + + //获取首页商品详情 + Result> getRiceProductDetail(String id); + + //获取首页新闻列表 + Result> getRiceNewsList(); + + + + + //创建订单 + Result> createOrder(String token,String shopId,Integer num,String addressId); + + + //再次支付 + Result> createOrderTwo(String token,String orderId); + + + //商城-立即购买多少商品 + Result> createSumOrder(String token,String list,String addressId); + + //商城-加入购物车之后一次下多个订单 - 再次下单 + Result> createSumOrderAgain(String token,String orderId); + + + //商城-支付回调 + Object payNotify(String requestBody); + + + //加入购物车 + Result> addCart(String token,String shopId,Integer num); + + //删除购物车信息 + Result> deleteCart(String token,String ids); + + //修改购物车信息数量 + Result> updateCartNum(String token,String id,Integer num); + + + Result> getClassShopPageList(PageBean pageBean, String classId); + + //获取优惠券信息列表 + Result> getRiceCouponList(String token, PageBean pageBean); + + + //获取流水记录带分页 + Result> getWaterPageList(String token,PageBean pageBean); + + //获取订单列表带分页 + Result> getOrderPageList(String token, PageBean pageBean,Integer state); + + //获取订单详情 + Result> getOrderDetail(String token, String id); + + //获取粉丝列表带分页 + Result> getFansPageList(String token,PageBean pageBean,String title); + + //获取购物车信息列表带分页 + Result> getCartPageList(String token,PageBean pageBean); + + //获取地址列表带分页 + Result> getAddressPageList(String token,PageBean pageBean); + + //获取个人邀请码 + Result> getInviteCode(String token); + + //获取相关介绍 + Result> getInfoIntroduce(String type); + + //查询分类的接口 + Result> getCategoryList(); + + //增加或者修改地址 + Result> addOrUpdateAddress(String token, CommonAddress commonAddress); + + //删除地址 + Result> deleteAddress(String token,String id); + + //修改默认地址 + Result> updateDefaultAddress(String token,String id); + + + //查询个人信息相关 + Result> getRiceInfo(String token); + + + //充值 + Result> recharge(String token, BigDecimal money); + + //提现 + Result> withdraw(String token,BigDecimal money,String bankName,String bankNo); + + + //确认收货 + Result> confirmOrder(String token,String orderId); + + + + + + +} diff --git a/module-common/src/main/java/org/jeecg/api/service/AppletLoginService.java b/module-common/src/main/java/org/jeecg/api/service/AppletLoginService.java index b0dfac4..092c7e3 100644 --- a/module-common/src/main/java/org/jeecg/api/service/AppletLoginService.java +++ b/module-common/src/main/java/org/jeecg/api/service/AppletLoginService.java @@ -18,10 +18,10 @@ public interface AppletLoginService { Result appletLogin(LoginReq loginReq); -// /** -// * 微信小程序登录绑定手机号码接口 -// * @param loginReq -// * @return -// */ -// Result bindPhone(LoginReq loginReq); + /** + * 微信小程序登录绑定手机号码接口 + * @param code + * @return + */ + Result bindPhone(String code); } diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java new file mode 100644 index 0000000..5e6e8e1 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java @@ -0,0 +1,1500 @@ +package org.jeecg.api.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.jeecg.api.bean.HttpClientUtil; +import org.jeecg.api.bean.PageBean; +import org.jeecg.api.bean.WxQrCodeVo; +import org.jeecg.api.service.AppletIndexService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.config.shiro.ShiroRealm; +import org.jeecg.modules.commonAddress.entity.CommonAddress; +import org.jeecg.modules.commonAddress.service.ICommonAddressService; +import org.jeecg.modules.commonBanner.entity.CommonBanner; +import org.jeecg.modules.commonBanner.service.ICommonBannerService; +import org.jeecg.modules.commonCat.entity.CommonCat; +import org.jeecg.modules.commonCat.service.ICommonCatService; +import org.jeecg.modules.commonClass.entity.CommonClass; +import org.jeecg.modules.commonClass.service.ICommonClassService; +import org.jeecg.modules.commonConfig.entity.CommonConfig; +import org.jeecg.modules.commonConfig.service.ICommonConfigService; +import org.jeecg.modules.commonCoupon.entity.CommonCoupon; +import org.jeecg.modules.commonCoupon.service.ICommonCouponService; +import org.jeecg.modules.commonIcon.entity.CommonIcon; +import org.jeecg.modules.commonIcon.service.ICommonIconService; +import org.jeecg.modules.commonIconImage.entity.CommonIconImage; +import org.jeecg.modules.commonIconImage.service.ICommonIconImageService; +import org.jeecg.modules.commonMoney.entity.CommonMoney; +import org.jeecg.modules.commonMoney.service.ICommonMoneyService; +import org.jeecg.modules.commonMoneyLog.entity.CommonMoneyLog; +import org.jeecg.modules.commonMoneyLog.service.ICommonMoneyLogService; +import org.jeecg.modules.commonNews.entity.CommonNews; +import org.jeecg.modules.commonNews.service.ICommonNewsService; +import org.jeecg.modules.commonNotice.entity.CommonNotice; +import org.jeecg.modules.commonNotice.service.ICommonNoticeService; +import org.jeecg.modules.commonOrder.entity.CommonOrder; +import org.jeecg.modules.commonOrder.service.ICommonOrderService; +import org.jeecg.modules.commonOrderSku.entity.CommonOrderSku; +import org.jeecg.modules.commonOrderSku.service.ICommonOrderSkuService; +import org.jeecg.modules.commonShop.entity.CommonShop; +import org.jeecg.modules.commonShop.service.ICommonShopService; +import org.jeecg.modules.commonVip.entity.CommonVip; +import org.jeecg.modules.commonVip.service.ICommonVipService; +import org.jeecg.modules.commonVipConfig.entity.CommonVipConfig; +import org.jeecg.modules.commonVipConfig.service.ICommonVipConfigService; +import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; +import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; +import org.jeecg.modules.pay.MpWxPayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.io.*; +import java.math.BigDecimal; +import java.util.*; + +@Slf4j +@Service +public class AppletIndexServiceImpl implements AppletIndexService { + + + @Resource + private ICommonAddressService commonAddressService; + @Resource + private ICommonBannerService commonBannerService; + @Resource + private ICommonCatService commonCatService; + @Resource + private ICommonClassService commonClassService; + @Resource + private ICommonConfigService commonConfigService; + @Resource + private ICommonMoneyService commonMoneyService; + @Resource + private ICommonIconImageService commonIconImageService; + @Resource + private ICommonMoneyLogService commonMoneyLogService; + @Resource + private ICommonNewsService commonNewsService; + @Resource + private ICommonNoticeService commonNoticeService; + @Resource + private ICommonOrderService commonOrderService; + @Resource + private ICommonOrderSkuService commonOrderSkuService; + @Resource + private ICommonShopService commonShopService; + + @Resource + private IHanHaiMemberService hanHaiMemberService; + + @Resource + private ICommonVipConfigService commonVipConfigService; + //权限配置 + @Resource + private ShiroRealm shiroRealm; + //支付接口 + @Autowired + private MpWxPayService mpWxPayService; + //首页广告 + @Resource + private ICommonIconService commonIconService; + @Resource + private ICommonCouponService commonCouponService; + + @Resource + private ICommonVipService commonVipService; + + + + + + + + //获取首页轮播图 + @Override + public Result> getRiceBanner() { + List list = commonBannerService.list(); + return Result.OK(list); + } + //获取首页公告列表 + @Override + public Result> getRiceNoticeList(){ + CommonNotice commonNotice = commonNoticeService.list().get(0); + return Result.OK(commonNotice); + } + + + + //获取会员信息 + @Override + public Result> getVipInfoList(){ + List list = commonVipService.list(); + return Result.OK(list); + } + + //获取首页跳转图标 + + @Override + public Result> getRiceIconList() { + List list = commonIconImageService + .lambdaQuery() + .orderByDesc(CommonIconImage::getSort) + .list(); + return Result.OK(list); + } + + + //获取首页广告列表 + @Override + public Result> getRiceAdList(PageBean pageBean){ + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + Page page1 = commonIconService.page(page); + return Result.OK(page1); + } + + + @Override + public Result> getClassShopPageList(PageBean pageBean, String classId){ + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + Page page1 = commonShopService.page(page); + //如果分类标识不为空 + if(classId!=null){ + IPage pageList = + commonShopService.lambdaQuery() + .eq(CommonShop::getClassId,classId) + .eq(CommonShop::getType,2) + .orderByDesc(CommonShop::getCreateTime) + .page(page); + return Result.OK(pageList); + } + return Result.OK(page1); + } + + + + + //获取优惠券信息列表 + @Override + public Result> getRiceCouponList(String token, PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + Page page1 = commonCouponService + .lambdaQuery() + .eq(CommonCoupon::getUserId,hanHaiMember.getId()) + .page(page); + return Result.OK(hanHaiMember); + } + + + //获取首页商品详情 + @Override + public Result> getRiceProductDetail(String id){ + CommonShop byId = commonShopService.getById(id); + return Result.OK(byId); + } + + //获取首页新闻列表 + + @Override + public Result> getRiceNewsList(){ + int pageNo = 1; + int pageSize = 10; + Page page = new Page(pageNo, pageSize); + Page page1 = commonNewsService.page(page); + return Result.OK(page1); + } + + + + //再次支付 + @Override + @Transactional + public Result> createOrderTwo(String token,String orderId){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //查询订单是否存在 + CommonOrder commonOrder = commonOrderService.getById(orderId); + if (commonOrder==null){ + return Result.error("订单不存在"); + } + if (commonOrder.getState()==1){ + return Result.error("订单已支付"); + } + //查询订单是否shopState不等于2 + if (commonOrder.getShopState()==2){ + return Result.error("非首页订单"); + } + + //根据配置列表查询每人限制数量 + CommonConfig commonConfig = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"pay_num") + .one(); + //得到配置的数值转为int类型 + int payNum = Integer.parseInt(commonConfig.getKeyContent()); + //根据商品信息是否是体验装进行判断 + if (commonOrder.getShopState()==0){ + //查询用户是否存在该订单 + List byUserIdAndShopId = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .eq(CommonOrder::getShopId,commonOrder.getShopId()) + .eq(CommonOrder::getShopState,0) + .eq(CommonOrder::getState,1) + .list(); + if (byUserIdAndShopId.size()+1>payNum){ + Result result = new Result(); + result.setMessage("已超过体验商品购买次数限制!请勿重复购买"); + result.setCode(901); + return result; + } + + //查询用户是否存在该订单 + List payNumList = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .eq(CommonOrder::getShopId,commonOrder.getShopId()) + .eq(CommonOrder::getShopState,0) + .eq(CommonOrder::getState,0) + .list(); + if (payNumList.size()>1){ + Result result = new Result(); + result.setMessage("您有相同订单未付款!请先付款"); + result.setCode(901); + return result; + } + } + + + + + //创建订单标识 + String newOrderId = IdWorker.getIdStr(); + //老的订单数据复制给新创建的订单对象 + CommonOrder commonOrder1 = new CommonOrder(); + commonOrder1.setId(newOrderId); + commonOrder1.setShopState(0); + commonOrder1.setUserId(hanHaiMember.getId()); + commonOrder1.setTitle(commonOrder.getTitle()); + commonOrder1.setImage(commonOrder.getImage()); + commonOrder1.setPrice(commonOrder.getPrice()); + commonOrder1.setNum(commonOrder.getNum()); + commonOrder1.setShopId(commonOrder.getShopId()); + commonOrder1.setPayNo(commonOrder.getPayNo()); + commonOrder1.setAddressId(commonOrder.getAddressId()); + commonOrder1.setAddressDetails(commonOrder.getAddressDetails()); + commonOrder1.setAddress(commonOrder.getAddress()); + commonOrder1.setState(0); + commonOrder1.setName(commonOrder.getName()); + commonOrder1.setPhone(commonOrder.getPhone()); + commonOrder1.setSku(commonOrder.getSku()); + commonOrder1.setCreateTime(new Date()); + commonOrderService.save(commonOrder1); + + + + + + + + + + //根据订单标识查询订单详情对象 + CommonOrderSku commonOrderSku = new CommonOrderSku(); + commonOrderSku.setOrderId(newOrderId); + commonOrderSku.setUserId(hanHaiMember.getId()); + commonOrderSku.setTitle(commonOrder.getTitle()); + commonOrderSku.setImage(commonOrder.getImage()); + commonOrderSku.setPrice(commonOrder.getPrice()); + commonOrderSku.setNum(commonOrder.getNum()); + commonOrderSku.setShopId(commonOrder.getShopId()); + commonOrderSku.setSku(commonOrder.getSku()); + commonOrderSku.setCreateTime(new Date()); + commonOrderSkuService.save(commonOrderSku); + + //删除原订单 + commonOrderService.removeById(orderId); + //查询订单关联的订单详情 + CommonOrderSku one = commonOrderSkuService.lambdaQuery().eq(CommonOrderSku::getOrderId, orderId) + .one(); + //删除该订单详情 + commonOrderSkuService.removeById(one); + + + + //吊起微信支付 + String s = commonOrder1.getPrice().multiply(new BigDecimal(100)).toString(); + int i1 = Double.valueOf(s).intValue(); + Object appOrder = mpWxPayService.createOrder( + "购买"+ commonOrder1.getTitle() , + "127.0.0.1", + orderId, + i1, + orderId, + hanHaiMember.getAppletOpenid(), + commonOrder.toString()); + + return Result.OK("支付成功",appOrder); + } + + //创建订单 + @Override + public Result> createOrder(String token,String shopId,Integer num,String addressId) { + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //商品标识不能为空 + if (shopId==null){ + return Result.error("商品标识不能为空"); + } + //数量不能为空 + if (num==null){ + return Result.error("数量不能为空"); + } + //查询商品信息 + CommonShop commonShop = commonShopService.getById(shopId); + //商品不能为空 + if (commonShop==null){ + return Result.error("商品不存在"); + } + //地址标识不能为空 + if (addressId==null){ + return Result.error("地址标识不能为空"); + } + //查询地址是否存在 + CommonAddress commonAddress = commonAddressService.getById(addressId); + if (commonAddress==null){ + return Result.error("地址不存在"); + } + + + //根据配置列表查询每人限制数量 + CommonConfig commonConfig = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"pay_num") + .one(); + //得到配置的数值转为int类型 + int payNum = Integer.parseInt(commonConfig.getKeyContent()); + //根据商品信息是否是体验装进行判断 + if (commonShop.getType()==0){ + //查询用户是否存在该订单 + List byUserIdAndShopId = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .eq(CommonOrder::getShopId,shopId) + .eq(CommonOrder::getShopState,0) + .eq(CommonOrder::getState,1) + .list(); + if (byUserIdAndShopId.size()+1>payNum){ + Result result = new Result(); + result.setMessage("已超过体验商品购买次数限制!请勿重复购买"); + result.setCode(901); + return result; + } + + //查询用户是否存在该订单 + List payNumList = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .eq(CommonOrder::getShopId,shopId) + .eq(CommonOrder::getShopState,0) + .eq(CommonOrder::getState,0) + .list(); + if (payNumList.size()>0){ + Result result = new Result(); + result.setMessage("已超过体验商品购买次数限制!请勿重复购买"); + result.setCode(901); + return result; + } + } + + + //创建订单标识 + String orderId = IdWorker.getIdStr(); + //创建订单 + BigDecimal price = commonShop.getPrice().multiply(new BigDecimal(num)); + + //生成订单信息 + CommonOrder commonOrder = new CommonOrder(); + + commonOrder.setId(orderId); + commonOrder.setTitle(commonShop.getTitle()); + commonOrder.setShopId(commonShop.getId()); + commonOrder.setImage(commonShop.getImage()); + commonOrder.setState(0); + commonOrder.setPrice(price); + commonOrder.setNum(num); + commonOrder.setSku(commonShop.getSku()); + commonOrder.setName(commonAddress.getName()); + commonOrder.setPhone(commonAddress.getPhone()); + commonOrder.setAddress(commonAddress.getAddress()); + commonOrder.setAddressDetails(commonAddress.getAddressDetails()); + + commonOrder.setUserId(hanHaiMember.getId()); + commonOrder.setAddressId(addressId); + commonOrder.setShopState(commonShop.getType()); + commonOrderService.save(commonOrder); + + //创建订单详情 + CommonOrderSku commonOrderSku = new CommonOrderSku(); + commonOrderSku.setOrderId(orderId); + commonOrderSku.setShopId(commonShop.getId()); + commonOrderSku.setTitle(commonShop.getTitle()); + commonOrderSku.setImage(commonShop.getImage()); + commonOrderSku.setPrice(price); + commonOrderSku.setNum(num); + commonOrderSku.setSku(commonShop.getSku()); + commonOrderSku.setCreateTime(new Date()); + commonOrderSkuService.save(commonOrderSku); + + //吊起微信支付 + String s = price.multiply(new BigDecimal(100)).toString(); + int i1 = Double.valueOf(s).intValue(); + Object appOrder = mpWxPayService.createOrder( + "购买"+ commonShop.getTitle() , + "127.0.0.1", + orderId, + i1, + orderId, + hanHaiMember.getAppletOpenid(), + commonOrder.toString()); + + return Result.OK("支付成功",appOrder); + } + + + //商城-立即购买多少商品 + @Override + public Result> createSumOrder(String token,String list,String addressId){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //用户地址不能为空 + if(StringUtils.isBlank(addressId)){ + return Result.error("请选择收货地址"); + } + //查询地址是否存在 + CommonAddress commonAddress = commonAddressService.getById(addressId); + if (commonAddress==null){ + return Result.error("地址不存在"); + } + //把list转为对象 list = [{"shopId":"1","num":1},{"shopId":"2","num":2}] + List list1 = JSON.parseArray(list, CommonOrderSku.class); + //创建订单标识 + String orderId = IdWorker.getIdStr(); + if(null!=list1 && list1.size()>0){ + //订单总额 + BigDecimal totalPrice = new BigDecimal(0); + //订单商品数量 + Integer totalNum = 0; + + //创建订单详情 + for (CommonOrderSku sku : list1) { + //查询商品信息 + CommonShop commonShop = commonShopService.getById(sku.getShopId()); + //商品不能为空 + if (commonShop==null){ + return Result.error("商品不存在"); + } + //创建订单 + BigDecimal price = commonShop.getPrice().multiply(new BigDecimal(sku.getNum())); + + + //获取vip价格 + if(hanHaiMember.getIsPay() == 1){ + price = commonShop.getVipPrice().multiply(new BigDecimal(sku.getNum())); + } + + + sku.setOrderId(orderId); + sku.setShopId(commonShop.getId()); + sku.setTitle(commonShop.getTitle()); + sku.setImage(commonShop.getImage()); + sku.setPrice(price); + sku.setNum(sku.getNum()); + sku.setSku(commonShop.getSku()); + sku.setCreateTime(new Date()); + sku.setPrice(price); + + sku.setImage(commonShop.getImage()); + sku.setCreateTime(new Date()); + sku.setOrderId(orderId); + commonOrderSkuService.save(sku); + + //计算总价格 + totalPrice = totalPrice.add(price); + + totalNum = totalNum + sku.getNum(); + } + + + //创建主订单 + CommonOrder cityOrder = new CommonOrder(); + cityOrder.setId(orderId); + cityOrder.setUserId(hanHaiMember.getId()); + cityOrder.setShopId(null); + cityOrder.setNum(totalNum); + cityOrder.setAddress(commonAddress.getAddress()); + cityOrder.setName(commonAddress.getName()); + cityOrder.setPhone(commonAddress.getPhone()); + cityOrder.setAddressDetails(commonAddress.getAddressDetails()); + cityOrder.setAddressId(addressId); + cityOrder.setName("店铺订单"); + cityOrder.setTitle("组合订单"); + cityOrder.setPrice(totalPrice); + cityOrder.setShopState(2); + + cityOrder.setImage(null); + cityOrder.setState(0); + cityOrder.setCreateTime(new Date()); + + commonOrderService.save(cityOrder); + + //吊起微信支付 + String s = totalPrice.multiply(new BigDecimal(100)).toString(); + int i1 = Double.valueOf(s).intValue(); + Object appOrder = mpWxPayService.createOrder( + "购买"+ "组合订单" , + "127.0.0.1", + orderId, + i1, + orderId, + hanHaiMember.getAppletOpenid(), + cityOrder.toString()); + + return Result.OK("支付成功",appOrder); + } + return null; + } + + + + //商城-加入购物车之后一次下多个订单 - 再次下单 + @Override + public Result> createSumOrderAgain(String token,String order){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //根据订单标识查询订单是否存在 + CommonOrder oldOrder = commonOrderService.getById(order); + if (oldOrder==null){ + return Result.error("订单不存在"); + } + //储存地址标识 + String addressId = oldOrder.getAddressId(); + //创建订单标识 + String orderId = IdWorker.getIdStr(); + + //根据订单标识查询订单详情列表 + List commonOrderSkuList = commonOrderSkuService.lambdaQuery() + .eq(CommonOrderSku::getOrderId,order) + .list(); + if (commonOrderSkuList==null || commonOrderSkuList.size()==0){ + return Result.error("订单详情不存在"); + } + //循环修改订单标识 + for (CommonOrderSku commonOrderSku : commonOrderSkuList) { + commonOrderSku.setOrderId(orderId); + commonOrderSkuService.updateById(commonOrderSku); + } + + + + //用户地址不能为空 + if(StringUtils.isBlank(addressId)){ + return Result.error("请选择收货地址"); + } + //查询地址是否存在 + CommonAddress commonAddress = commonAddressService.getById(addressId); + if (commonAddress==null){ + return Result.error("地址不存在"); + } + + //创建主订单 + CommonOrder cityOrder = new CommonOrder(); + cityOrder.setId(orderId); + cityOrder.setUserId(oldOrder.getUserId()); + cityOrder.setShopId(null); + cityOrder.setNum(oldOrder.getNum()); + cityOrder.setAddress(oldOrder.getAddress()); + cityOrder.setName(oldOrder.getName()); + cityOrder.setPhone(oldOrder.getPhone()); + cityOrder.setAddressDetails(oldOrder.getAddressDetails()); + cityOrder.setAddressId(addressId); + cityOrder.setName("店铺订单"); + cityOrder.setTitle("组合订单"); + + cityOrder.setPrice(oldOrder.getPrice()); + + cityOrder.setImage(null); + cityOrder.setState(0); + cityOrder.setShopState(2); + cityOrder.setCreateTime(new Date()); + + commonOrderService.save(cityOrder); + + //删除旧订单 + commonOrderService.removeById(order); + + //吊起微信支付 + String s = oldOrder.getPrice().multiply(new BigDecimal(100)).toString(); + int i1 = Double.valueOf(s).intValue(); + Object appOrder = mpWxPayService.createOrder( + "购买"+ "组合订单" , + "127.0.0.1", + orderId, + i1, + orderId, + hanHaiMember.getAppletOpenid(), + cityOrder.toString()); + + return Result.OK("支付成功",appOrder); + + } + + + //商城-支付回调 + @Override + public Result> payNotify(String requestBody){ + WxPayOrderNotifyResult notify = mpWxPayService.notify(requestBody); + String outTradeNo = notify.getOutTradeNo(); + log.info("支付回调订单号码:"+outTradeNo); + //查询订单信息 + CommonOrder commonOrder = commonOrderService.getById(outTradeNo); + //如果订单存在则修改订单状态 + if (commonOrder!=null){ + if(commonOrder.getState()==0){ + //修改订单状态 + if(commonOrder.getShopState()==0){ + commonOrder.setState(1); + commonOrderService.updateById(commonOrder); + } + + if(commonOrder.getShopState()==1){ + commonOrder.setState(1); + commonOrderService.updateById(commonOrder); + } + //查询购买订单的用户信息 + HanHaiMember hanHaiMember = hanHaiMemberService.getById(commonOrder.getUserId()); + boolean flag = false; + //如果这个订单是普通订单 + if (commonOrder.getShopState()==2){ + //获得这个订单的总价 + BigDecimal price = commonOrder.getPrice(); + + + //根据配置查询比例 + CommonConfig config = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"vip_money") + .one(); + + //如果总价超过1000元则修改用户为会员 + if (price.compareTo(new BigDecimal(config.getKeyContent())) > -1){ + + //查看这个用户是否有邀请者,如果有则进入返点 + //邀请者不能是会员 + if (hanHaiMember.getIsPay()==0){ + if (StringUtils.isNotBlank(hanHaiMember.getShareId())){ + //查询邀请者信息 //修改订单状态在方法内 + flag = this.getMoneyToUser(commonOrder.getId(), flag); + } + } + + //设置成为会员 + hanHaiMember.setIsPay(1); + } + //推荐奖励 + this.toUserPrice(commonOrder.getId(),flag); + } + + + commonOrder.setState(1); + commonOrderService.updateById(commonOrder); + + + hanHaiMemberService.updateById(hanHaiMember); + } + + } + + return null; + } + + //加入购物车 + @Override + public Result> addCart(String token,String shopId,Integer num){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //根据商品标识查询商品信息 + CommonShop commonShop = commonShopService.getById(shopId); + if (commonShop==null){ + return Result.error("商品不存在"); + } + //根据商品标识查询购物车是否存在该商品 + CommonCat commonCart = commonCatService.lambdaQuery() + .eq(CommonCat::getUserId,hanHaiMember.getId()) + .eq(CommonCat::getShopId,shopId) + .one(); + //如果有则修改数量 + if (commonCart!=null){ + commonCart.setNum(commonCart.getNum()+num); + commonCatService.updateById(commonCart); + return Result.OK("修改成功"); + }else{ + CommonCat commonCat = new CommonCat(); + commonCat.setTitle(commonShop.getTitle()); + commonCat.setShopId(commonShop.getId()); + commonCat.setImage(commonShop.getImage()); + commonCat.setSku(commonShop.getSku()); + commonCat.setPrice(commonShop.getPrice()); + commonCat.setUserId(hanHaiMember.getId()); + commonCat.setNum(num); + commonCat.setCreateTime(new Date()); + commonCatService.save(commonCat); + return Result.OK("加入成功"); + } + } + + //删除购物车信息 + @Override + public Result> deleteCart(String token,String ids){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //删除多个购物车数据 + String[] split = ids.split(","); + //如果没有,则直接删除 + if (split.length==1){ + commonCatService.removeById(split[0]); + return Result.OK("删除成功"); + } + //如果有则循环删除 + for (String id : split) { + commonCatService.removeById(id); + } + return Result.OK("删除成功"); + } + + + //修改购物车信息数量 + @Override + public Result> updateCartNum(String token,String id,Integer num){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CommonCat commonCat = commonCatService.getById(id); + commonCat.setNum(num); + commonCatService.updateById(commonCat); + return Result.OK("修改成功"); + } + + + + //获取流水记录带分页 + @Override + public Result> getWaterPageList(String token,PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = commonMoneyLogService.lambdaQuery() + .orderByDesc(CommonMoneyLog::getCreateTime) + .page(new Page<>(1, 10)); + return Result.OK(page); + } + + //获取订单列表带分页 + @Override + public Result> getOrderPageList(String token, PageBean bean,Integer state){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = new Page(bean.getPageNo(), bean.getPageSize()); + Page page1 = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .orderByDesc(CommonOrder::getCreateTime) + .page(page); + //如果订单状态不为空 + if(null!=state){ + page1 = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,hanHaiMember.getId()) + .eq(CommonOrder::getState,state) + .orderByDesc(CommonOrder::getCreateTime) + .page(page); + } + //拿出订单集合 + List records = page1.getRecords(); + //创建新集合 + List newRecords = new ArrayList<>(); + for (CommonOrder cityOrder : records) { + //根据订单id查询订单详情 + List commonOrderSkuList = commonOrderSkuService.lambdaQuery() + .eq(CommonOrderSku::getOrderId,cityOrder.getId()) + .list(); + cityOrder.setCommonOrderSkuList(commonOrderSkuList); + newRecords.add(cityOrder); + } + page1.setRecords(newRecords); + return Result.OK(page1); + } + + + //获取订单详情 + @Override + public Result> getOrderDetail(@RequestHeader("X-Access-Token") String token, String id){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CommonOrder cityOrder = commonOrderService.getById(id); + //根据订单id查询订单详情 + List commonOrderSkuList = commonOrderSkuService.lambdaQuery() + .eq(CommonOrderSku::getOrderId,cityOrder.getId()) + .list(); + cityOrder.setCommonOrderSkuList(commonOrderSkuList); + return Result.OK(cityOrder); + } + + + + + + + + //获取粉丝列表带分页 + @Override + public Result> getFansPageList(String token,PageBean pageBean,String title){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = hanHaiMemberService + .lambdaQuery() + .eq(HanHaiMember::getShareId,hanHaiMember.getId()) + .like(null!=title,HanHaiMember::getNickName,title) + .page(new Page<>(pageBean.getPageNo(), pageBean.getPageSize())); + return Result.OK(page); + } + + //获取购物车信息列表带分页 + @Override + public Result> getCartPageList(String token,PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = commonCatService + .lambdaQuery() + .eq(CommonCat::getUserId,hanHaiMember.getId()) + .page(new Page<>(1, 10)); + return Result.OK(page); + } + + //获取地址列表带分页 + @Override + public Result> getAddressPageList(String token,PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = commonAddressService + .lambdaQuery() + .eq(CommonAddress::getUserId,hanHaiMember.getId()) + .page(new Page<>(1, 10)); + return Result.OK(page); + } + + + + private String appid = "wx0839bc52e7849c13"; + + private String secret = "c614fd865951c5246e849501204e6f7f"; + + private String endpoint = "oss-cn-shenzhen.aliyuncs.com"; + + private String accessKey = "LTAI5tQSs47izVy8DLVdwUU9"; + + private String secretKey = "qHI7C3PaXYZySr84HTToviC71AYlFq"; + + private String bucketName = "hanhaiimage"; + + + + + + + private static final String APP_ID = "wx0839bc52e7849c13"; + private static final String APP_SECRET = "c614fd865951c5246e849501204e6f7f"; + private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APP_ID + "&secret=" + APP_SECRET; + private static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; + + + + //获取推广二维码 + @Override + public Result> getInviteCode(String token){ + HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + + CommonConfig vsion = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName, "v_sion") + .one(); + Integer vsionStr = Integer.parseInt(vsion.getKeyContent()); + String trial = "release"; + if(vsionStr == 0){ + trial= "release"; + }else if(vsionStr == 1){ + trial= "trial"; + }else{ + trial= "develop"; + } + +// WxQrCodeVo o = (WxQrCodeVo)redisUtil.get("CodeImage::" + trial+ member.getId()); +// if(o!=null){ +// +// +// o.setName("瑶都万能墙欢迎您的加入"); +// return Result.OK(o); +// } + + Map param = new HashMap<>(); + + CommonConfig xcxSharePage = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName, "xcxSharePage") + .one(); + + + + + + String key = "shareId=" + member.getId(); + + param.put("path", xcxSharePage.getKeyContent() + "?" + key); //跳转页面 + String accessToken = this.getAccessToken(); + RestTemplate rest = new RestTemplate(); + InputStream inputStream = null; + OutputStream outputStream = null; + File file = null; + +// LambdaQueryWrapper configImg = new LambdaQueryWrapper<>(); +// configImg.eq(DbConf::getIsDel,0).eq(DbConf::getKeyValue,"codeImg"); +// DbConf oneImg = confService.getOne(configImg); + + CommonConfig oneImage = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName, "codeImg") + .one(); + + + + + String codeImg = oneImage.getKeyContent(); + try{ + String url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + accessToken; + param.put("scene", member.getId()); + param.put("width", 150); + param.put("auto_color", false); + param.put("env_version", trial); + Map line_color = new HashMap<>(); + line_color.put("r", 0); + line_color.put("g", 0); + line_color.put("b", 0); + param.put("line_color", line_color); + MultiValueMap headers = new LinkedMultiValueMap<>(); + org.springframework.http.HttpEntity requestEntity = new org.springframework.http.HttpEntity(JSON.toJSONString(param), headers); + ResponseEntity entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); + byte[] result = entity.getBody(); + + inputStream = new ByteArrayInputStream(result); + String tempSave = codeImg; + String filePath = tempSave; + + file = new File(filePath); + if (!file.exists()) { + file.createNewFile(); + } + outputStream = new FileOutputStream(file); + int len = 0; + byte[] buf = new byte[1024]; + while ((len = inputStream.read(buf, 0, 1024)) != -1) { + outputStream.write(buf, 0, len); + } + outputStream.flush(); + /** + * 将文件上传至阿里云 + */ + DiskFileItemFactory factory = new DiskFileItemFactory(16, null); + FileItem item = factory.createItem("File", "text/plain", true, file.getName()); + int bytesRead = 0; + byte[] buffer = new byte[8192]; + try { + FileInputStream fis = new FileInputStream(file); + OutputStream os = item.getOutputStream(); + while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + MultipartFile mf = new CommonsMultipartFile(item); + //返回图片下载地址 + WxQrCodeVo wxCodeVo = new WxQrCodeVo(); + wxCodeVo.setUrl(this.uploadAliYunOss(mf)); + + + + + wxCodeVo.setName("陌美人珠宝欢迎您"); + +// redisUtil.set("CodeImage::"+trial+member.getId(),wxCodeVo); + return Result.OK(wxCodeVo); + + } catch (Exception e) { + e.printStackTrace(); + } finally { + + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //删除文件 + if (file.exists()) { + file.delete(); + } + } + return null; + } + + @Override + public Result> getInfoIntroduce(String type) { + return null; + } + + + /** + * 获取令牌 + * + * @return + */ + private String getAccessToken() { + String requestUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret; + String doGet2 = HttpClientUtil.doGet2(requestUrl); + Map map = JSON.parseObject(doGet2, new TypeReference>() { + }); + return map.get("access_token"); + } + /** + * 上传文件至阿里云oss + * + * @return + */ + private String uploadAliYunOss(MultipartFile mf) throws Exception { + String uploadFile = "WxCodeFile"; + String fileName = new StringBuffer(mf.getOriginalFilename()).append(".jpg").toString();// 获取文件名 + String dbpath = uploadFile + File.separator + fileName; + if (dbpath.contains("\\")) { + dbpath = dbpath.replace("\\", "/"); + } + String endpoint = this.endpoint; + String accessKey = this.accessKey; + String secretKey = this.secretKey; + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKey, secretKey); + // 上传Byte数组。 + byte[] content = mf.getBytes(); + String bucketName = this.bucketName; + ossClient.putObject(bucketName, dbpath, new ByteArrayInputStream(content)); + // 关闭OSSClient。 + ossClient.shutdown(); + return dbpath; + } + + + + + + + + + + + + //查询分类接口 + @Override + public Result> getCategoryList(){ + List list = commonClassService.list(); + return Result.OK(list); + } + + + //增加或者修改地址 + @Override + public Result> addOrUpdateAddress(String token,CommonAddress commonAddress){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + commonAddress.setUserId(hanHaiMember.getId()); + commonAddressService.saveOrUpdate(commonAddress); + return Result.OK("增加成功"); + } + + + //删除地址 + @Override + public Result> deleteAddress(String token,String id){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + commonAddressService.removeById(id); + return Result.OK("删除成功"); + } + + //修改默认地址 + @Override + public Result> updateDefaultAddress(String token,String id){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //查询是否有默认地址 + List list = commonAddressService.lambdaQuery() + .eq(CommonAddress::getDefaultFlag,1) + .list(); + //如果有全部改为不默认 + if (list!=null && list.size()>0){ + for (CommonAddress commonAddress : list) { + commonAddress.setDefaultFlag(0); + commonAddressService.updateById(commonAddress); + } + } + //查询当前这个地址信息 + CommonAddress commonAddress = commonAddressService.getById(id); + commonAddress.setDefaultFlag(1); + commonAddressService.updateById(commonAddress); + + return Result.OK("修改成功"); + } + + //查询个人信息相关 + @Override + public Result> getRiceInfo(String token){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Map map = new HashMap(); + //余额、可提现、收益明细 + map.put("balance",hanHaiMember.getPrice()); + map.put("canWithdraw",hanHaiMember.getMoney()); + map.put("income",0); + //黄金会员 + map.put("goldenMember",0); + //当前会员人数 + map.put("memberNum",hanHaiMemberService.lambdaQuery().eq(HanHaiMember::getIsPay,1).list().size()); + return Result.OK(map); + } + + + + //充值 + @Override + public Result> recharge(String token,BigDecimal money){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //查询当前用户余额 + CommonMoney commonMoney = commonMoneyService.lambdaQuery() + .eq(CommonMoney::getUserId,hanHaiMember.getId()) + .one(); + + return Result.OK("充值成功"); + } + + //提现 + @Override + public Result> withdraw(String token,BigDecimal money,String bankName,String bankNo){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + //查询当前用户余额 + BigDecimal userPrice = hanHaiMember.getMoney(); + //提现金额不能大于用户额度 + if (userPrice.compareTo(money) == -1){ + //余额不足 + return Result.error("余额不足"); + } + //创建支付流水 + CommonMoneyLog commonMoneyLog = new CommonMoneyLog(); + commonMoneyLog.setTitle("用户提现"); + commonMoneyLog.setMoney(money); + commonMoneyLog.setOldMoney(userPrice); + commonMoneyLog.setType(1); + commonMoneyLog.setState(0); +// commonMoneyLog.setBankName(bankName); +// commonMoneyLog.setBankNo(bankNo); + commonMoneyLog.setUserId(hanHaiMember.getId()); + commonMoneyLogService.save(commonMoneyLog); + + hanHaiMember.setMoney(userPrice.subtract(money)); + hanHaiMemberService.updateById(hanHaiMember); + return Result.OK("提现申请成功,等待审核!"); + } + + + + + + + + //这里执行的方法是:会员推荐用户购买会员 + //会员推荐朋友购买会员第一个返10%、第二个返20%、第三个返30%、第四个返40%,四四循环 + public boolean getMoneyToUser(String orderId,boolean flag){ + //根据订单标识查询订单信息 + CommonOrder commonOrder = commonOrderService.getById(orderId); + if (commonOrder==null){ + log.info("订单不存在:ID:"+orderId); + return flag; + } + //查询是否有推荐购买会员 + HanHaiMember member = hanHaiMemberService.lambdaQuery() + .eq(HanHaiMember::getId,commonOrder.getUserId()) + .one(); + String orderShareId = member.getShareId(); + if (orderShareId==null || "".equals(orderShareId)){ + log.info("订单没有推荐用户:ID:"+orderId); + return flag; + } + + + //根据推荐者标识查询推荐者用户信息 + HanHaiMember shareMember = hanHaiMemberService.getById(orderShareId); + if (shareMember==null){ + log.info("推荐用户不存在:ID:"+orderShareId); + return flag; + } + //推荐用户不是会员也不是渠道 + if (shareMember.getIsPay()==0){ + log.info("推荐用户不是会员也不是渠道:ID:"+orderShareId); + return flag; + } + //根据订单推荐者标识查询该推荐这推荐了几个订单 + List list = commonOrderService.lambdaQuery() + .eq(CommonOrder::getShareId,orderShareId) + .orderByDesc(CommonOrder::getCreateTime) + //订单状态1:未付款、2:已付款、3:已发货、4:已收货、5:已完成、 大于0 + .gt(CommonOrder::getState,0) + .list(); + log.info("订单条数:"+list.size()); + //如果为空则跳出 + Integer shareNum = 1; + if (list==null || list.size()==0){ + shareNum = 1; + }else{ + //查询有多少个返点配置 + int confSize = commonVipConfigService.list().size(); + if(list.size()+1>confSize){ + //最新的一个订单是第几次循环 + log.info("原订单:"+list.get(0).getShareNum()); + shareNum = list.get(0).getShareNum() + 1; + log.info("现在:"+shareNum); + //根据配置查询vip配置比例 + CommonVipConfig commonVipConfig = commonVipConfigService.lambdaQuery() + .eq(CommonVipConfig::getSort,shareNum) + .one(); + //如果查出来没有数据 + if (commonVipConfig==null){ + shareNum = 1; + } + + }else{ + shareNum = list.size()+1; + log.info("推荐用户购买会员第几次list.size()+1==:"+shareNum); + } + log.info("推荐用户购买会员第几次:"+shareNum); + } + //根据配置查询vip配置比例 + CommonVipConfig commonVipConfig = commonVipConfigService.lambdaQuery() + .eq(CommonVipConfig::getSort,shareNum) + .one(); + if (commonVipConfig==null){ + log.info("没有配置该比例:shareNum:"+shareNum); + return flag; + } + //得到比例 + BigDecimal price = commonVipConfig.getPrice(); + //返点金额公式:返点金额 = 当前订单金额乘得到比例 + BigDecimal money = commonOrder.getPrice().multiply(price); + + //判断用户是否是会员 + //增加推荐者流水 + CommonMoneyLog moneyLog = new CommonMoneyLog(); + if(shareMember.getIsPay() == 1){ + if (member.getIsPay()==0){ + moneyLog.setTitle("【会员】直推【普通】第"+shareNum+"次的推荐奖"); + moneyLog.setMoney(money); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); //0收入 1支出 + moneyLog.setState(0); + moneyLog.setUserId(orderShareId); + commonMoneyLogService.save(moneyLog); + + flag = true; + } + } + if(shareMember.getIsPay() == 2){ + + //根据配置查询比例 + CommonConfig config = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"qu_price") + .one(); + + if (member.getIsPay()==0){ + money = new BigDecimal(config.getKeyContent()); + moneyLog.setTitle("渠道推荐用户购买会员"); + moneyLog.setMoney(money); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); //0收入 1支出 + moneyLog.setState(0); + moneyLog.setUserId(orderShareId); + commonMoneyLogService.save(moneyLog); + } + } + //修改推荐者的钱 + shareMember.setPrice(shareMember.getPrice().add(money)); + hanHaiMemberService.updateById(shareMember); + + //修改订单的推荐次数 + commonOrder.setState(1); + commonOrder.setShareId(shareMember.getId()); + commonOrder.setShareNum(shareNum); + commonOrderService.updateById(commonOrder); + + return flag; + } + + + + // 1:用户推荐奖 +// 凡购买1盒即5斤享有推荐资格 +// 直推奖励:所推荐朋友购买产品或者购买会员返10%佣金,及今后产生复购产品的均有10%佣金(体验价不计算在内) + public boolean toUserPrice(String orderId,boolean flag){ + CommonOrder commonOrder = commonOrderService.getById(orderId); + if (commonOrder==null){ + log.info("订单不存在:ID:"+orderId); + return flag; + } + //根据订单查询用户信息 + HanHaiMember hanHaiMember = hanHaiMemberService.lambdaQuery() + .eq(HanHaiMember::getId,commonOrder.getUserId()) + .one(); + if (hanHaiMember==null){ + log.info("用户不存在:ID:"+commonOrder.getUserId()); + return flag; + } + //查询推荐人 + HanHaiMember shareMember = hanHaiMemberService.lambdaQuery() + .eq(HanHaiMember::getId,hanHaiMember.getShareId()) + .one(); + if (shareMember==null){ + log.info("推荐用户不存在:ID:"+hanHaiMember.getShareId()); + return flag; + } + //查询推荐人是否购买了并且支付了订单 + List list = commonOrderService.lambdaQuery() + .eq(CommonOrder::getUserId,shareMember.getId()) + .gt(CommonOrder::getState,0) + .list(); + if (list==null || list.size()==0){ + log.info("推荐用户没有购买的订单无法进行返点:ID:"+shareMember.getId()); + return flag; + } + + //增加流水 + CommonMoneyLog moneyLog = new CommonMoneyLog(); + + //查看用户是否是会员 + if (shareMember.getIsPay()==0){ + if(hanHaiMember.getIsPay()==0) { + moneyLog.setTitle("【用户】直推【用户】购买产品奖励"); + }else{ + moneyLog.setTitle("【用户】直推【会员】购买产品奖励"); + } + //根据配置查询比例 + CommonConfig config = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"user_price_money") + .one(); + + moneyLog.setMoney(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); + moneyLog.setState(0); + moneyLog.setUserId(shareMember.getId()); + + //修改推荐者的钱 + shareMember.setPrice(shareMember.getPrice().add(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent())))); + commonMoneyLogService.save(moneyLog); + }else if (shareMember.getIsPay()==1){ + + + //根据配置查询比例 + CommonConfig config = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"vip_price_money") + .one(); + + if(hanHaiMember.getIsPay()==1){ + moneyLog.setTitle("【会员】直推【会员】产品购买奖励"); + moneyLog.setMoney(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); + moneyLog.setState(0); + moneyLog.setUserId(shareMember.getId()); + + shareMember.getPrice().add(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + commonMoneyLogService.save(moneyLog); + + }else{ + if(flag == false){ + moneyLog.setTitle("【会员】直推【用户】产品购买奖励"); + moneyLog.setMoney(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); + moneyLog.setState(0); + moneyLog.setUserId(shareMember.getId()); + + shareMember.getPrice().add(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + commonMoneyLogService.save(moneyLog); + } + + } + + + + + }else{ + + //根据配置查询比例 + CommonConfig config = commonConfigService.lambdaQuery() + .eq(CommonConfig::getKeyName,"qu_price_money") + .one(); + + if(hanHaiMember.getIsPay()==0) { + moneyLog.setTitle("【渠道】直推【用户】购买产品奖励"); + }else{ + moneyLog.setTitle("【渠道】直推【会员】购买产品奖励"); + } + moneyLog.setMoney(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent()))); + moneyLog.setOldMoney(shareMember.getPrice()); + moneyLog.setType(0); + moneyLog.setState(0); + moneyLog.setUserId(shareMember.getId()); + + //修改推荐者的钱 + shareMember.setPrice(shareMember.getPrice().add(commonOrder.getPrice().multiply(new BigDecimal(config.getKeyContent())))); + commonMoneyLogService.save(moneyLog); + } + + + hanHaiMemberService.updateById(shareMember); + + return flag; + } + + + + //确认收货 + @Override + public Result> confirmOrder(String token,String orderId){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + + return Result.OK("确认收货"); + + } + + + + + + + +} diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java index 1b659a5..a930cc4 100644 --- a/module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java @@ -18,6 +18,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -116,6 +122,71 @@ public class AppletLoginServiceImpl implements AppletLoginService { } + + private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"; + + public String getAccessToken() throws Exception { + String requestUrl = String.format(TOKEN_URL, mpAppId, mpAppSecret); + URL url = new URL(requestUrl); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + + try (BufferedReader br = new BufferedReader( + new InputStreamReader(conn.getInputStream(), "UTF-8"))) { + StringBuilder response = new StringBuilder(); + String responseLine; + while ((responseLine = br.readLine()) != null) { + response.append(responseLine.trim()); + } + + org.json.JSONObject jsonResponse = new org.json.JSONObject(response.toString()); + return jsonResponse.getString("access_token"); + } + } + + private static final String API_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber"; + + public String getPhoneNumber(String code) throws Exception { + URL url = new URL(API_URL + "?access_token=" + this.getAccessToken()); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/json; utf-8"); + conn.setRequestProperty("Accept", "application/json"); + conn.setDoOutput(true); + + JSONObject jsonInput = new JSONObject(); + jsonInput.put("code", code); + + try (DataOutputStream os = new DataOutputStream(conn.getOutputStream())) { + byte[] input = jsonInput.toString().getBytes(StandardCharsets.UTF_8); + os.write(input, 0, input.length); + } + + try (BufferedReader br = new BufferedReader( + new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { + StringBuilder response = new StringBuilder(); + String responseLine; + while ((responseLine = br.readLine()) != null) { + response.append(responseLine.trim()); + } + //获取手机号码 + return response.toString(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public Result bindPhone(String code) { + try { + String phoneNumber = this.getPhoneNumber(code); + return Result.OK(phoneNumber); + }catch (Exception e){ + return Result.error(e.getMessage()); + } + } + + + // /** // * 微信小程序登录绑定手机号码接口 // * @param loginReq diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/controller/CommonCouponController.java b/module-common/src/main/java/org/jeecg/modules/commonCoupon/controller/CommonCouponController.java new file mode 100644 index 0000000..323f2e5 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/controller/CommonCouponController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.commonCoupon.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.commonCoupon.entity.CommonCoupon; +import org.jeecg.modules.commonCoupon.service.ICommonCouponService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 优惠券活动 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Api(tags="优惠券活动") +@RestController +@RequestMapping("/commonCoupon/commonCoupon") +@Slf4j +public class CommonCouponController extends JeecgController { + @Autowired + private ICommonCouponService commonCouponService; + + /** + * 分页列表查询 + * + * @param commonCoupon + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "优惠券活动-分页列表查询") + @ApiOperation(value="优惠券活动-分页列表查询", notes="优惠券活动-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CommonCoupon commonCoupon, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(commonCoupon, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = commonCouponService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param commonCoupon + * @return + */ + @AutoLog(value = "优惠券活动-添加") + @ApiOperation(value="优惠券活动-添加", notes="优惠券活动-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody CommonCoupon commonCoupon) { + commonCouponService.save(commonCoupon); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param commonCoupon + * @return + */ + @AutoLog(value = "优惠券活动-编辑") + @ApiOperation(value="优惠券活动-编辑", notes="优惠券活动-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody CommonCoupon commonCoupon) { + commonCouponService.updateById(commonCoupon); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "优惠券活动-通过id删除") + @ApiOperation(value="优惠券活动-通过id删除", notes="优惠券活动-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + commonCouponService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "优惠券活动-批量删除") + @ApiOperation(value="优惠券活动-批量删除", notes="优惠券活动-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.commonCouponService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "优惠券活动-通过id查询") + @ApiOperation(value="优惠券活动-通过id查询", notes="优惠券活动-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + CommonCoupon commonCoupon = commonCouponService.getById(id); + if(commonCoupon==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(commonCoupon); + } + + /** + * 导出excel + * + * @param request + * @param commonCoupon + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CommonCoupon commonCoupon) { + return super.exportXls(request, commonCoupon, CommonCoupon.class, "优惠券活动"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CommonCoupon.class); + } + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/entity/CommonCoupon.java b/module-common/src/main/java/org/jeecg/modules/commonCoupon/entity/CommonCoupon.java new file mode 100644 index 0000000..fa5fa9b --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/entity/CommonCoupon.java @@ -0,0 +1,78 @@ +package org.jeecg.modules.commonCoupon.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 优惠券活动 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Data +@TableName("common_coupon") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="common_coupon对象", description="优惠券活动") +public class CommonCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**金额*/ + @Excel(name = "金额", width = 15) + @ApiModelProperty(value = "金额") + private java.math.BigDecimal money; + /**满多少可用*/ + @Excel(name = "满多少可用", width = 15) + @ApiModelProperty(value = "满多少可用") + private java.math.BigDecimal useMoney; + /**结束时间*/ + @Excel(name = "结束时间", width = 15) + @ApiModelProperty(value = "结束时间") + private java.util.Date endTime; + /**优惠券备注*/ + @Excel(name = "优惠券备注", width = 15) + @ApiModelProperty(value = "优惠券备注") + private java.lang.String type; + /**使用时间*/ + @Excel(name = "使用时间", width = 15) + @ApiModelProperty(value = "使用时间") + private java.util.Date stateTime; + /**使用用户*/ + @Excel(name = "使用用户", width = 15) + @ApiModelProperty(value = "使用用户") + private java.lang.String userId; + /**使用状态*/ + @Excel(name = "使用状态", width = 15) + @ApiModelProperty(value = "使用状态") + private java.lang.Integer state; +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/CommonCouponMapper.java b/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/CommonCouponMapper.java new file mode 100644 index 0000000..ecb44db --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/CommonCouponMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.commonCoupon.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.commonCoupon.entity.CommonCoupon; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 优惠券活动 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface CommonCouponMapper extends BaseMapper { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/xml/CommonCouponMapper.xml b/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/xml/CommonCouponMapper.xml new file mode 100644 index 0000000..efed1eb --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/mapper/xml/CommonCouponMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/ICommonCouponService.java b/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/ICommonCouponService.java new file mode 100644 index 0000000..42e0acd --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/ICommonCouponService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.commonCoupon.service; + +import org.jeecg.modules.commonCoupon.entity.CommonCoupon; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 优惠券活动 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface ICommonCouponService extends IService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/impl/CommonCouponServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/impl/CommonCouponServiceImpl.java new file mode 100644 index 0000000..8927a6c --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/service/impl/CommonCouponServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.commonCoupon.service.impl; + +import org.jeecg.modules.commonCoupon.entity.CommonCoupon; +import org.jeecg.modules.commonCoupon.mapper.CommonCouponMapper; +import org.jeecg.modules.commonCoupon.service.ICommonCouponService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 优惠券活动 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Service +public class CommonCouponServiceImpl extends ServiceImpl implements ICommonCouponService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/CommonCouponList.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/CommonCouponList.vue new file mode 100644 index 0000000..686bede --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/CommonCouponList.vue @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + 新增 + 导出 + + 导入 + + + + + + 删除 + + 批量操作 + + + + + + + 已选择 {{ selectedRowKeys.length }}项 + 清空 + + + + + + + + + 无图片 + + + + 无文件 + + 下载 + + + + + 编辑 + + + + 更多 + + + 详情 + + + handleDelete(record.id)"> + 删除 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponForm.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponForm.vue new file mode 100644 index 0000000..f7f1822 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponForm.vue @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.Style#Drawer.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.Style#Drawer.vue new file mode 100644 index 0000000..bee7e0a --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.vue new file mode 100644 index 0000000..4c1d103 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue/modules/CommonCouponModal.vue @@ -0,0 +1,60 @@ + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.api.ts b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.api.ts new file mode 100644 index 0000000..38a5d7b --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/commonCoupon/commonCoupon/list', + save='/commonCoupon/commonCoupon/add', + edit='/commonCoupon/commonCoupon/edit', + deleteOne = '/commonCoupon/commonCoupon/delete', + deleteBatch = '/commonCoupon/commonCoupon/deleteBatch', + importExcel = '/commonCoupon/commonCoupon/importExcel', + exportXls = '/commonCoupon/commonCoupon/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.data.ts b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.data.ts new file mode 100644 index 0000000..d0e6568 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCoupon.data.ts @@ -0,0 +1,83 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '金额', + align:"center", + dataIndex: 'money' + }, + { + title: '满多少可用', + align:"center", + dataIndex: 'useMoney' + }, + { + title: '结束时间', + align:"center", + dataIndex: 'endTime' + }, + { + title: '优惠券备注', + align:"center", + dataIndex: 'type' + }, + { + title: '使用时间', + align:"center", + dataIndex: 'stateTime' + }, + { + title: '使用用户', + align:"center", + dataIndex: 'userId' + }, + { + title: '使用状态', + align:"center", + dataIndex: 'state' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '金额', + field: 'money', + component: 'InputNumber', + }, + { + label: '满多少可用', + field: 'useMoney', + component: 'InputNumber', + }, + { + label: '结束时间', + field: 'endTime', + component: 'Input', + }, + { + label: '优惠券备注', + field: 'type', + component: 'Input', + }, + { + label: '使用时间', + field: 'stateTime', + component: 'Input', + }, + { + label: '使用用户', + field: 'userId', + component: 'Input', + }, + { + label: '使用状态', + field: 'state', + component: 'InputNumber', + }, +]; diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCouponList.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCouponList.vue new file mode 100644 index 0000000..9e2acd7 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/CommonCouponList.vue @@ -0,0 +1,162 @@ + + + + + + + 新增 + 导出 + 导入 + + + + + + 删除 + + + + 批量操作 + + + + + + + + + + + + + + 无文件 + 下载 + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/components/CommonCouponModal.vue b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/components/CommonCouponModal.vue new file mode 100644 index 0000000..6282a4d --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonCoupon/vue3/components/CommonCouponModal.vue @@ -0,0 +1,58 @@ + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/controller/CommonIconController.java b/module-common/src/main/java/org/jeecg/modules/commonIcon/controller/CommonIconController.java new file mode 100644 index 0000000..b94ddef --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/controller/CommonIconController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.commonIcon.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.commonIcon.entity.CommonIcon; +import org.jeecg.modules.commonIcon.service.ICommonIconService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 广告位信息表 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Api(tags="广告位信息表") +@RestController +@RequestMapping("/commonIcon/commonIcon") +@Slf4j +public class CommonIconController extends JeecgController { + @Autowired + private ICommonIconService commonIconService; + + /** + * 分页列表查询 + * + * @param commonIcon + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "广告位信息表-分页列表查询") + @ApiOperation(value="广告位信息表-分页列表查询", notes="广告位信息表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CommonIcon commonIcon, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(commonIcon, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = commonIconService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param commonIcon + * @return + */ + @AutoLog(value = "广告位信息表-添加") + @ApiOperation(value="广告位信息表-添加", notes="广告位信息表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody CommonIcon commonIcon) { + commonIconService.save(commonIcon); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param commonIcon + * @return + */ + @AutoLog(value = "广告位信息表-编辑") + @ApiOperation(value="广告位信息表-编辑", notes="广告位信息表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody CommonIcon commonIcon) { + commonIconService.updateById(commonIcon); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "广告位信息表-通过id删除") + @ApiOperation(value="广告位信息表-通过id删除", notes="广告位信息表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + commonIconService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "广告位信息表-批量删除") + @ApiOperation(value="广告位信息表-批量删除", notes="广告位信息表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.commonIconService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "广告位信息表-通过id查询") + @ApiOperation(value="广告位信息表-通过id查询", notes="广告位信息表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + CommonIcon commonIcon = commonIconService.getById(id); + if(commonIcon==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(commonIcon); + } + + /** + * 导出excel + * + * @param request + * @param commonIcon + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CommonIcon commonIcon) { + return super.exportXls(request, commonIcon, CommonIcon.class, "广告位信息表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CommonIcon.class); + } + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/entity/CommonIcon.java b/module-common/src/main/java/org/jeecg/modules/commonIcon/entity/CommonIcon.java new file mode 100644 index 0000000..38a10f8 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/entity/CommonIcon.java @@ -0,0 +1,74 @@ +package org.jeecg.modules.commonIcon.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 广告位信息表 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Data +@TableName("common_icon") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="common_icon对象", description="广告位信息表") +public class CommonIcon implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**标题*/ + @Excel(name = "标题", width = 15) + @ApiModelProperty(value = "标题") + private java.lang.String title; + /**价格*/ + @Excel(name = "价格", width = 15) + @ApiModelProperty(value = "价格") + private java.math.BigDecimal price; + /**主图*/ + @Excel(name = "主图", width = 15) + @ApiModelProperty(value = "主图") + private java.lang.String icon; + /**跳转地址*/ + @Excel(name = "跳转地址", width = 15) + @ApiModelProperty(value = "跳转地址") + private java.lang.String url; + /**排序*/ + @Excel(name = "排序", width = 15) + @ApiModelProperty(value = "排序") + private java.lang.Integer sort; + /**详情*/ + @Excel(name = "详情", width = 15) + @ApiModelProperty(value = "详情") + private java.lang.String details; +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/CommonIconMapper.java b/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/CommonIconMapper.java new file mode 100644 index 0000000..1e37c5e --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/CommonIconMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.commonIcon.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.commonIcon.entity.CommonIcon; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 广告位信息表 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface CommonIconMapper extends BaseMapper { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/xml/CommonIconMapper.xml b/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/xml/CommonIconMapper.xml new file mode 100644 index 0000000..1534963 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/mapper/xml/CommonIconMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/service/ICommonIconService.java b/module-common/src/main/java/org/jeecg/modules/commonIcon/service/ICommonIconService.java new file mode 100644 index 0000000..27fc3b6 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/service/ICommonIconService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.commonIcon.service; + +import org.jeecg.modules.commonIcon.entity.CommonIcon; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 广告位信息表 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface ICommonIconService extends IService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/service/impl/CommonIconServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonIcon/service/impl/CommonIconServiceImpl.java new file mode 100644 index 0000000..7829d17 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/service/impl/CommonIconServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.commonIcon.service.impl; + +import org.jeecg.modules.commonIcon.entity.CommonIcon; +import org.jeecg.modules.commonIcon.mapper.CommonIconMapper; +import org.jeecg.modules.commonIcon.service.ICommonIconService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 广告位信息表 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Service +public class CommonIconServiceImpl extends ServiceImpl implements ICommonIconService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/CommonIconList.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/CommonIconList.vue new file mode 100644 index 0000000..bff9d4c --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/CommonIconList.vue @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + 新增 + 导出 + + 导入 + + + + + + 删除 + + 批量操作 + + + + + + + 已选择 {{ selectedRowKeys.length }}项 + 清空 + + + + + + + + + 无图片 + + + + 无文件 + + 下载 + + + + + 编辑 + + + + 更多 + + + 详情 + + + handleDelete(record.id)"> + 删除 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconForm.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconForm.vue new file mode 100644 index 0000000..dab93df --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconForm.vue @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.Style#Drawer.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.Style#Drawer.vue new file mode 100644 index 0000000..f356860 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.vue new file mode 100644 index 0000000..dfb4007 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue/modules/CommonIconModal.vue @@ -0,0 +1,60 @@ + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.api.ts b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.api.ts new file mode 100644 index 0000000..49496ed --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/commonIcon/commonIcon/list', + save='/commonIcon/commonIcon/add', + edit='/commonIcon/commonIcon/edit', + deleteOne = '/commonIcon/commonIcon/delete', + deleteBatch = '/commonIcon/commonIcon/deleteBatch', + importExcel = '/commonIcon/commonIcon/importExcel', + exportXls = '/commonIcon/commonIcon/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.data.ts b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.data.ts new file mode 100644 index 0000000..e937260 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIcon.data.ts @@ -0,0 +1,77 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '标题', + align:"center", + dataIndex: 'title' + }, + { + title: '价格', + align:"center", + dataIndex: 'price' + }, + { + title: '主图', + align:"center", + dataIndex: 'icon', + customRender:render.renderAvatar, + }, + { + title: '跳转地址', + align:"center", + dataIndex: 'url' + }, + { + title: '排序', + align:"center", + dataIndex: 'sort' + }, + { + title: '详情', + align:"center", + dataIndex: 'details', + slots: { customRender: 'htmlSlot' }, + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '标题', + field: 'title', + component: 'Input', + }, + { + label: '价格', + field: 'price', + component: 'InputNumber', + }, + { + label: '主图', + field: 'icon', + component: 'JImageUpload', + componentProps:{ + }, + }, + { + label: '跳转地址', + field: 'url', + component: 'Input', + }, + { + label: '排序', + field: 'sort', + component: 'InputNumber', + }, + { + label: '详情', + field: 'details', + component: 'JCodeEditor', //TODO String后缀暂未添加 + }, +]; diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIconList.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIconList.vue new file mode 100644 index 0000000..62e561f --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/CommonIconList.vue @@ -0,0 +1,162 @@ + + + + + + + 新增 + 导出 + 导入 + + + + + + 删除 + + + + 批量操作 + + + + + + + + + + + + + + 无文件 + 下载 + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/components/CommonIconModal.vue b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/components/CommonIconModal.vue new file mode 100644 index 0000000..7af8a5b --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonIcon/vue3/components/CommonIconModal.vue @@ -0,0 +1,58 @@ + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/controller/CommonShopController.java b/module-common/src/main/java/org/jeecg/modules/commonShop/controller/CommonShopController.java index a8beb39..d4ea20e 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/controller/CommonShopController.java +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/controller/CommonShopController.java @@ -39,7 +39,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: 单商户商品信息表 * @Author: jeecg-boot - * @Date: 2024-12-12 + * @Date: 2024-12-13 * @Version: V1.0 */ @Api(tags="单商户商品信息表") diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/entity/CommonShop.java b/module-common/src/main/java/org/jeecg/modules/commonShop/entity/CommonShop.java index 28cc388..29b755b 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/entity/CommonShop.java +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/entity/CommonShop.java @@ -20,7 +20,7 @@ import lombok.experimental.Accessors; /** * @Description: 单商户商品信息表 * @Author: jeecg-boot - * @Date: 2024-12-12 + * @Date: 2024-12-13 * @Version: V1.0 */ @Data @@ -109,4 +109,16 @@ public class CommonShop implements Serializable { @Excel(name = "首页显示", width = 15) @ApiModelProperty(value = "首页显示") private java.lang.String indexNo; + /**金卡价*/ + @Excel(name = "金卡价", width = 15) + @ApiModelProperty(value = "金卡价") + private java.math.BigDecimal goldPrice; + /**银卡价*/ + @Excel(name = "银卡价", width = 15) + @ApiModelProperty(value = "银卡价") + private java.math.BigDecimal silverPrice; + /**钻石价*/ + @Excel(name = "钻石价", width = 15) + @ApiModelProperty(value = "钻石价") + private java.lang.String diamondPrice; } diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/mapper/CommonShopMapper.java b/module-common/src/main/java/org/jeecg/modules/commonShop/mapper/CommonShopMapper.java index 1c3234f..fb15515 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/mapper/CommonShopMapper.java +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/mapper/CommonShopMapper.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: 单商户商品信息表 * @Author: jeecg-boot - * @Date: 2024-12-12 + * @Date: 2024-12-13 * @Version: V1.0 */ public interface CommonShopMapper extends BaseMapper { diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/service/ICommonShopService.java b/module-common/src/main/java/org/jeecg/modules/commonShop/service/ICommonShopService.java index 75a5862..9cce8d9 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/service/ICommonShopService.java +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/service/ICommonShopService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; /** * @Description: 单商户商品信息表 * @Author: jeecg-boot - * @Date: 2024-12-12 + * @Date: 2024-12-13 * @Version: V1.0 */ public interface ICommonShopService extends IService { diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/service/impl/CommonShopServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonShop/service/impl/CommonShopServiceImpl.java index a4214e8..5182d8d 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/service/impl/CommonShopServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/service/impl/CommonShopServiceImpl.java @@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @Description: 单商户商品信息表 * @Author: jeecg-boot - * @Date: 2024-12-12 + * @Date: 2024-12-13 * @Version: V1.0 */ @Service diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/vue/CommonShopList.vue b/module-common/src/main/java/org/jeecg/modules/commonShop/vue/CommonShopList.vue index d010cdf..0ae7a50 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/vue/CommonShopList.vue +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/vue/CommonShopList.vue @@ -174,40 +174,35 @@ dataIndex: 'vipPrice' }, { - title:'多少盒', - align:"center", - dataIndex: 'box' - }, - { - title:'斤', + title:'标签', align:"center", - dataIndex: 'jin' + dataIndex: 'skuIcon' }, { - title:'一盒多少罐', + title:'分类标识', align:"center", - dataIndex: 'tank' + dataIndex: 'classId_dictText' }, { - title:'限购数量', + title:'首页显示', align:"center", - dataIndex: 'num' + dataIndex: 'indexNo', + customRender: (text) => (text ? filterMultiDictText(this.dictOptions['indexNo'], text) : ''), }, { - title:'标签', + title:'金卡价', align:"center", - dataIndex: 'skuIcon' + dataIndex: 'goldPrice' }, { - title:'分类标识', + title:'银卡价', align:"center", - dataIndex: 'classId_dictText' + dataIndex: 'silverPrice' }, { - title:'首页显示', + title:'钻石价', align:"center", - dataIndex: 'indexNo', - customRender: (text) => (text ? filterMultiDictText(this.dictOptions['indexNo'], text) : ''), + dataIndex: 'diamondPrice' }, { title: '操作', @@ -251,14 +246,13 @@ fieldList.push({type:'BigDecimal',value:'price',text:'价格',dictCode:''}) fieldList.push({type:'BigDecimal',value:'oldPrice',text:'原价',dictCode:''}) fieldList.push({type:'BigDecimal',value:'vipPrice',text:'会员价格',dictCode:''}) - fieldList.push({type:'int',value:'box',text:'多少盒',dictCode:''}) - fieldList.push({type:'int',value:'jin',text:'斤',dictCode:''}) - fieldList.push({type:'int',value:'tank',text:'一盒多少罐',dictCode:''}) - fieldList.push({type:'int',value:'num',text:'限购数量',dictCode:''}) fieldList.push({type:'string',value:'skuIcon',text:'标签',dictCode:''}) fieldList.push({type:'Text',value:'details',text:'详情',dictCode:''}) fieldList.push({type:'sel_search',value:'classId',text:'分类标识',dictTable:"common_class", dictText:'title', dictCode:'id'}) fieldList.push({type:'switch',value:'indexNo',text:'首页显示'}) + fieldList.push({type:'BigDecimal',value:'goldPrice',text:'金卡价',dictCode:''}) + fieldList.push({type:'BigDecimal',value:'silverPrice',text:'银卡价',dictCode:''}) + fieldList.push({type:'string',value:'diamondPrice',text:'钻石价',dictCode:''}) this.superFieldList = fieldList } } diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/vue/modules/CommonShopForm.vue b/module-common/src/main/java/org/jeecg/modules/commonShop/vue/modules/CommonShopForm.vue index 9703275..cd448a8 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/vue/modules/CommonShopForm.vue +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/vue/modules/CommonShopForm.vue @@ -39,43 +39,38 @@ - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/module-common/src/main/java/org/jeecg/modules/commonShop/vue3/CommonShop.data.ts b/module-common/src/main/java/org/jeecg/modules/commonShop/vue3/CommonShop.data.ts index 1afc8e6..2406e3e 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonShop/vue3/CommonShop.data.ts +++ b/module-common/src/main/java/org/jeecg/modules/commonShop/vue3/CommonShop.data.ts @@ -40,26 +40,6 @@ export const columns: BasicColumn[] = [ align:"center", dataIndex: 'vipPrice' }, - { - title: '多少盒', - align:"center", - dataIndex: 'box' - }, - { - title: '斤', - align:"center", - dataIndex: 'jin' - }, - { - title: '一盒多少罐', - align:"center", - dataIndex: 'tank' - }, - { - title: '限购数量', - align:"center", - dataIndex: 'num' - }, { title: '标签', align:"center", @@ -78,6 +58,21 @@ export const columns: BasicColumn[] = [ return render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}]) }, }, + { + title: '金卡价', + align:"center", + dataIndex: 'goldPrice' + }, + { + title: '银卡价', + align:"center", + dataIndex: 'silverPrice' + }, + { + title: '钻石价', + align:"center", + dataIndex: 'diamondPrice' + }, ]; //查询数据 export const searchFormSchema: FormSchema[] = [ @@ -133,26 +128,6 @@ export const formSchema: FormSchema[] = [ field: 'vipPrice', component: 'InputNumber', }, - { - label: '多少盒', - field: 'box', - component: 'InputNumber', - }, - { - label: '斤', - field: 'jin', - component: 'InputNumber', - }, - { - label: '一盒多少罐', - field: 'tank', - component: 'InputNumber', - }, - { - label: '限购数量', - field: 'num', - component: 'InputNumber', - }, { label: '标签', field: 'skuIcon', @@ -178,4 +153,19 @@ export const formSchema: FormSchema[] = [ componentProps:{ }, }, + { + label: '金卡价', + field: 'goldPrice', + component: 'InputNumber', + }, + { + label: '银卡价', + field: 'silverPrice', + component: 'InputNumber', + }, + { + label: '钻石价', + field: 'diamondPrice', + component: 'Input', + }, ]; diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/controller/CommonVipController.java b/module-common/src/main/java/org/jeecg/modules/commonVip/controller/CommonVipController.java new file mode 100644 index 0000000..4ba84b4 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/controller/CommonVipController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.commonVip.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.commonVip.entity.CommonVip; +import org.jeecg.modules.commonVip.service.ICommonVipService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 会员信息内容 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Api(tags="会员信息内容") +@RestController +@RequestMapping("/commonVip/commonVip") +@Slf4j +public class CommonVipController extends JeecgController { + @Autowired + private ICommonVipService commonVipService; + + /** + * 分页列表查询 + * + * @param commonVip + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "会员信息内容-分页列表查询") + @ApiOperation(value="会员信息内容-分页列表查询", notes="会员信息内容-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CommonVip commonVip, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(commonVip, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = commonVipService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param commonVip + * @return + */ + @AutoLog(value = "会员信息内容-添加") + @ApiOperation(value="会员信息内容-添加", notes="会员信息内容-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody CommonVip commonVip) { + commonVipService.save(commonVip); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param commonVip + * @return + */ + @AutoLog(value = "会员信息内容-编辑") + @ApiOperation(value="会员信息内容-编辑", notes="会员信息内容-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody CommonVip commonVip) { + commonVipService.updateById(commonVip); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "会员信息内容-通过id删除") + @ApiOperation(value="会员信息内容-通过id删除", notes="会员信息内容-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + commonVipService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "会员信息内容-批量删除") + @ApiOperation(value="会员信息内容-批量删除", notes="会员信息内容-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.commonVipService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "会员信息内容-通过id查询") + @ApiOperation(value="会员信息内容-通过id查询", notes="会员信息内容-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + CommonVip commonVip = commonVipService.getById(id); + if(commonVip==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(commonVip); + } + + /** + * 导出excel + * + * @param request + * @param commonVip + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CommonVip commonVip) { + return super.exportXls(request, commonVip, CommonVip.class, "会员信息内容"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CommonVip.class); + } + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/entity/CommonVip.java b/module-common/src/main/java/org/jeecg/modules/commonVip/entity/CommonVip.java new file mode 100644 index 0000000..ba8c49d --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/entity/CommonVip.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.commonVip.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 会员信息内容 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Data +@TableName("common_vip") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="common_vip对象", description="会员信息内容") +public class CommonVip implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**名称*/ + @Excel(name = "名称", width = 15) + @ApiModelProperty(value = "名称") + private java.lang.String title; + /**小标题*/ + @Excel(name = "小标题", width = 15) + @ApiModelProperty(value = "小标题") + private java.lang.String subTitle; + /**图标*/ + @Excel(name = "图标", width = 15) + @ApiModelProperty(value = "图标") + private java.lang.String headImage; + /**累积满多少可成为*/ + @Excel(name = "累积满多少可成为", width = 15) + @ApiModelProperty(value = "累积满多少可成为") + private java.math.BigDecimal money; + /**会员权益*/ + @Excel(name = "会员权益", width = 15) + @ApiModelProperty(value = "会员权益") + private java.lang.String details; +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/CommonVipMapper.java b/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/CommonVipMapper.java new file mode 100644 index 0000000..d75270e --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/CommonVipMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.commonVip.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.commonVip.entity.CommonVip; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 会员信息内容 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface CommonVipMapper extends BaseMapper { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/xml/CommonVipMapper.xml b/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/xml/CommonVipMapper.xml new file mode 100644 index 0000000..4da0569 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/mapper/xml/CommonVipMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/service/ICommonVipService.java b/module-common/src/main/java/org/jeecg/modules/commonVip/service/ICommonVipService.java new file mode 100644 index 0000000..2810870 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/service/ICommonVipService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.commonVip.service; + +import org.jeecg.modules.commonVip.entity.CommonVip; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 会员信息内容 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +public interface ICommonVipService extends IService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/service/impl/CommonVipServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonVip/service/impl/CommonVipServiceImpl.java new file mode 100644 index 0000000..45c0675 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/service/impl/CommonVipServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.commonVip.service.impl; + +import org.jeecg.modules.commonVip.entity.CommonVip; +import org.jeecg.modules.commonVip.mapper.CommonVipMapper; +import org.jeecg.modules.commonVip.service.ICommonVipService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 会员信息内容 + * @Author: jeecg-boot + * @Date: 2024-12-30 + * @Version: V1.0 + */ +@Service +public class CommonVipServiceImpl extends ServiceImpl implements ICommonVipService { + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue/CommonVipList.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/CommonVipList.vue new file mode 100644 index 0000000..86a30ab --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/CommonVipList.vue @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + 新增 + 导出 + + 导入 + + + + + + 删除 + + 批量操作 + + + + + + + 已选择 {{ selectedRowKeys.length }}项 + 清空 + + + + + + + + + 无图片 + + + + 无文件 + + 下载 + + + + + 编辑 + + + + 更多 + + + 详情 + + + handleDelete(record.id)"> + 删除 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipForm.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipForm.vue new file mode 100644 index 0000000..7157b44 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipForm.vue @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.Style#Drawer.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.Style#Drawer.vue new file mode 100644 index 0000000..5aaafb3 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.vue new file mode 100644 index 0000000..818e801 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue/modules/CommonVipModal.vue @@ -0,0 +1,60 @@ + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.api.ts b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.api.ts new file mode 100644 index 0000000..0514789 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/commonVip/commonVip/list', + save='/commonVip/commonVip/add', + edit='/commonVip/commonVip/edit', + deleteOne = '/commonVip/commonVip/delete', + deleteBatch = '/commonVip/commonVip/deleteBatch', + importExcel = '/commonVip/commonVip/importExcel', + exportXls = '/commonVip/commonVip/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.data.ts b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.data.ts new file mode 100644 index 0000000..df8aaca --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVip.data.ts @@ -0,0 +1,67 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '名称', + align:"center", + dataIndex: 'title' + }, + { + title: '小标题', + align:"center", + dataIndex: 'subTitle' + }, + { + title: '图标', + align:"center", + dataIndex: 'headImage', + customRender:render.renderAvatar, + }, + { + title: '累积满多少可成为', + align:"center", + dataIndex: 'money' + }, + { + title: '会员权益', + align:"center", + dataIndex: 'details', + slots: { customRender: 'htmlSlot' }, + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '名称', + field: 'title', + component: 'Input', + }, + { + label: '小标题', + field: 'subTitle', + component: 'Input', + }, + { + label: '图标', + field: 'headImage', + component: 'JImageUpload', + componentProps:{ + }, + }, + { + label: '累积满多少可成为', + field: 'money', + component: 'InputNumber', + }, + { + label: '会员权益', + field: 'details', + component: 'JCodeEditor', //TODO String后缀暂未添加 + }, +]; diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVipList.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVipList.vue new file mode 100644 index 0000000..5a3ce56 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/CommonVipList.vue @@ -0,0 +1,162 @@ + + + + + + + 新增 + 导出 + 导入 + + + + + + 删除 + + + + 批量操作 + + + + + + + + + + + + + + 无文件 + 下载 + + + + + + + + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/components/CommonVipModal.vue b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/components/CommonVipModal.vue new file mode 100644 index 0000000..9399711 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonVip/vue3/components/CommonVipModal.vue @@ -0,0 +1,58 @@ + + + + + + + + + \ No newline at end of file diff --git a/module-system/src/main/resources/application-dev.yml b/module-system/src/main/resources/application-dev.yml index 98659de..ba554db 100644 --- a/module-system/src/main/resources/application-dev.yml +++ b/module-system/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8000 + port: 8001 tomcat: max-swallow-size: -1 error: @@ -339,12 +339,12 @@ third-app: # keyPath: # notifyUrl: -##配置微信 - 三只青蛙大米小程 +##配置微信 - 珠宝项目配置 wechat-dm: - mpAppId: wx0839bc52e7849c13 - mpAppSecret: c614fd865951c5246e849501204e6f7f - mchId: 1700534180 - mchKey: 9bde2770a74c2a460592de2d451ce05f + mpAppId: wx28679cb649907e7e + mpAppSecret: 6b5fbf1439176f7b78209bd237dfdf7e + mchId: 1702891319 + mchKey: 6b5fbf1439176f7b78209bd237dfdf7e keyPath: notifyUrl: