Browse Source

add /tagType/{code}

guozhaoshun 6 years ago
parent
commit
4f4b2067cd

+ 4 - 5
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/TagController.java

@@ -4,13 +4,12 @@ import cn.rankin.apiweb.assist.resolver.NeedUser;
 import cn.rankin.apiweb.service.tag.TagService;
 import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
-import cn.rankin.data.api.app.vo.DeviceUserVo;
-import cn.rankin.data.api.app.vo.ItemVo;
-import cn.rankin.data.api.app.vo.TagGroupVo;
-import cn.rankin.data.api.app.vo.TagTypeVo;
+import cn.rankin.data.api.app.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 @RestController
 public class TagController {
 
@@ -31,7 +30,7 @@ public class TagController {
     }
 
     @RequestMapping(value = "/tagType/{code}", method = RequestMethod.GET)
-    public APIResult<TagTypeVo> getTagType(@NeedUser DeviceUserVo user,@PathVariable("code") String code) {
+    public APIResult<List<TagVo>> getTagType(@NeedUser DeviceUserVo user,@PathVariable("code") String code) {
         String merchantId = user.getMerchantId();
         return tagService.findTagTypeByCode(code, merchantId);
     }

+ 4 - 1
rankin-api-web/src/main/java/cn/rankin/apiweb/service/tag/TagClient.java

@@ -3,6 +3,7 @@ package cn.rankin.apiweb.service.tag;
 import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.data.api.app.vo.ItemVo;
+import cn.rankin.data.api.app.vo.TagVo;
 import cn.rankin.data.api.product.entity.TagGroup;
 import cn.rankin.data.api.product.entity.TagType;
 import org.springframework.cloud.netflix.feign.FeignClient;
@@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 @FeignClient(name = "${service.product.name}")
 public interface TagClient {
 
@@ -18,7 +21,7 @@ public interface TagClient {
     APIResult<TagGroup> findTagGroupByCode(@PathVariable("code") String code, @RequestParam("merchantId") String merchantId);
 
     @RequestMapping(value = "/app/tagType/code/{code}", method = RequestMethod.GET)
-    APIResult<TagType> findTagTypeByCode(@PathVariable("code") String code, @RequestParam("merchantId") String merchantId);
+    APIResult<List<TagVo>> findTagTypeByCode(@PathVariable("code") String code, @RequestParam("merchantId") String merchantId);
 
     @RequestMapping(value = "/app/tag/item/{tagId}", method = RequestMethod.GET)
     APIResult<Page<ItemVo>> findPageByTagId(@PathVariable("tagId") String tagId, @RequestParam("merchantId") String merchantId,

+ 6 - 5
rankin-api-web/src/main/java/cn/rankin/apiweb/service/tag/TagService.java

@@ -6,11 +6,14 @@ import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.data.api.app.vo.ItemVo;
 import cn.rankin.data.api.app.vo.TagGroupVo;
 import cn.rankin.data.api.app.vo.TagTypeVo;
+import cn.rankin.data.api.app.vo.TagVo;
 import cn.rankin.data.api.product.entity.TagGroup;
 import cn.rankin.data.api.product.entity.TagType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 import static cn.rankin.apiweb.utils.DTOConverter.convert;
 
 @Service
@@ -29,14 +32,12 @@ public class TagService {
         return APIResult.ok(tagGroupVo);
     }
 
-    public APIResult<TagTypeVo> findTagTypeByCode(String code, String merchantId) {
-        APIResult<TagType> apiResult = tagClient.findTagTypeByCode(code,merchantId);
+    public APIResult<List<TagVo>> findTagTypeByCode(String code, String merchantId) {
+        APIResult<List<TagVo>> apiResult = tagClient.findTagTypeByCode(code,merchantId);
         if (!apiResult.getSuccess()) {
             return APIResult.error(new BaseCode(apiResult.getCode(), apiResult.getMessage()));
         }
-        TagType tagType = apiResult.getData();
-        TagTypeVo tagTypeVo = convert(tagType);
-        return APIResult.ok(tagTypeVo);
+        return apiResult;
     }
 
     public APIResult<Page<ItemVo>> findPageByTagId(String tagId, String merchantId, Integer pageNo, Integer pageSize) {

+ 4 - 4
rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/product/TagTypeController.java

@@ -48,15 +48,15 @@ public class TagTypeController {
         return tagTypeServiceInterface.delete(id);
     }
 
-/*
-    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+
+/*    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
     public APIResult<TagTypeVo> getTagType(@PathVariable("id") String id) {
         return tagTypeServiceInterface.getTagType(id);
     }*/
 
 /*    @RequestMapping(value = "/code/{typeCode}", method = RequestMethod.GET)
-    public APIResult<TagTypeVo> getTagTypeByCode(@PathVariable("typeCode") String typeCode) {
-        return tagTypeServiceInterface.getTagTypeByCode(typeCode);
+    public APIResult<List<TagVo>> getTagTypeByCode(@PathVariable("typeCode") String typeCode) {
+        return tagTypeServiceInterface.getTagTypeByCode(typeCode,"8d6c69748d064498a4265aa6e72a49cc");
     }*/
 
 

+ 3 - 1
rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/TagTypeServiceInterface.java

@@ -2,11 +2,13 @@ package cn.rankin.cmsweb.service.product;
 
 import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
+import cn.rankin.data.api.app.vo.TagVo;
 import cn.rankin.data.api.product.dto.TagTypeDTO;
 import cn.rankin.data.api.product.vo.TagTypeVo;
 import org.springframework.cloud.netflix.feign.FeignClient;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Map;
 
 @FeignClient(name = "${service.product.name}")
@@ -28,5 +30,5 @@ public interface TagTypeServiceInterface {
     APIResult<TagTypeVo> getTagType(@PathVariable("id") String id);
 
     @RequestMapping(value = "/tagType/code/{typeCode}", method = RequestMethod.GET)
-    APIResult<TagTypeVo> getTagTypeByCode(@PathVariable("typeCode") String typeCode);
+    APIResult<List<TagVo>> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId);
 }

+ 2 - 3
rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/AppTagController.java

@@ -45,7 +45,7 @@ public class AppTagController {
 
 
     @RequestMapping(value = "/tagType/code/{typeCode}", method = RequestMethod.GET)
-    public APIResult<TagType> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
+    public APIResult<List<Tag>> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
         TagType tagType = tagTypeService.getTagTypeByCode(typeCode);
 
         if (tagType == null) {
@@ -63,9 +63,8 @@ public class AppTagController {
                 tag.setRecs(itemVoList);
 
             });
-            tagType.setTagList(tagList);
 
-            return APIResult.ok(tagType);
+            return APIResult.ok(tagList);
         }
 
     }

+ 2 - 6
rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagTypeController.java

@@ -5,14 +5,12 @@ import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.common.utils.dto.search.TagTypeSearchDTO;
 import cn.rankin.common.utils.enums.BaseOrderEnum;
-import cn.rankin.data.api.app.vo.ItemVo;
 import cn.rankin.data.api.product.dto.TagTypeDTO;
 import cn.rankin.data.api.product.entity.Tag;
 import cn.rankin.data.api.product.entity.TagType;
 import cn.rankin.productservice.code.ProductServiceAPICode;
 import cn.rankin.productservice.service.TagService;
 import cn.rankin.productservice.service.TagTypeService;
-import cn.rankin.productservice.service.app.ItemService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -110,9 +108,8 @@ public class TagTypeController {
     }
 
 /*    @RequestMapping(value = "/code/{typeCode}", method = RequestMethod.GET)
-    public APIResult<TagType> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
+    public APIResult<List<Tag>> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
         TagType tagType = tagTypeService.getTagTypeByCode(typeCode);
-
         if (tagType == null) {
             return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
         }else{
@@ -129,9 +126,8 @@ public class TagTypeController {
                 tag.setRecs(itemVoList);
 
             });
-            tagType.setTagList(tagList);
 
-            return APIResult.ok(tagType);
+            return APIResult.ok(tagList);
         }
 
     }*/