|
@@ -15,7 +15,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
@Slf4j
|
|
|
@RestController
|
|
@@ -43,8 +42,8 @@ public class TagController {
|
|
|
return tagService.findPageByTagId(tagId, merchantId, pageNo, pageSize);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/tagType/{code}", method = RequestMethod.GET)
|
|
|
- public APIResult<List<TagVo>> getTagType(@NeedUser DeviceUserVo user,@PathVariable("code") String code) {
|
|
|
+ @RequestMapping(value = "/tagType/v1/{code}", method = RequestMethod.GET)
|
|
|
+ public APIResult<List<TagVo>> getTags(@NeedUser DeviceUserVo user,@PathVariable("code") String code) {
|
|
|
List<TagVo> result = new ArrayList<>();
|
|
|
|
|
|
//先去取用户标签,没有用户标签再使用渠道标签
|
|
@@ -75,7 +74,38 @@ public class TagController {
|
|
|
}
|
|
|
|
|
|
//没有用户标签数据,使用渠道标签数据
|
|
|
- return tagService.findTagTypeByCode(code, merchantId);
|
|
|
+ return tagService.findTagByTypeCode(code, merchantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/tagType/{code}", method = RequestMethod.GET)
|
|
|
+ public APIResult<TagTypeVo> getTagTypeByCode(@NeedUser DeviceUserVo user,@PathVariable("code") String code) {
|
|
|
+ TagTypeVo tagTypeVo = tagService.findTagTypeByCode(code);
|
|
|
+
|
|
|
+ //先去取用户标签,没有用户标签再使用渠道标签
|
|
|
+ String uid = user.getUid();
|
|
|
+ String merchantId = user.getMerchantId();
|
|
|
+
|
|
|
+ //用户标签列表
|
|
|
+ List<UserTag> userTagList = userService.findUserTagByCodeUid(code,uid);
|
|
|
+ if(null != userTagList && userTagList.size() > 0){
|
|
|
+ List<TagVo> tagVos = new ArrayList<>();
|
|
|
+ log.info("get userTag By code and uid, size={}", userTagList.size());
|
|
|
+ //组装数据 用户标签
|
|
|
+ userTagList.forEach(userTag -> {
|
|
|
+ TagVo vo = new TagVo();
|
|
|
+ vo.setId(userTag.getId());
|
|
|
+ vo.setName(userTag.getName());
|
|
|
+ tagVos.add(vo);
|
|
|
+ });
|
|
|
+ tagTypeVo.setList(tagVos);
|
|
|
+ }else{
|
|
|
+ //没有用户标签数据,使用渠道标签数据
|
|
|
+ List<TagVo> tagVos = tagService.findTagByTypeCodeMerchant(code, merchantId);
|
|
|
+ tagTypeVo.setList(tagVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ return APIResult.ok(tagTypeVo);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|