소스 검색

test commit

guozhaoshun 6 년 전
부모
커밋
967949bded
53개의 변경된 파일1113개의 추가작업 그리고 29개의 파일을 삭제
  1. 19 0
      rankin-api-web/pom.xml
  2. 1 0
      rankin-api-web/src/main/java/cn/rankin/apiweb/assist/resolver/RequestHeaderResolver.java
  3. 7 0
      rankin-api-web/src/main/java/cn/rankin/apiweb/controller/TagController.java
  4. 3 2
      rankin-api-web/src/main/resources/bootstrap.yml
  5. 11 0
      rankin-api-web/src/main/resources/bootstrap_online.yml
  6. 6 0
      rankin-cms-web/pom.xml
  7. 62 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/product/TagTypeController.java
  8. 1 2
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/security/JwtAuthenticationTokenFilter.java
  9. 20 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/security/JwtTokenService.java
  10. 32 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/TagTypeServiceInterface.java
  11. 3 2
      rankin-cms-web/src/main/resources/bootstrap.yml
  12. 19 0
      rankin-cms-web/src/main/resources/bootstrap_online.yml
  13. 24 0
      rankin-common-utils/src/main/java/cn/rankin/common/utils/dto/search/TagTypeSearchDTO.java
  14. 4 2
      rankin-config-service/src/main/resources/bootstrap.yml
  15. 13 0
      rankin-config-service/src/main/resources/bootstrap_bak.yml
  16. 16 0
      rankin-data-api/src/main/java/cn/rankin/data/api/app/vo/TagTypeVo.java
  17. 25 0
      rankin-data-api/src/main/java/cn/rankin/data/api/product/dto/TagTypeDTO.java
  18. 10 0
      rankin-data-api/src/main/java/cn/rankin/data/api/product/entity/Tag.java
  19. 48 0
      rankin-data-api/src/main/java/cn/rankin/data/api/product/entity/TagType.java
  20. 29 0
      rankin-data-api/src/main/java/cn/rankin/data/api/product/vo/TagTypeVo.java
  21. 5 0
      rankin-data-api/src/main/java/cn/rankin/data/api/product/vo/TagVo.java
  22. 2 1
      rankin-eureka-service/src/main/resources/bootstrap.yml
  23. 13 0
      rankin-eureka-service/src/main/resources/bootstrap_online.yml
  24. 10 0
      rankin-product-service/pom.xml
  25. 11 1
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/AppGoodsController.java
  26. 18 0
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/AppLessonController.java
  27. 10 1
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/MerchantProductController.java
  28. 14 1
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/ProductController.java
  29. 1 0
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagController.java
  30. 109 0
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagTypeController.java
  31. 8 0
      rankin-product-service/src/main/java/cn/rankin/productservice/repository/TagRepository.java
  32. 20 0
      rankin-product-service/src/main/java/cn/rankin/productservice/repository/TagTypeRepository.java
  33. 16 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/CourseService.java
  34. 5 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/GoodsService.java
  35. 49 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/MerchantProductService.java
  36. 12 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/PackageService.java
  37. 46 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/ProductService.java
  38. 12 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/SupportService.java
  39. 36 4
      rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java
  40. 132 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/TagTypeService.java
  41. 83 1
      rankin-product-service/src/main/java/cn/rankin/productservice/service/app/AppGoodsService.java
  42. 41 1
      rankin-product-service/src/main/java/cn/rankin/productservice/service/app/AppLessonService.java
  43. 10 0
      rankin-product-service/src/main/java/cn/rankin/productservice/utils/DTOConverter.java
  44. 4 3
      rankin-product-service/src/main/resources/bootstrap.yml
  45. 21 0
      rankin-product-service/src/main/resources/bootstrap_bak.yml
  46. 3 2
      rankin-resource-service/src/main/resources/bootstrap.yml
  47. 11 0
      rankin-resource-service/src/main/resources/bootstrap_online.yml
  48. 3 2
      rankin-task/src/main/resources/bootstrap.yml
  49. 21 0
      rankin-task/src/main/resources/bootstrap_online.yml
  50. 3 2
      rankin-trade-service/src/main/resources/bootstrap.yml
  51. 11 0
      rankin-trade-service/src/main/resources/bootstrap_online.yml
  52. 3 2
      rankin-user-service/src/main/resources/bootstrap.yml
  53. 17 0
      rankin-user-service/src/main/resources/bootstrap_online.yml

+ 19 - 0
rankin-api-web/pom.xml

@@ -96,6 +96,25 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.6.0</version>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>org.mapstruct</groupId>
+                            <artifactId>mapstruct-processor</artifactId>
+                            <version>${mapstruct.version}</version>
+                        </path>
+                        <path>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                            <version>1.14.8</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

+ 1 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/assist/resolver/RequestHeaderResolver.java

@@ -35,4 +35,5 @@ public class RequestHeaderResolver implements HandlerMethodArgumentResolver {
         }
         return null;
     }
+
 }

+ 7 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/TagController.java

@@ -28,4 +28,11 @@ public class TagController {
         String merchantId = user.getMerchantId();
         return tagService.findPageByTagId(tagId, merchantId, pageNo, pageSize);
     }
+
+    @RequestMapping(value = "/tagGroup/{code}", method = RequestMethod.GET)
+    public APIResult<TagGroupVo> getTagType(@NeedUser DeviceUserVo user, @PathVariable("code") String code) {
+        String merchantId = user.getMerchantId();
+        return tagService.findTagGroupByCode(code, merchantId);
+    }
+
 }

+ 3 - 2
rankin-api-web/src/main/resources/bootstrap.yml

@@ -3,9 +3,10 @@ spring:
     name: api-web
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 server:
   port: 8600

+ 11 - 0
rankin-api-web/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,11 @@
+spring:
+  application:
+    name: api-web
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+server:
+  port: 8600

+ 6 - 0
rankin-cms-web/pom.xml

@@ -93,6 +93,12 @@
             <artifactId>feign-httpclient</artifactId>
             <version>RELEASE</version>
         </dependency>
+        <dependency>
+            <groupId>cn.rankin</groupId>
+            <artifactId>rankin-product-service</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 	<dependencyManagement>

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

