Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg
This commit is contained in:
commit
cdeebc7afb
48
README.md
48
README.md
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
|
||||
#### 欢迎交流需求,交流业务,交流技术
|
||||
#### 欢迎交流需求,交流业务,交流技术(基础问题自行解决,进群先看文档后提问)
|
||||
|
||||
##### 交流 qq 1群 961316482(已满)
|
||||
|
||||
@ -28,75 +28,75 @@ Lilishop 商城系统 基于SpringBoot 研发,B2B2C多用户商城系统,前
|
||||
业务兼容O2O商城/B2B商城/B2B2C商城/F2B2C商城/S2B2C商城。支持小程序商城、H5商城、APP商城、 PC商城。
|
||||
|
||||
|
||||
|
||||
商城前后端分离、支持分布式部署。
|
||||
|
||||
商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、分销模块、文章模块、系统设置模块、流量分析模块
|
||||
|
||||
商城包含各种中间件、搜索引擎、多级缓存、分布式事务、分布式任务调度等,支持Docker,支持k8s。是一款高性能,支持高并发的商城系统。
|
||||
|
||||
##### 商城 API/消费者 聚合版
|
||||
api不需要单独部署,只需启动一个jar包就可以正常运转 如有需要,可以点击跳转https://gitee.com/beijing_hongye_huicheng/lilishop-simplify
|
||||
|
||||
|
||||
### ☃️ 帮助文档
|
||||
### ☃️ 商城 开发/使用/常见问题 帮助文档
|
||||
|
||||
https://docs.pickmall.cn
|
||||
|
||||
### 💧 项目链接(gitee)
|
||||
### 💧 开源商城项目地址(gitee)
|
||||
|
||||
**Java后台**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
||||
**Java后台(商城所有API)**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
||||
|
||||
**Vue后台前端**: https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
|
||||
**UI(商城管理端/商家端/买家PC端)**: https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
|
||||
|
||||
**Uni-app**:https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
|
||||
**Uni-app(商城移动端,支持小程序/APP/H5)**:https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
|
||||
|
||||
**docker一键部署**:https://gitee.com/beijing_hongye_huicheng/docker.git
|
||||
**docker一键部署(商城部署脚本)**:https://gitee.com/beijing_hongye_huicheng/docker.git
|
||||
|
||||
### 💧 项目链接(github)
|
||||
### 💧 开源商城项目地址(github)
|
||||
|
||||
**Java后台**:https://github.com/hongyehuicheng/lilishop.git
|
||||
**Java后台(商城所有API)**:https://github.com/hongyehuicheng/lilishop.git
|
||||
|
||||
**Vue后台前端**: https://github.com/hongyehuicheng/lilishop-ui.git
|
||||
**UI(商城管理端/商家端/买家PC端)**: https://github.com/hongyehuicheng/lilishop-ui.git
|
||||
|
||||
**Uni-app**:https://github.com/hongyehuicheng/lilishop-uniapp.git
|
||||
**Uni-app(商城移动端,支持小程序/APP/H5)**:https://github.com/hongyehuicheng/lilishop-uniapp.git
|
||||
|
||||
**docker一键部署**:https://github.com/hongyehuicheng/docker.git
|
||||
**docker一键部署(商城部署脚本)**:https://github.com/hongyehuicheng/docker.git
|
||||
|
||||
### 💧 演示地址(手机验证码为 ‘111111’)
|
||||
|
||||
**运营后台**:https://admin-b2b2c.pickmall.cn 账号:admin/123456
|
||||
**商城管理端**:https://admin-b2b2c.pickmall.cn 账号:admin/123456
|
||||
|
||||
**店铺后台**:https://store-b2b2c.pickmall.cn 账号:13011111111/111111
|
||||
**商城店铺后台**:https://store-b2b2c.pickmall.cn 账号:13011111111/111111
|
||||
|
||||
**PC**:https://pc-b2b2c.pickmall.cn
|
||||
**商城PC页面**:https://pc-b2b2c.pickmall.cn
|
||||
|
||||
**WAP**:https://m-b2b2c.pickmall.cn
|
||||
**商城移动端(请使浏览器手机模式,或者用手机浏览器打开)**:https://m-b2b2c.pickmall.cn
|
||||
|
||||
**小程序/公众号**:扫描二维码
|
||||
|
||||

