|
@@ -3,6 +3,7 @@ package cn.rankin.cmsweb.controller.user;
|
|
import cn.rankin.cmsweb.assist.resolver.NeedUser;
|
|
import cn.rankin.cmsweb.assist.resolver.NeedUser;
|
|
import cn.rankin.cmsweb.entity.UserDetails;
|
|
import cn.rankin.cmsweb.entity.UserDetails;
|
|
import cn.rankin.cmsweb.service.product.MerchantProductService;
|
|
import cn.rankin.cmsweb.service.product.MerchantProductService;
|
|
|
|
+import cn.rankin.cmsweb.service.product.TagService;
|
|
import cn.rankin.cmsweb.service.user.UserTagProductRelationServiceInterface;
|
|
import cn.rankin.cmsweb.service.user.UserTagProductRelationServiceInterface;
|
|
import cn.rankin.cmsweb.service.user.UserTagServiceInterface;
|
|
import cn.rankin.cmsweb.service.user.UserTagServiceInterface;
|
|
import cn.rankin.common.utils.api.model.APICode;
|
|
import cn.rankin.common.utils.api.model.APICode;
|
|
@@ -10,6 +11,7 @@ import cn.rankin.common.utils.api.model.APIResult;
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
import cn.rankin.common.utils.util.BeanUtil;
|
|
import cn.rankin.common.utils.util.BeanUtil;
|
|
import cn.rankin.data.api.product.entity.MerchantProduct;
|
|
import cn.rankin.data.api.product.entity.MerchantProduct;
|
|
|
|
+import cn.rankin.data.api.product.vo.TagVo;
|
|
import cn.rankin.data.api.user.dto.UserTagDTO;
|
|
import cn.rankin.data.api.user.dto.UserTagDTO;
|
|
import cn.rankin.data.api.user.dto.UserTagSearchDTO;
|
|
import cn.rankin.data.api.user.dto.UserTagSearchDTO;
|
|
import cn.rankin.data.api.user.entity.UserTag;
|
|
import cn.rankin.data.api.user.entity.UserTag;
|
|
@@ -29,6 +31,9 @@ import java.util.List;
|
|
public class UserTagController {
|
|
public class UserTagController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private TagService tagService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private UserTagServiceInterface userTagService;
|
|
private UserTagServiceInterface userTagService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -114,4 +119,29 @@ public class UserTagController {
|
|
return APIResult.error(APICode.OPERATE_ERROR);
|
|
return APIResult.error(APICode.OPERATE_ERROR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/copy" , method = RequestMethod.GET)
|
|
|
|
+ public APIResult<UserTag> copyTag(@RequestParam("userTagId") String userTagId,@RequestParam("tagId") String tagId) {
|
|
|
|
+ TagVo tagVo = tagService.getTagInfo(tagId);
|
|
|
|
+ if(null == tagVo){
|
|
|
|
+ log.error("{copyTag} not found Tag by id, id={}", tagId);
|
|
|
|
+ return APIResult.error(APICode.NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+ List<MerchantProduct> productList = tagVo.getProductList();
|
|
|
|
+ List<String> productIdList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ productList.forEach(product -> productIdList.add(product.getPid()));
|
|
|
|
+
|
|
|
|
+ UserTagDTO dto =new UserTagDTO();
|
|
|
|
+ dto.setId(userTagId);
|
|
|
|
+ dto.setProductList(productIdList);
|
|
|
|
+
|
|
|
|
+ UserTag userTag = userTagService.update(dto);
|
|
|
|
+ if (userTag != null) {
|
|
|
|
+ log.error("{copyTag} update UserTag is error, id={}", dto.getId());
|
|
|
|
+ return APIResult.ok(userTag);
|
|
|
|
+ }else{
|
|
|
|
+ return APIResult.error(APICode.NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|