Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
5262a232
Commit
5262a232
authored
Apr 20, 2019
by
macro
Browse files
mall-admin代码改造
parent
b5800856
Changes
37
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/component/BindingResultAspect.java
View file @
5262a232
package
com.macro.mall.component
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
...
...
@@ -8,6 +8,7 @@ import org.aspectj.lang.annotation.Pointcut;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
/**
* HibernateValidator错误结果处理切面
...
...
@@ -28,7 +29,12 @@ public class BindingResultAspect {
if
(
arg
instanceof
BindingResult
)
{
BindingResult
result
=
(
BindingResult
)
arg
;
if
(
result
.
hasErrors
())
{
return
new
CommonResult
().
validateFailed
(
result
);
FieldError
fieldError
=
result
.
getFieldError
();
if
(
fieldError
!=
null
){
return
CommonResult
.
validateFailed
(
fieldError
.
getDefaultMessage
());
}
else
{
return
CommonResult
.
validateFailed
();
}
}
}
}
...
...
mall-admin/src/main/java/com/macro/mall/component/RestAuthenticationEntryPoint.java
View file @
5262a232
package
com.macro.mall.component
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.util.JsonUtil
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
...
...
@@ -21,7 +21,7 @@ public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
public
void
commence
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AuthenticationException
authException
)
throws
IOException
,
ServletException
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/json"
);
response
.
getWriter
().
println
(
JsonUtil
.
objectToJson
(
new
CommonResult
()
.
unauthorized
(
authException
.
getMessage
())));
response
.
getWriter
().
println
(
JsonUtil
.
objectToJson
(
CommonResult
.
unauthorized
(
authException
.
getMessage
())));
response
.
getWriter
().
flush
();
}
}
mall-admin/src/main/java/com/macro/mall/component/RestfulAccessDeniedHandler.java
View file @
5262a232
package
com.macro.mall.component
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.util.JsonUtil
;
import
org.springframework.security.access.AccessDeniedException
;
import
org.springframework.security.web.access.AccessDeniedHandler
;
...
...
@@ -23,7 +23,7 @@ public class RestfulAccessDeniedHandler implements AccessDeniedHandler{
AccessDeniedException
e
)
throws
IOException
,
ServletException
{
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/json"
);
response
.
getWriter
().
println
(
JsonUtil
.
objectToJson
(
new
CommonResult
()
.
forbidden
(
e
.
getMessage
())));
response
.
getWriter
().
println
(
JsonUtil
.
objectToJson
(
CommonResult
.
forbidden
(
e
.
getMessage
())));
response
.
getWriter
().
flush
();
}
}
mall-admin/src/main/java/com/macro/mall/controller/CmsPrefrenceAreaController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.CmsPrefrenceArea
;
import
com.macro.mall.service.CmsPrefrenceAreaService
;
import
io.swagger.annotations.Api
;
...
...
@@ -27,8 +27,8 @@ public class CmsPrefrenceAreaController {
@ApiOperation
(
"获取所有商品优选"
)
@RequestMapping
(
value
=
"/listAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
listAll
()
{
public
CommonResult
<
List
<
CmsPrefrenceArea
>>
listAll
()
{
List
<
CmsPrefrenceArea
>
prefrenceAreaList
=
prefrenceAreaService
.
listAll
();
return
new
CommonResult
()
.
success
(
prefrenceAreaList
);
return
CommonResult
.
success
(
prefrenceAreaList
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/CmsSubjectController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.CmsSubject
;
import
com.macro.mall.service.CmsSubjectService
;
import
io.swagger.annotations.Api
;
...
...
@@ -28,18 +29,18 @@ public class CmsSubjectController {
@ApiOperation
(
"获取全部商品专题"
)
@RequestMapping
(
value
=
"/listAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
O
bject
listAll
()
{
public
CommonResult
<
List
<
CmsSu
bject
>>
listAll
()
{
List
<
CmsSubject
>
subjectList
=
subjectService
.
listAll
();
return
new
CommonResult
()
.
success
(
subjectList
);
return
CommonResult
.
success
(
subjectList
);
}
@ApiOperation
(
value
=
"根据专题名称分页获取专题"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
O
bject
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
public
CommonResult
<
CommonPage
<
CmsSu
bject
>>
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
List
<
CmsSubject
>
subjectList
=
subjectService
.
list
(
keyword
,
pageNum
,
pageSize
);
return
new
CommonResult
().
pageSuccess
(
subjectList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
subjectList
)
)
;
}
}
mall-admin/src/main/java/com/macro/mall/controller/OmsCompanyAddressController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.OmsCompanyAddress
;
import
com.macro.mall.service.OmsCompanyAddressService
;
import
io.swagger.annotations.Api
;
...
...
@@ -25,10 +25,10 @@ public class OmsCompanyAddressController {
private
OmsCompanyAddressService
companyAddressService
;
@ApiOperation
(
"获取所有收货地址"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
()
{
public
CommonResult
<
List
<
OmsCompanyAddress
>>
list
()
{
List
<
OmsCompanyAddress
>
companyAddressList
=
companyAddressService
.
list
();
return
new
CommonResult
()
.
success
(
companyAddressList
);
return
CommonResult
.
success
(
companyAddressList
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.*
;
import
com.macro.mall.model.OmsOrder
;
import
com.macro.mall.service.OmsOrderService
;
...
...
@@ -25,86 +27,86 @@ public class OmsOrderController {
@ApiOperation
(
"查询订单"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
OmsOrderQueryParam
queryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
OmsOrder
>>
list
(
OmsOrderQueryParam
queryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
OmsOrder
>
orderList
=
orderService
.
list
(
queryParam
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
orderList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
orderList
)
)
;
}
@ApiOperation
(
"批量发货"
)
@RequestMapping
(
value
=
"/update/delivery"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delivery
(
@RequestBody
List
<
OmsOrderDeliveryParam
>
deliveryParamList
)
{
public
CommonResul
t
delivery
(
@RequestBody
List
<
OmsOrderDeliveryParam
>
deliveryParamList
)
{
int
count
=
orderService
.
delivery
(
deliveryParamList
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"批量关闭订单"
)
@RequestMapping
(
value
=
"/update/close"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
close
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
String
note
)
{
int
count
=
orderService
.
close
(
ids
,
note
);
public
CommonResul
t
close
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
String
note
)
{
int
count
=
orderService
.
close
(
ids
,
note
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"批量删除订单"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderService
.
delete
(
ids
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"获取订单详情:订单信息、商品信息、操作记录"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
detail
(
@PathVariable
Long
id
)
{
public
CommonResult
<
OmsOrderDetail
>
detail
(
@PathVariable
Long
id
)
{
OmsOrderDetail
orderDetailResult
=
orderService
.
detail
(
id
);
return
new
CommonResult
()
.
success
(
orderDetailResult
);
return
CommonResult
.
success
(
orderDetailResult
);
}
@ApiOperation
(
"修改收货人信息"
)
@RequestMapping
(
value
=
"/update/receiverInfo"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
updateReceiverInfo
(
@RequestBody
OmsReceiverInfoParam
receiverInfoParam
)
{
public
CommonResul
t
updateReceiverInfo
(
@RequestBody
OmsReceiverInfoParam
receiverInfoParam
)
{
int
count
=
orderService
.
updateReceiverInfo
(
receiverInfoParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"修改订单费用信息"
)
@RequestMapping
(
value
=
"/update/moneyInfo"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
updateReceiverInfo
(
@RequestBody
OmsMoneyInfoParam
moneyInfoParam
)
{
public
CommonResul
t
updateReceiverInfo
(
@RequestBody
OmsMoneyInfoParam
moneyInfoParam
)
{
int
count
=
orderService
.
updateMoneyInfo
(
moneyInfoParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"备注订单"
)
@RequestMapping
(
value
=
"/update/note"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
updateNote
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"note"
)
String
note
,
@RequestParam
(
"status"
)
Integer
status
)
{
int
count
=
orderService
.
updateNote
(
id
,
note
,
status
);
public
CommonResul
t
updateNote
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"note"
)
String
note
,
@RequestParam
(
"status"
)
Integer
status
)
{
int
count
=
orderService
.
updateNote
(
id
,
note
,
status
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnApplyController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.OmsOrderReturnApplyResult
;
import
com.macro.mall.dto.OmsReturnApplyQueryParam
;
import
com.macro.mall.dto.OmsUpdateStatusParam
;
...
...
@@ -28,41 +29,41 @@ public class OmsOrderReturnApplyController {
@ApiOperation
(
"分页查询退货申请"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
OmsReturnApplyQueryParam
queryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
OmsOrderReturnApply
>>
list
(
OmsReturnApplyQueryParam
queryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
OmsOrderReturnApply
>
returnApplyList
=
returnApplyService
.
list
(
queryParam
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
returnApplyList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
returnApplyList
)
)
;
}
@ApiOperation
(
"批量删除申请"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
returnApplyService
.
delete
(
ids
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"获取退货申请详情"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Objec
t
getItem
(
@PathVariable
Long
id
)
{
public
CommonResul
t
getItem
(
@PathVariable
Long
id
)
{
OmsOrderReturnApplyResult
result
=
returnApplyService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
result
);
return
CommonResult
.
success
(
result
);
}
@ApiOperation
(
"修改申请状态"
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
updateStatus
(
@PathVariable
Long
id
,
@RequestBody
OmsUpdateStatusParam
statusParam
)
{
public
CommonResul
t
updateStatus
(
@PathVariable
Long
id
,
@RequestBody
OmsUpdateStatusParam
statusParam
)
{
int
count
=
returnApplyService
.
updateStatus
(
id
,
statusParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnReasonController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.OmsOrderReturnReason
;
import
com.macro.mall.service.OmsOrderReturnReasonService
;
import
io.swagger.annotations.Api
;
...
...
@@ -25,62 +26,62 @@ public class OmsOrderReturnReasonController {
@ApiOperation
(
"添加退货原因"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
create
(
@RequestBody
OmsOrderReturnReason
returnReason
)
{
public
CommonResul
t
create
(
@RequestBody
OmsOrderReturnReason
returnReason
)
{
int
count
=
orderReturnReasonService
.
create
(
returnReason
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"修改退货原因"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
OmsOrderReturnReason
returnReason
)
{
int
count
=
orderReturnReasonService
.
update
(
id
,
returnReason
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
OmsOrderReturnReason
returnReason
)
{
int
count
=
orderReturnReasonService
.
update
(
id
,
returnReason
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"批量删除退货原因"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderReturnReasonService
.
delete
(
ids
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"分页查询全部退货原因"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
OmsOrderReturnReason
>
reasonList
=
orderReturnReasonService
.
list
(
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
reasonList
);
public
CommonResult
<
CommonPage
<
OmsOrderReturnReason
>>
list
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
OmsOrderReturnReason
>
reasonList
=
orderReturnReasonService
.
list
(
pageSize
,
pageNum
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
reasonList
)
)
;
}
@ApiOperation
(
"获取单个退货原因详情信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
OmsOrderReturnReason
>
getItem
(
@PathVariable
Long
id
)
{
OmsOrderReturnReason
reason
=
orderReturnReasonService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
reason
);
return
CommonResult
.
success
(
reason
);
}
@ApiOperation
(
"修改退货原因启用状态"
)
@RequestMapping
(
value
=
"/update/status"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
updateStatus
(
@RequestParam
(
value
=
"status"
)
Integer
status
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderReturnReasonService
.
updateStatus
(
ids
,
status
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
public
CommonResul
t
updateStatus
(
@RequestParam
(
value
=
"status"
)
Integer
status
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderReturnReasonService
.
updateStatus
(
ids
,
status
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderSettingController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.OmsOrderSetting
;
import
com.macro.mall.service.OmsOrderSettingService
;
import
io.swagger.annotations.Api
;
...
...
@@ -23,19 +23,19 @@ public class OmsOrderSettingController {
@ApiOperation
(
"获取指定订单设置"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
OmsOrderSetting
>
getItem
(
@PathVariable
Long
id
)
{
OmsOrderSetting
orderSetting
=
orderSettingService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
orderSetting
);
return
CommonResult
.
success
(
orderSetting
);
}
@ApiOperation
(
"修改指定订单设置"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
OmsOrderSetting
orderSetting
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
OmsOrderSetting
orderSetting
)
{
int
count
=
orderSettingService
.
update
(
id
,
orderSetting
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
mall-admin/src/main/java/com/macro/mall/controller/OssController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.dto.OssCallbackResult
;
import
com.macro.mall.dto.OssPolicyResult
;
import
com.macro.mall.service.impl.OssServiceImpl
;
...
...
@@ -18,26 +18,26 @@ import javax.servlet.http.HttpServletRequest;
* Created by macro on 2018/4/26.
*/
@Controller
@Api
(
tags
=
"OssController"
,
description
=
"Oss管理"
)
@Api
(
tags
=
"OssController"
,
description
=
"Oss管理"
)
@RequestMapping
(
"/aliyun/oss"
)
public
class
OssController
{
@Autowired
private
OssServiceImpl
ossService
;
@Autowired
private
OssServiceImpl
ossService
;
@ApiOperation
(
value
=
"oss上传签名生成"
)
@RequestMapping
(
value
=
"/policy"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
policy
()
{
OssPolicyResult
result
=
ossService
.
policy
();
return
new
CommonResult
()
.
success
(
result
);
}
@ApiOperation
(
value
=
"oss上传签名生成"
)
@RequestMapping
(
value
=
"/policy"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
CommonResult
<
OssPolicyResult
>
policy
()
{
OssPolicyResult
result
=
ossService
.
policy
();
return
CommonResult
.
success
(
result
);
}
@ApiOperation
(
value
=
"oss上传成功回调"
)
@RequestMapping
(
value
=
"callback"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
callback
(
HttpServletRequest
request
)
{
OssCallbackResult
ossCallbackResult
=
ossService
.
callback
(
request
);
return
new
CommonResult
()
.
success
(
ossCallbackResult
);
}
@ApiOperation
(
value
=
"oss上传成功回调"
)
@RequestMapping
(
value
=
"callback"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
<
OssCallbackResult
>
callback
(
HttpServletRequest
request
)
{
OssCallbackResult
ossCallbackResult
=
ossService
.
callback
(
request
);
return
CommonResult
.
success
(
ossCallbackResult
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsBrandController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.PmsBrandParam
;
import
com.macro.mall.model.PmsBrand
;
import
com.macro.mall.service.PmsBrandService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -19,7 +21,7 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api
(
tags
=
"PmsBrandController"
,
description
=
"商品品牌管理"
)
@Api
(
tags
=
"PmsBrandController"
,
description
=
"商品品牌管理"
)
@RequestMapping
(
"/brand"
)
public
class
PmsBrandController
{
@Autowired
...
...
@@ -29,21 +31,21 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/listAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:read')"
)
public
Object
getList
()
{
return
new
CommonResult
()
.
success
(
brandService
.
listAllBrand
());
public
CommonResult
<
List
<
PmsBrand
>>
getList
()
{
return
CommonResult
.
success
(
brandService
.
listAllBrand
());
}
@ApiOperation
(
value
=
"添加品牌"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:create')"
)
public
Objec
t
create
(
@Validated
@RequestBody
PmsBrandParam
pmsBrand
,
BindingResult
result
)
{
public
CommonResul
t
create
(
@Validated
@RequestBody
PmsBrandParam
pmsBrand
,
BindingResult
result
)
{
CommonResult
commonResult
;
int
count
=
brandService
.
createBrand
(
pmsBrand
);
if
(
count
==
1
)
{
commonResult
=
new
CommonResult
()
.
success
(
count
);
commonResult
=
CommonResult
.
success
(
count
);
}
else
{
commonResult
=
new
CommonResult
()
.
failed
();
commonResult
=
CommonResult
.
failed
();
}
return
commonResult
;
}
...
...
@@ -52,15 +54,15 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:update')"
)
public
Objec
t
update
(
@PathVariable
(
"id"
)
Long
id
,
@Validated
@RequestBody
PmsBrandParam
pmsBrandParam
,
BindingResult
result
)
{
public
CommonResul
t
update
(
@PathVariable
(
"id"
)
Long
id
,
@Validated
@RequestBody
PmsBrandParam
pmsBrandParam
,
BindingResult
result
)
{
CommonResult
commonResult
;
int
count
=
brandService
.
updateBrand
(
id
,
pmsBrandParam
);
if
(
count
==
1
)
{
commonResult
=
new
CommonResult
()
.
success
(
count
);
commonResult
=
CommonResult
.
success
(
count
);
}
else
{
commonResult
=
new
CommonResult
()
.
failed
();
commonResult
=
CommonResult
.
failed
();
}
return
commonResult
;
}
...
...
@@ -69,12 +71,12 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:delete')"
)
public
Objec
t
delete
(
@PathVariable
(
"id"
)
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
(
"id"
)
Long
id
)
{
int
count
=
brandService
.
deleteBrand
(
id
);
if
(
count
==
1
)
{
return
new
CommonResult
()
.
success
(
null
);
return
CommonResult
.
success
(
null
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -82,30 +84,31 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:read')"
)
public
Object
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
return
new
CommonResult
().
pageSuccess
(
brandService
.
listBrand
(
keyword
,
pageNum
,
pageSize
));
public
CommonResult
<
CommonPage
<
PmsBrand
>>
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
List
<
PmsBrand
>
brandList
=
brandService
.
listBrand
(
keyword
,
pageNum
,
pageSize
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
brandList
));
}
@ApiOperation
(
value
=
"根据编号查询品牌信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:read')"
)
public
Object
getItem
(
@PathVariable
(
"id"
)
Long
id
)
{
return
new
CommonResult
()
.
success
(
brandService
.
getBrand
(
id
));
public
CommonResult
<
PmsBrand
>
getItem
(
@PathVariable
(
"id"
)
Long
id
)
{
return
CommonResult
.
success
(
brandService
.
getBrand
(
id
));
}
@ApiOperation
(
value
=
"批量删除品牌"
)
@RequestMapping
(
value
=
"/delete/batch"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:delete')"
)
public
Objec
t
deleteBatch
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
deleteBatch
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
brandService
.
deleteBrand
(
ids
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -113,13 +116,13 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/update/showStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:update')"
)
public
Objec
t
updateShowStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
public
CommonResul
t
updateShowStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"showStatus"
)
Integer
showStatus
)
{
int
count
=
brandService
.
updateShowStatus
(
ids
,
showStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -127,13 +130,13 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/update/factoryStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:brand:update')"
)
public
Objec
t
updateFactoryStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
public
CommonResul
t
updateFactoryStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"factoryStatus"
)
Integer
factoryStatus
)
{
int
count
=
brandService
.
updateFactoryStatus
(
ids
,
factoryStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsProductAttributeCategoryController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.PmsProductAttributeCategoryItem
;
import
com.macro.mall.model.PmsProductAttributeCategory
;
import
com.macro.mall.service.PmsProductAttributeCategoryService
;
...
...
@@ -26,60 +27,60 @@ public class PmsProductAttributeCategoryController {
@ApiOperation
(
"添加商品属性分类"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
create
(
@RequestParam
String
name
)
{
public
CommonResul
t
create
(
@RequestParam
String
name
)
{
int
count
=
productAttributeCategoryService
.
create
(
name
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改商品属性分类"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestParam
String
name
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestParam
String
name
)
{
int
count
=
productAttributeCategoryService
.
update
(
id
,
name
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"删除单个商品属性分类"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Objec
t
delete
(
@PathVariable
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
productAttributeCategoryService
.
delete
(
id
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取单个商品属性分类信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
PmsProductAttributeCategory
>
getItem
(
@PathVariable
Long
id
)
{
PmsProductAttributeCategory
productAttributeCategory
=
productAttributeCategoryService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
productAttributeCategory
);
return
CommonResult
.
success
(
productAttributeCategory
);
}
@ApiOperation
(
"分页获取所有商品属性分类"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getList
(
@RequestParam
(
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
PmsProductAttributeCategory
>>
getList
(
@RequestParam
(
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
PmsProductAttributeCategory
>
productAttributeCategoryList
=
productAttributeCategoryService
.
getList
(
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
productAttributeCategoryList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
productAttributeCategoryList
)
)
;
}
@ApiOperation
(
"获取所有商品属性分类及其下属性"
)
@RequestMapping
(
value
=
"/list/withAttr"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getListWithAttr
()
{
public
CommonResult
<
List
<
PmsProductAttributeCategoryItem
>>
getListWithAttr
()
{
List
<
PmsProductAttributeCategoryItem
>
productAttributeCategoryResultList
=
productAttributeCategoryService
.
getListWithAttr
();
return
new
CommonResult
()
.
success
(
productAttributeCategoryResultList
);
return
CommonResult
.
success
(
productAttributeCategoryResultList
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsProductAttributeController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.PmsProductAttributeParam
;
import
com.macro.mall.dto.ProductAttrInfo
;
import
com.macro.mall.model.PmsProductAttribute
;
...
...
@@ -9,8 +10,6 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.BindingResult
;
...
...
@@ -33,63 +32,63 @@ public class PmsProductAttributeController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"type"
,
value
=
"0表示属性,1表示参数"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"integer"
)})
@RequestMapping
(
value
=
"/list/{cid}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getList
(
@PathVariable
Long
cid
,
@RequestParam
(
value
=
"type"
)
Integer
type
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
PmsProductAttribute
>>
getList
(
@PathVariable
Long
cid
,
@RequestParam
(
value
=
"type"
)
Integer
type
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
PmsProductAttribute
>
productAttributeList
=
productAttributeService
.
getList
(
cid
,
type
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
productAttributeList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
productAttributeList
)
)
;
}
@ApiOperation
(
"添加商品属性信息"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
create
(
@RequestBody
PmsProductAttributeParam
productAttributeParam
,
BindingResult
bindingResult
)
{
public
CommonResul
t
create
(
@RequestBody
PmsProductAttributeParam
productAttributeParam
,
BindingResult
bindingResult
)
{
int
count
=
productAttributeService
.
create
(
productAttributeParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改商品属性信息"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
PmsProductAttributeParam
productAttributeParam
,
BindingResult
bindingResult
){
int
count
=
productAttributeService
.
update
(
id
,
productAttributeParam
);
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
PmsProductAttributeParam
productAttributeParam
,
BindingResult
bindingResult
)
{
int
count
=
productAttributeService
.
update
(
id
,
productAttributeParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"查询单个商品属性"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
){
public
CommonResult
<
PmsProductAttribute
>
getItem
(
@PathVariable
Long
id
)
{
PmsProductAttribute
productAttribute
=
productAttributeService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
productAttribute
);
return
CommonResult
.
success
(
productAttribute
);
}
@ApiOperation
(
"批量删除商品属性"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
){
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
productAttributeService
.
delete
(
ids
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"根据商品分类的id获取商品属性及属性分类"
)
@RequestMapping
(
value
=
"/attrInfo/{productCategoryId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/attrInfo/{productCategoryId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getAttrInfo
(
@PathVariable
Long
productCategoryId
){
public
CommonResult
<
List
<
ProductAttrInfo
>>
getAttrInfo
(
@PathVariable
Long
productCategoryId
)
{
List
<
ProductAttrInfo
>
productAttrInfoList
=
productAttributeService
.
getProductAttrInfo
(
productCategoryId
);
return
new
CommonResult
()
.
success
(
productAttrInfoList
);
return
CommonResult
.
success
(
productAttrInfoList
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsProductCategoryController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.PmsProductCategoryParam
;
import
com.macro.mall.dto.PmsProductCategoryWithChildrenItem
;
import
com.macro.mall.model.PmsProductCategory
;
...
...
@@ -31,13 +32,13 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:create')"
)
public
Objec
t
create
(
@Validated
@RequestBody
PmsProductCategoryParam
productCategoryParam
,
public
CommonResul
t
create
(
@Validated
@RequestBody
PmsProductCategoryParam
productCategoryParam
,
BindingResult
result
)
{
int
count
=
productCategoryService
.
create
(
productCategoryParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -45,15 +46,15 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:update')"
)
public
Objec
t
update
(
@PathVariable
Long
id
,
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@Validated
@RequestBody
PmsProductCategoryParam
productCategoryParam
,
BindingResult
result
)
{
int
count
=
productCategoryService
.
update
(
id
,
productCategoryParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -61,32 +62,32 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/list/{parentId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:read')"
)
public
Object
getList
(
@PathVariable
Long
parentId
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
PmsProductCategory
>>
getList
(
@PathVariable
Long
parentId
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
PmsProductCategory
>
productCategoryList
=
productCategoryService
.
getList
(
parentId
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
productCategoryList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
productCategoryList
)
)
;
}
@ApiOperation
(
"根据id获取商品分类"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:read')"
)
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
PmsProductCategory
>
getItem
(
@PathVariable
Long
id
)
{
PmsProductCategory
productCategory
=
productCategoryService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
productCategory
);
return
CommonResult
.
success
(
productCategory
);
}
@ApiOperation
(
"删除商品分类"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:delete')"
)
public
Objec
t
delete
(
@PathVariable
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
productCategoryService
.
delete
(
id
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -94,12 +95,12 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/update/navStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:update')"
)
public
Objec
t
updateNavStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"navStatus"
)
Integer
navStatus
)
{
public
CommonResul
t
updateNavStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"navStatus"
)
Integer
navStatus
)
{
int
count
=
productCategoryService
.
updateNavStatus
(
ids
,
navStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -107,12 +108,12 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/update/showStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:update')"
)
public
Objec
t
updateShowStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"showStatus"
)
Integer
showStatus
)
{
public
CommonResul
t
updateShowStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"showStatus"
)
Integer
showStatus
)
{
int
count
=
productCategoryService
.
updateShowStatus
(
ids
,
showStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -120,8 +121,8 @@ public class PmsProductCategoryController {
@RequestMapping
(
value
=
"/list/withChildren"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:productCategory:read')"
)
public
Object
listWithChildren
()
{
public
CommonResult
<
List
<
PmsProductCategoryWithChildrenItem
>>
listWithChildren
()
{
List
<
PmsProductCategoryWithChildrenItem
>
list
=
productCategoryService
.
listWithChildren
();
return
new
CommonResult
()
.
success
(
list
);
return
CommonResult
.
success
(
list
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsProductController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.PmsProductParam
;
import
com.macro.mall.dto.PmsProductQueryParam
;
import
com.macro.mall.dto.PmsProductResult
;
...
...
@@ -31,12 +32,12 @@ public class PmsProductController {
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:create')"
)
public
Objec
t
create
(
@RequestBody
PmsProductParam
productParam
,
BindingResult
bindingResult
)
{
public
CommonResul
t
create
(
@RequestBody
PmsProductParam
productParam
,
BindingResult
bindingResult
)
{
int
count
=
productService
.
create
(
productParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -44,21 +45,21 @@ public class PmsProductController {
@RequestMapping
(
value
=
"/updateInfo/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:read')"
)
public
Object
getUpdateInfo
(
@PathVariable
Long
id
)
{
public
CommonResult
<
PmsProductResult
>
getUpdateInfo
(
@PathVariable
Long
id
)
{
PmsProductResult
productResult
=
productService
.
getUpdateInfo
(
id
);
return
new
CommonResult
()
.
success
(
productResult
);
return
CommonResult
.
success
(
productResult
);
}
@ApiOperation
(
"更新商品"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:update')"
)
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
PmsProductParam
productParam
,
BindingResult
bindingResult
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
PmsProductParam
productParam
,
BindingResult
bindingResult
)
{
int
count
=
productService
.
update
(
id
,
productParam
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
...
...
@@ -66,89 +67,89 @@ public class PmsProductController {
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:read')"
)
public
Object
getList
(
PmsProductQueryParam
productQueryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
public
CommonResult
<
CommonPage
<
PmsProduct
>>
getList
(
PmsProductQueryParam
productQueryParam
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
PmsProduct
>
productList
=
productService
.
list
(
productQueryParam
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
productList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
productList
)
)
;
}
@ApiOperation
(
"根据商品名称或货号模糊查询"
)
@RequestMapping
(
value
=
"/simpleList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getList
(
String
keyword
)
{
public
CommonResult
<
List
<
PmsProduct
>>
getList
(
String
keyword
)
{
List
<
PmsProduct
>
productList
=
productService
.
list
(
keyword
);
return
new
CommonResult
()
.
success
(
productList
);
return
CommonResult
.
success
(
productList
);
}
@ApiOperation
(
"批量修改审核状态"
)
@RequestMapping
(
value
=
"/update/verifyStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/verifyStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:update')"
)
public
Objec
t
updateVerifyStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"verifyStatus"
)
Integer
verifyStatus
,
@RequestParam
(
"detail"
)
String
detail
)
{
public
CommonResul
t
updateVerifyStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"verifyStatus"
)
Integer
verifyStatus
,
@RequestParam
(
"detail"
)
String
detail
)
{
int
count
=
productService
.
updateVerifyStatus
(
ids
,
verifyStatus
,
detail
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量上下架"
)
@RequestMapping
(
value
=
"/update/publishStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/publishStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:update')"
)
public
Objec
t
updatePublishStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"publishStatus"
)
Integer
publishStatus
)
{
public
CommonResul
t
updatePublishStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"publishStatus"
)
Integer
publishStatus
)
{
int
count
=
productService
.
updatePublishStatus
(
ids
,
publishStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量推荐商品"
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:update')"
)
public
Objec
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"recommendStatus"
)
Integer
recommendStatus
)
{
public
CommonResul
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"recommendStatus"
)
Integer
recommendStatus
)
{
int
count
=
productService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量设为新品"
)
@RequestMapping
(
value
=
"/update/newStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/newStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:update')"
)
public
Objec
t
updateNewStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
public
CommonResul
t
updateNewStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"newStatus"
)
Integer
newStatus
)
{
int
count
=
productService
.
updateNewStatus
(
ids
,
newStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量修改删除状态"
)
@RequestMapping
(
value
=
"/update/deleteStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/deleteStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@PreAuthorize
(
"hasAuthority('pms:product:delete')"
)
public
Objec
t
updateDeleteStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"deleteStatus"
)
Integer
deleteStatus
)
{
public
CommonResul
t
updateDeleteStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"deleteStatus"
)
Integer
deleteStatus
)
{
int
count
=
productService
.
updateDeleteStatus
(
ids
,
deleteStatus
);
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/PmsSkuStockController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.PmsSkuStock
;
import
com.macro.mall.service.PmsSkuStockService
;
import
io.swagger.annotations.Api
;
...
...
@@ -25,19 +25,19 @@ public class PmsSkuStockController {
@ApiOperation
(
"根据商品编号及编号模糊搜索sku库存"
)
@RequestMapping
(
value
=
"/{pid}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getList
(
@PathVariable
Long
pid
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
)
{
public
CommonResult
<
List
<
PmsSkuStock
>>
getList
(
@PathVariable
Long
pid
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
)
{
List
<
PmsSkuStock
>
skuStockList
=
skuStockService
.
getList
(
pid
,
keyword
);
return
new
CommonResult
()
.
success
(
skuStockList
);
return
CommonResult
.
success
(
skuStockList
);
}
@ApiOperation
(
"批量更新库存信息"
)
@RequestMapping
(
value
=
"/update/{pid}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
pid
,
@RequestBody
List
<
PmsSkuStock
>
skuStockList
){
public
CommonResul
t
update
(
@PathVariable
Long
pid
,
@RequestBody
List
<
PmsSkuStock
>
skuStockList
){
int
count
=
skuStockService
.
update
(
pid
,
skuStockList
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
else
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsCouponController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.SmsCouponParam
;
import
com.macro.mall.model.SmsCoupon
;
import
com.macro.mall.service.SmsCouponService
;
...
...
@@ -25,53 +26,53 @@ public class SmsCouponController {
@ApiOperation
(
"添加优惠券"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
add
(
@RequestBody
SmsCouponParam
couponParam
)
{
public
CommonResul
t
add
(
@RequestBody
SmsCouponParam
couponParam
)
{
int
count
=
couponService
.
create
(
couponParam
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"删除优惠券"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
delete
(
@PathVariable
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
couponService
.
delete
(
id
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"修改优惠券"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsCouponParam
couponParam
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsCouponParam
couponParam
)
{
int
count
=
couponService
.
update
(
id
,
couponParam
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"根据优惠券名称和类型分页获取优惠券列表"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
public
CommonResult
<
CommonPage
<
SmsCoupon
>>
list
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsCoupon
>
couponList
=
couponService
.
list
(
name
,
type
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
couponList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
couponList
)
)
;
}
@ApiOperation
(
"获取单个优惠券的详细信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
SmsCouponParam
>
getItem
(
@PathVariable
Long
id
)
{
SmsCouponParam
couponParam
=
couponService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
couponParam
);
return
CommonResult
.
success
(
couponParam
);
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsCouponHistoryController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsCouponHistory
;
import
com.macro.mall.service.SmsCouponHistoryService
;
import
io.swagger.annotations.Api
;
...
...
@@ -19,20 +20,21 @@ import java.util.List;
* Created by macro on 2018/11/6.
*/
@Controller
@Api
(
tags
=
"SmsCouponHistoryController"
,
description
=
"优惠券领取记录管理"
)
@Api
(
tags
=
"SmsCouponHistoryController"
,
description
=
"优惠券领取记录管理"
)
@RequestMapping
(
"/couponHistory"
)
public
class
SmsCouponHistoryController
{
@Autowired
private
SmsCouponHistoryService
historyService
;
@ApiOperation
(
"根据优惠券id,使用状态,订单编号分页获取领取记录"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"couponId"
,
required
=
false
)
Long
couponId
,
@RequestParam
(
value
=
"useStatus"
,
required
=
false
)
Integer
useStatus
,
@RequestParam
(
value
=
"orderSn"
,
required
=
false
)
String
orderSn
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
){
List
<
SmsCouponHistory
>
historyList
=
historyService
.
list
(
couponId
,
useStatus
,
orderSn
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
historyList
);
public
CommonResult
<
CommonPage
<
SmsCouponHistory
>>
list
(
@RequestParam
(
value
=
"couponId"
,
required
=
false
)
Long
couponId
,
@RequestParam
(
value
=
"useStatus"
,
required
=
false
)
Integer
useStatus
,
@RequestParam
(
value
=
"orderSn"
,
required
=
false
)
String
orderSn
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsCouponHistory
>
historyList
=
historyService
.
list
(
couponId
,
useStatus
,
orderSn
,
pageSize
,
pageNum
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
historyList
)
)
;
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionController.java
View file @
5262a232
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsFlashPromotion
;
import
com.macro.mall.service.SmsFlashPromotionService
;
import
io.swagger.annotations.Api
;
...
...
@@ -16,70 +17,71 @@ import java.util.List;
* Created by macro on 2018/11/16.
*/
@Controller
@Api
(
tags
=
"SmsFlashPromotionController"
,
description
=
"限时购活动管理"
)
@Api
(
tags
=
"SmsFlashPromotionController"
,
description
=
"限时购活动管理"
)
@RequestMapping
(
"/flash"
)
public
class
SmsFlashPromotionController
{
@Autowired
private
SmsFlashPromotionService
flashPromotionService
;
@ApiOperation
(
"添加活动"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Objec
t
create
(
@RequestBody
SmsFlashPromotion
flashPromotion
){
public
CommonResul
t
create
(
@RequestBody
SmsFlashPromotion
flashPromotion
)
{
int
count
=
flashPromotionService
.
create
(
flashPromotion
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"编辑活动信息"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotion
flashPromotion
){
int
count
=
flashPromotionService
.
update
(
id
,
flashPromotion
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
public
Object
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotion
flashPromotion
)
{
int
count
=
flashPromotionService
.
update
(
id
,
flashPromotion
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"删除活动信息"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
delete
(
@PathVariable
Long
id
){
public
Object
delete
(
@PathVariable
Long
id
)
{
int
count
=
flashPromotionService
.
delete
(
id
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"修改上下线状态"
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
update
(
@PathVariable
Long
id
,
Integer
status
){
int
count
=
flashPromotionService
.
updateStatus
(
id
,
status
);
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
public
Object
update
(
@PathVariable
Long
id
,
Integer
status
)
{
int
count
=
flashPromotionService
.
updateStatus
(
id
,
status
);
if
(
count
>
0
)
{
return
CommonResult
.
success
(
count
);
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
@ApiOperation
(
"获取活动详情"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
){
public
Object
getItem
(
@PathVariable
Long
id
)
{
SmsFlashPromotion
flashPromotion
=
flashPromotionService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
flashPromotion
);
return
CommonResult
.
success
(
flashPromotion
);
}
@ApiOperation
(
"根据活动名称分页查询"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
){
List
<
SmsFlashPromotion
>
flashPromotionList
=
flashPromotionService
.
list
(
keyword
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
flashPromotionList
);
public
Object
getItem
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsFlashPromotion
>
flashPromotionList
=
flashPromotionService
.
list
(
keyword
,
pageSize
,
pageNum
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
flashPromotionList
)
)
;
}
}
Prev
1
2
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