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
1d7e490d
Commit
1d7e490d
authored
Jun 07, 2018
by
zhh
Browse files
问题修复
parent
2b0372f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/service/impl/PmsProductServiceImpl.java
View file @
1d7e490d
...
...
@@ -17,6 +17,7 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.StringUtils
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -78,6 +79,8 @@ public class PmsProductServiceImpl implements PmsProductService {
relateAndInsertList
(
productLadderDao
,
productParam
.
getProductLadderList
(),
productId
);
//满减价格
relateAndInsertList
(
productFullReductionDao
,
productParam
.
getProductFullReductionList
(),
productId
);
//处理sku的编码
handleSkuStockCode
(
productParam
.
getSkuStockList
(),
productId
);
//添加sku库存信息
relateAndInsertList
(
skuStockDao
,
productParam
.
getSkuStockList
(),
productId
);
//添加商品参数,添加自定义商品规格
...
...
@@ -90,6 +93,24 @@ public class PmsProductServiceImpl implements PmsProductService {
return
count
;
}
private
void
handleSkuStockCode
(
List
<
PmsSkuStock
>
skuStockList
,
Long
productId
)
{
if
(
CollectionUtils
.
isEmpty
(
skuStockList
))
return
;
for
(
int
i
=
0
;
i
<
skuStockList
.
size
();
i
++){
PmsSkuStock
skuStock
=
skuStockList
.
get
(
i
);
if
(
StringUtils
.
isEmpty
(
skuStock
.
getSkuCode
())){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
StringBuilder
sb
=
new
StringBuilder
();
//日期
sb
.
append
(
sdf
.
format
(
new
Date
()));
//四位商品id
sb
.
append
(
String
.
format
(
"%04d"
,
productId
));
//三位索引id
sb
.
append
(
String
.
format
(
"%03d"
,
i
+
1
));
skuStock
.
setSkuCode
(
sb
.
toString
());
}
}
}
@Override
public
PmsProductResult
getUpdateInfo
(
Long
id
)
{
return
productDao
.
getUpdateInfo
(
id
);
...
...
@@ -121,6 +142,7 @@ public class PmsProductServiceImpl implements PmsProductService {
PmsSkuStockExample
skuStockExample
=
new
PmsSkuStockExample
();
skuStockExample
.
createCriteria
().
andProductIdEqualTo
(
id
);
skuStockMapper
.
deleteByExample
(
skuStockExample
);
handleSkuStockCode
(
productParam
.
getSkuStockList
(),
id
);
relateAndInsertList
(
skuStockDao
,
productParam
.
getSkuStockList
(),
id
);
//修改商品参数,添加自定义商品规格
PmsProductAttributeValueExample
productAttributeValueExample
=
new
PmsProductAttributeValueExample
();
...
...
mall-admin/src/main/resources/dao/PmsMemberPriceDao.xml
View file @
1d7e490d
...
...
@@ -3,11 +3,12 @@
<mapper
namespace=
"com.macro.mall.dao.PmsMemberPriceDao"
>
<!--批量新增回写主键支持-->
<insert
id=
"insertList"
>
INSERT INTO pms_member_price (product_id, member_level_id, member_price) VALUES
INSERT INTO pms_member_price (product_id, member_level_id, member_price
,member_level_name
) VALUES
<foreach
collection=
"list"
separator=
","
item=
"item"
index=
"index"
>
(#{item.productId,jdbcType=BIGINT},
#{item.memberLevelId,jdbcType=BIGINT},
#{item.memberPrice,jdbcType=DECIMAL})
#{item.memberPrice,jdbcType=DECIMAL},
#{item.memberLevelName,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>
\ No newline at end of file
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