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
jinli gu
Litemall
Commits
02e3d98f
Commit
02e3d98f
authored
Nov 09, 2018
by
Junling Bu
Browse files
管理后台litemall-admin和litemall-admin-wx更新
parent
b05140b9
Changes
14
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/dao/GoodsAllinone.java
View file @
02e3d98f
...
@@ -3,24 +3,24 @@ package org.linlinjava.litemall.admin.dao;
...
@@ -3,24 +3,24 @@ package org.linlinjava.litemall.admin.dao;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsAttribute
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsAttribute
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsSpecification
;
import
org.linlinjava.litemall.db.domain.LitemallGoodsSpecification
;
import
org.linlinjava.litemall.db.domain.LitemallProduct
;
import
org.linlinjava.litemall.db.domain.Litemall
Goods
Product
;
public
class
GoodsAllinone
{
public
class
GoodsAllinone
{
LitemallGoods
goods
;
LitemallGoods
goods
;
LitemallGoodsSpecification
[]
specifications
;
LitemallGoodsSpecification
[]
specifications
;
LitemallGoodsAttribute
[]
attributes
;
LitemallGoodsAttribute
[]
attributes
;
// 这里采用 Product 再转换到 LitemallProduct
// 这里采用 Product 再转换到 Litemall
Goods
Product
LitemallProduct
[]
products
;
Litemall
Goods
Product
[]
products
;
public
LitemallGoods
getGoods
()
{
public
LitemallGoods
getGoods
()
{
return
goods
;
return
goods
;
}
}
public
LitemallProduct
[]
getProducts
()
{
public
Litemall
Goods
Product
[]
getProducts
()
{
return
products
;
return
products
;
}
}
public
void
setProducts
(
LitemallProduct
[]
products
)
{
public
void
setProducts
(
Litemall
Goods
Product
[]
products
)
{
this
.
products
=
products
;
this
.
products
=
products
;
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAdController.java
View file @
02e3d98f
...
@@ -69,7 +69,6 @@ public class AdminAdController {
...
@@ -69,7 +69,6 @@ public class AdminAdController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
ad
.
setAddTime
(
LocalDateTime
.
now
());
adService
.
add
(
ad
);
adService
.
add
(
ad
);
return
ResponseUtil
.
ok
(
ad
);
return
ResponseUtil
.
ok
(
ad
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminAdminController.java
View file @
02e3d98f
...
@@ -111,8 +111,6 @@ public class AdminAdminController {
...
@@ -111,8 +111,6 @@ public class AdminAdminController {
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
();
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
();
String
encodedPassword
=
encoder
.
encode
(
rawPassword
);
String
encodedPassword
=
encoder
.
encode
(
rawPassword
);
admin
.
setPassword
(
encodedPassword
);
admin
.
setPassword
(
encodedPassword
);
admin
.
setAddTime
(
LocalDateTime
.
now
());
adminService
.
add
(
admin
);
adminService
.
add
(
admin
);
return
ResponseUtil
.
ok
(
admin
);
return
ResponseUtil
.
ok
(
admin
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminBrandController.java
View file @
02e3d98f
...
@@ -76,8 +76,6 @@ public class AdminBrandController {
...
@@ -76,8 +76,6 @@ public class AdminBrandController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
brand
.
setAddTime
(
LocalDateTime
.
now
());
brandService
.
add
(
brand
);
brandService
.
add
(
brand
);
return
ResponseUtil
.
ok
(
brand
);
return
ResponseUtil
.
ok
(
brand
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminCategoryController.java
View file @
02e3d98f
...
@@ -81,7 +81,6 @@ public class AdminCategoryController {
...
@@ -81,7 +81,6 @@ public class AdminCategoryController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
category
.
setAddTime
(
LocalDateTime
.
now
());
categoryService
.
add
(
category
);
categoryService
.
add
(
category
);
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminDashbordController.java
View file @
02e3d98f
...
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
...
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import
org.linlinjava.litemall.admin.annotation.LoginAdmin
;
import
org.linlinjava.litemall.admin.annotation.LoginAdmin
;
import
org.linlinjava.litemall.db.service.LitemallGoodsService
;
import
org.linlinjava.litemall.db.service.LitemallGoodsService
;
import
org.linlinjava.litemall.db.service.LitemallOrderService
;
import
org.linlinjava.litemall.db.service.LitemallOrderService
;
import
org.linlinjava.litemall.db.service.LitemallProductService
;
import
org.linlinjava.litemall.db.service.Litemall
Goods
ProductService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -26,7 +26,7 @@ public class AdminDashbordController {
...
@@ -26,7 +26,7 @@ public class AdminDashbordController {
@Autowired
@Autowired
private
LitemallGoodsService
goodsService
;
private
LitemallGoodsService
goodsService
;
@Autowired
@Autowired
private
LitemallProductService
productService
;
private
Litemall
Goods
ProductService
productService
;
@Autowired
@Autowired
private
LitemallOrderService
orderService
;
private
LitemallOrderService
orderService
;
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java
View file @
02e3d98f
...
@@ -41,7 +41,7 @@ public class AdminGoodsController {
...
@@ -41,7 +41,7 @@ public class AdminGoodsController {
@Autowired
@Autowired
private
LitemallGoodsAttributeService
attributeService
;
private
LitemallGoodsAttributeService
attributeService
;
@Autowired
@Autowired
private
LitemallProductService
productService
;
private
Litemall
Goods
ProductService
productService
;
@Autowired
@Autowired
private
LitemallCategoryService
categoryService
;
private
LitemallCategoryService
categoryService
;
@Autowired
@Autowired
...
@@ -119,8 +119,8 @@ public class AdminGoodsController {
...
@@ -119,8 +119,8 @@ public class AdminGoodsController {
}
}
}
}
LitemallProduct
[]
products
=
goodsAllinone
.
getProducts
();
Litemall
Goods
Product
[]
products
=
goodsAllinone
.
getProducts
();
for
(
LitemallProduct
product
:
products
){
for
(
Litemall
Goods
Product
product
:
products
){
Integer
number
=
product
.
getNumber
();
Integer
number
=
product
.
getNumber
();
if
(
number
==
null
||
number
<
0
){
if
(
number
==
null
||
number
<
0
){
return
ResponseUtil
.
badArgument
();
return
ResponseUtil
.
badArgument
();
...
@@ -165,7 +165,7 @@ public class AdminGoodsController {
...
@@ -165,7 +165,7 @@ public class AdminGoodsController {
LitemallGoods
goods
=
goodsAllinone
.
getGoods
();
LitemallGoods
goods
=
goodsAllinone
.
getGoods
();
LitemallGoodsAttribute
[]
attributes
=
goodsAllinone
.
getAttributes
();
LitemallGoodsAttribute
[]
attributes
=
goodsAllinone
.
getAttributes
();
LitemallGoodsSpecification
[]
specifications
=
goodsAllinone
.
getSpecifications
();
LitemallGoodsSpecification
[]
specifications
=
goodsAllinone
.
getSpecifications
();
LitemallProduct
[]
products
=
goodsAllinone
.
getProducts
();
Litemall
Goods
Product
[]
products
=
goodsAllinone
.
getProducts
();
// 开启事务管理
// 开启事务管理
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
...
@@ -179,7 +179,7 @@ public class AdminGoodsController {
...
@@ -179,7 +179,7 @@ public class AdminGoodsController {
// 商品基本信息表litemall_goods
// 商品基本信息表litemall_goods
if
(
goodsService
.
updateById
(
goods
)
==
0
){
if
(
goodsService
.
updateById
(
goods
)
==
0
){
throw
new
Exception
(
"跟新数据
已失效
"
);
throw
new
Exception
(
"跟新数据
失败
"
);
}
}
Integer
gid
=
goods
.
getId
();
Integer
gid
=
goods
.
getId
();
...
@@ -190,21 +190,18 @@ public class AdminGoodsController {
...
@@ -190,21 +190,18 @@ public class AdminGoodsController {
// 商品规格表litemall_goods_specification
// 商品规格表litemall_goods_specification
for
(
LitemallGoodsSpecification
specification
:
specifications
)
{
for
(
LitemallGoodsSpecification
specification
:
specifications
)
{
specification
.
setGoodsId
(
goods
.
getId
());
specification
.
setGoodsId
(
goods
.
getId
());
specification
.
setAddTime
(
LocalDateTime
.
now
());
specificationService
.
add
(
specification
);
specificationService
.
add
(
specification
);
}
}
// 商品参数表litemall_goods_attribute
// 商品参数表litemall_goods_attribute
for
(
LitemallGoodsAttribute
attribute
:
attributes
)
{
for
(
LitemallGoodsAttribute
attribute
:
attributes
)
{
attribute
.
setGoodsId
(
goods
.
getId
());
attribute
.
setGoodsId
(
goods
.
getId
());
attribute
.
setAddTime
(
LocalDateTime
.
now
());
attributeService
.
add
(
attribute
);
attributeService
.
add
(
attribute
);
}
}
// 商品货品表litemall_product
// 商品货品表litemall_product
for
(
LitemallProduct
product
:
products
)
{
for
(
Litemall
Goods
Product
product
:
products
)
{
product
.
setGoodsId
(
goods
.
getId
());
product
.
setGoodsId
(
goods
.
getId
());
product
.
setAddTime
(
LocalDateTime
.
now
());
productService
.
add
(
product
);
productService
.
add
(
product
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -263,7 +260,7 @@ public class AdminGoodsController {
...
@@ -263,7 +260,7 @@ public class AdminGoodsController {
LitemallGoods
goods
=
goodsAllinone
.
getGoods
();
LitemallGoods
goods
=
goodsAllinone
.
getGoods
();
LitemallGoodsAttribute
[]
attributes
=
goodsAllinone
.
getAttributes
();
LitemallGoodsAttribute
[]
attributes
=
goodsAllinone
.
getAttributes
();
LitemallGoodsSpecification
[]
specifications
=
goodsAllinone
.
getSpecifications
();
LitemallGoodsSpecification
[]
specifications
=
goodsAllinone
.
getSpecifications
();
LitemallProduct
[]
products
=
goodsAllinone
.
getProducts
();
Litemall
Goods
Product
[]
products
=
goodsAllinone
.
getProducts
();
String
name
=
goods
.
getName
();
String
name
=
goods
.
getName
();
if
(
goodsService
.
checkExistByName
(
name
))
{
if
(
goodsService
.
checkExistByName
(
name
))
{
...
@@ -277,8 +274,6 @@ public class AdminGoodsController {
...
@@ -277,8 +274,6 @@ public class AdminGoodsController {
try
{
try
{
// 商品基本信息表litemall_goods
// 商品基本信息表litemall_goods
goods
.
setAddTime
(
LocalDateTime
.
now
());
goodsService
.
add
(
goods
);
goodsService
.
add
(
goods
);
//将生成的分享图片地址写入数据库
//将生成的分享图片地址写入数据库
...
@@ -286,28 +281,25 @@ public class AdminGoodsController {
...
@@ -286,28 +281,25 @@ public class AdminGoodsController {
if
(!
StringUtils
.
isEmpty
(
url
))
{
if
(!
StringUtils
.
isEmpty
(
url
))
{
goods
.
setShareUrl
(
url
);
goods
.
setShareUrl
(
url
);
if
(
goodsService
.
updateById
(
goods
)
==
0
)
{
if
(
goodsService
.
updateById
(
goods
)
==
0
)
{
throw
new
Exception
(
"跟新数据
已失效
"
);
throw
new
Exception
(
"跟新数据
失败
"
);
}
}
}
}
// 商品规格表litemall_goods_specification
// 商品规格表litemall_goods_specification
for
(
LitemallGoodsSpecification
specification
:
specifications
)
{
for
(
LitemallGoodsSpecification
specification
:
specifications
)
{
specification
.
setGoodsId
(
goods
.
getId
());
specification
.
setGoodsId
(
goods
.
getId
());
specification
.
setAddTime
(
LocalDateTime
.
now
());
specificationService
.
add
(
specification
);
specificationService
.
add
(
specification
);
}
}
// 商品参数表litemall_goods_attribute
// 商品参数表litemall_goods_attribute
for
(
LitemallGoodsAttribute
attribute
:
attributes
)
{
for
(
LitemallGoodsAttribute
attribute
:
attributes
)
{
attribute
.
setGoodsId
(
goods
.
getId
());
attribute
.
setGoodsId
(
goods
.
getId
());
attribute
.
setAddTime
(
LocalDateTime
.
now
());
attributeService
.
add
(
attribute
);
attributeService
.
add
(
attribute
);
}
}
// 商品货品表litemall_product
// 商品货品表litemall_product
for
(
LitemallProduct
product
:
products
)
{
for
(
Litemall
Goods
Product
product
:
products
)
{
product
.
setGoodsId
(
goods
.
getId
());
product
.
setGoodsId
(
goods
.
getId
());
product
.
setAddTime
(
LocalDateTime
.
now
());
productService
.
add
(
product
);
productService
.
add
(
product
);
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -374,7 +366,7 @@ public class AdminGoodsController {
...
@@ -374,7 +366,7 @@ public class AdminGoodsController {
}
}
LitemallGoods
goods
=
goodsService
.
findById
(
id
);
LitemallGoods
goods
=
goodsService
.
findById
(
id
);
List
<
LitemallProduct
>
products
=
productService
.
queryByGid
(
id
);
List
<
Litemall
Goods
Product
>
products
=
productService
.
queryByGid
(
id
);
List
<
LitemallGoodsSpecification
>
specifications
=
specificationService
.
queryByGid
(
id
);
List
<
LitemallGoodsSpecification
>
specifications
=
specificationService
.
queryByGid
(
id
);
List
<
LitemallGoodsAttribute
>
attributes
=
attributeService
.
queryByGid
(
id
);
List
<
LitemallGoodsAttribute
>
attributes
=
attributeService
.
queryByGid
(
id
);
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGrouponController.java
View file @
02e3d98f
...
@@ -164,7 +164,6 @@ public class AdminGrouponController {
...
@@ -164,7 +164,6 @@ public class AdminGrouponController {
return
ResponseUtil
.
badArgumentValue
();
return
ResponseUtil
.
badArgumentValue
();
}
}
grouponRules
.
setAddTime
(
LocalDateTime
.
now
());
grouponRules
.
setGoodsName
(
goods
.
getName
());
grouponRules
.
setGoodsName
(
goods
.
getName
());
grouponRules
.
setPicUrl
(
goods
.
getPicUrl
());
grouponRules
.
setPicUrl
(
goods
.
getPicUrl
());
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminIssueController.java
View file @
02e3d98f
...
@@ -69,7 +69,6 @@ public class AdminIssueController {
...
@@ -69,7 +69,6 @@ public class AdminIssueController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
issue
.
setAddTime
(
LocalDateTime
.
now
());
issueService
.
add
(
issue
);
issueService
.
add
(
issue
);
return
ResponseUtil
.
ok
(
issue
);
return
ResponseUtil
.
ok
(
issue
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminKeywordController.java
View file @
02e3d98f
...
@@ -69,7 +69,6 @@ public class AdminKeywordController {
...
@@ -69,7 +69,6 @@ public class AdminKeywordController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
keywords
.
setAddTime
(
LocalDateTime
.
now
());
keywordService
.
add
(
keywords
);
keywordService
.
add
(
keywords
);
return
ResponseUtil
.
ok
(
keywords
);
return
ResponseUtil
.
ok
(
keywords
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminOrderController.java
View file @
02e3d98f
...
@@ -11,7 +11,7 @@ import org.linlinjava.litemall.core.validator.Sort;
...
@@ -11,7 +11,7 @@ import org.linlinjava.litemall.core.validator.Sort;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.service.LitemallOrderGoodsService
;
import
org.linlinjava.litemall.db.service.LitemallOrderGoodsService
;
import
org.linlinjava.litemall.db.service.LitemallOrderService
;
import
org.linlinjava.litemall.db.service.LitemallOrderService
;
import
org.linlinjava.litemall.db.service.LitemallProductService
;
import
org.linlinjava.litemall.db.service.Litemall
Goods
ProductService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.db.util.OrderUtil
;
import
org.linlinjava.litemall.db.util.OrderUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
...
@@ -45,7 +45,7 @@ public class AdminOrderController {
...
@@ -45,7 +45,7 @@ public class AdminOrderController {
@Autowired
@Autowired
private
LitemallOrderService
orderService
;
private
LitemallOrderService
orderService
;
@Autowired
@Autowired
private
LitemallProductService
productService
;
private
Litemall
Goods
ProductService
productService
;
@Autowired
@Autowired
private
LitemallUserService
userService
;
private
LitemallUserService
userService
;
...
@@ -127,8 +127,6 @@ public class AdminOrderController {
...
@@ -127,8 +127,6 @@ public class AdminOrderController {
return
ResponseUtil
.
fail
(
403
,
"订单不能确认收货"
);
return
ResponseUtil
.
fail
(
403
,
"订单不能确认收货"
);
}
}
Integer
version
=
order
.
getVersion
();
// 开启事务管理
// 开启事务管理
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
...
@@ -136,7 +134,7 @@ public class AdminOrderController {
...
@@ -136,7 +134,7 @@ public class AdminOrderController {
try
{
try
{
// 设置订单取消状态
// 设置订单取消状态
order
.
setOrderStatus
(
OrderUtil
.
STATUS_REFUND_CONFIRM
);
order
.
setOrderStatus
(
OrderUtil
.
STATUS_REFUND_CONFIRM
);
if
(
orderService
.
update
ByIdWithVersion
(
version
,
order
)
==
0
)
{
if
(
orderService
.
update
WithOptimisticLocker
(
order
)
==
0
)
{
throw
new
Exception
(
"跟新数据已失效"
);
throw
new
Exception
(
"跟新数据已失效"
);
}
}
...
@@ -144,11 +142,11 @@ public class AdminOrderController {
...
@@ -144,11 +142,11 @@ public class AdminOrderController {
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
orderId
);
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
orderId
);
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
)
{
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
)
{
Integer
productId
=
orderGoods
.
getProductId
();
Integer
productId
=
orderGoods
.
getProductId
();
LitemallProduct
product
=
productService
.
findById
(
productId
);
Litemall
Goods
Product
product
=
productService
.
findById
(
productId
);
Integer
number
=
product
.
getNumber
()
+
orderGoods
.
getNumber
();
Integer
number
=
product
.
getNumber
()
+
orderGoods
.
getNumber
();
product
.
setNumber
(
number
);
product
.
setNumber
(
number
);
if
(
productService
.
updateById
(
product
)
==
0
){
if
(
productService
.
updateById
(
product
)
==
0
){
throw
new
Exception
(
"跟新数据
已失效
"
);
throw
new
Exception
(
"跟新数据
失败
"
);
}
}
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
@@ -201,8 +199,6 @@ public class AdminOrderController {
...
@@ -201,8 +199,6 @@ public class AdminOrderController {
return
ResponseUtil
.
badArgument
();
return
ResponseUtil
.
badArgument
();
}
}
Integer
version
=
order
.
getVersion
();
// 如果订单不是已付款状态,则不能发货
// 如果订单不是已付款状态,则不能发货
if
(!
order
.
getOrderStatus
().
equals
(
OrderUtil
.
STATUS_PAY
))
{
if
(!
order
.
getOrderStatus
().
equals
(
OrderUtil
.
STATUS_PAY
))
{
return
ResponseUtil
.
fail
(
403
,
"订单不能确认收货"
);
return
ResponseUtil
.
fail
(
403
,
"订单不能确认收货"
);
...
@@ -212,7 +208,7 @@ public class AdminOrderController {
...
@@ -212,7 +208,7 @@ public class AdminOrderController {
order
.
setShipSn
(
shipSn
);
order
.
setShipSn
(
shipSn
);
order
.
setShipChannel
(
shipChannel
);
order
.
setShipChannel
(
shipChannel
);
order
.
setShipTime
(
LocalDateTime
.
now
());
order
.
setShipTime
(
LocalDateTime
.
now
());
if
(
orderService
.
update
ByIdWithVersion
(
version
,
order
)
==
0
){
if
(
orderService
.
update
WithOptimisticLocker
(
order
)
==
0
){
return
ResponseUtil
.
updatedDateExpired
();
return
ResponseUtil
.
updatedDateExpired
();
}
}
...
@@ -247,8 +243,6 @@ public class AdminOrderController {
...
@@ -247,8 +243,6 @@ public class AdminOrderController {
continue
;
continue
;
}
}
Integer
version
=
order
.
getVersion
();
// 开启事务管理
// 开启事务管理
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
...
@@ -257,7 +251,7 @@ public class AdminOrderController {
...
@@ -257,7 +251,7 @@ public class AdminOrderController {
// 设置订单已取消状态
// 设置订单已取消状态
order
.
setOrderStatus
(
OrderUtil
.
STATUS_AUTO_CANCEL
);
order
.
setOrderStatus
(
OrderUtil
.
STATUS_AUTO_CANCEL
);
order
.
setEndTime
(
LocalDateTime
.
now
());
order
.
setEndTime
(
LocalDateTime
.
now
());
if
(
orderService
.
update
ByIdWithVersion
(
version
,
order
)
==
0
){
if
(
orderService
.
update
WithOptimisticLocker
(
order
)
==
0
){
throw
new
Exception
(
"跟新数据已失效"
);
throw
new
Exception
(
"跟新数据已失效"
);
}
}
...
@@ -266,7 +260,7 @@ public class AdminOrderController {
...
@@ -266,7 +260,7 @@ public class AdminOrderController {
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
orderId
);
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
orderId
);
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
)
{
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
)
{
Integer
productId
=
orderGoods
.
getProductId
();
Integer
productId
=
orderGoods
.
getProductId
();
LitemallProduct
product
=
productService
.
findById
(
productId
);
Litemall
Goods
Product
product
=
productService
.
findById
(
productId
);
Integer
number
=
product
.
getNumber
()
+
orderGoods
.
getNumber
();
Integer
number
=
product
.
getNumber
()
+
orderGoods
.
getNumber
();
product
.
setNumber
(
number
);
product
.
setNumber
(
number
);
if
(
productService
.
updateById
(
product
)
==
0
){
if
(
productService
.
updateById
(
product
)
==
0
){
...
@@ -313,12 +307,10 @@ public class AdminOrderController {
...
@@ -313,12 +307,10 @@ public class AdminOrderController {
continue
;
continue
;
}
}
Integer
version
=
order
.
getVersion
();
// 设置订单已取消状态
// 设置订单已取消状态
order
.
setOrderStatus
(
OrderUtil
.
STATUS_AUTO_CONFIRM
);
order
.
setOrderStatus
(
OrderUtil
.
STATUS_AUTO_CONFIRM
);
order
.
setConfirmTime
(
now
);
order
.
setConfirmTime
(
now
);
if
(
orderService
.
update
ByIdWithVersion
(
version
,
order
)
==
0
){
if
(
orderService
.
update
WithOptimisticLocker
(
order
)
==
0
){
logger
.
info
(
"订单 ID="
+
order
.
getId
()
+
" 数据已经更新,放弃自动确认收货"
);
logger
.
info
(
"订单 ID="
+
order
.
getId
()
+
" 数据已经更新,放弃自动确认收货"
);
}
}
else
{
else
{
...
@@ -326,4 +318,34 @@ public class AdminOrderController {
...
@@ -326,4 +318,34 @@ public class AdminOrderController {
}
}
}
}
}
}
/**
* 可评价订单商品超期
* <p>
* 定时检查订单商品评价情况,如果确认商品超时七天则取消可评价状态
* 定时时间是每天凌晨4点。
*/
@Scheduled
(
cron
=
"0 0 4 * * ?"
)
public
void
checkOrderComment
()
{
logger
.
info
(
"系统开启任务检查订单是否已经超期未评价"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
LitemallOrder
>
orderList
=
orderService
.
queryComment
();
for
(
LitemallOrder
order
:
orderList
)
{
LocalDateTime
confirm
=
order
.
getConfirmTime
();
LocalDateTime
expired
=
confirm
.
plusDays
(
7
);
if
(
expired
.
isAfter
(
now
))
{
continue
;
}
order
.
setComments
((
short
)
0
);
orderService
.
updateWithOptimisticLocker
(
order
);
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
queryByOid
(
order
.
getId
());
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
){
orderGoods
.
setComment
(-
1
);
orderGoodsService
.
updateById
(
orderGoods
);
}
}
}
}
}
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminTopicController.java
View file @
02e3d98f
...
@@ -74,7 +74,6 @@ public class AdminTopicController {
...
@@ -74,7 +74,6 @@ public class AdminTopicController {
if
(
error
!=
null
){
if
(
error
!=
null
){
return
error
;
return
error
;
}
}
topic
.
setAddTime
(
LocalDateTime
.
now
());
topicService
.
add
(
topic
);
topicService
.
add
(
topic
);
return
ResponseUtil
.
ok
(
topic
);
return
ResponseUtil
.
ok
(
topic
);
}
}
...
...
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminUserController.java
View file @
02e3d98f
...
@@ -113,7 +113,6 @@ public class AdminUserController {
...
@@ -113,7 +113,6 @@ public class AdminUserController {
String
encodedPassword
=
encoder
.
encode
(
password
);
String
encodedPassword
=
encoder
.
encode
(
password
);
user
.
setPassword
(
encodedPassword
);
user
.
setPassword
(
encodedPassword
);
user
.
setAddTime
(
LocalDateTime
.
now
());
userService
.
add
(
user
);
userService
.
add
(
user
);
return
ResponseUtil
.
ok
(
user
);
return
ResponseUtil
.
ok
(
user
);
}
}
...
...
litemall-admin/src/views/mall/order.vue
View file @
02e3d98f
...
@@ -77,6 +77,9 @@
...
@@ -77,6 +77,9 @@
<el-form-item
label=
"订单用户"
>
<el-form-item
label=
"订单用户"
>
<span>
{{ orderDetail.user.nickname }}
</span>
<span>
{{ orderDetail.user.nickname }}
</span>
</el-form-item>
</el-form-item>
<el-form-item
label=
"用户留言"
>
<span>
{{ orderDetail.order.message }}
</span>
</el-form-item>
<el-form-item
label=
"收货信息"
>
<el-form-item
label=
"收货信息"
>
<span>
(收货人){{ orderDetail.order.consignee }}
</span>
<span>
(收货人){{ orderDetail.order.consignee }}
</span>
<span>
(手机号){{ orderDetail.order.mobile }}
</span>
<span>
(手机号){{ orderDetail.order.mobile }}
</span>
...
...
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