Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
1a707599
Commit
1a707599
authored
Mar 06, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
恢复部分代码
parent
3f058b83
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
250 deletions
+95
-250
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
+6
-8
soss-system/src/main/java/com/soss/system/domain/ShopGoodsSku.java
+38
-39
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
+10
-0
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
+7
-0
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
+3
-4
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
+10
-184
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+5
-15
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+16
-0
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
View file @
1a707599
...
@@ -210,15 +210,13 @@ public class ShopController extends BaseController {
...
@@ -210,15 +210,13 @@ public class ShopController extends BaseController {
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
@GetMapping
(
"/getShopGoodsSpec
s"
)
@GetMapping
(
value
=
"/selectSkuByShopGood
s"
)
public
AjaxResult
getShopGoodsSpecs
(
Long
shopId
,
L
ong
goodsId
)
{
public
AjaxResult
selectSkuByShopGoods
(
long
shopId
,
l
ong
goodsId
)
{
return
AjaxResult
.
success
(
shopGoodsService
.
getShopGoodsSpec
s
(
shopId
,
goodsId
));
return
AjaxResult
.
success
(
shopGoodsService
.
selectSkuByShopGood
s
(
shopId
,
goodsId
));
}
}
@GetMapping
(
"/updateShopGoodsS
pec
State"
)
@GetMapping
(
"/updateShopGoodsS
ku
State"
)
public
AjaxResult
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
,
Long
ruleId
,
Integer
state
)
{
public
AjaxResult
updateShopGoodsSkuState
(
@RequestParam
(
"id"
)
Long
shopGoodsSkuId
,
@RequestParam
(
"state"
)
Integer
state
)
{
return
AjaxResult
.
success
(
shopGoodsService
.
updateShopGoodsS
pecState
(
shopId
,
goodsId
,
rule
Id
,
state
));
return
AjaxResult
.
success
(
shopGoodsService
.
updateShopGoodsS
kuState
(
shopGoodsSku
Id
,
state
));
}
}
}
}
soss-system/src/main/java/com/soss/system/domain/ShopGoodsSku.java
View file @
1a707599
...
@@ -15,8 +15,7 @@ import java.util.Date;
...
@@ -15,8 +15,7 @@ import java.util.Date;
* @author zxq
* @author zxq
* @date 2022-04-28
* @date 2022-04-28
*/
*/
public
class
ShopGoodsSku
extends
BaseEntity
public
class
ShopGoodsSku
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
/** 主键 */
...
@@ -66,6 +65,16 @@ public class ShopGoodsSku extends BaseEntity
...
@@ -66,6 +65,16 @@ public class ShopGoodsSku extends BaseEntity
*/
*/
private
BigDecimal
discount
;
private
BigDecimal
discount
;
private
String
ruleList
;
public
String
getRuleList
()
{
return
ruleList
;
}
public
void
setRuleList
(
String
ruleList
)
{
this
.
ruleList
=
ruleList
;
}
public
BigDecimal
getOrigDiscount
()
{
public
BigDecimal
getOrigDiscount
()
{
return
origDiscount
;
return
origDiscount
;
}
}
...
@@ -82,91 +91,81 @@ public class ShopGoodsSku extends BaseEntity
...
@@ -82,91 +91,81 @@ public class ShopGoodsSku extends BaseEntity
this
.
discount
=
discount
;
this
.
discount
=
discount
;
}
}
public
void
setId
(
String
id
)
public
void
setId
(
String
id
)
{
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
String
getId
()
public
String
getId
()
{
{
return
id
;
return
id
;
}
}
public
void
setShopId
(
Long
shopId
)
{
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
this
.
shopId
=
shopId
;
}
}
public
Long
getShopId
()
public
Long
getShopId
()
{
{
return
shopId
;
return
shopId
;
}
}
public
void
setMachineId
(
String
machineId
)
{
public
void
setMachineId
(
String
machineId
)
{
this
.
machineId
=
machineId
;
this
.
machineId
=
machineId
;
}
}
public
String
getMachineId
()
public
String
getMachineId
()
{
{
return
machineId
;
return
machineId
;
}
}
public
void
setGoodsId
(
Long
goodsId
)
{
public
void
setGoodsId
(
Long
goodsId
)
{
this
.
goodsId
=
goodsId
;
this
.
goodsId
=
goodsId
;
}
}
public
Long
getGoodsId
()
public
Long
getGoodsId
()
{
{
return
goodsId
;
return
goodsId
;
}
}
public
void
setSkuId
(
Long
skuId
)
{
public
void
setSkuId
(
Long
skuId
)
{
this
.
skuId
=
skuId
;
this
.
skuId
=
skuId
;
}
}
public
Long
getSkuId
()
public
Long
getSkuId
()
{
{
return
skuId
;
return
skuId
;
}
}
public
void
setState
(
String
state
)
{
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
this
.
state
=
state
;
}
}
public
String
getState
()
public
String
getState
()
{
{
return
state
;
return
state
;
}
}
public
void
setIsDeleted
(
String
isDeleted
)
{
public
void
setIsDeleted
(
String
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
this
.
isDeleted
=
isDeleted
;
}
}
public
String
getIsDeleted
()
public
String
getIsDeleted
()
{
{
return
isDeleted
;
return
isDeleted
;
}
}
public
void
setCreatedAt
(
Date
createdAt
)
{
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
this
.
createdAt
=
createdAt
;
}
}
public
Date
getCreatedAt
()
public
Date
getCreatedAt
()
{
{
return
createdAt
;
return
createdAt
;
}
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
this
.
updatedAt
=
updatedAt
;
}
}
public
Date
getUpdatedAt
()
public
Date
getUpdatedAt
()
{
{
return
updatedAt
;
return
updatedAt
;
}
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"id"
,
getId
())
.
append
(
"shopId"
,
getShopId
())
.
append
(
"shopId"
,
getShopId
())
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"machineId"
,
getMachineId
())
...
...
soss-system/src/main/java/com/soss/system/domain/vo/SkuCountVo.java
0 → 100644
View file @
1a707599
package
com
.
soss
.
system
.
domain
.
vo
;
import
lombok.Data
;
@Data
public
class
SkuCountVo
{
private
Integer
sellin
;
private
Integer
sellout
;
}
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
View file @
1a707599
...
@@ -2,6 +2,7 @@ package com.soss.system.mapper;
...
@@ -2,6 +2,7 @@ package com.soss.system.mapper;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.domain.vo.SkuCountVo
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -47,6 +48,8 @@ public interface ShopGoodsSkuMapper {
...
@@ -47,6 +48,8 @@ public interface ShopGoodsSkuMapper {
*/
*/
public
int
updateShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
);
public
int
updateShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
);
int
updateShopGoodsSkuState
(
@Param
(
"id"
)
Long
shopGoodsSkuId
,
@Param
(
"state"
)
Integer
state
);
/**
/**
* 删除从店铺到sku关联
* 删除从店铺到sku关联
*
*
...
@@ -65,6 +68,8 @@ public interface ShopGoodsSkuMapper {
...
@@ -65,6 +68,8 @@ public interface ShopGoodsSkuMapper {
List
<
GoodsSku
>
selectSkuByShopAndGoods
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"goodsId"
)
long
goodsId
);
List
<
GoodsSku
>
selectSkuByShopAndGoods
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"goodsId"
)
long
goodsId
);
List
<
ShopGoodsSku
>
selectSkuByShopGoods
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"goodsId"
)
long
goodsId
);
List
<
SkuVo
>
selectSkuByGoodAndShop
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
String
goodId
);
List
<
SkuVo
>
selectSkuByGoodAndShop
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
String
goodId
);
void
deleteShopGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
Long
goodsId
);
void
deleteShopGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
Long
goodsId
);
...
@@ -76,4 +81,6 @@ public interface ShopGoodsSkuMapper {
...
@@ -76,4 +81,6 @@ public interface ShopGoodsSkuMapper {
void
updateSkuDiscount
(
@Param
(
"id"
)
Long
id
,
@Param
(
"discount"
)
BigDecimal
discount
);
void
updateSkuDiscount
(
@Param
(
"id"
)
Long
id
,
@Param
(
"discount"
)
BigDecimal
discount
);
void
restoreSkuDiscount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
void
restoreSkuDiscount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
SkuCountVo
getSkuCount
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"goodsId"
)
long
goodsId
);
}
}
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
View file @
1a707599
package
com
.
soss
.
system
.
service
;
package
com
.
soss
.
system
.
service
;
import
com.soss.system.domain.ShopGoods
;
import
com.soss.system.domain.ShopGoods
;
import
com.soss.system.domain.S
pec
;
import
com.soss.system.domain.S
hopGoodsSku
;
import
java.util.List
;
import
java.util.List
;
...
@@ -60,7 +60,6 @@ public interface IShopGoodsService {
...
@@ -60,7 +60,6 @@ public interface IShopGoodsService {
*/
*/
public
int
deleteShopGoodsById
(
String
id
);
public
int
deleteShopGoodsById
(
String
id
);
List
<
Spec
>
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
);
List
<
ShopGoodsSku
>
selectSkuByShopGoods
(
Long
shopId
,
Long
goodsId
);
Boolean
updateShopGoodsSkuState
(
Long
shopGoodsSkuId
,
Integer
state
);
Boolean
updateShopGoodsSpecState
(
Long
shopId
,
Long
goodsId
,
Long
ruleId
,
Integer
state
);
}
}
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
View file @
1a707599
package
com
.
soss
.
system
.
service
.
impl
;
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.soss.system.domain.ShopGoods
;
import
com.alibaba.fastjson.JSONArray
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
com.soss.system.mapper.*
;
import
com.soss.system.mapper.*
;
import
com.soss.system.service.IShopGoodsService
;
import
com.soss.system.service.IShopGoodsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 店铺和商品关联Service业务层处理
* 店铺和商品关联Service业务层处理
...
@@ -102,186 +97,17 @@ public class ShopGoodsServiceImpl implements IShopGoodsService {
...
@@ -102,186 +97,17 @@ public class ShopGoodsServiceImpl implements IShopGoodsService {
}
}
@Override
@Override
public
List
<
Spec
>
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
)
{
public
List
<
ShopGoodsSku
>
selectSkuByShopGoods
(
Long
shopId
,
Long
goodsId
)
{
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsId
.
toString
());
List
<
ShopGoodsSku
>
skus
=
shopGoodsSkuMapper
.
selectSkuByShopGoods
(
shopId
,
goodsId
);
if
(
CollectionUtils
.
isEmpty
(
skuVos
))
{
return
skus
;
return
null
;
}
}
Map
<
String
,
List
<
SkuVo
>>
skuMap
=
skuVos
.
stream
().
collect
(
Collectors
.
groupingBy
(
SkuVo:
:
getState
));
@Override
if
(
CollectionUtils
.
isEmpty
(
skuMap
))
{
public
Boolean
updateShopGoodsSkuState
(
Long
shopGoodsSkuId
,
Integer
state
)
{
return
null
;
int
i
=
shopGoodsSkuMapper
.
updateShopGoodsSkuState
(
shopGoodsSkuId
,
state
);
}
if
(
i
>
0
)
{
Set
<
Long
>
selloutRules
=
new
HashSet
<>();
Set
<
Long
>
sellinRules
=
new
HashSet
<>();
List
<
SkuVo
>
selloutSkus
=
skuMap
.
get
(
"2"
);
if
(!
CollectionUtils
.
isEmpty
(
selloutSkus
))
{
selloutSkus
.
forEach
(
skuVo
->
{
List
<
SpecRule
>
rules
=
JSON
.
parseArray
(
skuVo
.
getRulesString
(),
SpecRule
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
rules
))
{
rules
.
forEach
(
rule
->
selloutRules
.
add
(
rule
.
getId
()));
}
});
}
List
<
SkuVo
>
sellinSkus
=
skuMap
.
get
(
"1"
);
if
(!
CollectionUtils
.
isEmpty
(
sellinSkus
))
{
sellinSkus
.
forEach
(
skuVo
->
{
List
<
SpecRule
>
rules
=
JSON
.
parseArray
(
skuVo
.
getRulesString
(),
SpecRule
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
rules
))
{
rules
.
forEach
(
rule
->
sellinRules
.
add
(
rule
.
getId
()));
}
});
}
// 从售罄sku选项列表中删除 未售罄sku选项
sellinRules
.
forEach
(
sellinId
->
selloutRules
.
remove
(
sellinId
));
Goods
goods
=
goodsMapper
.
selectGoodsById
(
goodsId
);
if
(
goods
==
null
)
{
return
null
;
}
List
<
Spec
>
specs
=
JSONArray
.
parseArray
(
goods
.
getSpec
(),
Spec
.
class
);
if
(
CollectionUtils
.
isEmpty
(
specs
))
{
return
specs
;
}
specs
.
forEach
(
spec
->
{
List
<
SpecRule
>
rules
=
spec
.
getSpecRules
();
if
(
CollectionUtils
.
isEmpty
(
rules
))
{
return
;
}
rules
.
forEach
(
rule
->
{
if
(
sellinRules
.
contains
(
rule
.
getId
()))
{
rule
.
setState
(
1
);
}
else
{
rule
.
setState
(
0
);
}
});
});
// Map<Long, List<SpecRule>> selloutRulesBySpec = selloutRules.values().stream().collect(Collectors.groupingBy(SpecRule::getSpecId));
// Map<Long, List<SpecRule>> sellinRulesBySpec = sellinRules.values().stream().collect(Collectors.groupingBy(SpecRule::getSpecId));
//
// List<Long> specIds = new ArrayList<>();
// specIds.addAll(sellinRules.values().stream().map(SpecRule::getSpecId).collect(Collectors.toList()));
// specIds.addAll(selloutRules.values().stream().map(SpecRule::getSpecId).collect(Collectors.toList()));
//
// // 构建返回数据
// List<Spec> specVos = specMapper.selectSpecByIds(specIds);
// if (CollectionUtils.isEmpty(specVos)) {
// return null;
// }
// specVos.forEach(spec -> {
// if (CollectionUtils.isEmpty(spec.getSpecRules())) {
// spec.setSpecRules(new ArrayList<>());
// }
// if (!CollectionUtils.isEmpty(sellinRulesBySpec.get(spec.getId()))) {
// spec.getSpecRules().addAll(sellinRulesBySpec.get(spec.getId()));
// }
// if (!CollectionUtils.isEmpty(selloutRulesBySpec.get(spec.getId()))) {
// spec.getSpecRules().addAll(selloutRulesBySpec.get(spec.getId()));
// }
// });
return
specs
;
}
public
Boolean
updateShopGoodsSpecState
(
Long
shopId
,
Long
goodsId
,
Long
ruleId
,
Integer
state
)
{
if
(
shopId
==
null
||
shopId
<=
0
)
{
throw
new
ServiceException
(
"店铺id错误"
);
}
if
(
goodsId
==
null
||
goodsId
<=
0
)
{
throw
new
ServiceException
(
"商品id错误"
);
}
if
(
ruleId
==
null
||
ruleId
<=
0
)
{
throw
new
ServiceException
(
"选项id错误"
);
}
if
(
state
==
null
)
{
throw
new
ServiceException
(
"状态不能为空"
);
}
if
(
state
!=
1
&&
state
!=
2
)
{
throw
new
ServiceException
(
"状态错误,1-2"
);
}
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsId
.
toString
());
if
(
CollectionUtils
.
isEmpty
(
skuVos
))
{
return
false
;
}
// 本店铺本商品 所有规格,选项状态
List
<
Spec
>
specs
=
getShopGoodsSpecs
(
shopId
,
goodsId
);
if
(
CollectionUtils
.
isEmpty
(
specs
))
{
return
false
;
}
// 包含本次修改选项的sku列表
List
<
String
>
skuIds
=
new
ArrayList
<>();
skuVos
.
forEach
(
skuVo
->
{
List
<
SpecRule
>
rules
=
JSON
.
parseArray
(
skuVo
.
getRulesString
(),
SpecRule
.
class
);
if
(
CollectionUtils
.
isEmpty
(
rules
))
{
return
;
}
rules
.
forEach
(
rule
->
{
// 判断本sku是否包含本次修改的选项
if
(
rule
.
getId
()
==
ruleId
)
{
if
(
existsOtherSellout
(
skuVo
,
specs
,
ruleId
))
{
// 除本次修改选项外,本商品还有其它售罄选项
return
;
}
skuIds
.
add
(
skuVo
.
getSkuId
().
toString
());
}
});
});
if
(
CollectionUtils
.
isEmpty
(
skuIds
))
{
return
true
;
}
int
i
=
shopGoodsSkuMapper
.
updateSkuStatus
(
skuIds
,
"0"
,
String
.
valueOf
(
shopId
),
String
.
valueOf
(
state
));
//推送给极光
List
<
Machine
>
machines
=
machineMapper
.
selectMachineByShopId
(
shopId
);
if
(
CollectionUtils
.
isEmpty
(
machines
))
{
return
true
;
}
List
<
Long
>
longSkuIds
=
skuIds
.
stream
().
map
(
x
->
Long
.
parseLong
(
x
)).
collect
(
Collectors
.
toList
());
Machine
machine
=
machines
.
get
(
0
);
Map
<
Long
,
List
<
Long
>>
map
=
new
HashMap
<>();
map
.
put
(
goodsId
,
longSkuIds
);
machineApiService
.
push
(
machine
,
String
.
valueOf
(
state
),
map
);
return
true
;
}
/** 判断除本次修改选项外,本商品还有其它售罄选项 */
private
boolean
existsOtherSellout
(
SkuVo
skuVo
,
List
<
Spec
>
specs
,
long
ruleId
)
{
List
<
Long
>
selloutRuleIds
=
new
ArrayList
<>();
for
(
Spec
spec
:
specs
)
{
for
(
SpecRule
rule
:
spec
.
getSpecRules
())
{
if
(
rule
.
getState
()
==
1
)
{
continue
;
}
if
(
rule
.
getId
()
==
ruleId
)
{
continue
;
}
selloutRuleIds
.
add
(
rule
.
getId
());
}
}
// 没有其它售罄选项
if
(
CollectionUtils
.
isEmpty
(
selloutRuleIds
))
{
return
false
;
}
// 有其它售罄选项,判断本商品是否包含其它售罄选项
List
<
SpecRule
>
rules
=
JSON
.
parseArray
(
skuVo
.
getRulesString
(),
SpecRule
.
class
);
for
(
SpecRule
rule
:
rules
)
{
if
(
selloutRuleIds
.
contains
(
rule
.
getId
()))
{
return
true
;
return
true
;
}
}
}
return
false
;
return
false
;
}
}
}
}
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
1a707599
...
@@ -10,6 +10,7 @@ import com.soss.common.enums.SkuDeleteState;
...
@@ -10,6 +10,7 @@ import com.soss.common.enums.SkuDeleteState;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.SkuCountVo
;
import
com.soss.system.domain.vo.orderTaking.*
;
import
com.soss.system.domain.vo.orderTaking.*
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.mapper.*
;
import
com.soss.system.mapper.*
;
...
@@ -281,22 +282,11 @@ public class ShopServiceImpl implements IShopService {
...
@@ -281,22 +282,11 @@ public class ShopServiceImpl implements IShopService {
}
}
}
}
List
<
Spec
>
specs
=
shopGoodsService
.
getShopGoodsSpecs
(
shopId
,
goods
.
getId
());
SkuCountVo
skuCountVo
=
shopGoodsSkuMapper
.
getSkuCount
(
shopId
,
goods
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
specs
)
)
{
if
(
skuCountVo
!=
null
)
{
goods
.
setSelloutCount
(
0
);
goods
.
setSelloutCount
(
skuCountVo
.
getSellout
()
);
goods
.
setSkuCount
(
0
);
goods
.
setSkuCount
(
skuCountVo
.
getSellout
()
+
skuCountVo
.
getSellin
()
);
}
}
specs
.
forEach
(
spec
->
{
if
(
CollectionUtils
.
isEmpty
(
spec
.
getSpecRules
()))
{
return
;
}
spec
.
getSpecRules
().
forEach
(
rule
->
{
goods
.
setSkuCount
(
goods
.
getSkuCount
()
+
1
);
if
(
rule
.
getState
()
==
0
)
{
goods
.
setSelloutCount
(
goods
.
getSelloutCount
()
+
1
);
}
});
});
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
...
...
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
1a707599
...
@@ -81,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -81,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
where id = #{id}
</update>
</update>
<update
id=
"updateShopGoodsSkuState"
>
update shop_goods_sku set `state`= #{state} where id = #{id}
</update>
<delete
id=
"deleteShopGoodsSkuById"
parameterType=
"String"
>
<delete
id=
"deleteShopGoodsSkuById"
parameterType=
"String"
>
delete from shop_goods_sku where id = #{id}
delete from shop_goods_sku where id = #{id}
</delete>
</delete>
...
@@ -98,6 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -98,6 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select gs.* from shop_goods_sku sgs ,goods_sku gs where gs.id =sgs.sku_id and gs.is_deleted ='0'
select gs.* from shop_goods_sku sgs ,goods_sku gs where gs.id =sgs.sku_id and gs.is_deleted ='0'
and sgs.goods_id =#{goodsId} and shop_id =#{shopId}
and sgs.goods_id =#{goodsId} and shop_id =#{shopId}
</select>
</select>
<select
id=
"selectSkuByShopGoods"
resultType=
"ShopGoodsSku"
>
select sgs.*,gs.rule_list from shop_goods_sku sgs
left join goods_sku gs on sgs.sku_id = gs.id
where sgs.goods_id =#{goodsId} and shop_id =#{shopId}
</select>
<select
id=
"selectSkuByGoodAndShop"
resultType=
"com.soss.system.domain.vo.orderTaking.SkuVo"
>
<select
id=
"selectSkuByGoodAndShop"
resultType=
"com.soss.system.domain.vo.orderTaking.SkuVo"
>
select
select
sgs.id as id,
sgs.id as id,
...
@@ -145,4 +154,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -145,4 +154,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</foreach>
</delete>
</delete>
<select
id=
"getSkuCount"
resultType=
"SkuCountVo"
>
select
sum(case when `state`=1 then 1 else 0 end) sellin,
sum(case when `state`=2 then 1 else 0 end) sellout
from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId}
</select>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
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