Authored by 张帅

修改

... ... @@ -104,19 +104,23 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
try{
List<GrassArticleProduct> sknList = Lists.newArrayList();
String[] skns = req.getArticleSkns().split(",");
int orderby = 0;
for (String skn: skns) {
GrassArticleProduct grassArticleSkn = new GrassArticleProduct();
grassArticleSkn.setArticleId(article.getId());
grassArticleSkn.setProductSkn(Integer.valueOf(skn));
grassArticleSkn.setCreateTime(DateUtil.getCurrentTimeSeconds());
grassArticleSkn.setOrderBy(orderby);
orderby++;
sknList.add(grassArticleSkn);
if(StringUtils.isNotEmpty( req.getArticleSkns())){
String[] skns = req.getArticleSkns().split(",");
int orderby = 0;
for (String skn: skns) {
GrassArticleProduct grassArticleSkn = new GrassArticleProduct();
grassArticleSkn.setArticleId(article.getId());
grassArticleSkn.setProductSkn(Integer.valueOf(skn));
grassArticleSkn.setCreateTime(DateUtil.getCurrentTimeSeconds());
grassArticleSkn.setOrderBy(orderby);
orderby++;
sknList.add(grassArticleSkn);
}
if(CollectionUtils.isNotEmpty(sknList)){
grassArticleProductDao.insertArticleSkns(sknList);
}
logger.info("insert grass article skns success, ariticle id is {}, sknList size is {}", article.getId(), sknList.size());
}
grassArticleProductDao.insertArticleSkns(sknList);
logger.info("insert grass article skns success, ariticle id is {}, sknList size is {}", article.getId(), sknList.size());
}catch (Exception e){
logger.warn("insert article skns fail,ariticle id is {}, e is {}",article.getId(), e );
}
... ... @@ -397,9 +401,9 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
logger.info("publishCheck images is null");
throw new PlatformException("publish images is null", 403);
}
if(StringUtils.isEmpty(req.getArticleSkns())){
logger.info("publishCheck skn is null");
throw new PlatformException("publish skn is null", 403);
if(StringUtils.isEmpty(req.getContent())){
logger.info("publishCheck content is null");
throw new PlatformException("publish content is null", 403);
}
}
... ...
... ... @@ -51,7 +51,7 @@
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>选择话题</label> <br>
<label>选择话题</label> <br>
<input id="topic" name="topicId" class="easyui-combobox" style="width:60% "/>
</td>
</tr>
... ... @@ -70,7 +70,7 @@
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>关联商品</label> <br>
<label>关联商品</label> <br>
<a id="addSkn" class="btn-primary" onclick="getEditDialog()" style="font-size: 15px">新增商品+</a>
<input id="skns" name="articleSkns" hidden="hidden"/>
</td>
... ... @@ -128,7 +128,7 @@
$("#topic").combobox({
prompt: "请选择话题",
required: true,
required: false,
selectOnNavigation : true,
valueField: 'id',
textField: 'topicName',
... ...