From 4114e871bcb3dce771b6aed64a1027d0bbb95ca6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 16 五月 2019 15:28:37 +0800 Subject: [PATCH] 增加动态用户 --- fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java index a8edbcb..8719c02 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java @@ -19,6 +19,7 @@ import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.db.MongoDBManager; import com.yeshi.fanli.util.taobao.TaoBaoShopUtil; +import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.vo.brand.TaoBaoShopVO; @Service @@ -26,7 +27,7 @@ @Resource private MongoDBManager mongoDBManager; - + @Resource private TaoBaoShopMapper taoBaoShopMapper; @@ -55,32 +56,29 @@ LogHelper.test("鑾峰彇搴楅摵淇℃伅鑰楁椂:" + (System.currentTimeMillis() - startTime)); return shopInfo; } - - + @Override public TaoBaoShop selectByPrimaryKey(Long id) { return taoBaoShopMapper.selectByPrimaryKey(id); } - @Override public int insertSelective(TaoBaoShop record) { return taoBaoShopMapper.insertSelective(record); } - @Override public int updateByPrimaryKeySelective(TaoBaoShop record) { return taoBaoShopMapper.updateByPrimaryKeySelective(record); } - + @Override public void changeInfo(MultipartFile file, Long id, String shopName) { TaoBaoShop taoBaoShop = taoBaoShopMapper.selectByPrimaryKey(id); if (taoBaoShop == null) { return; } - + String fileLink = null; if (file != null) { try { @@ -89,61 +87,67 @@ e.printStackTrace(); } } - + TaoBaoShop updateShop = new TaoBaoShop(); if (!StringUtil.isNullOrEmpty(fileLink)) { updateShop.setShopIconCustom(fileLink); - + // 鍒犻櫎鍥剧墖 String shopIconCustom = taoBaoShop.getShopIconCustom(); if (!StringUtil.isNullOrEmpty(shopIconCustom)) { COSManager.getInstance().deleteFile(shopIconCustom); } } - - + if (StringUtil.isNullOrEmpty(shopName) || "null".equalsIgnoreCase(shopName)) { shopName = null; } - + updateShop.setId(id); updateShop.setShopNameCustom(shopName); taoBaoShopMapper.updateByPrimaryKeySelective(updateShop); } - - + /** * 涓婁紶鍥剧墖 + * * @param file * @return * @throws Exception */ public String uploadPicture(MultipartFile file) throws Exception { - // 鏂囦欢瑙f瀽 + // 鏂囦欢瑙f瀽 InputStream inputStream = file.getInputStream(); String contentType = file.getContentType(); String type = contentType.substring(contentType.indexOf("/") + 1); - + // 鏂囦欢璺緞 - String filePath="/img/TaoBaoShop/"+UUID.randomUUID().toString().replace("-", "") + "." + type; + String filePath = "/img/TaoBaoShop/" + UUID.randomUUID().toString().replace("-", "") + "." + type; // 鎵ц涓婁紶 - String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); - + String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); + return fileLink; } - @Override public List<TaoBaoShopVO> listBrandShopinfo(long start, int count, Long cid) { return taoBaoShopMapper.listBrandShopinfo(start, count, cid); } - @Override public long countBrandShopinfo(Long cid) { return taoBaoShopMapper.countBrandShopinfo(cid); } - + @Override + public TaoBaoShop getTaoBaoShop(Long auctionId, Long sellerId) { + TaoBaoShop shop = taoBaoShopMapper.selectByPrimaryKey(sellerId); + if (shop != null) + return shop; + shop = TaoBaoUtil.getTaoBaoShopDetailByAuctionId(auctionId); + if (shop != null) + taoBaoShopMapper.insert(shop); + return shop; + } } -- Gitblit v1.8.0