|
@@ -15,6 +15,7 @@ import com.caimei365.user.service.ShopService;
|
|
import com.caimei365.user.utils.DateUtil;
|
|
import com.caimei365.user.utils.DateUtil;
|
|
import com.caimei365.user.utils.GenerateUtils;
|
|
import com.caimei365.user.utils.GenerateUtils;
|
|
import com.caimei365.user.utils.ImageUtils;
|
|
import com.caimei365.user.utils.ImageUtils;
|
|
|
|
+import com.caimei365.user.utils.OssUtil;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -583,11 +584,12 @@ public class ShopServiceImpl implements ShopService {
|
|
baikeProductMapper.updateBaikeProduct(baikeProductPo);
|
|
baikeProductMapper.updateBaikeProduct(baikeProductPo);
|
|
}
|
|
}
|
|
Integer productId = baikeProductPo.getProductId();
|
|
Integer productId = baikeProductPo.getProductId();
|
|
- // 删除原先的图片/参数/问题数据
|
|
|
|
|
|
+ // 删除原先的图片/参数/问题/视频文件数据
|
|
if (!newProductFlag) {
|
|
if (!newProductFlag) {
|
|
baikeProductMapper.deleteParamsByProductId(productId);
|
|
baikeProductMapper.deleteParamsByProductId(productId);
|
|
baikeProductMapper.deleteImagesByProductId(productId);
|
|
baikeProductMapper.deleteImagesByProductId(productId);
|
|
baikeProductMapper.deleteQuestionsByProductId(productId);
|
|
baikeProductMapper.deleteQuestionsByProductId(productId);
|
|
|
|
+ baikeProductMapper.deleteFilesByProductId(productId);
|
|
}
|
|
}
|
|
// 保存参数
|
|
// 保存参数
|
|
JSONArray paramArray = JSONArray.parseArray(baikeProductDto.getParamList());
|
|
JSONArray paramArray = JSONArray.parseArray(baikeProductDto.getParamList());
|
|
@@ -609,7 +611,7 @@ public class ShopServiceImpl implements ShopService {
|
|
// 保存展示图片
|
|
// 保存展示图片
|
|
List<String> displayImageList = baikeProductDto.getDisplayImageList();
|
|
List<String> displayImageList = baikeProductDto.getDisplayImageList();
|
|
if (null != displayImageList) {
|
|
if (null != displayImageList) {
|
|
- displayImageList.forEach(diplayImage-> baikeProductMapper.insertProductImage(diplayImage, productId, 2));
|
|
|
|
|
|
+ displayImageList.forEach(displayImage-> baikeProductMapper.insertProductImage(displayImage, productId, 2));
|
|
}
|
|
}
|
|
// 保存问题
|
|
// 保存问题
|
|
JSONArray questionArray = JSONArray.parseArray(baikeProductDto.getQuestionList());
|
|
JSONArray questionArray = JSONArray.parseArray(baikeProductDto.getQuestionList());
|
|
@@ -623,6 +625,19 @@ public class ShopServiceImpl implements ShopService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ // 保存视频文件
|
|
|
|
+ JSONArray videoArray = JSONArray.parseArray(baikeProductDto.getVideoList());
|
|
|
|
+ if (null != videoArray) {
|
|
|
|
+ videoArray.forEach(videoObject->{
|
|
|
|
+ Map<String,String> videoMap = (Map<String,String>) videoObject;
|
|
|
|
+ String fileTitle = videoMap.get("fileTitle");
|
|
|
|
+ String fileName = videoMap.get("fileName");
|
|
|
|
+ String ossName = videoMap.get("ossName");
|
|
|
|
+ if (StringUtils.isNotEmpty(ossName)) {
|
|
|
|
+ baikeProductMapper.insertProductFile(fileTitle, fileName, ossName, productId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return ResponseJson.success(null);
|
|
return ResponseJson.success(null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -648,6 +663,10 @@ public class ShopServiceImpl implements ShopService {
|
|
// 问题列表
|
|
// 问题列表
|
|
List<BaikeProductQuestionPo> questionList = baikeProductMapper.getQuestionList(productId);
|
|
List<BaikeProductQuestionPo> questionList = baikeProductMapper.getQuestionList(productId);
|
|
baikeProduct.setQuestionList(questionList);
|
|
baikeProduct.setQuestionList(questionList);
|
|
|
|
+ // 视频列表
|
|
|
|
+ List<BaikeProductFilePo> videoList = baikeProductMapper.getVideoList(productId);
|
|
|
|
+ videoList.forEach(video -> video.setFileUrl(OssUtil.getOssUrl(video.getOssName())));
|
|
|
|
+ baikeProduct.setVideoList(videoList);
|
|
return ResponseJson.success(baikeProduct);
|
|
return ResponseJson.success(baikeProduct);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -686,4 +705,76 @@ public class ShopServiceImpl implements ShopService {
|
|
return ResponseJson.success(null);
|
|
return ResponseJson.success(null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<String> getSensitiveWords(Integer checkPoint) {
|
|
|
|
+ String sensitiveWords = baseMapper.getSensitiveWords(checkPoint);
|
|
|
|
+ return ResponseJson.success(sensitiveWords);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Map<String, Object>> getBaikeRecommendForm(Integer productId) {
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
+ BaikeProductFormVo baikeProduct = baikeProductMapper.getBaikeProductById(productId);
|
|
|
|
+ Integer productTypeId = baikeProduct.getTypeId();
|
|
|
|
+ Integer recommendType = baikeProduct.getRecommendType();
|
|
|
|
+ Integer shopId = baikeProduct.getShopId();
|
|
|
|
+ // 手动推荐列表
|
|
|
|
+ List<BaikeRecommendVo> manualRecommendList = baikeProductMapper.getManualRecommendList(productId);
|
|
|
|
+ // 自动推荐列表
|
|
|
|
+ List<BaikeRecommendVo> autoRecommendList = baikeProductMapper.getAutoRecommendList(shopId, productTypeId, productId);
|
|
|
|
+ autoRecommendList.forEach(authRecommend->{
|
|
|
|
+ authRecommend.setProductId(productId);
|
|
|
|
+ });
|
|
|
|
+ map.put("manualRecommendList", manualRecommendList);
|
|
|
|
+ map.put("autoRecommendList", autoRecommendList);
|
|
|
|
+ map.put("recommendType", recommendType);
|
|
|
|
+ return ResponseJson.success(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Void> saveRecommendType(BaikeProductDto baikeProductDto) {
|
|
|
|
+ baikeProductMapper.updateRecommendType(baikeProductDto.getProductId(), baikeProductDto.getRecommendType());
|
|
|
|
+ return ResponseJson.success(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<PageInfo<BaikeProductListVo>> getAddRecommendList(Integer productId, Integer typeId, String name, int pageNum, int pageSize) {
|
|
|
|
+ BaikeProductDto baikeProductDto = new BaikeProductDto();
|
|
|
|
+ baikeProductDto.setTypeId(typeId);
|
|
|
|
+ baikeProductDto.setName(name);
|
|
|
|
+ BaikeProductFormVo baikeProduct = baikeProductMapper.getBaikeProductById(productId);
|
|
|
|
+ baikeProductDto.setShopId(baikeProduct.getShopId());
|
|
|
|
+ // 已推荐产品id,以,隔开
|
|
|
|
+ String productIds = baikeProductMapper.getRecommendProductIds(productId);
|
|
|
|
+ productIds += "".equals(productIds) ? productId : "," + productId;
|
|
|
|
+ baikeProductDto.setProductIds(productIds);
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
+ List<BaikeProductListVo> addRecommendList = baikeProductMapper.getBaikeProductList(baikeProductDto);
|
|
|
|
+ PageInfo<BaikeProductListVo> pageInfo = new PageInfo<>(addRecommendList);
|
|
|
|
+ return ResponseJson.success(pageInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Void> addBaikeRecommend(BaikeProductDto baikeProduct) {
|
|
|
|
+ String baikeRecommendList = baikeProduct.getBaikeRecommendList();
|
|
|
|
+ List<BaikeRecommendVo> recommendList = JSONObject.parseArray(baikeRecommendList, BaikeRecommendVo.class);
|
|
|
|
+ recommendList.forEach(baikeRecommend -> {
|
|
|
|
+ baikeRecommend.setProductId(baikeProduct.getProductId());
|
|
|
|
+ baikeProductMapper.insertRecommend(baikeRecommend);
|
|
|
|
+ });
|
|
|
|
+ return ResponseJson.success(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Void> deleBaikeRecommend(Integer recommendId) {
|
|
|
|
+ baikeProductMapper.deleteBaikeRecommend(recommendId);
|
|
|
|
+ return ResponseJson.success(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Void> saveRecommendSort(BaikeRecommendVo baikeRecommend) {
|
|
|
|
+ baikeProductMapper.updateRecommendSort(baikeRecommend);
|
|
|
|
+ return ResponseJson.success(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|