| | |
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.GoodsClassMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | 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.StringUtil;
|
| | |
|
| | |
| | | @Resource
|
| | | private LabelClassService labelClassService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | | |
| | |
|
| | | public GoodsClass getGoodsClass(long id) {
|
| | | return goodsClassMapper.selectByPrimaryKey(id);
|
| | |
| | | // 标签
|
| | | int countlabel = labelClassService.getCountQueryByClassId(gclass.getId());
|
| | | gclass.setCountlabel(countlabel);
|
| | | |
| | | |
| | | List<TaoBaoClass> listTB = taoBaoClassService.listBySystemCid(0, Integer.MAX_VALUE, gclass.getId());
|
| | | if (listTB == null || listTB.size() == 0) {
|
| | | gclass.setTaobaoCids("");
|
| | | } else {
|
| | | String taobaoCids = ""; |
| | | for (TaoBaoClass taoBaoClass: listTB) {
|
| | | taobaoCids = taobaoCids + taoBaoClass.getCategoryName() + "-" + taoBaoClass.getCategoryId() + ",";
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(taobaoCids)){
|
| | | taobaoCids = taobaoCids.substring(0, taobaoCids.length()-1);
|
| | | } |
| | | gclass.setTaobaoCids(taobaoCids);
|
| | | }
|
| | | |
| | | }
|
| | | return list;
|
| | | }
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception{
|
| | |
|
| | | String name = record.getName();
|
| | |
| | | } else if (!StringUtil.isJson(params)) {
|
| | | throw new GoodsClassException(1, "筛选条件非JSON格式");
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | Long id = record.getId();
|
| | |
| | | record.setAndroidClick(resultObj.getAndroidClick());
|
| | | record.setCreatetime(resultObj.getCreatetime());
|
| | | goodsClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | |
| | | // 保存淘宝商品分类id
|
| | | String taobaoCids = record.getTaobaoCids();
|
| | | if (!StringUtil.isNullOrEmpty(taobaoCids) && !"null".equalsIgnoreCase(taobaoCids)) {
|
| | | taoBaoClassService.save(record.getId(), taobaoCids);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | @Cacheable(value="classCache",key="'getClassListAllCache'")
|
| | | public List<Map<String, Object>> getClassListAllCache() throws Exception {
|
| | | @Cacheable(value="classCache",key="'getClassListAllCache'+#changePicture")
|
| | | public List<Map<String, Object>> getClassListAllCache(boolean changePicture) throws Exception {
|
| | |
|
| | | List<GoodsClass> goodsClassList = goodsClassMapper.getEffectiveClass();
|
| | | if (goodsClassList == null || goodsClassList.size() == 0) {
|
| | |
| | | GoodsSubClass goodsSubClass = iterator.next();
|
| | | GoodsClass goodsClassInner = goodsSubClass.getRootClass();
|
| | | if (goodsClass.getId() == goodsClassInner.getId()) {
|
| | | |
| | | // 1.5.3新版图片替换
|
| | | if (changePicture) {
|
| | | String pictureSecond = goodsSubClass.getPictureSecond();
|
| | | if (pictureSecond != null && pictureSecond.trim().length() > 0) {
|
| | | goodsSubClass.setPicture(pictureSecond);
|
| | | }
|
| | | }
|
| | | |
| | | // 对应下子分类
|
| | | subClassList.add(goodsSubClass);
|
| | | iterator.remove();
|
| | | }
|
| | | |
| | | |
| | | }
|
| | | }
|
| | |
|