@@ -0,0 +1,62 @@
+package cn.rankin.cmsweb.controller.product;
+
+import cn.rankin.cmsweb.assist.resolver.NeedUser;
+import cn.rankin.cmsweb.entity.UserDetails;
+import cn.rankin.cmsweb.service.product.TagTypeServiceInterface;
+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.util.BeanUtil;
+
+import cn.rankin.data.api.product.dto.TagTypeDTO;
+import cn.rankin.data.api.product.vo.TagTypeVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+@Slf4j
+@RestController
+@RequestMapping(value = "/tagType")
+public class TagTypeController {
+
+    @Autowired
+    private TagTypeServiceInterface tagTypeServiceInterface;
+
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public APIResult<Page<TagTypeVo>> search(@NeedUser UserDetails user, TagTypeSearchDTO searchDTO) {
+
+        return tagTypeServiceInterface.search(BeanUtil.convertToMap(searchDTO));
+    }
+
+    @RequestMapping(method = RequestMethod.POST)
+    public APIResult<TagTypeVo> create(@Valid @RequestBody TagTypeDTO tagTypeDTO) {
+
+        return tagTypeServiceInterface.create(tagTypeDTO);
+
+    }
+
+    @RequestMapping(method = RequestMethod.PUT)
+    public APIResult<TagTypeVo> update(@RequestBody TagTypeDTO tagTypeDTO) {
+        return tagTypeServiceInterface.update(tagTypeDTO);
+    }
+
+    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+    public APIResult<Boolean> delete(@PathVariable("id") String id) {
+
+        return tagTypeServiceInterface.delete(id);
+    }
+
+    @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);
+    }
+
+
+}

+ 1 - 2
rankin-cms-web/src/main/java/cn/rankin/cmsweb/security/JwtAuthenticationTokenFilter.java

@@ -50,7 +50,6 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
     protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
         startTimeThreadLocal.set(System.currentTimeMillis());//线程绑定变量(该数据只有当前请求的线程可见)
         logger.info("进入JwtAuthenticationTokenFilter开始 url={} method={}", request.getRequestURI(), request.getMethod());
-
         if (HttpMethod.OPTIONS.matches(request.getMethod()) || request.getRequestURL().indexOf("favicon.ico")!=-1) {
             logger.debug("OPTIONS 请求 忽略 返回200");
             response.setStatus(HttpStatus.OK.value());
@@ -97,7 +96,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
                 request.getSession().setAttribute("SPRING_SECURITY_CONTEXT_DETAILS",userDetails);
             }
             //验证 用户名和 token 的有效性
