From ab9e60fa9a8e43d797446730a5dc9ebfb6b3f4e6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 27 六月 2019 09:48:17 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java | 41 +++++++++++++++++++++++++++++++++++------ 1 files changed, 35 insertions(+), 6 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java index d984973..0052f7b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java @@ -18,10 +18,14 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass; +import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel; +import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap; import com.yeshi.fanli.exception.GoodsSubClassException; +import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.goods.TaoBaoClassService; import com.yeshi.fanli.service.inter.lable.LabelClassService; +import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; @Service @@ -36,6 +40,9 @@ @Resource private TaoBaoClassService taoBaoClassService; + + @Resource + private GoodsSubClassLabelService goodsSubClassLabelService; @Override public int deleteByPrimaryKey(Long id) { @@ -122,8 +129,8 @@ } @Override - public void saveObject(MultipartFile file, MultipartFile file2, GoodsSubClass record, Integer type, Long pid) - throws GoodsSubClassException, Exception { + public void saveObject(MultipartFile file, MultipartFile file2, GoodsSubClass record, Integer type, Long pid, + Long labelId) throws GoodsSubClassException, Exception { String name = record.getName(); if (name == null || name.trim().length() == 0) { @@ -188,6 +195,8 @@ record.setIosClick(0L); record.setCreatetime(new Date()); record.setUpdatetime(new Date()); + if (labelId != null) + record.setClassLabel(new GoodsSubClassLabel(labelId)); if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { // 鎼滅储鏉′欢:鏈夊埜銆佸湪鍞环20-200銆佺墰鐨櫍杞诲井 @@ -195,6 +204,13 @@ } goodsSubClassMapper.insert(record); + + if (labelId != null) { + GoodsSubClassLabelMap map = new GoodsSubClassLabelMap(); + map.setGoodsSubClass(record); + map.setLabel(new GoodsSubClassLabel(labelId)); + goodsSubClassLabelService.addSubClassLabelMap(map); + } } else { // 淇敼 @@ -205,7 +221,8 @@ if (picture != null && picture.trim().length() > 0) { // 鍒犻櫎鑰佸浘 - removePicture(resultObj.getPicture()); + if (!Constant.IS_TEST) + removePicture(resultObj.getPicture()); // 瀛樺偍鏂板浘 record.setPicture(picture); } else { @@ -214,7 +231,8 @@ if (pictureSecond != null && pictureSecond.trim().length() > 0) { // 鍒犻櫎鑰佸浘 - removePicture(resultObj.getPictureSecond()); + if (!Constant.IS_TEST) + removePicture(resultObj.getPictureSecond()); // 瀛樺偍鏂板浘 record.setPictureSecond(pictureSecond); } else { @@ -228,20 +246,31 @@ record.setAndroidClick(resultObj.getAndroidClick()); record.setCreatetime(resultObj.getCreatetime()); record.setUpdatetime(new Date()); + if (labelId != null) { + GoodsSubClassLabelMap map = new GoodsSubClassLabelMap(); + map.setGoodsSubClass(record); + map.setLabel(new GoodsSubClassLabel(labelId)); + try { + goodsSubClassLabelService.addSubClassLabelMap(map); + } catch (Exception e) { + } + } + goodsSubClassMapper.updateByPrimaryKey(record); } // 淇濆瓨娣樺疂鍟嗗搧鍒嗙被id String taobaoCids = record.getTaobaoCids(); + List<Long> tbCidList = new ArrayList<>(); if (!StringUtil.isNullOrEmpty(taobaoCids) && !"null".equalsIgnoreCase(taobaoCids)) { - List<Long> tbCidList = new ArrayList<>(); + String[] sts = taobaoCids.split(","); for (String st : sts) { String cid = st.split("-")[st.split("-").length - 1]; tbCidList.add(Long.parseLong(cid)); } - taoBaoClassService.saveSub(record.getId(), tbCidList); } + taoBaoClassService.saveSub(record.getId(), tbCidList); } /** -- Gitblit v1.8.0