|
||||
|
||||
### 🚙 3行命令搭建本地运行环境
|
||||
### 🚙 3行命令搭建本地商城(注:只能本机访问,如需调整,请自行操作镜像)
|
||||
|
||||
温馨提示:由于服务中间件较多,如果笔记本环境启动内存没有32g可能无法启动成功(macbookpro 2020 16g内存启动无法成功),台式机在16g内存、AMD 3700x 的ubuntu系统成功运行。
|
||||
|
||||
|
||||
|
||||
##### docker环境安装 [点击跳转](https://docs.pickmall.cn/deploy/%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2.html)
|
||||
##### docker环境安装 [点击跳转](https://docs.pickmall.cn/deploy/%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87.html)
|
||||
|
||||
|
||||
|
||||
##### 下载docker-compose脚本
|
||||
`git clone https://gitee.com/beijing_hongye_huicheng/docker.git `
|
||||
|
||||
##### 部署基础环境
|
||||
##### 部署商城所需中间件
|
||||
`docker-compose up -d`
|
||||
|
||||
##### 部署应用
|
||||
##### 部署商城应用
|
||||
`docker-compose -f docker-compose-application.yml up -d`
|
||||
|
||||
|
||||
|
||||
PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql 这里有与tag版本一致的sql,根据tag获取sql,如果使用master代码,则需要在lilishop项目根目录的update-sql目录中,获取对应的升级sql。
|
||||
PS:商城数据库单独部署 https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql 这里有与tag版本一致的sql,根据tag获取sql,如果使用master代码,则需要在lilishop项目根目录的DB目录中,获取对应的升级sql。
|
||||
|
||||
##### 商城 API/UI 地址
|
||||
|
||||
@ -193,7 +193,7 @@ PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/d
|
||||
```
|
||||
商城后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
||||
|
||||
后续会考虑推出微服务商城系统/中台商城等
|
||||
后续会考虑推出微服务商城系统/商城中台等
|
||||
```
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 买家端,意见反馈接口
|
||||
*
|
||||
@ -31,7 +33,7 @@ public class FeedbackBuyerController {
|
||||
|
||||
@ApiOperation(value = "添加意见反馈")
|
||||
@PostMapping()
|
||||
public ResultMessage<Object> save(Feedback feedback) {
|
||||
public ResultMessage<Object> save(@Valid Feedback feedback) {
|
||||
feedback.setUserName(UserContext.getCurrentUser().getNickName());
|
||||
feedbackService.save(feedback);
|
||||
return ResultUtil.success();
|
||||
|
@ -136,9 +136,7 @@ ignored:
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/store
|
||||
- /buyer/store/get**
|
||||
- /buyer/store/label/get**
|
||||
- /buyer/store/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/**
|
||||
- /buyer/promotion/pintuan/**
|
||||
|
@ -151,7 +151,7 @@ ignored:
|
||||
- /swagger-resources/**
|
||||
- /swagger/**
|
||||
- /webjars/**
|
||||
- /v2/api-docs
|
||||
- /v2/api-docs**
|
||||
- /configuration/ui
|
||||
- /boot-admin
|
||||
- /manager/promotion/seckill/init
|
||||
@ -162,9 +162,9 @@ ignored:
|
||||
|
||||
# Swagger界面内容配置
|
||||
swagger:
|
||||
title: lili API接口文档
|
||||
description: lili Api Documentation
|
||||
version: 1.0.0
|
||||
title: lilishop API接口文档
|
||||
description: lilishop Api Documentation
|
||||
version: 4.2.2
|
||||
termsOfServiceUrl: https://pickmall.cn
|
||||
contact:
|
||||
name: lili
|
||||
|
@ -108,11 +108,6 @@
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>${swagger-bootstrap-ui-version}</version>
|
||||
</dependency>
|
||||
<!-- Hutool工具包 -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
@ -136,12 +131,6 @@
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>${jasypt-version}</version>
|
||||
</dependency>
|
||||
<!-- 模板引擎 -->
|
||||
<dependency>
|
||||
<groupId>com.ibeetl</groupId>
|
||||
<artifactId>beetl</artifactId>
|
||||
<version>${beetl-version}</version>
|
||||
</dependency>
|
||||
<!-- 阿里云核心包-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
@ -276,11 +265,11 @@
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.interceptor</groupId>
|
||||
<artifactId>javax.interceptor-api</artifactId>
|
||||
<version>${interceptor-api}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.interceptor</groupId>-->
|
||||
<!-- <artifactId>javax.interceptor-api</artifactId>-->
|
||||
<!-- <version>${interceptor-api}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
|
@ -1,19 +0,0 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 过滤路径
|
||||
* @author Chopper
|
||||
*/
|
||||
@Configuration
|
||||
public class ContextConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new ThreadContextHolderInterceptorAdapter()).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +1,29 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 用户上下文
|
||||
* request / response 获取工具
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
public class ThreadContextHolder {
|
||||
|
||||
private static final ThreadLocal<HttpServletRequest> REQUEST_THREAD_LOCAL_HOLDER = new ThreadLocal<>();
|
||||
private static final ThreadLocal<HttpServletResponse> RESPONSE_THREAD_LOCAL_HOLDER = new ThreadLocal<>();
|
||||
|
||||
public static void remove() {
|
||||
REQUEST_THREAD_LOCAL_HOLDER.remove();
|
||||
RESPONSE_THREAD_LOCAL_HOLDER.remove();
|
||||
}
|
||||
|
||||
public static HttpServletResponse getHttpResponse() {
|
||||
|
||||
return RESPONSE_THREAD_LOCAL_HOLDER.get();
|
||||
}
|
||||
|
||||
public static void setHttpResponse(HttpServletResponse response) {
|
||||
RESPONSE_THREAD_LOCAL_HOLDER.set(response);
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
assert servletRequestAttributes != null;
|
||||
return servletRequestAttributes.getResponse();
|
||||
}
|
||||
|
||||
public static HttpServletRequest getHttpRequest() {
|
||||
return REQUEST_THREAD_LOCAL_HOLDER.get();
|
||||
}
|
||||
|
||||
public static void setHttpRequest(HttpServletRequest request) {
|
||||
|
||||
REQUEST_THREAD_LOCAL_HOLDER.set(request);
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
assert servletRequestAttributes != null;
|
||||
return servletRequestAttributes.getRequest();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* request response 填充
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v4.0
|
||||
* @since 2020/12/9 10:44
|
||||
*/
|
||||
public class ThreadContextHolderInterceptorAdapter extends HandlerInterceptorAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* 拦截request和response并放到上下文中
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @param handler 处理程序
|
||||
* @return 处理结果
|
||||
* @throws Exception 未知异常
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
ThreadContextHolder.setHttpResponse(response);
|
||||
ThreadContextHolder.setHttpRequest(request);
|
||||
|
||||
return super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从上下文中移除 request 和response
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @param handler 处理程序
|
||||
* @param ex 异常
|
||||
* @throws Exception 完成之前处理异常
|
||||
*/
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
|
||||
ThreadContextHolder.remove();
|
||||
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package cn.lili.common.context.interceptor;
|
||||
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 写入request/response
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* @since 2020-06-13 13:38
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RequestInterceptorAdapter extends HandlerInterceptorAdapter {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
ThreadContextHolder.setHttpResponse(response);
|
||||
ThreadContextHolder.setHttpRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, Exception ex) throws Exception {
|
||||
ThreadContextHolder.remove();
|
||||
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package cn.lili.common.context.interceptor;
|
||||
|
||||
import cn.lili.common.properties.IgnoredUrlsProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 过滤路径
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@Configuration
|
||||
public class UrlConfiguration implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
private IgnoredUrlsProperties ignoredUrlsProperties;
|
||||
@Autowired
|
||||
private RequestInterceptorAdapter requestInterceptorAdapter;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
//注册拦截器
|
||||
InterceptorRegistration ir = registry.addInterceptor(requestInterceptorAdapter);
|
||||
//配置拦截的路径
|
||||
ir.addPathPatterns("/**");
|
||||
//配置不拦截的路径
|
||||
ir.excludePathPatterns(ignoredUrlsProperties.getUrls());
|
||||
}
|
||||
|
||||
/**
|
||||
* 开放资源 这里配置swagger可以在前端访问
|
||||
*
|
||||
* @param registry 资源处理
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
//解决 SWAGGER 404报错
|
||||
registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
}
|
||||
|
||||
}
|
@ -1,345 +0,0 @@
|
||||
package cn.lili.generator;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.generator.bean.Entity;
|
||||
import org.beetl.core.Configuration;
|
||||
import org.beetl.core.GroupTemplate;
|
||||
import org.beetl.core.Template;
|
||||
import org.beetl.core.resource.ClasspathResourceLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成器 Mybatis-Plus
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
/**
|
||||
* 代码生成在哪个项目
|
||||
*/
|
||||
private static final String PROJECT = "framework";
|
||||
|
||||
/**
|
||||
* 代码生成在哪个包下边
|
||||
*/
|
||||
private static final String PACKAGES = "cn.lili.modules.";
|
||||
|
||||
/**
|
||||
* modules
|
||||
*/
|
||||
private static final String MODULES = "message";
|
||||
|
||||
|
||||
/**
|
||||
* 实体类名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String CLASS_NAME = "ShortLink";
|
||||
|
||||
/**
|
||||
* 类说明描述
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String DESCRIPTION = "短链接";
|
||||
|
||||
/**
|
||||
* 作者名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String AUTHOR = "Chopper";
|
||||
|
||||
/**
|
||||
* 数据库表名前缀
|
||||
* 下方请根据需要修改
|
||||
*/
|
||||
private static final String TABLE_PRE = "li_";
|
||||
|
||||
/**
|
||||
* 主键类型
|
||||
*/
|
||||
private static final String PRIMARY_KEY_TYPE = "String";
|
||||
|
||||
|
||||
/**
|
||||
* endity
|
||||
*/
|
||||
private static final String ENTITY_PACKAGE = PACKAGES + MODULES + ".entity";
|
||||
|
||||
/**
|
||||
* dao
|
||||
*/
|
||||
private static final String DAO_PACKAGE = PACKAGES + MODULES + ".mapper";
|
||||
|
||||
/**
|
||||
* service
|
||||
*/
|
||||
private static final String SERVICE_PACKAGE = PACKAGES + MODULES + ".service";
|
||||
|
||||
/**
|
||||
* serviceImpl
|
||||
*/
|
||||
private static final String SERVICE_IMPL_PACKAGE = PACKAGES + MODULES + ".serviceimpl";
|
||||
|
||||
/**
|
||||
* controller
|
||||
*/
|
||||
private static final String CONTROLLER_PACKAGE = PACKAGES + MODULES + ".controller";
|
||||
|
||||
/**
|
||||
* 运行该主函数即可生成代码
|
||||
*
|
||||
* @param args
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
//模板路径
|
||||
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("/templates/");
|
||||
Configuration cfg = Configuration.defaultConfiguration();
|
||||
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
|
||||
//生成代码
|
||||
generateCode(gt);
|
||||
//根据类名删除生成的代码
|
||||
// deleteCode(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*
|
||||
* @param gt
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void generateCode(GroupTemplate gt) throws IOException {
|
||||
|
||||
Template entityTemplate = gt.getTemplate("entity.btl");
|
||||
Template daoTemplate = gt.getTemplate("mapper.btl");
|
||||
Template serviceTemplate = gt.getTemplate("service.btl");
|
||||
Template serviceImplTemplate = gt.getTemplate("serviceImpl.btl");
|
||||
Template controllerTemplate = gt.getTemplate("controller.btl");
|
||||
Template mapperXmlTemplate = gt.getTemplate("mapperXml.btl");
|
||||
|
||||
Entity entity = new Entity();
|
||||
entity.setEntityPackage(ENTITY_PACKAGE);
|
||||
entity.setDaoPackage(DAO_PACKAGE);
|
||||
entity.setServicePackage(SERVICE_PACKAGE);
|
||||
entity.setServiceImplPackage(SERVICE_IMPL_PACKAGE);
|
||||
entity.setControllerPackage(CONTROLLER_PACKAGE);
|
||||
entity.setAuthor(AUTHOR);
|
||||
entity.setClassName(CLASS_NAME);
|
||||
entity.setTableName(TABLE_PRE + StringUtils.camel2Underline(CLASS_NAME));
|
||||
entity.setClassNameLowerCase(name(CLASS_NAME, false));
|
||||
entity.setDescription(DESCRIPTION);
|
||||
entity.setPrimaryKeyType(PRIMARY_KEY_TYPE);
|
||||
|
||||
OutputStream out = null;
|
||||
|
||||
//生成实体类代码
|
||||
entityTemplate.binding("entity", entity);
|
||||
String entityResult = entityTemplate.render();
|
||||
System.out.println(entityResult);
|
||||
//创建文件
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(ENTITY_PACKAGE) + "/" + CLASS_NAME + ".java";
|
||||
File entityFile = new File(entityFileUrl);
|
||||
File entityDir = entityFile.getParentFile();
|
||||
if (!entityDir.exists()) {
|
||||
entityDir.mkdirs();
|
||||
}
|
||||
if (!entityFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
entityFile.createNewFile();
|
||||
out = new FileOutputStream(entityFile);
|
||||
entityTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成dao代码
|
||||
daoTemplate.binding("entity", entity);
|
||||
String daoResult = daoTemplate.render();
|
||||
System.out.println(daoResult);
|
||||
//创建文件
|
||||
String daoFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(DAO_PACKAGE) + "/" + CLASS_NAME + "Mapper.java";
|
||||
File daoFile = new File(daoFileUrl);
|
||||
File daoDir = daoFile.getParentFile();
|
||||
if (!daoDir.exists()) {
|
||||
daoDir.mkdirs();
|
||||
}
|
||||
if (!daoFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
daoFile.createNewFile();
|
||||
out = new FileOutputStream(daoFile);
|
||||
daoTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成service代码
|
||||
serviceTemplate.binding("entity", entity);
|
||||
String serviceResult = serviceTemplate.render();
|
||||
System.out.println(serviceResult);
|
||||
//创建文件
|
||||
String serviceFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_PACKAGE) + "/" + CLASS_NAME + "Service.java";
|
||||
File serviceFile = new File(serviceFileUrl);
|
||||
File serviceDir = serviceFile.getParentFile();
|
||||
if (!serviceDir.exists()) {
|
||||
serviceDir.mkdirs();
|
||||
}
|
||||
if (!serviceFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
serviceFile.createNewFile();
|
||||
out = new FileOutputStream(serviceFile);
|
||||
serviceTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成serviceImpl代码
|
||||
serviceImplTemplate.binding("entity", entity);
|
||||
String serviceImplResult = serviceImplTemplate.render();
|
||||
System.out.println(serviceImplResult);
|
||||
//创建文件
|
||||
System.out.println(System.getProperty("user.dir"));
|
||||
String serviceImplFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_IMPL_PACKAGE) + "/" + CLASS_NAME + "ServiceImpl.java";
|
||||
File serviceImplFile = new File(serviceImplFileUrl);
|
||||
File serviceImplDir = serviceImplFile.getParentFile();
|
||||
if (!serviceImplDir.exists()) {
|
||||
serviceImplDir.mkdirs();
|
||||
}
|
||||
if (!serviceImplFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
serviceImplFile.createNewFile();
|
||||
out = new FileOutputStream(serviceImplFile);
|
||||
serviceImplTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成controller代码
|
||||
controllerTemplate.binding("entity", entity);
|
||||
String controllerResult = controllerTemplate.render();
|
||||
System.out.println(controllerResult);
|
||||
//创建文件
|
||||
String controllerFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(CONTROLLER_PACKAGE) + "/" + CLASS_NAME + "Controller.java";
|
||||
File controllerFile = new File(controllerFileUrl);
|
||||
File controllerDir = controllerFile.getParentFile();
|
||||
if (!controllerDir.exists()) {
|
||||
controllerDir.mkdirs();
|
||||
}
|
||||
if (!controllerFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
controllerFile.createNewFile();
|
||||
out = new FileOutputStream(controllerFile);
|
||||
controllerTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成mapperXml代码
|
||||
mapperXmlTemplate.binding("entity", entity);
|
||||
String mapperXmlResult = mapperXmlTemplate.render();
|
||||
System.out.println(mapperXmlResult);
|
||||
//创建文件
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/resources/mapper/" + CLASS_NAME + "Mapper.xml";
|
||||
File mapperXmlFile = new File(mapperXmlFileUrl);
|
||||
File mapperXmlDir = mapperXmlFile.getParentFile();
|
||||
if (!mapperXmlDir.exists()) {
|
||||
mapperXmlDir.mkdirs();
|
||||
}
|
||||
if (!mapperXmlFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
mapperXmlFile.createNewFile();
|
||||
out = new FileOutputStream(mapperXmlFile);
|
||||
mapperXmlTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
System.out.println("生成代码成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定类代码
|
||||
*
|
||||
* @param className
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void deleteCode(String className) throws IOException {
|
||||
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(ENTITY_PACKAGE) + "/" + className + ".java";
|
||||
File entityFile = new File(entityFileUrl);
|
||||
if (entityFile.exists()) {
|
||||
entityFile.delete();
|
||||
}
|
||||
String daoFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(DAO_PACKAGE) + "/" + className + "Mapper.java";
|
||||
File daoFile = new File(daoFileUrl);
|
||||
if (daoFile.exists()) {
|
||||
daoFile.delete();
|
||||
}
|
||||
|
||||
String serviceFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_PACKAGE) + "/" + className + "Service.java";
|
||||
File serviceFile = new File(serviceFileUrl);
|
||||
if (serviceFile.exists()) {
|
||||
serviceFile.delete();
|
||||
}
|
||||
|
||||
String serviceImplFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_IMPL_PACKAGE) + "/" + className + "ServiceImpl.java";
|
||||
File serviceImplFile = new File(serviceImplFileUrl);
|
||||
if (serviceImplFile.exists()) {
|
||||
serviceImplFile.delete();
|
||||
}
|
||||
|
||||
String controllerFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(CONTROLLER_PACKAGE) + "/" + className + "Controller.java";
|
||||
File controllerFile = new File(controllerFileUrl);
|
||||
if (controllerFile.exists()) {
|
||||
controllerFile.delete();
|
||||
}
|
||||
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/resources/mapper/" + className + "Mapper.xml";
|
||||
File mapperXmlFile = new File(mapperXmlFileUrl);
|
||||
if (mapperXmlFile.exists()) {
|
||||
mapperXmlFile.delete();
|
||||
}
|
||||
|
||||
System.out.println("删除代码完毕!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 点转斜线
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String dotToLine(String str) {
|
||||
return str.replace(".", "/");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首字母是否大小写
|
||||
*
|
||||
* @param name
|
||||
* @param isFirstUpper
|
||||
* @return
|
||||
*/
|
||||
public static String name(String name, boolean isFirstUpper) {
|
||||
|
||||
if (StrUtil.isBlank(name)) {
|
||||
throw new ServiceException("name不能为空");
|
||||
}
|
||||
|
||||
if (name.length() == 1) {
|
||||
if (isFirstUpper) {
|
||||
return name.toUpperCase();
|
||||
} else {
|
||||
return name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (isFirstUpper) {
|
||||
sb.append(Character.toUpperCase(name.charAt(0)));
|
||||
} else {
|
||||
sb.append(Character.toLowerCase(name.charAt(0)));
|
||||
}
|
||||
sb.append(name.substring(1));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package cn.lili.generator.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
*/
|
||||
@Data
|
||||
public class Entity {
|
||||
|
||||
/**
|
||||
* 实体类,dao,service,controller目录
|
||||
*/
|
||||
private String entityPackage;
|
||||
|
||||
private String daoPackage;
|
||||
|
||||
private String servicePackage;
|
||||
|
||||
private String serviceImplPackage;
|
||||
|
||||
private String controllerPackage;
|
||||
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 类名
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 首字母小写的类名字,用于模版内的变量名称
|
||||
*/
|
||||
private String classNameLowerCase;
|
||||
|
||||
/**
|
||||
* 数据库
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 类说明描述,一般设定关键字即可 例如:会员
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 主键类型
|
||||
*/
|
||||
private String primaryKeyType;
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package cn.lili.modules.connect.entity.enums;
|
||||
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 通知类站内信模版对象
|
||||
@ -21,22 +24,30 @@ public class NoticeMessage extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "站内信节点")
|
||||
@NotEmpty(message = "站内信节点不能为空")
|
||||
@Length(max = 50, message = "站内信节点名称太长,不能超过50")
|
||||
private String noticeNode;
|
||||
|
||||
@ApiModelProperty(value = "站内信标题")
|
||||
@NotEmpty(message = "站内信标题不能为空")
|
||||
@Length(max = 50, message = "站内信标题名称太长,不能超过50")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "站内信内容")
|
||||
@NotEmpty(message = "站内信内容不能为空")
|
||||
@Length(max = 200, message = "站内信内容名称太长,不能超过200")
|
||||
private String noticeContent;
|
||||
/**
|
||||
* @see cn.lili.common.enums.SwitchEnum
|
||||
*/
|
||||
@NotEmpty(message = "站内信状态不能为空")
|
||||
@ApiModelProperty(value = "站内信是否开启")
|
||||
private String noticeStatus;
|
||||
/**
|
||||
* @see cn.lili.modules.message.entity.enums.NoticeMessageParameterEnum
|
||||
*/
|
||||
@ApiModelProperty(value = "消息变量")
|
||||
@NotEmpty(message = "站内信状态不能为空")
|
||||
private String variable;
|
||||
|
||||
|
||||
|
@ -43,8 +43,6 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
|
||||
//保存站内信信息
|
||||
this.save(message);
|
||||
//发送站内信消息提醒
|
||||
String destination = rocketmqCustomProperties.getOtherTopic() + ":" + OtherTagsEnum.MESSAGE.name();
|
||||
rocketMQTemplate.asyncSend(destination, message, RocketmqSendCallbackBuilder.commonCallback());
|
||||
String noticeSendDestination = rocketmqCustomProperties.getNoticeSendTopic() + ":" + OtherTagsEnum.MESSAGE.name();
|
||||
rocketMQTemplate.asyncSend(noticeSendDestination, message, RocketmqSendCallbackBuilder.commonCallback());
|
||||
return true;
|
||||
|
@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -34,8 +35,8 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMapper, WechatMPMessage> implements WechatMPMessageService {
|
||||
@Autowired
|
||||
private WechatAccessTokenUtil wechatAccessTokenUtil;
|
||||
@ -52,6 +53,9 @@ public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMappe
|
||||
* post 删除模版 添加模版 获取模版id
|
||||
*/
|
||||
private final String delMsgTpl = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=";
|
||||
/**
|
||||
* post 添加模版
|
||||
*/
|
||||
private final String addTpl = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=";
|
||||
|
||||
@Override
|
||||
@ -61,6 +65,8 @@ public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMappe
|
||||
String accessToken = wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP);
|
||||
//获取已有模版,删除
|
||||
String context = HttpUtil.get(allMsgTpl + accessToken);
|
||||
|
||||
log.info("获取全部模版:{}", context);
|
||||
JSONObject jsonObject = new JSONObject(context);
|
||||
WechatMessageUtil.wechatHandler(jsonObject);
|
||||
List<String> oldList = new ArrayList<>();
|
||||
@ -73,7 +79,8 @@ public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMappe
|
||||
oldList.forEach(templateId -> {
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
params.put("priTmplId", templateId);
|
||||
WechatMessageUtil.wechatHandler(HttpUtil.post(delMsgTpl + accessToken, params));
|
||||
String message = WechatMessageUtil.wechatHandler(HttpUtil.post(delMsgTpl + accessToken, params));
|
||||
log.info("删除模版请求:{},删除模版响应:{}", params, message);
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,7 +96,7 @@ public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMappe
|
||||
JSONArray jsonArray = new JSONObject(keywordsItems).getJSONArray("data");
|
||||
List<WechatMessageKeyword> keywordArray = jsonArray.toList(WechatMessageKeyword.class);
|
||||
|
||||
log.error("keywords:" + keywordArray);
|
||||
log.info("keywords:" + keywordArray);
|
||||
//存放约定好的kids
|
||||
List<String> kids = new ArrayList<>(tplData.keyWord.size());
|
||||
List<String> kidTexts = new ArrayList<>(tplData.keyWord.size());
|
||||
@ -111,7 +118,7 @@ public class WechatMPMessageServiceImpl extends ServiceImpl<WechatMPMessageMappe
|
||||
params.put("kidList", kids);
|
||||
params.put("sceneDesc", tplData.getSceneDesc());
|
||||
String content = HttpUtils.doPostWithJson(addTpl + accessToken, params);
|
||||
log.error(JSONUtil.toJsonStr(params));
|
||||
log.info("添加模版参数:{},添加模版响应:{}", params, content);
|
||||
JSONObject tplContent = new JSONObject(content);
|
||||
WechatMessageUtil.wechatHandler(tplContent);
|
||||
|
||||
|
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -33,6 +34,7 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class WechatMessageServiceImpl extends ServiceImpl<WechatMessageMapper, WechatMessage> implements WechatMessageService {
|
||||
|
||||
@ -51,6 +53,9 @@ public class WechatMessageServiceImpl extends ServiceImpl<WechatMessageMapper, W
|
||||
* post 删除模版 添加模版 获取模版id
|
||||
*/
|
||||
private final String delMsgTpl = "https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token=";
|
||||
/**
|
||||
* post 添加模版
|
||||
*/
|
||||
private final String addTpl = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=";
|
||||
|
||||
@Override
|
||||
@ -70,9 +75,13 @@ public class WechatMessageServiceImpl extends ServiceImpl<WechatMessageMapper, W
|
||||
setIndustryParams.put("industry_id2", 5);
|
||||
String context = HttpUtils.doPostWithJson(setIndustry + accessToken, setIndustryParams);
|
||||
|
||||
log.info("设置模版请求{},设置行业响应:{}", setIndustryParams, context);
|
||||
//获取已有模版,删除
|
||||
context = HttpUtil.get(allMsgTpl + accessToken);
|
||||
JSONObject jsonObject = new JSONObject(context);
|
||||
|
||||
|
||||
log.info("获取全部模版:{}", context);
|
||||
WechatMessageUtil.wechatHandler(jsonObject);
|
||||
List<String> oldList = new ArrayList<>();
|
||||
if (jsonObject.containsKey("template_list")) {
|
||||
@ -84,7 +93,8 @@ public class WechatMessageServiceImpl extends ServiceImpl<WechatMessageMapper, W
|
||||
oldList.forEach(templateId -> {
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
params.put("template_id", templateId);
|
||||
WechatMessageUtil.wechatHandler(HttpUtil.post(delMsgTpl + accessToken, params));
|
||||
String message = WechatMessageUtil.wechatHandler(HttpUtil.post(delMsgTpl + accessToken, params));
|
||||
log.info("删除模版请求:{},删除模版响应:{}", params, message);
|
||||
});
|
||||
}
|
||||
|
||||
@ -94,8 +104,10 @@ public class WechatMessageServiceImpl extends ServiceImpl<WechatMessageMapper, W
|
||||
WechatMessage wechatMessage = new WechatMessage();
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
params.put("template_id_short", tplData.getMsgId());
|
||||
String content = HttpUtils.doPostWithJson(addTpl + accessToken, params);
|
||||
JSONObject tplContent = new JSONObject(content);
|
||||
String message = HttpUtils.doPostWithJson(addTpl + accessToken, params);
|
||||
log.info("添加模版请求:{},添加模版响应:{}", params, message);
|
||||
|
||||
JSONObject tplContent = new JSONObject(message);
|
||||
WechatMessageUtil.wechatHandler(tplContent);
|
||||
|
||||
//如果包含模版id则进行操作,否则抛出异常
|
||||
|
@ -215,7 +215,7 @@ public interface OrderService extends IService<Order> {
|
||||
/**
|
||||
* 获取待发货订单编号列表
|
||||
*
|
||||
* @param response 响应
|
||||
* @param response 响应
|
||||
* @param logisticsName 店铺已选择物流公司列表
|
||||
*/
|
||||
void getBatchDeliverList(HttpServletResponse response, List<String> logisticsName);
|
||||
@ -227,4 +227,12 @@ public interface OrderService extends IService<Order> {
|
||||
*/
|
||||
void batchDeliver(MultipartFile files);
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单实际支付的总金额
|
||||
*
|
||||
* @param orderSn 订单sn
|
||||
* @return 金额
|
||||
*/
|
||||
Double getPaymentTotal(String orderSn);
|
||||
}
|
@ -23,6 +23,7 @@ import cn.lili.modules.order.order.aop.OrderLogPoint;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dos.OrderItem;
|
||||
import cn.lili.modules.order.order.entity.dos.Receipt;
|
||||
import cn.lili.modules.order.order.entity.dos.Trade;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderBatchDeliverDTO;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
@ -33,10 +34,7 @@ import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderVO;
|
||||
import cn.lili.modules.order.order.mapper.OrderItemMapper;
|
||||
import cn.lili.modules.order.order.mapper.OrderMapper;
|
||||
import cn.lili.modules.order.order.service.OrderItemService;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.order.order.service.ReceiptService;
|
||||
import cn.lili.modules.order.order.service.StoreFlowService;
|
||||
import cn.lili.modules.order.order.service.*;
|
||||
import cn.lili.modules.order.trade.entity.dos.OrderLog;
|
||||
import cn.lili.modules.order.trade.service.OrderLogService;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
@ -144,11 +142,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
*/
|
||||
@Autowired
|
||||
private PintuanService pintuanService;
|
||||
/**
|
||||
* 规格商品
|
||||
*/
|
||||
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
private TradeService tradeService;
|
||||
|
||||
@Override
|
||||
public void intoDB(TradeDTO tradeDTO) {
|
||||
@ -592,6 +588,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Double getPaymentTotal(String orderSn) {
|
||||
Order order = this.getBySn(orderSn);
|
||||
Trade trade = tradeService.getBySn(order.getTradeSn());
|
||||
if (trade.getPayStatus().equals(PayStatusEnum.PAID.name())) {
|
||||
return trade.getFlowPrice();
|
||||
}
|
||||
return order.getFlowPrice();
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环检查批量发货订单列表
|
||||
*
|
||||
|
@ -45,9 +45,11 @@ public class Feedback extends BaseIdEntity {
|
||||
private String context;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
@Length(max = 11, message = "手机号不能超过11位")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "图片,多个图片使用:(,)分割")
|
||||
@Length(max = 255, message = "图片上传太多啦,请选择删除掉")
|
||||
private String images;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,6 @@ public class ArticleVO {
|
||||
@ApiModelProperty(value = "文章排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "状态, allowableValues = OPEN,CLOSE")
|
||||
@ApiModelProperty(value = "开启状态")
|
||||
private Boolean openStatus;
|
||||
}
|
||||
|
@ -21,6 +21,12 @@ import java.util.List;
|
||||
@CacheConfig(cacheNames = "{article}")
|
||||
public interface ArticleService extends IService<Article> {
|
||||
|
||||
/**
|
||||
* 管理端获取文章
|
||||
* @param articleSearchParams
|
||||
* @return
|
||||
*/
|
||||
IPage<ArticleVO> managerArticlePage(ArticleSearchParams articleSearchParams);
|
||||
/**
|
||||
* 获取文章分页
|
||||
*
|
||||
|
@ -34,11 +34,19 @@ import java.util.List;
|
||||
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
|
||||
|
||||
@Override
|
||||
public IPage<ArticleVO> articlePage(ArticleSearchParams articleSearchParams) {
|
||||
public IPage<ArticleVO> managerArticlePage(ArticleSearchParams articleSearchParams) {
|
||||
articleSearchParams.setSort("a.sort");
|
||||
return this.baseMapper.getArticleList(PageUtil.initPage(articleSearchParams), articleSearchParams.queryWrapper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ArticleVO> articlePage(ArticleSearchParams articleSearchParams) {
|
||||
articleSearchParams.setSort("a.sort");
|
||||
QueryWrapper queryWrapper = articleSearchParams.queryWrapper();
|
||||
queryWrapper.eq("open_status",true);
|
||||
return this.baseMapper.getArticleList(PageUtil.initPage(articleSearchParams), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Article> list(String categoryId) {
|
||||
|
||||
|
@ -20,6 +20,7 @@ import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.modules.connect.entity.Connect;
|
||||
import cn.lili.modules.connect.entity.enums.ConnectEnum;
|
||||
import cn.lili.modules.connect.service.ConnectService;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.payment.entity.RefundLog;
|
||||
import cn.lili.modules.payment.kit.CashierSupport;
|
||||
import cn.lili.modules.payment.kit.Payment;
|
||||
@ -100,6 +101,11 @@ public class WechatPlugin implements Payment {
|
||||
*/
|
||||
@Autowired
|
||||
private ConnectService connectService;
|
||||
/**
|
||||
* 联合登陆
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -497,7 +503,7 @@ public class WechatPlugin implements Payment {
|
||||
try {
|
||||
|
||||
Amount amount = new Amount().setRefund(CurrencyUtil.fen(refundLog.getTotalAmount()))
|
||||
.setTotal(CurrencyUtil.fen(refundLog.getPayPrice()));
|
||||
.setTotal(CurrencyUtil.fen(orderService.getPaymentTotal(refundLog.getOrderSn())));
|
||||
|
||||
//退款参数准备
|
||||
RefundModel refundModel = new RefundModel()
|
||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
|
||||
/**
|
||||
@ -21,18 +22,22 @@ public class AdminUser extends BaseEntity {
|
||||
private static final long serialVersionUID = 2918352800205024873L;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
@Length(max = 20,message = "用户名长度不能超过20个字符")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
@Length(max = 10,message = "昵称长度不能超过10个字符")
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "手机")
|
||||
@Length(max = 11,message = "手机号长度不能超过11")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "邮件")
|
||||
@Length(max = 100,message = "邮箱长度不能超过100")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
|
@ -4,6 +4,7 @@ import cn.lili.mybatis.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@ -19,23 +20,29 @@ public class AdminUserDTO extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
@NotEmpty(message = "用户名不能为空")
|
||||
@Length(max = 20,message = "用户名长度不能超过20个字符")
|
||||
private String username;
|
||||
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
@Length(max = 10,message = "昵称长度不能超过10个字符")
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "手机")
|
||||
@Length(max = 11,message = "手机号长度不能超过11")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "邮件")
|
||||
@Length(max = 100,message = "邮箱长度不能超过100")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "描述/详情/备注")
|
||||
private String description;
|
||||
|
||||
|
@ -2,8 +2,7 @@ package cn.lili.modules.search.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 搜索热词
|
||||
@ -16,9 +15,12 @@ import javax.validation.constraints.NotNull;
|
||||
public class HotWordsDTO {
|
||||
|
||||
@NotBlank(message = "搜索热词不能为空")
|
||||
@Size(max = 20, min = 1, message = "搜索热词长度限制在1-20")
|
||||
private String keywords;
|
||||
|
||||
@NotNull(message = "分数不能为空")
|
||||
@Max(value = 9999999999L,message = "分数不能大于9999999999")
|
||||
@Min(value = -9999999999L,message = "分数不能小于9999999999")
|
||||
private Integer point;
|
||||
}
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
package ${entity.controllerPackage};
|
||||
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.SearchVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import ${entity.entityPackage}.${entity.className};
|
||||
import ${entity.servicePackage}.${entity.className}Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author ${entity.author}
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "${entity.description}接口")
|
||||
@RequestMapping("/lili/${entity.classNameLowerCase}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public class ${entity.className}Controller {
|
||||
|
||||
private final ${entity.className}Service ${entity.classNameLowerCase}Service;
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "查看${entity.description}详情")
|
||||
public ResultMessage<${entity.className}> get(@PathVariable ${entity.primaryKeyType} id){
|
||||
|
||||
${entity.className} ${entity.classNameLowerCase} = ${entity.classNameLowerCase}Service.getById(id);
|
||||
return new ResultUtil<${entity.className}>().setData(${entity.classNameLowerCase});
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "分页获取${entity.description}")
|
||||
public ResultMessage<IPage<${entity.className}>> getByPage(${entity.className} entity,
|
||||
SearchVO searchVo,
|
||||
PageVO page){
|
||||
IPage<${entity.className}> data = ${entity.classNameLowerCase}Service.page(PageUtil.initPage(page),PageUtil.initWrapper(entity, searchVo));
|
||||
return new ResultUtil<IPage<${entity.className}>>().setData(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增${entity.description}")
|
||||
public ResultMessage<${entity.className}> save(${entity.className} ${entity.classNameLowerCase}){
|
||||
|
||||
if(${entity.classNameLowerCase}Service.save(${entity.classNameLowerCase})){
|
||||
return new ResultUtil<${entity.className}>().setData(${entity.classNameLowerCase});
|
||||
}
|
||||
return new ResultUtil<${entity.className}>().setErrorMsg("未知异常,请稍后重试");
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation(value = "更新${entity.description}")
|
||||
public ResultMessage<${entity.className}> update(@PathVariable String id, ${entity.className} ${entity.classNameLowerCase}){
|
||||
if(${entity.classNameLowerCase}Service.updateById(${entity.classNameLowerCase})){
|
||||
return new ResultUtil<${entity.className}>().setData(${entity.classNameLowerCase});
|
||||
}
|
||||
return new ResultUtil<${entity.className}>().setErrorMsg("未知异常,请稍后重试");
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ApiOperation(value = "删除${entity.description}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable List ids){
|
||||
|
||||
${entity.classNameLowerCase}Service.removeByIds(ids);
|
||||
return ResultUtil.success("成功删除");
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package ${entity.entityPackage};
|
||||
|
||||
import cn.lili.mybatis.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author ${entity.author}
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "${entity.tableName}")
|
||||
@TableName("${entity.tableName}")
|
||||
@ApiModel(value = "${entity.description}")
|
||||
public class ${entity.className} extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package ${entity.daoPackage};
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import ${entity.entityPackage}.${entity.className};
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ${entity.description} Dao层
|
||||
* @author ${entity.author}
|
||||
*/
|
||||
public interface ${entity.className}Mapper extends BaseMapper<${entity.className}> {
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${entity.daoPackage}.${entity.className}Mapper">
|
||||
|
||||
</mapper>
|
@ -1,14 +0,0 @@
|
||||
package ${entity.servicePackage};
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import ${entity.entityPackage}.${entity.className};
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ${entity.description} 业务层
|
||||
* @author ${entity.author}
|
||||
*/
|
||||
public interface ${entity.className}Service extends IService<${entity.className}> {
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package ${entity.serviceImplPackage};
|
||||
|
||||
import ${entity.daoPackage}.${entity.className}Mapper;
|
||||
import ${entity.entityPackage}.${entity.className};
|
||||
import ${entity.servicePackage}.${entity.className}Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* ${entity.description} 业务实现
|
||||
* @author ${entity.author}
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public class ${entity.className}ServiceImpl extends ServiceImpl<${entity.className}Mapper, ${entity.className}> implements ${entity.className}Service {
|
||||
|
||||
private final ${entity.className}Mapper ${entity.classNameLowerCase}Mapper;
|
||||
}
|
@ -49,7 +49,7 @@ public class ArticleManagerController {
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
return ResultUtil.data(articleService.articlePage(articleSearchParams));
|
||||
return ResultUtil.data(articleService.managerArticlePage(articleSearchParams));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加文章")
|
||||
|
@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@ -110,7 +111,7 @@ public class AdminUserManagerController {
|
||||
@PutMapping(value = "/admin/edit")
|
||||
@ApiOperation(value = "超级管理员修改其他管理员资料")
|
||||
@DemoSite
|
||||
public ResultMessage<Object> edit(AdminUser adminUser,
|
||||
public ResultMessage<Object> edit(@Valid AdminUser adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
if (!adminUserService.updateAdminUser(adminUser, roles)) {
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
@ -154,7 +155,7 @@ public class AdminUserManagerController {
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加用户")
|
||||
public ResultMessage<Object> register(AdminUserDTO adminUser,
|
||||
public ResultMessage<Object> register(@Valid AdminUserDTO adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
int rolesMaxSize=10;
|
||||
try {
|
||||
|
@ -96,7 +96,7 @@ public class NoticeMessageManagerController {
|
||||
noticeMessage.setNoticeContent(noticeContent);
|
||||
noticeMessage.setNoticeTitle(noticeTitle);
|
||||
noticeMessageService.updateById(noticeMessage);
|
||||
ResultUtil.data(noticeMessage);
|
||||
return ResultUtil.data(noticeMessage);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
4
pom.xml
4
pom.xml
@ -21,7 +21,6 @@
|
||||
<revision>4.2.2</revision>
|
||||
<docker-registry>registry.cn-beijing.aliyuncs.com/lili-images</docker-registry>
|
||||
<images-version>1</images-version>
|
||||
<swagger-bootstrap-ui-version>1.9.6</swagger-bootstrap-ui-version>
|
||||
<alipay-sdk-version>4.13.40.ALL</alipay-sdk-version>
|
||||
<mysql-connector-version>5.1.48</mysql-connector-version>
|
||||
<mybatis-plus-version>3.3.1.tmp</mybatis-plus-version>
|
||||
@ -42,11 +41,10 @@
|
||||
<antlr4-version>4.7.2</antlr4-version>
|
||||
<okhttp-version>4.4.1</okhttp-version>
|
||||
<httpclient-version>4.5.12</httpclient-version>
|
||||
<beetl-version>2.9.10</beetl-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<skipTests>true</skipTests>
|
||||
<knife4j.version>2.0.8</knife4j.version>
|
||||
<knife4j.version>2.0.9</knife4j.version>
|
||||
<de.codecentric>2.3.1</de.codecentric>
|
||||
<userAgentUtils>1.21</userAgentUtils>
|
||||
<interceptor-api>1.2</interceptor-api>
|
||||
|
Loading…
x
Reference in New Issue
Block a user