-            if (jwtTokenService.validateToken(authToken, userDetails)) {
+            if (jwtTokenService.validateToken(authToken, userDetails) ) {
                 //默认 cookie 一小时有效 但是我半小时 会更新一次 cookie 信息
                 if((System.currentTimeMillis()+expiration*1000/2)>jwtTokenService.getExpirationDateFromToken(authToken).getTime()){
                     authToken =  jwtTokenService.generateToken(userDetails.getUsername());

+ 20 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/security/JwtTokenService.java

@@ -107,4 +107,24 @@ public class JwtTokenService implements Serializable {
         final String username = getUsernameFromToken(token);
         return (username.equals(userDetails.getUsername())&& !isTokenExpired(token));
     }
+
+
+    public static void main(String[] args){
+        //String zhaoshunToken = new JwtTokenService().generateToken("zhaoshun");
+
+
+        Map<String, Object> claims = new HashMap<>();
+        claims.put(CLAIM_KEY_USERNAME, "zhaoshun");
+        claims.put(CLAIM_KEY_CREATED, new Date());
+        //String s = new JwtTokenService().generateToken(claims);
+
+
+        String compact = Jwts.builder()
+                .setClaims(claims)
+                .setExpiration(new Date(System.currentTimeMillis() + 604800 * 1000))
+                .signWith(SignatureAlgorithm.HS512, "ohq3TGwT")
+                .compact();
+        System.out.println(compact);
+
+    }
 }

+ 32 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/TagTypeServiceInterface.java

@@ -0,0 +1,32 @@
+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.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.Map;
+
+@FeignClient(name = "${service.product.name}")
+public interface TagTypeServiceInterface {
+
+    @RequestMapping(value = "/tagType/list", method = RequestMethod.GET)
+    APIResult<Page<TagTypeVo>> search(@RequestParam Map<String, Object> searchDTO);
+
+    @RequestMapping(value = "/tagType", method = RequestMethod.POST)
+    APIResult<TagTypeVo> create(@RequestBody TagTypeDTO tagTypeDTO);
+
+    @RequestMapping(value = "/tagType", method = RequestMethod.PUT)
+    APIResult<TagTypeVo> update(@RequestBody TagTypeDTO tagTypeDTO);
+
+    @RequestMapping(value = "/tagType/{id}", method = RequestMethod.DELETE)
+    APIResult<Boolean> delete(@PathVariable("id") String id);
+
+    @RequestMapping(value = "/tagType/{id}", method = RequestMethod.GET)
+    APIResult<TagTypeVo> getTagType(@PathVariable("id") String id);
+
+    @RequestMapping(value = "/tagType/code/{typeCode}", method = RequestMethod.GET)
+    APIResult<TagTypeVo> getTagTypeByCode(@PathVariable("typeCode") String typeCode);
+}

+ 3 - 2
rankin-cms-web/src/main/resources/bootstrap.yml

@@ -3,9 +3,10 @@ spring:
     name: cms-web
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 feign:
   httpclient:

+ 19 - 0
rankin-cms-web/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,19 @@
+spring:
+  application:
+    name: cms-web
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+feign:
+  httpclient:
+    enabled: true
+
+server:
+  port: 8500
+
+#logging:
+#  level:
+#    root: debug

+ 24 - 0
rankin-common-utils/src/main/java/cn/rankin/common/utils/dto/search/TagTypeSearchDTO.java

@@ -0,0 +1,24 @@
+package cn.rankin.common.utils.dto.search;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@ToString
+public class TagTypeSearchDTO implements Serializable {
+
+    private String code;
+
+    private String name;
+
+    private String sort;
+
+    private Integer by;
+
+    private Integer pageNo = 1;
+
+    private Integer pageSize = 10;
+
+}

+ 4 - 2
rankin-config-service/src/main/resources/bootstrap.yml

@@ -5,8 +5,10 @@ spring:
     config:
       server:
         git:
-          uri: http://gogs.efunbox.cn:3000/Rankin/setting.git
-          search-paths: dev, prod
+          uri: https://gitee.com/guozhaoshun/project-config.git
+#          uri: http://gogs.efunbox.cn:3000/Rankin/setting.git
+          search-paths: dev, prod, local
+#          search-paths: dev, prod
 
 server:
   port: 8921

+ 13 - 0
rankin-config-service/src/main/resources/bootstrap_bak.yml

@@ -0,0 +1,13 @@
+spring:
+  application:
+    name: config-service
+  cloud:
+    config:
+      server:
+        git:
+          uri: http://gogs.efunbox.cn:3000/Rankin/setting.git
+          search-paths: dev, prod
+
+server:
+  port: 8921
+

+ 16 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/app/vo/TagTypeVo.java

@@ -0,0 +1,16 @@
+package cn.rankin.data.api.app.vo;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@ToString
+public class TagTypeVo implements Serializable {
+
+    private String name;
+
+    private List<TagVo> list;
+}

+ 25 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/product/dto/TagTypeDTO.java

@@ -0,0 +1,25 @@
+package cn.rankin.data.api.product.dto;
+
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class TagTypeDTO implements Serializable {
+
+    private String id;
+
+    @NotNull
+    private String code;
+
+    private String name;
+
+    private Integer sort;
+
+    private List<String> tagList;
+
+    private BaseStatusEnum status;
+}

+ 10 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/product/entity/Tag.java

@@ -2,6 +2,7 @@ package cn.rankin.data.api.product.entity;
 
 import cn.rankin.common.utils.enums.BaseStatusEnum;
 import cn.rankin.common.utils.enums.TagTypeEnum;
+import cn.rankin.data.api.app.vo.ItemVo;
 import lombok.Data;
 import lombok.ToString;
 import org.hibernate.annotations.DynamicInsert;
@@ -30,6 +31,9 @@ public class Tag implements Serializable {
     @Column(name = "group_id", updatable = false, nullable = false)
     private String groupId;
 
+    @Column(name = "type_code", updatable = false, nullable = false)
+    private String typeCode;
+
     @Column
     private Integer sort;
 
@@ -52,6 +56,12 @@ public class Tag implements Serializable {
     private String groupName;
 
     @Transient
+    private String typeName;
+
+    @Transient
     private List<MerchantProduct> productList;
 
+    @Transient
+    private List<ItemVo> recs;
+
 }

+ 48 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/product/entity/TagType.java

@@ -0,0 +1,48 @@
+package cn.rankin.data.api.product.entity;
+
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import lombok.Data;
+import lombok.ToString;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ToString
+@Entity
+@Table(name = "p_tag_type", uniqueConstraints = {@UniqueConstraint(columnNames = {"code"})})
+@DynamicInsert
+@DynamicUpdate
+public class TagType implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column(unique = true, updatable = false)
+    private String code;
+
+    @Column(nullable = false)
+    private String name;
+
+    @Column
+    private Integer sort;
+
+    @Column
+    @Enumerated(EnumType.ORDINAL)
+    private BaseStatusEnum status;
+
+    @Column(name = "gmt_created", updatable = false, insertable = false, columnDefinition = "timestamp NULL DEFAULT CURRENT_TIMESTAMP")
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date gmtCreated;
+
+    @Column(name = "gmt_modified", updatable = false, insertable = false, columnDefinition = "timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date gmtModified;
+
+    @Transient
+    private List<Tag> tagList;
+}

+ 29 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/product/vo/TagTypeVo.java

@@ -0,0 +1,29 @@
+package cn.rankin.data.api.product.vo;
+
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import lombok.Data;
+import lombok.ToString;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ToString
+public class TagTypeVo {
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private Integer sort;
+
+    private BaseStatusEnum status;
+
+    private List<TagVo> tagList;
+
+    private Date gmtCreated;
+
+    private Date gmtModified;
+}

+ 5 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/product/vo/TagVo.java

@@ -2,6 +2,7 @@ package cn.rankin.data.api.product.vo;
 
 import cn.rankin.common.utils.enums.BaseStatusEnum;
 import cn.rankin.common.utils.enums.TagTypeEnum;
+import cn.rankin.data.api.app.vo.ItemVo;
 import cn.rankin.data.api.product.entity.MerchantProduct;
 import lombok.Data;
 
@@ -19,6 +20,8 @@ public class TagVo implements Serializable {
 
     private String code;
 
+    private String typeCode;
+
     private String name;
 
     private TagTypeEnum type;
@@ -32,4 +35,6 @@ public class TagVo implements Serializable {
     private BaseStatusEnum status;
 
     private List<MerchantProduct> productList;
+
+    private List<ItemVo> recs;
 }

+ 2 - 1
rankin-eureka-service/src/main/resources/bootstrap.yml

@@ -10,4 +10,5 @@ eureka:
     register-with-eureka: false
     fetch-registry: false
     service-url:
-      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
+      defaultZone: http://127.0.0.1:${server.port}/eureka/
+#      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

+ 13 - 0
rankin-eureka-service/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,13 @@
+server:
+  port: 8821
+
+eureka:
+  instance:
+    hostname: discovery.rankin.com
+  server:
+    enable-self-preservation: false
+  client:
+    register-with-eureka: false
+    fetch-registry: false
+    service-url:
+      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

+ 10 - 0
rankin-product-service/pom.xml

@@ -94,6 +94,14 @@
         <finalName>${project.name}</finalName>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
@@ -108,6 +116,8 @@
                 </executions>
             </plugin>
         </plugins>
+
+
     </build>
 
 </project>

+ 11 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/AppGoodsController.java

@@ -15,8 +15,18 @@ public class AppGoodsController {
     @Autowired
     private AppGoodsService goodsService;
 
-    @RequestMapping(method = RequestMethod.POST)
+/*    @RequestMapping(method = RequestMethod.POST)
     public APIResult<List<GoodsVo>> findByIds(@RequestBody List<String> goodsIdList, @RequestParam("merchantId") String merchantId) {
         return goodsService.findByIds(goodsIdList, merchantId);
+    }*/
+
+    /*   --- rewrite 2018-05-14--------------------------------------  start   */
+
+    @RequestMapping(method = RequestMethod.POST)
+    public APIResult<List<GoodsVo>> findByIds(@RequestBody List<String> goodsIdList, @RequestParam("merchantId") String merchantId) {
+        List<GoodsVo> goodsVoList = goodsService.findByIds(goodsIdList, merchantId);
+        return APIResult.ok(goodsVoList);
     }
+
+    /*   --- rewrite 2018-05-14--------------------------------------  end   */
 }

+ 18 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/AppLessonController.java

@@ -1,6 +1,8 @@
 package cn.rankin.productservice.controller.app;
 
 import cn.rankin.common.utils.api.model.APIResult;
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import cn.rankin.productservice.code.ProductServiceAPICode;
 import cn.rankin.data.api.product.entity.Lesson;
 import cn.rankin.productservice.service.app.AppLessonService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,8 +15,24 @@ public class AppLessonController {
     @Autowired
     private AppLessonService lessonService;
 
+    /*
     @RequestMapping(value = "/{lessonId}", method = RequestMethod.GET)
     public APIResult<Lesson> getLesson(@PathVariable("lessonId") String lessonId, @RequestParam("courseId") String coursId) {
         return lessonService.getLesson(lessonId, coursId);
     }
+
+    */
+
+
+    /*   --- rewrite 2018-05-14--------------------------------------  start   */
+    @RequestMapping(value = "/{lessonId}", method = RequestMethod.GET)
+    public APIResult<Lesson> getLesson(@PathVariable("lessonId") String lessonId, @RequestParam("courseId") String coursId) {
+        Lesson lesson = lessonService.getLesson(lessonId, coursId);
+        if (lesson == null || !BaseStatusEnum.NORMAL.equals(lesson.getStatus())) {
+            return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
+        }
+        return APIResult.ok(lesson);
+    }
+
+    /*   --- rewrite 2018-05-14--------------------------------------  end   */
 }

+ 10 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/MerchantProductController.java

@@ -86,8 +86,17 @@ public class MerchantProductController {
         return merchantProductService.mountTags(productId, merchantId, tagIdList);
     }
 
-    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    @RequestMapping(value = "/2/list", method = RequestMethod.POST)
     public APIResult<List<MerchantProduct>> getList(@RequestBody List<String> productIdList, @RequestParam("merchantId") String merchantId) {
         return merchantProductService.findByPidList(productIdList, merchantId);
     }
+
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    public APIResult<List<MerchantProduct>> getList2(@RequestBody List<String> productIdList, @RequestParam("merchantId") String merchantId) {
+        List<MerchantProduct> merchantProductList = merchantProductService.findByPidList2(productIdList, merchantId);
+        return APIResult.ok(merchantProductList);
+    }
+
+
+
 }

+ 14 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/ProductController.java

@@ -6,6 +6,7 @@ import cn.rankin.common.utils.enums.BaseOrderEnum;
 import cn.rankin.data.api.product.dto.*;
 import cn.rankin.data.api.product.entity.*;
 import cn.rankin.data.api.product.entity.Package;
+import cn.rankin.productservice.code.ProductServiceAPICode;
 import cn.rankin.productservice.service.ProductService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping(value = "/product")
@@ -44,11 +46,22 @@ public class ProductController {
         return pageAPIResult;
     }
 
-    @RequestMapping(value = "/{productId}", method = RequestMethod.GET)
+    @RequestMapping(value = "/2/{productId}", method = RequestMethod.GET)
     public APIResult getProduct(@PathVariable("productId") String productId) {
         return productService.get(productId);
     }
 
+    @RequestMapping(value = "/{productId}", method = RequestMethod.GET)
+    public APIResult getProduct2(@PathVariable("productId") String productId) {
+        Map<String, Object> product = productService.getProduct(productId);
+        if(null == product){
+            return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
+        }else{
+            return APIResult.ok(product);
+        }
+
+    }
+
     @RequestMapping(value = "/course", method = RequestMethod.PUT)
     public APIResult updateCourse(@RequestBody CourseDTO courseDTO) {
         return productService.update(courseDTO);

+ 1 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagController.java

@@ -23,6 +23,7 @@ public class TagController {
 
     @RequestMapping(value = "/{tagId}", method = RequestMethod.GET)
     public APIResult<Tag> getTag(@PathVariable("tagId") String tagId) {
+
         return tagService.getTag(tagId);
     }
 

+ 109 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagTypeController.java

@@ -0,0 +1,109 @@
+package cn.rankin.productservice.controller.cms;
+
+import cn.rankin.common.utils.api.model.APICode;
+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.product.dto.TagTypeDTO;
+import cn.rankin.data.api.product.entity.TagType;
+import cn.rankin.productservice.code.ProductServiceAPICode;
+import cn.rankin.productservice.service.TagTypeService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.LinkedHashMap;
+
+@RestController
+@RequestMapping(value = "tagType")
+public class TagTypeController {
+
+    @Autowired
+    private TagTypeService tagTypeService;
+
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public APIResult<Page<TagType>> search(TagTypeSearchDTO searchDTO) {
+        TagType tagType = new TagType();
+
+        String code = searchDTO.getCode();
+        if (!StringUtils.isEmpty(code)) {
+            tagType.setCode("%" + code + "%");
+        }
+
+        String name = searchDTO.getName();
+        if (!StringUtils.isEmpty(name)) {
+            tagType.setName("%" + name + "%");
+        }
+
+//        // others
+//        tagType.setMerchantId(searchDTO.getMerchantId());
+
+        // sort
+        LinkedHashMap<String, BaseOrderEnum> sort = new LinkedHashMap<>();
+        sort.put("gmtModified", BaseOrderEnum.DESC);
+
+        Page<TagType> pageResult = tagTypeService.search(tagType, searchDTO.getPageNo(), searchDTO.getPageSize(), sort);
+
+
+        return APIResult.ok(pageResult);
+    }
+
+    @Transactional
+    @RequestMapping(method = RequestMethod.POST)
+    public APIResult<TagType> create(@Valid @RequestBody TagTypeDTO tagTypeDTO) {
+        TagType tagType = tagTypeService.create(tagTypeDTO);
+        if(tagType == null){
+            return APIResult.error(APICode.ALREADY_EXISTS);
+        }else{
+            return APIResult.ok(tagType);
+        }
+
+    }
+
+    @RequestMapping(method = RequestMethod.PUT)
+    public APIResult<TagType> update(@RequestBody TagTypeDTO tagTypeDTO) {
+
+        TagType tagType = tagTypeService.update(tagTypeDTO);
+        return APIResult.ok(tagType);
+
+    }
+
+    @RequestMapping(value = "/{tagTypeId}", method = RequestMethod.DELETE)
+    public APIResult<Boolean> delete(@PathVariable("tagTypeId") String tagTypeId) {
+
+        Boolean flag = tagTypeService.delete(tagTypeId);
+        if(flag){
+            return APIResult.ok();
+        }else{
+            return APIResult.error(ProductServiceAPICode.error("删除失败"));
+        }
+
+    }
+
+    @RequestMapping(value = "/{tagTypeId}", method = RequestMethod.GET)
+    public APIResult<TagType> getTagType(@PathVariable("tagTypeId") String tagTypeId) {
+        TagType tagType = tagTypeService.getTagType(tagTypeId);
+
+        if (tagType == null) {
+            return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
+        }else{
+            return APIResult.ok(tagType);
+        }
+
+    }
+
+    @RequestMapping(value = "/code/{typeCode}", method = RequestMethod.GET)
+    public APIResult<TagType> getTagTypeByCode(@PathVariable("typeCode") String typeCode) {
+        TagType tagType = tagTypeService.getTagTypeByCode(typeCode);
+
+        if (tagType == null) {
+            return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
+        }else{
+            return APIResult.ok(tagType);
+        }
+
+    }
+}

+ 8 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/repository/TagRepository.java

@@ -13,6 +13,14 @@ public interface TagRepository extends BasicJpaRepository<Tag, String> {
     @Query(value = "select t from Tag t where t.groupId = ?1 order by t.sort")
     List<Tag> findByGroupId(String groupId);
 
+    /*  add   */
+    @Query(value = "select t from Tag t where t.groupId = ?1 order by t.sort")
+    List<Tag> findByTagTypeId(String tagTypeId);
+
+
+    @Query(value = "select t from Tag t where t.typeCode = ?1 order by t.sort")
+    List<Tag> findByTypeCode(String typeCode);
+
     @Query(value = "select t from Tag t where t.id in (?1) and t.status = ?2")
     List<Tag> findByIds(List<String> tagIdList, BaseStatusEnum status);
 

+ 20 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/repository/TagTypeRepository.java

@@ -0,0 +1,20 @@
+package cn.rankin.productservice.repository;
+
+import cn.rankin.common.utils.jpa.BasicJpaRepository;
+import cn.rankin.data.api.product.entity.TagType;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+
+public interface TagTypeRepository extends BasicJpaRepository<TagType, String> {
+
+    Long countByCode(String code);
+
+    @Query(value = "select t from TagType t where t.code = ?1 ")
+    TagType findFirstByCode(String code);
+
+    @Modifying
+    @Query(value = "update TagType t set t.status = 1 where t.id = :id")
+    Integer deleteById(@Param("id") String id);
+}

+ 16 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/CourseService.java

@@ -63,6 +63,22 @@ public class CourseService {
         return APIResult.ok(course);
     }
 
+    public Course getCourse2(String courseId) {
+        Course course = courseRepository.find(courseId);
+        if (course == null) {
+            return null;
+        }
+
+        // subItem list
+        List<CourseSubItemVo> subItemVoList = findSubItemVo(courseId);
+        course.setSubItemList(subItemVoList);
+
+        // support list
+        List<Support> supportList = findSupportList(courseId);
+        course.setSupportList(supportList);
+        return course;
+    }
+
     public APIResult<Course> getCourseLessons(String courseId) {
         Course course = courseRepository.find(courseId);
         if (course == null) {

+ 5 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/GoodsService.java

@@ -77,4 +77,9 @@ public class GoodsService {
         List<Goods> goodsList = goodsRepository.findByPkgIdAndMerchantId(pkgId, merchantId);
         return APIResult.ok(goodsList);
     }
+
+    public List<Goods> findByPidAndMerchantId(String pId, String merchantId) {
+        List<Goods> goodsList = goodsRepository.findByPidAndMerchantId(pId, merchantId);
+        return goodsList;
+    }
 }

+ 49 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/MerchantProductService.java

@@ -45,6 +45,10 @@ public class MerchantProductService {
     @Autowired
     private PackageChangeService packageChangeService;
 
+    @Autowired
+    private ProductService productService;
+
+
     public APIResult<Page<MerchantProduct>> search(MerchantProduct merchantProduct, Integer pageNo, Integer pageSize, LinkedHashMap<String, BaseOrderEnum> sort) {
         Long count = merchantProductRepository.count(merchantProduct);
         Page<MerchantProduct> page = new Page<>(count, pageNo, pageSize);
@@ -128,6 +132,10 @@ public class MerchantProductService {
         // 挂载标签及标价商品数组
         for (MerchantProduct product : merchantProductList) {
             String productId = product.getPid();
+
+            Map<String, Object> productMap = productService.getProduct(productId);
+            merchantProduct.setName(String.valueOf(productMap.get("name")));
+
             String merchantId = product.getMerchantId();
             String key = String.format("%s_%s", productId, merchantId);
             List<Goods> goods = goodsMap.get(key);
@@ -269,4 +277,45 @@ public class MerchantProductService {
 
         return APIResult.ok(merchantProductList);
     }
+
+
+    public List<MerchantProduct> findByPidList2(List<String> productIdList, String merchantId) {
+
+        if (CollectionUtils.isEmpty(productIdList)) {
+            return new ArrayList<>();
+        }
+
+        List<MerchantProduct> merchantProductList = merchantProductRepository.findByPidsAndMerchantId(productIdList, merchantId, BaseStatusEnum.NORMAL);
+        if (merchantProductList.size() == 0) {
+            return new ArrayList<>();
+        }
+
+        // map同一产品同一渠道下多个标价商品
+        Map<String, List<Goods>> goodsMap = new HashMap<>();
+        List<Goods> goodsList = goodsRepository.findByPidsAndMerchantId(productIdList, merchantId);
+
+        for (Goods goods : goodsList) {
+            String productId = goods.getPid();
+            if (goodsMap.containsKey(productId)) {
+                List<Goods> tmp = goodsMap.get(productId);
+                tmp.add(goods);
+            } else {
+                List<Goods> tmpList = new ArrayList<>();
+                tmpList.add(goods);
+                goodsMap.put(productId, tmpList);
+            }
+        }
+
+        for (MerchantProduct merchantProduct : merchantProductList) {
+            String productId = merchantProduct.getPid();
+            List<Goods> tmp = goodsMap.get(productId);
+
+            Map<String, Object> product = productService.getProduct(productId);
+            merchantProduct.setName(String.valueOf(product.get("name")));
+
+            merchantProduct.setGoods(tmp);
+        }
+
+        return merchantProductList;
+    }
 }

+ 12 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/PackageService.java

@@ -56,6 +56,18 @@ public class PackageService {
         return APIResult.ok(pkg);
     }
 
+    public Package getPackage2(String pkgId) {
+        Package pkg = packageRepository.find(pkgId);
+        if (pkg == null) {
+            return null;
+        }
+
+        List<PackageProductVo> packageProductVoList = getPackageProducts(pkgId);
+        pkg.setProducts(packageProductVoList);
+
+        return pkg;
+    }
+
     public List<PackageProductVo> getPackageProducts(String pkgId) {
         List<PackageProductVo> packageProductVoList = new ArrayList<>();
 

+ 46 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/ProductService.java

@@ -88,6 +88,52 @@ public class ProductService {
         return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
     }
 
+    public Map<String, Object> getProduct(String productId) {
+        Map<String, Object> result = null;
+
+
+        Product product = productRepository.findByPid(productId);
+        if (product == null) {
+            return result;
+        }
+
+        ProductTypeEnum type = product.getType();
+        if (ProductTypeEnum.COURSE.equals(type)){
+            Course entity = courseService.getCourse2(productId);
+            if(null == entity){
+                return null;
+            }
+            result = BeanUtil.convertToMap(entity, true);
+            result.put("type", ProductTypeEnum.COURSE);
+            result.put("name", result.get("title") +"|"+result.get("subTitle"));
+        }else if (ProductTypeEnum.SUPPORT.equals(type)) {
+            Support entity = supportService.getSupport2(productId);
+            if(null == entity){
+                return null;
+            }
+            result = BeanUtil.convertToMap(entity, true);
+            result.put("type", ProductTypeEnum.SUPPORT);
+            result.put("name", result.get("title") +"|"+result.get("subTitle"));
+        }else if (ProductTypeEnum.PACKAGE.equals(type)) {
+            Package entity = packageService.getPackage2(productId);
+            if(null == entity){
+                return null;
+            }
+            result = BeanUtil.convertToMap(entity, true);
+            result.put("type", ProductTypeEnum.PACKAGE);
+        }else if (ProductTypeEnum.TRAINING.equals(type)) {
+            Training entity =  trainingService.get(productId);
+            if(null == entity){
+                return null;
+            }
+            result = BeanUtil.convertToMap(entity, true);
+            result.put("type", ProductTypeEnum.TRAINING);
+
+        }
+
+        return result;
+    }
+
     public APIResult<Package> getPackage(String productId) {
         return packageService.getPackage(productId);
     }

+ 12 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/SupportService.java

@@ -93,6 +93,18 @@ public class SupportService {
         return APIResult.ok(support);
     }
 
+    public Support getSupport2(String id) {
+        Support support = supportRepository.find(id);
+        if (support == null) {
+            return null;
+        }
+
+        List<Support> supportList = getRelationSupport(support.getId());
+        support.setSupportList(supportList);
+
+        return support;
+    }
+
     @Transactional
     public List<Support> updateSelfRelation(String fid, List<String> tids) {
         if (tids == null) {

+ 36 - 4
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java

@@ -7,10 +7,7 @@ import cn.rankin.common.utils.enums.BaseStatusEnum;
 import cn.rankin.common.utils.util.JpaSortUtil;
 import cn.rankin.common.utils.util.ListUtil;
 import cn.rankin.data.api.product.dto.TagDTO;
-import cn.rankin.data.api.product.entity.MerchantProduct;
-import cn.rankin.data.api.product.entity.MerchantProductTagRelation;
-import cn.rankin.data.api.product.entity.Tag;
-import cn.rankin.data.api.product.entity.TagGroup;
+import cn.rankin.data.api.product.entity.*;
 import cn.rankin.productservice.code.ProductServiceAPICode;
 import cn.rankin.productservice.repository.MerchantProductRepository;
 import cn.rankin.productservice.repository.TagGroupRepository;
@@ -44,12 +41,23 @@ public class TagService {
     @Autowired
     private MerchantProductTagRelationService merchantProductTagRelationService;
 
+    @Autowired
+    private GoodsService goodsService;
+
     public List<Tag> findByGroupId(String groupId) {
         List<Tag> tagList = tagRepository.findByGroupId(groupId);
         setGroupInfo(tagList);
         return tagList;
     }
 
+    /*add    2018-05-17 */
+    public List<Tag> findByTypeCode(String typeCode) {
+        List<Tag> tagList = tagRepository.findByTypeCode(typeCode);
+        setGroupInfo(tagList);
+        return tagList;
+    }
+
+
     public void setGroupInfo(List<Tag> tagList) {
         if (CollectionUtils.isEmpty(tagList)) return;
         List<String> groupIdList = new ArrayList<>();
@@ -93,6 +101,30 @@ public class TagService {
         return sortMerchantProductList;
     }
 
+    public List<MerchantProduct> getMerchantProductList2(String tagId, String merchantId) {
+        List<MerchantProductTagRelation> relationList = merchantProductTagRelationService.findByTagId(tagId, BaseStatusEnum.NORMAL);
+        if (CollectionUtils.isEmpty(relationList)) {
+            return new ArrayList<>();
+        }
+
+        List<String> productIdList = new ArrayList<>();
+        relationList.forEach(relation -> productIdList.add(relation.getPid()));
+        List<MerchantProduct> merchantProductList = merchantProductRepository.findByPidsAndMerchantId(productIdList, merchantId);
+        Map<String, MerchantProduct> merchantProductMap = ListUtil.convert(merchantProductList, "pid", MerchantProduct.class);
+
+        List<MerchantProduct> sortMerchantProductList = new ArrayList<>();
+
+        for (String productId : productIdList) {
+            MerchantProduct merchantProduct = merchantProductMap.get(productId);
+            if (merchantProduct != null) {
+                List<Goods> goodsList = goodsService.findByPidAndMerchantId(merchantProduct.getPid(), merchantProduct.getMerchantId());
+                merchantProduct.setGoods(goodsList);
+                sortMerchantProductList.add(merchantProduct);
+            }
+        }
+        return sortMerchantProductList;
+    }
+
     // 搜索标签
     public APIResult<Page<Tag>> search(Tag tag, Integer pageNo, Integer pageSize, LinkedHashMap<String, BaseOrderEnum> sort) {
         Long count = tagRepository.count(tag);

+ 132 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagTypeService.java

@@ -0,0 +1,132 @@
+package cn.rankin.productservice.service;
+
+import cn.rankin.common.utils.api.page.Page;
+import cn.rankin.common.utils.enums.BaseOrderEnum;
+import cn.rankin.common.utils.util.JpaSortUtil;
+import cn.rankin.data.api.app.vo.ItemVo;
+import cn.rankin.data.api.product.dto.TagTypeDTO;
+import cn.rankin.data.api.product.entity.MerchantProduct;
+import cn.rankin.data.api.product.entity.Tag;
+import cn.rankin.data.api.product.entity.TagType;
+import cn.rankin.productservice.repository.TagTypeRepository;
+import cn.rankin.productservice.service.app.ItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import static cn.rankin.productservice.utils.DTOConverter.convert;
+
+@Service
+public class TagTypeService {
+
+    @Autowired
+    private TagTypeRepository tagTypeRepository;
+
+    @Autowired
+    private TagService tagService;
+
+    @Autowired
+    private ItemService itemService;
+
+    public boolean exists(String code) {
+        Long count = tagTypeRepository.countByCode(code);
+        return count > 0;
+    }
+
+    public Page<TagType> search(TagType tagType, Integer pageNo, Integer pageSize, LinkedHashMap<String, BaseOrderEnum> sort) {
+        Long count = tagTypeRepository.count(tagType);
+
+        Page<TagType> page = new Page<>(count, pageNo, pageSize);
+        if (count == 0) {
+            return page;
+        }
+
+        List<TagType> tagTypeList = tagTypeRepository.find(tagType, page.getStart(), page.getPageSize(), JpaSortUtil.sort(sort));
+        page.setList(tagTypeList);
+
+        return page;
+    }
+
+    @Transactional
+    public TagType create(TagTypeDTO tagTypeDTO) {
+        String code = tagTypeDTO.getCode();
+        if (exists(code)) {
+            //已存在返回null
+            return null;
+        }
+
+        TagType tagType = convert(tagTypeDTO);
+        TagType result = tagTypeRepository.save(tagType);
+        return result;
+    }
+
+    @Transactional
+    public TagType update(TagTypeDTO tagTypeDTO) {
+        String groupId = tagTypeDTO.getId();
+        TagType tagType = convert(tagTypeDTO);
+        // 更新标签组
+        TagType result = tagTypeRepository.update(tagType);
+        // 给组内的标签排序
+        List<String> tagIdList = tagTypeDTO.getTagList();
+        if (!CollectionUtils.isEmpty(tagIdList)) {
+            tagService.sortTag(groupId, tagIdList);
+        }
+        return result;
+    }
+
+    @Transactional
+    public Boolean delete(String id) {
+        Integer count = tagTypeRepository.deleteById(id);
+        if (count > 0) {
+            return true;
+        }
+        return false;
+    }
+
+    public TagType getTagType(String tagTypeId) {
+        TagType tagType = tagTypeRepository.find(tagTypeId);
+        if (tagType == null) {
+            return null;
+        }
+
+        List<Tag> tagList = tagService.findByTypeCode(tagType.getCode());
+        tagType.setTagList(tagList);
+        return tagType;
+    }
+
+    public TagType getTagTypeByCode(String typeCode) {
+        TagType tagType = tagTypeRepository.findFirstByCode(typeCode);
+        if (tagType == null) {
+            return null;
+        }
+
+        List<Tag> tagList = tagService.findByTypeCode(typeCode);
+
+        tagList.forEach(tag -> {
+            String tagId = tag.getId();
+            String merchantId = tag.getMerchantId();
+            List<ItemVo> itemVoList = itemService.findPageByTagId(tagId, merchantId);
+//            List<MerchantProduct> merchantProductList = tagService.getMerchantProductList2(tagId, merchantId);
+//            tag.setProductList(merchantProductList);
+            tag.setRecs(itemVoList);
+            
+        });
+        
+        
+        tagType.setTagList(tagList);
+        return tagType;
+    }
+
+    public TagType findTagTypeByCode(String code) {
+        TagType tagType = tagTypeRepository.findFirstByCode(code);
+        if (tagType == null) {
+            return null;
+        }
+        String tagTypeId = tagType.getId();
+        return this.getTagType(tagTypeId);
+    }
+}

+ 83 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/service/app/AppGoodsService.java

@@ -31,7 +31,7 @@ public class AppGoodsService {
     @Autowired
     private SupportRepository supportRepository;
 
-    public APIResult<List<GoodsVo>> findByIds(List<String> goodsIdList, String merchantId) {
+/*    public APIResult<List<GoodsVo>> findByIds(List<String> goodsIdList, String merchantId) {
         if (CollectionUtils.isEmpty(goodsIdList)) {
             return APIResult.ok(new ArrayList<>());
         }
@@ -108,5 +108,87 @@ public class AppGoodsService {
             goodsVoList.add(goodsVo);
         }
         return APIResult.ok(goodsVoList);
+    }*/
+
+    /*   --- rewrite 2018-05-14--------------------------------------  start   */
+    public List<GoodsVo> findByIds(List<String> goodsIdList, String merchantId) {
+        if (CollectionUtils.isEmpty(goodsIdList)) {
+            return new ArrayList<>();
+        }
+
+        List<Goods> goodsList = goodsRepository.findByIds(goodsIdList, merchantId);
+
+        Map<String, Goods> goodsMap = new HashMap<>();
+        List<String> courseIdList = new ArrayList<>();
+        List<String> supportIdList = new ArrayList<>();
+        for (Goods goods : goodsList) {
+            String productId = goods.getPid();
+            ProductTypeEnum type = goods.getType();
+            if (ProductTypeEnum.COURSE.equals(type)) {
+                courseIdList.add(productId);
+            } else if (type.equals(ProductTypeEnum.SUPPORT)) {
+                supportIdList.add(productId);
+            }
+            String goodsId = goods.getId();
+            goodsMap.put(goodsId, goods);
+        }
+
+        List<Course> courseList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(courseIdList)) {
+            courseList = courseRepository.findByIds(courseIdList);
+        }
+
+        List<Support> supportList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(supportIdList)) {
+            supportList = supportRepository.findByIds(supportIdList);
+        }
+
+        // 拿产品信息
+        Map<String, Course> courseMap = new HashMap<>();
+        for (Course course : courseList) {
+            String productId = course.getId();
+            courseMap.put(productId, course);
+        }
+        Map<String, Support> supportMap = new HashMap<>();
+        for (Support support : supportList) {
+            String productId = support.getId();
+            supportMap.put(productId, support);
+        }
+
+        // 组装
+        List<GoodsVo> goodsVoList = new ArrayList<>();
+        for (String goodsId : goodsIdList) {
+            Goods goods = goodsMap.get(goodsId);
+            if (StringUtils.isEmpty(goods)) {
+                continue;
+            }
+            GoodsVo goodsVo = new GoodsVo();
+            goodsVo.setId(goods.getId());
+            goodsVo.setPid(goods.getPid());
+            goodsVo.setType(goods.getType());
+            goodsVo.setChargeUnit(goods.getChargeUnit());
+            goodsVo.setTerminalPrice(goods.getTerminalPrice());
+            ProductTypeEnum type = goods.getType();
+            String productId = goods.getPid();
+            if (ProductTypeEnum.COURSE.equals(type)) {
+                Course course = courseMap.get(productId);
+                if (course != null) {
+                    goodsVo.setTitle(course.getTitle());
+                    goodsVo.setSubTitle(course.getSubTitle());
+                    goodsVo.setCoverUrl(course.getCoverUrl());
+                }
+            } else if (ProductTypeEnum.SUPPORT.equals(type)) {
+                Support support = supportMap.get(productId);
+                if (support != null) {
+                    goodsVo.setTitle(support.getTitle());
+                    goodsVo.setSubTitle(support.getSubTitle());
+                    goodsVo.setCoverUrl(support.getCoverUrl());
+                }
+            }
+            goodsVoList.add(goodsVo);
+        }
+        return goodsVoList;
     }
+
+    /*   --- rewrite 2018-05-14--------------------------------------  end   */
 }

+ 41 - 1
rankin-product-service/src/main/java/cn/rankin/productservice/service/app/AppLessonService.java

@@ -32,7 +32,7 @@ public class AppLessonService {
     @Autowired
     private CourseSubRelationRepository courseSubRelationRepository;
 
-    public APIResult<Lesson> getLesson(String lessonId, String courseId) {
+/*    public APIResult<Lesson> getLesson(String lessonId, String courseId) {
         Lesson lesson = lessonRepository.find(lessonId);
         if (lesson == null || !BaseStatusEnum.NORMAL.equals(lesson.getStatus())) {
             return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
@@ -68,5 +68,45 @@ public class AppLessonService {
         lesson.setWareList(sortWareList);
 
         return APIResult.ok(lesson);
+    }*/
+
+    /*   --- rewrite 2018-05-14--------------------------------------  start   */
+    public Lesson getLesson(String lessonId, String courseId) {
+        Lesson lesson = lessonRepository.find(lessonId);
+        if (lesson == null || !BaseStatusEnum.NORMAL.equals(lesson.getStatus())) {
+            return null;
+        }
+
+        // set lesson sort from relation
+        CourseSubRelation courseSubRelation = courseSubRelationRepository.findFirstByCourseIdOrderBySort(courseId);
+        if (courseSubRelation == null) {
+            return null;
+        }
+        lesson.setSort(courseSubRelation.getSort());
+
+        // get courseware id list
+        List<LessonWareRelation> lessonWareRelationList = lessonWareRelationRepository.findByLessonId(lessonId, BaseStatusEnum.NORMAL);
+        if (CollectionUtils.isEmpty(lessonWareRelationList)) {
+            lesson.setWareList(new ArrayList<>());
+            return lesson;
+        }
+        List<String> wareIdList = new ArrayList<>();
+        lessonWareRelationList.forEach(relation -> wareIdList.add(relation.getWareId()));
+
+        // get courseware list with sort
+        List<CourseWare> courseWareList = wareRepository.findByIdIn(wareIdList, BaseStatusEnum.NORMAL);
+        Map<String, CourseWare> courseWareMap = ListUtil.convert(courseWareList, "id", CourseWare.class);
+        List<CourseWare> sortWareList = new ArrayList<>();
+        for (String wareId : wareIdList) {
+            CourseWare courseWare = courseWareMap.get(wareId);
+            if (courseWare == null) {
+                continue;
+            }
+            sortWareList.add(courseWare);
+        }
+        lesson.setWareList(sortWareList);
+
+        return lesson;
     }
+    /*   --- rewrite 2018-05-14--------------------------------------  end   */
 }

+ 10 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/utils/DTOConverter.java

@@ -70,6 +70,16 @@ public class DTOConverter {
         relation.setStatus(BaseStatusEnum.NORMAL);
         return relation;
     }
+    /*add*/
+    public static TagType convert(TagTypeDTO tagTypeDTO) {
+        TagType tagType = new TagType();
+        tagType.setId(tagTypeDTO.getId());
+        tagType.setCode(tagTypeDTO.getCode());
+        tagType.setName(tagTypeDTO.getName());
+        tagType.setSort(tagTypeDTO.getSort());
+        tagType.setStatus(tagTypeDTO.getStatus());
+        return tagType;
+    }
 
     public static TagGroup convert(GroupDTO groupDTO) {
         TagGroup tagGroup = new TagGroup();

+ 4 - 3
rankin-product-service/src/main/resources/bootstrap.yml

@@ -3,10 +3,11 @@ spring:
     name: product-service
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
-      
+      profile: ${profile:local}
+
 server:
   port: 8100
 

+ 21 - 0
rankin-product-service/src/main/resources/bootstrap_bak.yml

@@ -0,0 +1,21 @@
+spring:
+  application:
+    name: product-service
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+      
+server:
+  port: 8100
+
+feign:
+  httpclient:
+     enabled: true
+  hystrix:
+    enabled: false
+
+#logging:
+#  level:
+#    root: debug

+ 3 - 2
rankin-resource-service/src/main/resources/bootstrap.yml

@@ -3,9 +3,10 @@ spring:
     name: resource-service
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 server:
   port: 8200

+ 11 - 0
rankin-resource-service/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,11 @@
+spring:
+  application:
+    name: resource-service
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+server:
+  port: 8200

+ 3 - 2
rankin-task/src/main/resources/bootstrap.yml

@@ -3,9 +3,10 @@ spring:
     name: rankin-task
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 feign:
   httpclient:

+ 21 - 0
rankin-task/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,21 @@
+spring:
+  application:
+    name: rankin-task
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+feign:
+  httpclient:
+    enabled: true
+  hystrix:
+    enabled: false
+
+server:
+  port: 10100
+
+#logging:
+#  level:
+#    root: debug

+ 3 - 2
rankin-trade-service/src/main/resources/bootstrap.yml

@@ -3,9 +3,10 @@ spring:
     name: trade-service
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#      uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 server:
   port: 8300

+ 11 - 0
rankin-trade-service/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,11 @@
+spring:
+  application:
+    name: trade-service
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+server:
+  port: 8300

+ 3 - 2
rankin-user-service/src/main/resources/bootstrap.yml

@@ -5,9 +5,10 @@ spring:
     active:
   cloud:
     config:
-      uri: http://config.rankin.com:8921
+      uri: http://127.0.0.1:8921
+#     uri: http://config.rankin.com:8921
       label: master
-      profile: ${profile:dev}
+      profile: ${profile:local}
 
 #logging:
 #  level:

+ 17 - 0
rankin-user-service/src/main/resources/bootstrap_online.yml

@@ -0,0 +1,17 @@
+spring:
+  application:
+    name: user-service
+  profiles:
+    active:
+  cloud:
+    config:
+      uri: http://config.rankin.com:8921
+      label: master
+      profile: ${profile:dev}
+
+#logging:
+#  level:
+#    root: debug
+
+server:
+  port: 8400