|
|
@@ -1398,6 +1398,52 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
return fsStoreProductMapper.getProductNoticeInfo(storeId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R copyProduct(FsStoreProductScrm product) {
|
|
|
+ //获取复制商品信息
|
|
|
+ FsStoreProductScrm copyProductInfo = fsStoreProductMapper.selectFsStoreProductById(product.getProductId());
|
|
|
+ if(copyProductInfo==null){
|
|
|
+ return R.error("复制,商品数据不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ copyProductInfo.setProductId(null);
|
|
|
+ copyProductInfo.setCreateTime(new Date());
|
|
|
+ copyProductInfo.setUpdateTime(new Date());
|
|
|
+ copyProductInfo.setIsAudit("0");
|
|
|
+
|
|
|
+ //插入复制商品
|
|
|
+ if(fsStoreProductMapper.insertFsStoreProduct(copyProductInfo) < 1){
|
|
|
+ return R.error("操作失败,复制信息异常!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long productId = copyProductInfo.getProductId();
|
|
|
+ //获取项目属性
|
|
|
+ List<FsStoreProductAttrScrm> attrScrmList = fsStoreProductAttrMapper.selectFsStoreProductAttrByProductId(product.getProductId());
|
|
|
+ if(!attrScrmList.isEmpty()){
|
|
|
+ attrScrmList.stream().forEach(a->{
|
|
|
+ a.setId(null);
|
|
|
+ a.setProductId(productId);
|
|
|
+ fsStoreProductAttrMapper.insertFsStoreProductAttr(a);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取对应的属性信息
|
|
|
+ List<FsStoreProductAttrValueScrm> attrValueScrmList = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(product.getProductId());
|
|
|
+ if(!attrValueScrmList.isEmpty()){
|
|
|
+ attrValueScrmList.stream().forEach(a->{
|
|
|
+ a.setId(null);
|
|
|
+ a.setProductId(productId);
|
|
|
+ a.setCreateTime(new Date());
|
|
|
+ a.setUpdateTime(new Date());
|
|
|
+ fsStoreProductAttrValueMapper.insertFsStoreProductAttrValue(a);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ storeAuditLogUtil.addOperLog(copyProductInfo.getProductId());
|
|
|
+ return R.ok().put("msg",new StringBuilder().append("一键复制商品/").append("商品名称:").append(product.getProductName()));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, String>> getStoreProductColumns() {
|
|
|
List<Map<String, String> > list = fsStoreProductMapper.getStoreProductColumns();
|