Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
wang wilson
JooLun Wx
Commits
009dfdc6
Commit
009dfdc6
authored
3 years ago
by
102353
Browse files
Options
Download
Email Patches
Plain Diff
取消订单回滚库存
parent
9f10147e
Changes
337
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
joolun-wx/bin/clean.bat
+11
-11
joolun-wx/bin/clean.bat
joolun-wx/bin/package.bat
+11
-11
joolun-wx/bin/package.bat
joolun-wx/bin/run.bat
+13
-13
joolun-wx/bin/run.bat
joolun-wx/joolun-admin/pom.xml
+118
-118
joolun-wx/joolun-admin/pom.xml
joolun-wx/joolun-admin/src/main/java/com/joolun/JooLunServletInitializer.java
+18
-18
...in/src/main/java/com/joolun/JooLunServletInitializer.java
joolun-wx/joolun-admin/src/main/java/com/joolun/JooLunWxApplication.java
+21
-21
...n-admin/src/main/java/com/joolun/JooLunWxApplication.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/GoodsSpuApi.java
+68
-68
...n-admin/src/main/java/com/joolun/web/api/GoodsSpuApi.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/OrderInfoApi.java
+293
-293
...-admin/src/main/java/com/joolun/web/api/OrderInfoApi.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/ShoppingCartApi.java
+97
-97
...min/src/main/java/com/joolun/web/api/ShoppingCartApi.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/UserAddressApi.java
+72
-72
...dmin/src/main/java/com/joolun/web/api/UserAddressApi.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/common/CaptchaController.java
+86
-86
...a/com/joolun/web/controller/common/CaptchaController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/common/CommonController.java
+118
-118
...va/com/joolun/web/controller/common/CommonController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/GoodsSpuController.java
+142
-142
...va/com/joolun/web/controller/mall/GoodsSpuController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/OrderInfoController.java
+144
-144
...a/com/joolun/web/controller/mall/OrderInfoController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/ShoppingCartController.java
+98
-98
...om/joolun/web/controller/mall/ShoppingCartController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/UserAddressController.java
+98
-98
...com/joolun/web/controller/mall/UserAddressController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/CacheController.java
+53
-53
...va/com/joolun/web/controller/monitor/CacheController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/ServerController.java
+27
-27
...a/com/joolun/web/controller/monitor/ServerController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/SysLogininforController.java
+67
-67
...oolun/web/controller/monitor/SysLogininforController.java
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/SysOperlogController.java
+66
-66
...m/joolun/web/controller/monitor/SysOperlogController.java
with
1621 additions
and
1621 deletions
+1621
-1621
joolun-wx/bin/clean.bat
+
11
-
11
View file @
009dfdc6
@echo
off
echo
.
echo
[
Ϣ
]
·
echo
.
%~d0
cd
%~dp0
cd
..
call
mvn
clean
@echo
off
echo
.
echo
.
%~d0
cd
%~dp0
cd
..
call
mvn
clean
pause
\ No newline at end of file
This diff is collapsed.
Click to expand it.
joolun-wx/bin/package.bat
+
11
-
11
View file @
009dfdc6
@echo
off
echo
.
echo
[
信息
]
打包Web工程,生成war/jar包文件。
echo
.
%~d0
cd
%~dp0
cd
..
call
mvn
clean
package
-Dmaven
.test.skip
=
true
@echo
off
echo
.
echo
[
信息
]
打包Web工程,生成war/jar包文件。
echo
.
%~d0
cd
%~dp0
cd
..
call
mvn
clean
package
-Dmaven
.test.skip
=
true
pause
\ No newline at end of file
This diff is collapsed.
Click to expand it.
joolun-wx/bin/run.bat
+
13
-
13
View file @
009dfdc6
@echo
off
echo
.
echo
[
Ϣ
]
Web
̡
echo
.
cd
%~dp0
cd
../ruoyi
-admin/target
set
JAVA_OPTS
=
-Xms
256
m
-Xmx
1024
m
-XX
:MetaspaceSize
=
128
m
-XX
:MaxMetaspaceSize
=
512
m
java
-jar
%JAVA_OPTS%
ruoyi
-admin
.jar
cd
bin
@echo
off
echo
.
echo
.
cd
%~dp0
cd
../ruoyi
-admin/target
set
JAVA_OPTS
=
-Xms
256
m
-Xmx
1024
m
-XX
:MetaspaceSize
=
128
m
-XX
:MaxMetaspaceSize
=
512
m
java
-jar
%JAVA_OPTS%
ruoyi
-admin
.jar
cd
bin
pause
\ No newline at end of file
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/pom.xml
+
118
-
118
View file @
009dfdc6
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
joolun-wx
</artifactId>
<groupId>
com.joolun
</groupId>
<version>
3.3.1
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
joolun-admin
</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
<!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger2-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-annotations
</artifactId>
<version>
1.5.21
</version>
</dependency>
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-models
</artifactId>
<version>
1.5.21
</version>
</dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-framework
</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-quartz
</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-generator
</artifactId>
</dependency>
<!-- 微信模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-weixin
</artifactId>
</dependency>
<!-- 商城模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-mall
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.1.1.RELEASE
</version>
<configuration>
<fork>
true
</fork>
<!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.1.0
</version>
<configuration>
<failOnMissingWebXml>
false
</failOnMissingWebXml>
<warName>
${project.artifactId}
</warName>
</configuration>
</plugin>
</plugins>
<finalName>
${project.artifactId}
</finalName>
</build>
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
joolun-wx
</artifactId>
<groupId>
com.joolun
</groupId>
<version>
3.3.1
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
joolun-admin
</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
<!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger2-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-annotations
</artifactId>
<version>
1.5.21
</version>
</dependency>
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-models
</artifactId>
<version>
1.5.21
</version>
</dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-framework
</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-quartz
</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-generator
</artifactId>
</dependency>
<!-- 微信模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-weixin
</artifactId>
</dependency>
<!-- 商城模块-->
<dependency>
<groupId>
com.joolun
</groupId>
<artifactId>
joolun-mall
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.1.1.RELEASE
</version>
<configuration>
<fork>
true
</fork>
<!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.1.0
</version>
<configuration>
<failOnMissingWebXml>
false
</failOnMissingWebXml>
<warName>
${project.artifactId}
</warName>
</configuration>
</plugin>
</plugins>
<finalName>
${project.artifactId}
</finalName>
</build>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/JooLunServletInitializer.java
+
18
-
18
View file @
009dfdc6
package
com.joolun
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public
class
JooLunServletInitializer
extends
SpringBootServletInitializer
{
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
JooLunWxApplication
.
class
);
}
}
package
com.joolun
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public
class
JooLunServletInitializer
extends
SpringBootServletInitializer
{
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
JooLunWxApplication
.
class
);
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/JooLunWxApplication.java
+
21
-
21
View file @
009dfdc6
package
com.joolun
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
public
class
JooLunWxApplication
{
public
static
void
main
(
String
[]
args
)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication
.
run
(
JooLunWxApplication
.
class
,
args
);
System
.
out
.
println
(
"JooLun微信管理系统启动成功"
);
}
}
package
com.joolun
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
public
class
JooLunWxApplication
{
public
static
void
main
(
String
[]
args
)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication
.
run
(
JooLunWxApplication
.
class
,
args
);
System
.
out
.
println
(
"JooLun微信管理系统启动成功"
);
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/GoodsSpuApi.java
+
68
-
68
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.config.CommonConstants
;
import
com.joolun.mall.entity.GoodsSpu
;
import
com.joolun.mall.service.GoodsSpuService
;
import
com.joolun.weixin.constant.MyReturnCode
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商品api
*
* @author JL
* @date 2019-08-12 16:25:10
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/goodsspu"
)
@Api
(
value
=
"goodsspu"
,
tags
=
"商品接口API"
)
public
class
GoodsSpuApi
{
private
final
GoodsSpuService
goodsSpuService
;
/**
* 分页查询
* @param page 分页对象
* @param goodsSpu spu商品
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getGoodsSpuPage
(
Page
page
,
GoodsSpu
goodsSpu
,
String
couponUserId
)
{
goodsSpu
.
setShelf
(
CommonConstants
.
YES
);
return
AjaxResult
.
success
(
goodsSpuService
.
page1
(
page
,
goodsSpu
));
}
/**
* 通过id查询spu商品
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询spu商品"
)
@GetMapping
(
"/{id}"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
GoodsSpu
goodsSpu
=
goodsSpuService
.
getById2
(
id
);
if
(
goodsSpu
==
null
){
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_80004
.
getCode
(),
MyReturnCode
.
ERR_80004
.
getMsg
());
}
return
AjaxResult
.
success
(
goodsSpu
);
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.config.CommonConstants
;
import
com.joolun.mall.entity.GoodsSpu
;
import
com.joolun.mall.service.GoodsSpuService
;
import
com.joolun.weixin.constant.MyReturnCode
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 商品api
*
* @author JL
* @date 2019-08-12 16:25:10
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/goodsspu"
)
@Api
(
value
=
"goodsspu"
,
tags
=
"商品接口API"
)
public
class
GoodsSpuApi
{
private
final
GoodsSpuService
goodsSpuService
;
/**
* 分页查询
* @param page 分页对象
* @param goodsSpu spu商品
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getGoodsSpuPage
(
Page
page
,
GoodsSpu
goodsSpu
,
String
couponUserId
)
{
goodsSpu
.
setShelf
(
CommonConstants
.
YES
);
return
AjaxResult
.
success
(
goodsSpuService
.
page1
(
page
,
goodsSpu
));
}
/**
* 通过id查询spu商品
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询spu商品"
)
@GetMapping
(
"/{id}"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
GoodsSpu
goodsSpu
=
goodsSpuService
.
getById2
(
id
);
if
(
goodsSpu
==
null
){
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_80004
.
getCode
(),
MyReturnCode
.
ERR_80004
.
getMsg
());
}
return
AjaxResult
.
success
(
goodsSpu
);
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/OrderInfoApi.java
+
293
-
293
View file @
009dfdc6
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/ShoppingCartApi.java
+
97
-
97
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.ShoppingCart
;
import
com.joolun.mall.service.ShoppingCartService
;
import
com.joolun.weixin.utils.ThirdSessionHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 购物车
*
* @author JL
* @date 2019-08-29 21:27:33
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/shoppingcart"
)
@Api
(
value
=
"shoppingcart"
,
tags
=
"购物车API"
)
public
class
ShoppingCartApi
{
private
final
ShoppingCartService
shoppingCartService
;
/**
* 分页查询
* @param page 分页对象
* @param shoppingCart 购物车
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getShoppingCartPage
(
Page
page
,
ShoppingCart
shoppingCart
)
{
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
page2
(
page
,
shoppingCart
));
}
/**
* 数量
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getShoppingCartCount
(
ShoppingCart
shoppingCart
)
{
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
count
(
Wrappers
.
query
(
shoppingCart
)));
}
/**
* 加入购物车
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"加入购物车"
)
@PostMapping
public
AjaxResult
save
(
@RequestBody
ShoppingCart
shoppingCart
){
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
save
(
shoppingCart
));
}
/**
* 修改购物车商品
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"修改购物车商品"
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
ShoppingCart
shoppingCart
){
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
updateById
(
shoppingCart
));
}
/**
* 删除购物车商品数量
* @param ids
* @return
*/
@ApiOperation
(
value
=
"删除购物车商品数量"
)
@PostMapping
(
"/del"
)
public
AjaxResult
del
(
@RequestBody
List
<
String
>
ids
){
return
AjaxResult
.
success
(
shoppingCartService
.
removeByIds
(
ids
));
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.ShoppingCart
;
import
com.joolun.mall.service.ShoppingCartService
;
import
com.joolun.weixin.utils.ThirdSessionHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 购物车
*
* @author JL
* @date 2019-08-29 21:27:33
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/shoppingcart"
)
@Api
(
value
=
"shoppingcart"
,
tags
=
"购物车API"
)
public
class
ShoppingCartApi
{
private
final
ShoppingCartService
shoppingCartService
;
/**
* 分页查询
* @param page 分页对象
* @param shoppingCart 购物车
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getShoppingCartPage
(
Page
page
,
ShoppingCart
shoppingCart
)
{
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
page2
(
page
,
shoppingCart
));
}
/**
* 数量
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getShoppingCartCount
(
ShoppingCart
shoppingCart
)
{
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
count
(
Wrappers
.
query
(
shoppingCart
)));
}
/**
* 加入购物车
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"加入购物车"
)
@PostMapping
public
AjaxResult
save
(
@RequestBody
ShoppingCart
shoppingCart
){
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
save
(
shoppingCart
));
}
/**
* 修改购物车商品
* @param shoppingCart
* @return
*/
@ApiOperation
(
value
=
"修改购物车商品"
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
ShoppingCart
shoppingCart
){
shoppingCart
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
shoppingCartService
.
updateById
(
shoppingCart
));
}
/**
* 删除购物车商品数量
* @param ids
* @return
*/
@ApiOperation
(
value
=
"删除购物车商品数量"
)
@PostMapping
(
"/del"
)
public
AjaxResult
del
(
@RequestBody
List
<
String
>
ids
){
return
AjaxResult
.
success
(
shoppingCartService
.
removeByIds
(
ids
));
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/api/UserAddressApi.java
+
72
-
72
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.UserAddress
;
import
com.joolun.mall.service.UserAddressService
;
import
com.joolun.weixin.utils.ThirdSessionHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
/**
* 用户收货地址
*
* @author JL
* @date 2019-09-11 14:28:59
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/useraddress"
)
@Api
(
value
=
"useraddress"
,
tags
=
"用户收货地址API"
)
public
class
UserAddressApi
{
private
final
UserAddressService
userAddressService
;
/**
* 分页查询
* @param page 分页对象
* @param userAddress 用户收货地址
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getUserAddressPage
(
Page
page
,
UserAddress
userAddress
)
{
userAddress
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
userAddressService
.
page
(
page
,
Wrappers
.
query
(
userAddress
)));
}
/**
* 新增、修改用户收货地址
* @param userAddress 用户收货地址
* @return AjaxResult
*/
@ApiOperation
(
value
=
"新增、修改用户收货地址"
)
@PostMapping
public
AjaxResult
save
(
@RequestBody
UserAddress
userAddress
){
userAddress
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
userAddressService
.
saveOrUpdate
(
userAddress
));
}
/**
* 通过id删除用户收货地址
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id删除用户收货地址"
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
removeById
(
id
));
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.api
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.UserAddress
;
import
com.joolun.mall.service.UserAddressService
;
import
com.joolun.weixin.utils.ThirdSessionHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
/**
* 用户收货地址
*
* @author JL
* @date 2019-09-11 14:28:59
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/weixin/api/ma/useraddress"
)
@Api
(
value
=
"useraddress"
,
tags
=
"用户收货地址API"
)
public
class
UserAddressApi
{
private
final
UserAddressService
userAddressService
;
/**
* 分页查询
* @param page 分页对象
* @param userAddress 用户收货地址
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
AjaxResult
getUserAddressPage
(
Page
page
,
UserAddress
userAddress
)
{
userAddress
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
userAddressService
.
page
(
page
,
Wrappers
.
query
(
userAddress
)));
}
/**
* 新增、修改用户收货地址
* @param userAddress 用户收货地址
* @return AjaxResult
*/
@ApiOperation
(
value
=
"新增、修改用户收货地址"
)
@PostMapping
public
AjaxResult
save
(
@RequestBody
UserAddress
userAddress
){
userAddress
.
setUserId
(
ThirdSessionHolder
.
getWxUserId
());
return
AjaxResult
.
success
(
userAddressService
.
saveOrUpdate
(
userAddress
));
}
/**
* 通过id删除用户收货地址
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id删除用户收货地址"
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
removeById
(
id
));
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/common/CaptchaController.java
+
86
-
86
View file @
009dfdc6
package
com.joolun.web.controller.common
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
import
javax.annotation.Resource
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.FastByteArrayOutputStream
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.google.code.kaptcha.Producer
;
import
com.joolun.common.constant.Constants
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.redis.RedisCache
;
import
com.joolun.common.utils.sign.Base64
;
import
com.joolun.common.utils.uuid.IdUtils
;
/**
* 验证码操作处理
*
* @author ruoyi
*/
@RestController
public
class
CaptchaController
{
@Resource
(
name
=
"captchaProducer"
)
private
Producer
captchaProducer
;
@Resource
(
name
=
"captchaProducerMath"
)
private
Producer
captchaProducerMath
;
@Autowired
private
RedisCache
redisCache
;
// 验证码类型
@Value
(
"${ruoyi.captchaType}"
)
private
String
captchaType
;
/**
* 生成验证码
*/
@GetMapping
(
"/captchaImage"
)
public
AjaxResult
getCode
(
HttpServletResponse
response
)
throws
IOException
{
// 保存验证码信息
String
uuid
=
IdUtils
.
simpleUUID
();
String
verifyKey
=
Constants
.
CAPTCHA_CODE_KEY
+
uuid
;
String
capStr
=
null
,
code
=
null
;
BufferedImage
image
=
null
;
// 生成验证码
if
(
"math"
.
equals
(
captchaType
))
{
String
capText
=
captchaProducerMath
.
createText
();
capStr
=
capText
.
substring
(
0
,
capText
.
lastIndexOf
(
"@"
));
code
=
capText
.
substring
(
capText
.
lastIndexOf
(
"@"
)
+
1
);
image
=
captchaProducerMath
.
createImage
(
capStr
);
}
else
if
(
"char"
.
equals
(
captchaType
))
{
capStr
=
code
=
captchaProducer
.
createText
();
image
=
captchaProducer
.
createImage
(
capStr
);
}
redisCache
.
setCacheObject
(
verifyKey
,
code
,
Constants
.
CAPTCHA_EXPIRATION
,
TimeUnit
.
MINUTES
);
// 转换流信息写出
FastByteArrayOutputStream
os
=
new
FastByteArrayOutputStream
();
try
{
ImageIO
.
write
(
image
,
"jpg"
,
os
);
}
catch
(
IOException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"uuid"
,
uuid
);
ajax
.
put
(
"img"
,
Base64
.
encode
(
os
.
toByteArray
()));
return
ajax
;
}
}
package
com.joolun.web.controller.common
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
import
javax.annotation.Resource
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.FastByteArrayOutputStream
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.google.code.kaptcha.Producer
;
import
com.joolun.common.constant.Constants
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.redis.RedisCache
;
import
com.joolun.common.utils.sign.Base64
;
import
com.joolun.common.utils.uuid.IdUtils
;
/**
* 验证码操作处理
*
* @author ruoyi
*/
@RestController
public
class
CaptchaController
{
@Resource
(
name
=
"captchaProducer"
)
private
Producer
captchaProducer
;
@Resource
(
name
=
"captchaProducerMath"
)
private
Producer
captchaProducerMath
;
@Autowired
private
RedisCache
redisCache
;
// 验证码类型
@Value
(
"${ruoyi.captchaType}"
)
private
String
captchaType
;
/**
* 生成验证码
*/
@GetMapping
(
"/captchaImage"
)
public
AjaxResult
getCode
(
HttpServletResponse
response
)
throws
IOException
{
// 保存验证码信息
String
uuid
=
IdUtils
.
simpleUUID
();
String
verifyKey
=
Constants
.
CAPTCHA_CODE_KEY
+
uuid
;
String
capStr
=
null
,
code
=
null
;
BufferedImage
image
=
null
;
// 生成验证码
if
(
"math"
.
equals
(
captchaType
))
{
String
capText
=
captchaProducerMath
.
createText
();
capStr
=
capText
.
substring
(
0
,
capText
.
lastIndexOf
(
"@"
));
code
=
capText
.
substring
(
capText
.
lastIndexOf
(
"@"
)
+
1
);
image
=
captchaProducerMath
.
createImage
(
capStr
);
}
else
if
(
"char"
.
equals
(
captchaType
))
{
capStr
=
code
=
captchaProducer
.
createText
();
image
=
captchaProducer
.
createImage
(
capStr
);
}
redisCache
.
setCacheObject
(
verifyKey
,
code
,
Constants
.
CAPTCHA_EXPIRATION
,
TimeUnit
.
MINUTES
);
// 转换流信息写出
FastByteArrayOutputStream
os
=
new
FastByteArrayOutputStream
();
try
{
ImageIO
.
write
(
image
,
"jpg"
,
os
);
}
catch
(
IOException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"uuid"
,
uuid
);
ajax
.
put
(
"img"
,
Base64
.
encode
(
os
.
toByteArray
()));
return
ajax
;
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/common/CommonController.java
+
118
-
118
View file @
009dfdc6
package
com.joolun.web.controller.common
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.joolun.common.config.JooLunConfig
;
import
com.joolun.common.constant.Constants
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.utils.StringUtils
;
import
com.joolun.common.utils.file.FileUploadUtils
;
import
com.joolun.common.utils.file.FileUtils
;
import
com.joolun.framework.config.ServerConfig
;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
public
class
CommonController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
CommonController
.
class
);
@Autowired
private
ServerConfig
serverConfig
;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping
(
"common/download"
)
public
void
fileDownload
(
String
fileName
,
Boolean
delete
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
try
{
if
(!
FileUtils
.
checkAllowDownload
(
fileName
))
{
throw
new
Exception
(
StringUtils
.
format
(
"文件名称({})非法,不允许下载。 "
,
fileName
));
}
String
realFileName
=
System
.
currentTimeMillis
()
+
fileName
.
substring
(
fileName
.
indexOf
(
"_"
)
+
1
);
String
filePath
=
JooLunConfig
.
getDownloadPath
()
+
fileName
;
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
realFileName
);
FileUtils
.
writeBytes
(
filePath
,
response
.
getOutputStream
());
if
(
delete
)
{
FileUtils
.
deleteFile
(
filePath
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"下载文件失败"
,
e
);
}
}
/**
* 通用上传请求
*/
@PostMapping
(
"/common/upload"
)
public
AjaxResult
uploadFile
(
MultipartFile
file
)
throws
Exception
{
try
{
// 上传文件路径
String
filePath
=
JooLunConfig
.
getUploadPath
();
// 上传并返回新文件名称
String
fileName
=
FileUploadUtils
.
upload
(
filePath
,
file
);
String
url
=
serverConfig
.
getUrl
()
+
fileName
;
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"fileName"
,
fileName
);
ajax
.
put
(
"url"
,
url
);
return
ajax
;
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
}
/**
* 本地资源通用下载
*/
@GetMapping
(
"/common/download/resource"
)
public
void
resourceDownload
(
String
resource
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
try
{
if
(!
FileUtils
.
checkAllowDownload
(
resource
))
{
throw
new
Exception
(
StringUtils
.
format
(
"资源文件({})非法,不允许下载。 "
,
resource
));
}
// 本地资源路径
String
localPath
=
JooLunConfig
.
getProfile
();
// 数据库资源地址
String
downloadPath
=
localPath
+
StringUtils
.
substringAfter
(
resource
,
Constants
.
RESOURCE_PREFIX
);
// 下载名称
String
downloadName
=
StringUtils
.
substringAfterLast
(
downloadPath
,
"/"
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
downloadName
);
FileUtils
.
writeBytes
(
downloadPath
,
response
.
getOutputStream
());
}
catch
(
Exception
e
)
{
log
.
error
(
"下载文件失败"
,
e
);
}
}
}
package
com.joolun.web.controller.common
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.joolun.common.config.JooLunConfig
;
import
com.joolun.common.constant.Constants
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.utils.StringUtils
;
import
com.joolun.common.utils.file.FileUploadUtils
;
import
com.joolun.common.utils.file.FileUtils
;
import
com.joolun.framework.config.ServerConfig
;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
public
class
CommonController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
CommonController
.
class
);
@Autowired
private
ServerConfig
serverConfig
;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping
(
"common/download"
)
public
void
fileDownload
(
String
fileName
,
Boolean
delete
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
try
{
if
(!
FileUtils
.
checkAllowDownload
(
fileName
))
{
throw
new
Exception
(
StringUtils
.
format
(
"文件名称({})非法,不允许下载。 "
,
fileName
));
}
String
realFileName
=
System
.
currentTimeMillis
()
+
fileName
.
substring
(
fileName
.
indexOf
(
"_"
)
+
1
);
String
filePath
=
JooLunConfig
.
getDownloadPath
()
+
fileName
;
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
realFileName
);
FileUtils
.
writeBytes
(
filePath
,
response
.
getOutputStream
());
if
(
delete
)
{
FileUtils
.
deleteFile
(
filePath
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"下载文件失败"
,
e
);
}
}
/**
* 通用上传请求
*/
@PostMapping
(
"/common/upload"
)
public
AjaxResult
uploadFile
(
MultipartFile
file
)
throws
Exception
{
try
{
// 上传文件路径
String
filePath
=
JooLunConfig
.
getUploadPath
();
// 上传并返回新文件名称
String
fileName
=
FileUploadUtils
.
upload
(
filePath
,
file
);
String
url
=
serverConfig
.
getUrl
()
+
fileName
;
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"fileName"
,
fileName
);
ajax
.
put
(
"url"
,
url
);
return
ajax
;
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
}
/**
* 本地资源通用下载
*/
@GetMapping
(
"/common/download/resource"
)
public
void
resourceDownload
(
String
resource
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
try
{
if
(!
FileUtils
.
checkAllowDownload
(
resource
))
{
throw
new
Exception
(
StringUtils
.
format
(
"资源文件({})非法,不允许下载。 "
,
resource
));
}
// 本地资源路径
String
localPath
=
JooLunConfig
.
getProfile
();
// 数据库资源地址
String
downloadPath
=
localPath
+
StringUtils
.
substringAfter
(
resource
,
Constants
.
RESOURCE_PREFIX
);
// 下载名称
String
downloadName
=
StringUtils
.
substringAfterLast
(
downloadPath
,
"/"
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
downloadName
);
FileUtils
.
writeBytes
(
downloadPath
,
response
.
getOutputStream
());
}
catch
(
Exception
e
)
{
log
.
error
(
"下载文件失败"
,
e
);
}
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/GoodsSpuController.java
+
142
-
142
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
cn.hutool.core.convert.Convert
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.GoodsSpu
;
import
com.joolun.mall.service.GoodsSpuService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* spu商品
*
* @author JL
* @date 2019-08-12 16:25:10
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/goodsspu"
)
@Api
(
value
=
"goodsspu"
,
tags
=
"spu商品管理"
)
public
class
GoodsSpuController
extends
BaseController
{
private
final
GoodsSpuService
goodsSpuService
;
/**
* 分页查询
* @param page 分页对象
* @param goodsSpu spu商品
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:index')"
)
public
AjaxResult
getGoodsSpuPage
(
Page
page
,
GoodsSpu
goodsSpu
)
{
return
AjaxResult
.
success
(
goodsSpuService
.
page1
(
page
,
goodsSpu
));
}
/**
* list查询
* @param goodsSpu
* @return
*/
@ApiOperation
(
value
=
"list查询"
)
@GetMapping
(
"/list"
)
public
List
<
GoodsSpu
>
getList
(
GoodsSpu
goodsSpu
)
{
return
goodsSpuService
.
list
(
Wrappers
.
query
(
goodsSpu
).
lambda
()
.
select
(
GoodsSpu:
:
getId
,
GoodsSpu:
:
getName
)
);
}
/**
* 查询数量
* @param goodsSpu
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getCount
(
GoodsSpu
goodsSpu
)
{
return
AjaxResult
.
success
(
goodsSpuService
.
count
(
Wrappers
.
query
(
goodsSpu
)));
}
/**
* 通过id查询spu商品
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id查询spu商品"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
goodsSpuService
.
getById1
(
id
));
}
/**
* 新增spu商品
* @param goodsSpu spu商品
* @return AjaxResult
*/
@ApiOperation
(
value
=
"新增spu商品"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:add')"
)
public
AjaxResult
save
(
@RequestBody
GoodsSpu
goodsSpu
){
return
AjaxResult
.
success
(
goodsSpuService
.
save1
(
goodsSpu
));
}
/**
* 修改spu商品
* @param goodsSpu spu商品
* @return AjaxResult
*/
@ApiOperation
(
value
=
"修改spu商品"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
GoodsSpu
goodsSpu
){
return
AjaxResult
.
success
(
goodsSpuService
.
updateById1
(
goodsSpu
));
}
/**
* 商品上下架操作
* @param shelf
* @param ids
* @return AjaxResult
*/
@ApiOperation
(
value
=
"商品上下架操作"
)
@PutMapping
(
"/shelf"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:edit')"
)
public
AjaxResult
updateById
(
@RequestParam
(
value
=
"shelf"
)
String
shelf
,
@RequestParam
(
value
=
"ids"
)
String
ids
){
GoodsSpu
goodsSpu
=
new
GoodsSpu
();
goodsSpu
.
setShelf
(
shelf
);
return
AjaxResult
.
success
(
goodsSpuService
.
update
(
goodsSpu
,
Wrappers
.<
GoodsSpu
>
lambdaQuery
()
.
in
(
GoodsSpu:
:
getId
,
Convert
.
toList
(
ids
))));
}
/**
* 通过id删除spu商品
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id删除spu商品"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
goodsSpuService
.
removeById
(
id
));
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
cn.hutool.core.convert.Convert
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.GoodsSpu
;
import
com.joolun.mall.service.GoodsSpuService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* spu商品
*
* @author JL
* @date 2019-08-12 16:25:10
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/goodsspu"
)
@Api
(
value
=
"goodsspu"
,
tags
=
"spu商品管理"
)
public
class
GoodsSpuController
extends
BaseController
{
private
final
GoodsSpuService
goodsSpuService
;
/**
* 分页查询
* @param page 分页对象
* @param goodsSpu spu商品
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:index')"
)
public
AjaxResult
getGoodsSpuPage
(
Page
page
,
GoodsSpu
goodsSpu
)
{
return
AjaxResult
.
success
(
goodsSpuService
.
page1
(
page
,
goodsSpu
));
}
/**
* list查询
* @param goodsSpu
* @return
*/
@ApiOperation
(
value
=
"list查询"
)
@GetMapping
(
"/list"
)
public
List
<
GoodsSpu
>
getList
(
GoodsSpu
goodsSpu
)
{
return
goodsSpuService
.
list
(
Wrappers
.
query
(
goodsSpu
).
lambda
()
.
select
(
GoodsSpu:
:
getId
,
GoodsSpu:
:
getName
)
);
}
/**
* 查询数量
* @param goodsSpu
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getCount
(
GoodsSpu
goodsSpu
)
{
return
AjaxResult
.
success
(
goodsSpuService
.
count
(
Wrappers
.
query
(
goodsSpu
)));
}
/**
* 通过id查询spu商品
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id查询spu商品"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
goodsSpuService
.
getById1
(
id
));
}
/**
* 新增spu商品
* @param goodsSpu spu商品
* @return AjaxResult
*/
@ApiOperation
(
value
=
"新增spu商品"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:add')"
)
public
AjaxResult
save
(
@RequestBody
GoodsSpu
goodsSpu
){
return
AjaxResult
.
success
(
goodsSpuService
.
save1
(
goodsSpu
));
}
/**
* 修改spu商品
* @param goodsSpu spu商品
* @return AjaxResult
*/
@ApiOperation
(
value
=
"修改spu商品"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
GoodsSpu
goodsSpu
){
return
AjaxResult
.
success
(
goodsSpuService
.
updateById1
(
goodsSpu
));
}
/**
* 商品上下架操作
* @param shelf
* @param ids
* @return AjaxResult
*/
@ApiOperation
(
value
=
"商品上下架操作"
)
@PutMapping
(
"/shelf"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:edit')"
)
public
AjaxResult
updateById
(
@RequestParam
(
value
=
"shelf"
)
String
shelf
,
@RequestParam
(
value
=
"ids"
)
String
ids
){
GoodsSpu
goodsSpu
=
new
GoodsSpu
();
goodsSpu
.
setShelf
(
shelf
);
return
AjaxResult
.
success
(
goodsSpuService
.
update
(
goodsSpu
,
Wrappers
.<
GoodsSpu
>
lambdaQuery
()
.
in
(
GoodsSpu:
:
getId
,
Convert
.
toList
(
ids
))));
}
/**
* 通过id删除spu商品
* @param id
* @return AjaxResult
*/
@ApiOperation
(
value
=
"通过id删除spu商品"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:goodsspu:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
goodsSpuService
.
removeById
(
id
));
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/OrderInfoController.java
+
144
-
144
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.config.CommonConstants
;
import
com.joolun.mall.constant.MallConstants
;
import
com.joolun.mall.entity.OrderInfo
;
import
com.joolun.mall.entity.OrderLogistics
;
import
com.joolun.mall.enums.OrderInfoEnum
;
import
com.joolun.mall.service.OrderInfoService
;
import
com.joolun.mall.service.OrderLogisticsService
;
import
com.joolun.weixin.constant.MyReturnCode
;
import
com.joolun.weixin.service.WxUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
/**
* 商城订单
*
* @author JL
* @date 2019-09-10 15:21:22
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/orderinfo"
)
@Api
(
value
=
"orderinfo"
,
tags
=
"商城订单管理"
)
public
class
OrderInfoController
extends
BaseController
{
private
final
OrderInfoService
orderInfoService
;
private
final
OrderLogisticsService
orderLogisticsService
;
private
final
WxUserService
wxUserService
;
/**
* 分页查询
* @param page 分页对象
* @param orderInfo 商城订单
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:index')"
)
public
AjaxResult
getOrderInfoPage
(
Page
page
,
OrderInfo
orderInfo
)
{
return
AjaxResult
.
success
(
orderInfoService
.
page1
(
page
,
Wrappers
.
query
(
orderInfo
)));
}
/**
* 查询数量
* @param orderInfo
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getCount
(
OrderInfo
orderInfo
)
{
return
AjaxResult
.
success
(
orderInfoService
.
count
(
Wrappers
.
query
(
orderInfo
)));
}
/**
* 通过id查询商城订单
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询商城订单"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
OrderInfo
orderInfo
=
orderInfoService
.
getById
(
id
);
OrderLogistics
orderLogistics
=
orderLogisticsService
.
getById
(
orderInfo
.
getLogisticsId
());
orderInfo
.
setOrderLogistics
(
orderLogistics
);
orderInfo
.
setUserInfo
(
wxUserService
.
getById
(
orderInfo
.
getUserId
()));
return
AjaxResult
.
success
(
orderInfo
);
}
/**
* 新增商城订单
* @param orderInfo 商城订单
* @return R
*/
@ApiOperation
(
value
=
"新增商城订单"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:add')"
)
public
AjaxResult
save
(
@RequestBody
OrderInfo
orderInfo
){
return
AjaxResult
.
success
(
orderInfoService
.
save
(
orderInfo
));
}
/**
* 修改商城订单
* @param orderInfo 商城订单
* @return R
*/
@ApiOperation
(
value
=
"修改商城订单"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
OrderInfo
orderInfo
){
return
AjaxResult
.
success
(
orderInfoService
.
updateById
(
orderInfo
));
}
/**
* 通过id删除商城订单
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除商城订单"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
orderInfoService
.
removeById
(
id
));
}
/**
* 取消商城订单
* @param id 商城订单
* @return R
*/
@ApiOperation
(
value
=
"取消商城订单"
)
@PutMapping
(
"/cancel/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:edit')"
)
public
AjaxResult
orderCancel
(
@PathVariable
String
id
){
OrderInfo
orderInfo
=
orderInfoService
.
getById
(
id
);
if
(
orderInfo
==
null
){
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_70005
.
getCode
(),
MyReturnCode
.
ERR_70005
.
getMsg
());
}
if
(!
CommonConstants
.
NO
.
equals
(
orderInfo
.
getIsPay
())){
//只有未支付订单能取消
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_70001
.
getCode
(),
MyReturnCode
.
ERR_70001
.
getMsg
());
}
orderInfoService
.
orderCancel
(
orderInfo
);
return
AjaxResult
.
success
();
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.config.CommonConstants
;
import
com.joolun.mall.constant.MallConstants
;
import
com.joolun.mall.entity.OrderInfo
;
import
com.joolun.mall.entity.OrderLogistics
;
import
com.joolun.mall.enums.OrderInfoEnum
;
import
com.joolun.mall.service.OrderInfoService
;
import
com.joolun.mall.service.OrderLogisticsService
;
import
com.joolun.weixin.constant.MyReturnCode
;
import
com.joolun.weixin.service.WxUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
/**
* 商城订单
*
* @author JL
* @date 2019-09-10 15:21:22
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/orderinfo"
)
@Api
(
value
=
"orderinfo"
,
tags
=
"商城订单管理"
)
public
class
OrderInfoController
extends
BaseController
{
private
final
OrderInfoService
orderInfoService
;
private
final
OrderLogisticsService
orderLogisticsService
;
private
final
WxUserService
wxUserService
;
/**
* 分页查询
* @param page 分页对象
* @param orderInfo 商城订单
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:index')"
)
public
AjaxResult
getOrderInfoPage
(
Page
page
,
OrderInfo
orderInfo
)
{
return
AjaxResult
.
success
(
orderInfoService
.
page1
(
page
,
Wrappers
.
query
(
orderInfo
)));
}
/**
* 查询数量
* @param orderInfo
* @return
*/
@ApiOperation
(
value
=
"查询数量"
)
@GetMapping
(
"/count"
)
public
AjaxResult
getCount
(
OrderInfo
orderInfo
)
{
return
AjaxResult
.
success
(
orderInfoService
.
count
(
Wrappers
.
query
(
orderInfo
)));
}
/**
* 通过id查询商城订单
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询商城订单"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
OrderInfo
orderInfo
=
orderInfoService
.
getById
(
id
);
OrderLogistics
orderLogistics
=
orderLogisticsService
.
getById
(
orderInfo
.
getLogisticsId
());
orderInfo
.
setOrderLogistics
(
orderLogistics
);
orderInfo
.
setUserInfo
(
wxUserService
.
getById
(
orderInfo
.
getUserId
()));
return
AjaxResult
.
success
(
orderInfo
);
}
/**
* 新增商城订单
* @param orderInfo 商城订单
* @return R
*/
@ApiOperation
(
value
=
"新增商城订单"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:add')"
)
public
AjaxResult
save
(
@RequestBody
OrderInfo
orderInfo
){
return
AjaxResult
.
success
(
orderInfoService
.
save
(
orderInfo
));
}
/**
* 修改商城订单
* @param orderInfo 商城订单
* @return R
*/
@ApiOperation
(
value
=
"修改商城订单"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
OrderInfo
orderInfo
){
return
AjaxResult
.
success
(
orderInfoService
.
updateById
(
orderInfo
));
}
/**
* 通过id删除商城订单
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除商城订单"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
orderInfoService
.
removeById
(
id
));
}
/**
* 取消商城订单
* @param id 商城订单
* @return R
*/
@ApiOperation
(
value
=
"取消商城订单"
)
@PutMapping
(
"/cancel/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:orderinfo:edit')"
)
public
AjaxResult
orderCancel
(
@PathVariable
String
id
){
OrderInfo
orderInfo
=
orderInfoService
.
getById
(
id
);
if
(
orderInfo
==
null
){
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_70005
.
getCode
(),
MyReturnCode
.
ERR_70005
.
getMsg
());
}
if
(!
CommonConstants
.
NO
.
equals
(
orderInfo
.
getIsPay
())){
//只有未支付订单能取消
return
AjaxResult
.
error
(
MyReturnCode
.
ERR_70001
.
getCode
(),
MyReturnCode
.
ERR_70001
.
getMsg
());
}
orderInfoService
.
orderCancel
(
orderInfo
);
return
AjaxResult
.
success
();
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/ShoppingCartController.java
+
98
-
98
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.ShoppingCart
;
import
com.joolun.mall.service.ShoppingCartService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 购物车
*
* @author JL
* @date 2019-08-29 21:27:33
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/shoppingcart"
)
@Api
(
value
=
"shoppingcart"
,
tags
=
"购物车管理"
)
public
class
ShoppingCartController
extends
BaseController
{
private
final
ShoppingCartService
shoppingCartService
;
/**
* 分页查询
* @param page 分页对象
* @param shoppingCart 购物车
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:index')"
)
public
AjaxResult
getShoppingCartPage
(
Page
page
,
ShoppingCart
shoppingCart
)
{
return
AjaxResult
.
success
(
shoppingCartService
.
page
(
page
,
Wrappers
.
query
(
shoppingCart
)));
}
/**
* 通过id查询购物车
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询购物车"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
shoppingCartService
.
getById
(
id
));
}
/**
* 新增购物车
* @param shoppingCart 购物车
* @return R
*/
@ApiOperation
(
value
=
"新增购物车"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:add')"
)
public
AjaxResult
save
(
@RequestBody
ShoppingCart
shoppingCart
){
return
AjaxResult
.
success
(
shoppingCartService
.
save
(
shoppingCart
));
}
/**
* 修改购物车
* @param shoppingCart 购物车
* @return R
*/
@ApiOperation
(
value
=
"修改购物车"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
ShoppingCart
shoppingCart
){
return
AjaxResult
.
success
(
shoppingCartService
.
updateById
(
shoppingCart
));
}
/**
* 通过id删除购物车
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除购物车"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
shoppingCartService
.
removeById
(
id
));
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.ShoppingCart
;
import
com.joolun.mall.service.ShoppingCartService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 购物车
*
* @author JL
* @date 2019-08-29 21:27:33
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/shoppingcart"
)
@Api
(
value
=
"shoppingcart"
,
tags
=
"购物车管理"
)
public
class
ShoppingCartController
extends
BaseController
{
private
final
ShoppingCartService
shoppingCartService
;
/**
* 分页查询
* @param page 分页对象
* @param shoppingCart 购物车
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:index')"
)
public
AjaxResult
getShoppingCartPage
(
Page
page
,
ShoppingCart
shoppingCart
)
{
return
AjaxResult
.
success
(
shoppingCartService
.
page
(
page
,
Wrappers
.
query
(
shoppingCart
)));
}
/**
* 通过id查询购物车
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询购物车"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
shoppingCartService
.
getById
(
id
));
}
/**
* 新增购物车
* @param shoppingCart 购物车
* @return R
*/
@ApiOperation
(
value
=
"新增购物车"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:add')"
)
public
AjaxResult
save
(
@RequestBody
ShoppingCart
shoppingCart
){
return
AjaxResult
.
success
(
shoppingCartService
.
save
(
shoppingCart
));
}
/**
* 修改购物车
* @param shoppingCart 购物车
* @return R
*/
@ApiOperation
(
value
=
"修改购物车"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
ShoppingCart
shoppingCart
){
return
AjaxResult
.
success
(
shoppingCartService
.
updateById
(
shoppingCart
));
}
/**
* 通过id删除购物车
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除购物车"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:shoppingcart:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
shoppingCartService
.
removeById
(
id
));
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/mall/UserAddressController.java
+
98
-
98
View file @
009dfdc6
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.UserAddress
;
import
com.joolun.mall.service.UserAddressService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 用户收货地址
*
* @author JL
* @date 2019-09-11 14:28:59
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/useraddress"
)
@Api
(
value
=
"useraddress"
,
tags
=
"用户收货地址管理"
)
public
class
UserAddressController
extends
BaseController
{
private
final
UserAddressService
userAddressService
;
/**
* 分页查询
* @param page 分页对象
* @param userAddress 用户收货地址
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:index')"
)
public
AjaxResult
getUserAddressPage
(
Page
page
,
UserAddress
userAddress
)
{
return
AjaxResult
.
success
(
userAddressService
.
page
(
page
,
Wrappers
.
query
(
userAddress
)));
}
/**
* 通过id查询用户收货地址
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询用户收货地址"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
getById
(
id
));
}
/**
* 新增用户收货地址
* @param userAddress 用户收货地址
* @return R
*/
@ApiOperation
(
value
=
"新增用户收货地址"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:add')"
)
public
AjaxResult
save
(
@RequestBody
UserAddress
userAddress
){
return
AjaxResult
.
success
(
userAddressService
.
save
(
userAddress
));
}
/**
* 修改用户收货地址
* @param userAddress 用户收货地址
* @return R
*/
@ApiOperation
(
value
=
"修改用户收货地址"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
UserAddress
userAddress
){
return
AjaxResult
.
success
(
userAddressService
.
updateById
(
userAddress
));
}
/**
* 通过id删除用户收货地址
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除用户收货地址"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
removeById
(
id
));
}
}
/**
* Copyright (C) 2018-2019
* All rights reserved, Designed By www.joolun.com
* 注意:
* 本软件为www.joolun.com开发研制,项目使用请保留此说明
*/
package
com.joolun.web.controller.mall
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.mall.entity.UserAddress
;
import
com.joolun.mall.service.UserAddressService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 用户收货地址
*
* @author JL
* @date 2019-09-11 14:28:59
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping
(
"/useraddress"
)
@Api
(
value
=
"useraddress"
,
tags
=
"用户收货地址管理"
)
public
class
UserAddressController
extends
BaseController
{
private
final
UserAddressService
userAddressService
;
/**
* 分页查询
* @param page 分页对象
* @param userAddress 用户收货地址
* @return
*/
@ApiOperation
(
value
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:index')"
)
public
AjaxResult
getUserAddressPage
(
Page
page
,
UserAddress
userAddress
)
{
return
AjaxResult
.
success
(
userAddressService
.
page
(
page
,
Wrappers
.
query
(
userAddress
)));
}
/**
* 通过id查询用户收货地址
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id查询用户收货地址"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:get')"
)
public
AjaxResult
getById
(
@PathVariable
(
"id"
)
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
getById
(
id
));
}
/**
* 新增用户收货地址
* @param userAddress 用户收货地址
* @return R
*/
@ApiOperation
(
value
=
"新增用户收货地址"
)
@PostMapping
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:add')"
)
public
AjaxResult
save
(
@RequestBody
UserAddress
userAddress
){
return
AjaxResult
.
success
(
userAddressService
.
save
(
userAddress
));
}
/**
* 修改用户收货地址
* @param userAddress 用户收货地址
* @return R
*/
@ApiOperation
(
value
=
"修改用户收货地址"
)
@PutMapping
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:edit')"
)
public
AjaxResult
updateById
(
@RequestBody
UserAddress
userAddress
){
return
AjaxResult
.
success
(
userAddressService
.
updateById
(
userAddress
));
}
/**
* 通过id删除用户收货地址
* @param id
* @return R
*/
@ApiOperation
(
value
=
"通过id删除用户收货地址"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@ss.hasPermi('mall:useraddress:del')"
)
public
AjaxResult
removeById
(
@PathVariable
String
id
){
return
AjaxResult
.
success
(
userAddressService
.
removeById
(
id
));
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/CacheController.java
+
53
-
53
View file @
009dfdc6
package
com.joolun.web.controller.monitor
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisCallback
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.utils.StringUtils
;
/**
* 缓存监控
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/cache"
)
public
class
CacheController
{
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@PreAuthorize
(
"@ss.hasPermi('monitor:cache:list')"
)
@GetMapping
()
public
AjaxResult
getInfo
()
throws
Exception
{
Properties
info
=
(
Properties
)
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
info
());
Properties
commandStats
=
(
Properties
)
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
info
(
"commandstats"
));
Object
dbSize
=
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
dbSize
());
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
3
);
result
.
put
(
"info"
,
info
);
result
.
put
(
"dbSize"
,
dbSize
);
List
<
Map
<
String
,
String
>>
pieList
=
new
ArrayList
<>();
commandStats
.
stringPropertyNames
().
forEach
(
key
->
{
Map
<
String
,
String
>
data
=
new
HashMap
<>(
2
);
String
property
=
commandStats
.
getProperty
(
key
);
data
.
put
(
"name"
,
StringUtils
.
removeStart
(
key
,
"cmdstat_"
));
data
.
put
(
"value"
,
StringUtils
.
substringBetween
(
property
,
"calls="
,
",usec"
));
pieList
.
add
(
data
);
});
result
.
put
(
"commandStats"
,
pieList
);
return
AjaxResult
.
success
(
result
);
}
}
package
com.joolun.web.controller.monitor
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisCallback
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.utils.StringUtils
;
/**
* 缓存监控
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/cache"
)
public
class
CacheController
{
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@PreAuthorize
(
"@ss.hasPermi('monitor:cache:list')"
)
@GetMapping
()
public
AjaxResult
getInfo
()
throws
Exception
{
Properties
info
=
(
Properties
)
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
info
());
Properties
commandStats
=
(
Properties
)
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
info
(
"commandstats"
));
Object
dbSize
=
redisTemplate
.
execute
((
RedisCallback
<
Object
>)
connection
->
connection
.
dbSize
());
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
3
);
result
.
put
(
"info"
,
info
);
result
.
put
(
"dbSize"
,
dbSize
);
List
<
Map
<
String
,
String
>>
pieList
=
new
ArrayList
<>();
commandStats
.
stringPropertyNames
().
forEach
(
key
->
{
Map
<
String
,
String
>
data
=
new
HashMap
<>(
2
);
String
property
=
commandStats
.
getProperty
(
key
);
data
.
put
(
"name"
,
StringUtils
.
removeStart
(
key
,
"cmdstat_"
));
data
.
put
(
"value"
,
StringUtils
.
substringBetween
(
property
,
"calls="
,
",usec"
));
pieList
.
add
(
data
);
});
result
.
put
(
"commandStats"
,
pieList
);
return
AjaxResult
.
success
(
result
);
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/ServerController.java
+
27
-
27
View file @
009dfdc6
package
com.joolun.web.controller.monitor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.framework.web.domain.Server
;
/**
* 服务器监控
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/server"
)
public
class
ServerController
{
@PreAuthorize
(
"@ss.hasPermi('monitor:server:list')"
)
@GetMapping
()
public
AjaxResult
getInfo
()
throws
Exception
{
Server
server
=
new
Server
();
server
.
copyTo
();
return
AjaxResult
.
success
(
server
);
}
}
package
com.joolun.web.controller.monitor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.framework.web.domain.Server
;
/**
* 服务器监控
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/server"
)
public
class
ServerController
{
@PreAuthorize
(
"@ss.hasPermi('monitor:server:list')"
)
@GetMapping
()
public
AjaxResult
getInfo
()
throws
Exception
{
Server
server
=
new
Server
();
server
.
copyTo
();
return
AjaxResult
.
success
(
server
);
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/SysLogininforController.java
+
67
-
67
View file @
009dfdc6
package
com.joolun.web.controller.monitor
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.annotation.Log
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.page.TableDataInfo
;
import
com.joolun.common.enums.BusinessType
;
import
com.joolun.common.utils.poi.ExcelUtil
;
import
com.joolun.system.domain.SysLogininfor
;
import
com.joolun.system.service.ISysLogininforService
;
/**
* 系统访问记录
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/logininfor"
)
public
class
SysLogininforController
extends
BaseController
{
@Autowired
private
ISysLogininforService
logininforService
;
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysLogininfor
logininfor
)
{
startPage
();
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
return
getDataTable
(
list
);
}
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:export')"
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
SysLogininfor
logininfor
)
{
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
ExcelUtil
<
SysLogininfor
>
util
=
new
ExcelUtil
<
SysLogininfor
>(
SysLogininfor
.
class
);
return
util
.
exportExcel
(
list
,
"登录日志"
);
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{infoIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
infoIds
)
{
return
toAjax
(
logininforService
.
deleteLogininforByIds
(
infoIds
));
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
logininforService
.
cleanLogininfor
();
return
AjaxResult
.
success
();
}
}
package
com.joolun.web.controller.monitor
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.annotation.Log
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.page.TableDataInfo
;
import
com.joolun.common.enums.BusinessType
;
import
com.joolun.common.utils.poi.ExcelUtil
;
import
com.joolun.system.domain.SysLogininfor
;
import
com.joolun.system.service.ISysLogininforService
;
/**
* 系统访问记录
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/logininfor"
)
public
class
SysLogininforController
extends
BaseController
{
@Autowired
private
ISysLogininforService
logininforService
;
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysLogininfor
logininfor
)
{
startPage
();
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
return
getDataTable
(
list
);
}
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:export')"
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
SysLogininfor
logininfor
)
{
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
ExcelUtil
<
SysLogininfor
>
util
=
new
ExcelUtil
<
SysLogininfor
>(
SysLogininfor
.
class
);
return
util
.
exportExcel
(
list
,
"登录日志"
);
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{infoIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
infoIds
)
{
return
toAjax
(
logininforService
.
deleteLogininforByIds
(
infoIds
));
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
CLEAN
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
logininforService
.
cleanLogininfor
();
return
AjaxResult
.
success
();
}
}
This diff is collapsed.
Click to expand it.
joolun-wx/joolun-admin/src/main/java/com/joolun/web/controller/monitor/SysOperlogController.java
+
66
-
66
View file @
009dfdc6
package
com.joolun.web.controller.monitor
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.annotation.Log
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.page.TableDataInfo
;
import
com.joolun.common.enums.BusinessType
;
import
com.joolun.common.utils.poi.ExcelUtil
;
import
com.joolun.system.domain.SysOperLog
;
import
com.joolun.system.service.ISysOperLogService
;
/**
* 操作日志记录
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/operlog"
)
public
class
SysOperlogController
extends
BaseController
{
@Autowired
private
ISysOperLogService
operLogService
;
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysOperLog
operLog
)
{
startPage
();
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
return
getDataTable
(
list
);
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:export')"
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
SysOperLog
operLog
)
{
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
ExcelUtil
<
SysOperLog
>
util
=
new
ExcelUtil
<
SysOperLog
>(
SysOperLog
.
class
);
return
util
.
exportExcel
(
list
,
"操作日志"
);
}
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/{operIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
operIds
)
{
return
toAjax
(
operLogService
.
deleteOperLogByIds
(
operIds
));
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
CLEAN
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
operLogService
.
cleanOperLog
();
return
AjaxResult
.
success
();
}
}
package
com.joolun.web.controller.monitor
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.joolun.common.annotation.Log
;
import
com.joolun.common.core.controller.BaseController
;
import
com.joolun.common.core.domain.AjaxResult
;
import
com.joolun.common.core.page.TableDataInfo
;
import
com.joolun.common.enums.BusinessType
;
import
com.joolun.common.utils.poi.ExcelUtil
;
import
com.joolun.system.domain.SysOperLog
;
import
com.joolun.system.service.ISysOperLogService
;
/**
* 操作日志记录
*
* @author ruoyi
*/
@RestController
@RequestMapping
(
"/monitor/operlog"
)
public
class
SysOperlogController
extends
BaseController
{
@Autowired
private
ISysOperLogService
operLogService
;
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SysOperLog
operLog
)
{
startPage
();
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
return
getDataTable
(
list
);
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:export')"
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
SysOperLog
operLog
)
{
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
ExcelUtil
<
SysOperLog
>
util
=
new
ExcelUtil
<
SysOperLog
>(
SysOperLog
.
class
);
return
util
.
exportExcel
(
list
,
"操作日志"
);
}
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/{operIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
operIds
)
{
return
toAjax
(
operLogService
.
deleteOperLogByIds
(
operIds
));
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
CLEAN
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:remove')"
)
@DeleteMapping
(
"/clean"
)
public
AjaxResult
clean
()
{
operLogService
.
cleanOperLog
();
return
AjaxResult
.
success
();
}
}
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
…
17
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment