Explorar el Código

华为hag接口

xushengqiang hace 5 años
padre
commit
cd97a271fa
Se han modificado 36 ficheros con 1492 adiciones y 10 borrados
  1. 2 3
      src/main/java/cn/efunbox/audio/config/Config.java
  2. 27 0
      src/main/java/cn/efunbox/audio/controller/hag/HagContentController.java
  3. 28 0
      src/main/java/cn/efunbox/audio/controller/hag/HagOrderController.java
  4. 27 0
      src/main/java/cn/efunbox/audio/controller/hag/HagProductController.java
  5. 27 0
      src/main/java/cn/efunbox/audio/controller/hag/HagResourceController.java
  6. 81 0
      src/main/java/cn/efunbox/audio/entity/hag/HagAlbum.java
  7. 67 0
      src/main/java/cn/efunbox/audio/entity/hag/HagContent.java
  8. 60 0
      src/main/java/cn/efunbox/audio/entity/hag/HagOrder.java
  9. 81 0
      src/main/java/cn/efunbox/audio/entity/hag/HagProduct.java
  10. 133 0
      src/main/java/cn/efunbox/audio/impl/hag/HagContentServiceImpl.java
  11. 128 0
      src/main/java/cn/efunbox/audio/impl/hag/HagOrderServiceImpl.java
  12. 98 0
      src/main/java/cn/efunbox/audio/impl/hag/HagProductServiceImpl.java
  13. 5 4
      src/main/java/cn/efunbox/audio/repository/base/ProjectSimpleJpaRepository.java
  14. 11 0
      src/main/java/cn/efunbox/audio/repository/hag/HagAlbumRepository.java
  15. 14 0
      src/main/java/cn/efunbox/audio/repository/hag/HagContentRepository.java
  16. 12 0
      src/main/java/cn/efunbox/audio/repository/hag/HagOrderRepository.java
  17. 22 0
      src/main/java/cn/efunbox/audio/repository/hag/HagProductRepository.java
  18. 16 0
      src/main/java/cn/efunbox/audio/service/hag/HagContentService.java
  19. 12 0
      src/main/java/cn/efunbox/audio/service/hag/HagOrderService.java
  20. 13 0
      src/main/java/cn/efunbox/audio/service/hag/HagProductService.java
  21. 16 3
      src/main/java/cn/efunbox/audio/utils/DateUtil.java
  22. 63 0
      src/main/java/cn/efunbox/audio/vo/hag/AlbumConverter.java
  23. 29 0
      src/main/java/cn/efunbox/audio/vo/hag/AudioUrl.java
  24. 42 0
      src/main/java/cn/efunbox/audio/vo/hag/ContentConverter.java
  25. 57 0
      src/main/java/cn/efunbox/audio/vo/hag/ContentVO.java
  26. 14 0
      src/main/java/cn/efunbox/audio/vo/hag/HagBaseResp.java
  27. 17 0
      src/main/java/cn/efunbox/audio/vo/hag/HagContentReq.java
  28. 20 0
      src/main/java/cn/efunbox/audio/vo/hag/HagContentResp.java
  29. 17 0
      src/main/java/cn/efunbox/audio/vo/hag/HagProductReq.java
  30. 16 0
      src/main/java/cn/efunbox/audio/vo/hag/HagProductResp.java
  31. 114 0
      src/main/java/cn/efunbox/audio/vo/hag/HagSkillReq.java
  32. 51 0
      src/main/java/cn/efunbox/audio/vo/hag/HagSkillResp.java
  33. 16 0
      src/main/java/cn/efunbox/audio/vo/hag/OrderSyncResult.java
  34. 18 0
      src/main/java/cn/efunbox/audio/vo/hag/Pagination.java
  35. 71 0
      src/main/java/cn/efunbox/audio/vo/hag/ProductConverter.java
  36. 67 0
      src/main/java/cn/efunbox/audio/vo/hag/ProductVO.java

+ 2 - 3
src/main/java/cn/efunbox/audio/config/Config.java

@@ -50,12 +50,11 @@ public class Config extends WebMvcConfigurerAdapter {
         registry.addInterceptor(authInterceptor())
                 .addPathPatterns("/audio/search", "/audio/searchList", "/audio/info/{audioId}", "/album", "/album/{albumId}")
                 .excludePathPatterns("/device/**", "/error", "/audio/*");
-
         registry.addInterceptor(adminInterceptor())
                 .addPathPatterns("/**", "/device/update", "/device/delete")
                 .excludePathPatterns("/device/**", "/audio/info/{audioId}", "/error", "/admin/login", "/audio/search", "/file/**", "/audio/searchList", "/statistics", "/album", "/album/{albumId}")
-
-                .excludePathPatterns("/getTypeList", "/getTypeContentList", "/getContentDetail", "/getContentChapterList", "/getChapterDetail", "/getTypeUpdateList", "/getContentUpdateList", "/getChapterUpdateList", "/getTypeUpdateList/**", "/getContentUpdateList/**", "/getChapterUpdateList/**");
+                .excludePathPatterns("/getTypeList", "/getTypeContentList", "/getContentDetail", "/getContentChapterList", "/getChapterDetail", "/getTypeUpdateList", "/getContentUpdateList", "/getChapterUpdateList", "/getTypeUpdateList/**", "/getContentUpdateList/**", "/getChapterUpdateList/**")
+                .excludePathPatterns("/api/hag/v1/**");
 
         //杭研开放接口
         //.excludePathPatterns("/getTypeList","/getTypeContentList","/getContentDetail","/getContentChapterList","/getChapterDetail","/getTypeUpdateList","/getContentUpdateList","/getChapterUpdateList");

+ 27 - 0
src/main/java/cn/efunbox/audio/controller/hag/HagContentController.java

@@ -0,0 +1,27 @@
+package cn.efunbox.audio.controller.hag;
+
+import cn.efunbox.audio.service.hag.HagContentService;
+import cn.efunbox.audio.vo.hag.HagContentReq;
+import cn.efunbox.audio.vo.hag.HagBaseResp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * HagContentController
+ * Created by xusq on 2019/12/25.
+ */
+@RequestMapping("/api/hag/v1/content")
+@RestController
+public class HagContentController {
+
+    @Autowired
+    private HagContentService hagContentService;
+
+    @PostMapping
+    public HagBaseResp content(@RequestBody HagContentReq hagContentReq){
+        return hagContentService.list(hagContentReq);
+    }
+}

+ 28 - 0
src/main/java/cn/efunbox/audio/controller/hag/HagOrderController.java

@@ -0,0 +1,28 @@
+package cn.efunbox.audio.controller.hag;
+
+import cn.efunbox.audio.service.hag.HagOrderService;
+import cn.efunbox.audio.vo.hag.HagSkillReq;
+import cn.efunbox.audio.vo.hag.HagSkillResp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * HaOrderController
+ * Created by xusq on 2019/12/25.
+ */
+@RequestMapping("/api/hag/v1/order")
+@RestController
+public class HagOrderController {
+
+    @Autowired
+    private HagOrderService hagOrderService;
+
+    @PostMapping
+    public HagSkillResp sync(@RequestBody HagSkillReq skillReq) {
+        return hagOrderService.save(skillReq);
+    }
+
+}

+ 27 - 0
src/main/java/cn/efunbox/audio/controller/hag/HagProductController.java

@@ -0,0 +1,27 @@
+package cn.efunbox.audio.controller.hag;
+
+import cn.efunbox.audio.service.hag.HagProductService;
+import cn.efunbox.audio.vo.hag.HagProductReq;
+import cn.efunbox.audio.vo.hag.HagProductResp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * HagProductController
+ * Created by xusq on 2019/12/25.
+ */
+@RestController
+@RequestMapping("/api/hag/v1/product")
+public class HagProductController {
+
+    @Autowired
+    private HagProductService hagProductService;
+
+    @RequestMapping
+    public HagProductResp list(@RequestBody HagProductReq productReq) {
+        return hagProductService.list(productReq);
+    }
+
+}

+ 27 - 0
src/main/java/cn/efunbox/audio/controller/hag/HagResourceController.java

@@ -0,0 +1,27 @@
+package cn.efunbox.audio.controller.hag;
+
+import cn.efunbox.audio.service.hag.HagContentService;
+import cn.efunbox.audio.vo.hag.HagSkillReq;
+import cn.efunbox.audio.vo.hag.HagSkillResp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * HagResourceController
+ * Created by xusq on 2019/12/26.
+ */
+@RestController
+@RequestMapping("/api/hag/v1/resource")
+public class HagResourceController {
+
+    @Autowired
+    private HagContentService hagContentService;
+
+    @PostMapping
+    public HagSkillResp url(@RequestBody HagSkillReq skillReq) {
+        return hagContentService.getResUrl(skillReq);
+    }
+}

+ 81 - 0
src/main/java/cn/efunbox/audio/entity/hag/HagAlbum.java

@@ -0,0 +1,81 @@
+package cn.efunbox.audio.entity.hag;
+
+import lombok.Data;
+import lombok.ToString;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * HagAlbum
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+@ToString
+@Entity
+@Table(name = "hag_album")
+@DynamicInsert
+@DynamicUpdate
+public class HagAlbum implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column(name = "album_name")
+    private String albumName;
+
+    @Column(name = "artist_name")
+    private String artistName;
+
+    private Integer chapter;
+
+    @Column(name = "charge_type")
+    private Integer chargeType;
+
+    @Column(name = "relate_cp_sku_id")
+    private String relateCpSkuId;
+
+    private String crowd;
+
+    @Column(name = "first_class")
+    private String firstClass;
+
+    @Column(name = "second_class")
+    private String secondClass;
+
+    @Column(name = "third_class")
+    private String thirdClass;
+
+    private Integer status;
+
+    @Column(name = "song_num")
+    private Integer songNum;
+
+    @Column(name = "large_icon")
+    private String largeIcon;
+
+    @Column(name = "medium_icon")
+    private String mediumIcon;
+
+    @Column(name = "small_icon")
+    private String smallIcon;
+
+    @Column(name = "height_pixels")
+    private String heightPixels;
+
+    @Column(name = "width_pixels")
+    private String widthPixels;
+
+    @Column(name = "gmt_created")
+    private Date gmtCreated;
+
+    @Column(name = "gmt_modified")
+    private Date gmtModified;
+
+}

+ 67 - 0
src/main/java/cn/efunbox/audio/entity/hag/HagContent.java

@@ -0,0 +1,67 @@
+package cn.efunbox.audio.entity.hag;
+
+import lombok.Data;
+import lombok.ToString;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * HagContent
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+@ToString
+@Entity
+@Table(name = "hag_content")
+@DynamicInsert
+@DynamicUpdate
+public class HagContent implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column(name = "album_id")
+    private String albumId;
+
+    private Integer chapter;
+
+    @Column(name = "content_name")
+    private String contentName;
+
+    private String crowd;
+
+    @Column(name = "first_class")
+    private String firstClass;
+
+    @Column(name = "second_class")
+    private String secondClass;
+
+    @Column(name = "third_class")
+    private String thirdClass;
+
+    @Column(name = "free_flag")
+    private Integer freeFlag;
+
+    private String language;
+
+    private String url;
+
+    @Column(name = "time_length")
+    private String timeLength;
+
+    private Integer status;
+
+    @Column(name = "gmt_created")
+    private Date gmtCreated;
+
+    @Column(name = "gmt_modified")
+    private Date gmtModified;
+
+}

+ 60 - 0
src/main/java/cn/efunbox/audio/entity/hag/HagOrder.java

@@ -0,0 +1,60 @@
+package cn.efunbox.audio.entity.hag;
+
+import lombok.Data;
+import lombok.ToString;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * HagOrder
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+@ToString
+@Entity
+@Table(name = "hag_order")
+@DynamicInsert
+@DynamicUpdate
+public class HagOrder implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column(name = "device_id")
+    private String deviceId;
+
+    @Column(name = "sku_id")
+    private String skuId;
+
+    private String amount;
+
+    private String currency;
+
+    @Column(name = "order_id")
+    private String orderId;
+
+    @Column(name = "bought_time")
+    private String boughtTime;
+
+    @Column(name = "resource_type")
+    private String resourceType;
+
+    @Column(name = "content_id")
+    private String contentId;
+
+    private Integer status;
+
+    @Column(name = "gmt_created")
+    private Date gmtCreated;
+
+    @Column(name = "gmt_modified")
+    private Date gmtModified;
+
+}

+ 81 - 0
src/main/java/cn/efunbox/audio/entity/hag/HagProduct.java

@@ -0,0 +1,81 @@
+package cn.efunbox.audio.entity.hag;
+
+import lombok.Data;
+import lombok.ToString;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * HagProduct
+ * Created by xusq on 2019/12/25.
+ */
+
+@Data
+@ToString
+@Entity
+@Table(name = "hag_product")
+@DynamicInsert
+@DynamicUpdate
+public class HagProduct implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column(name = "ability_id")
+    private String abilityId;
+
+    @Column(name = "sku_name")
+    private String skuName;
+
+    private String description;
+
+    @Column(name = "sku_type")
+    private String skuType;
+
+    @Column(name = "right_controller")
+    private String rightController;
+
+    @Column(name = "price_controller")
+    private String priceController;
+
+    @Column(name = "sku_release_state")
+    private String skuReleaseState;
+
+    @Column(name = "price_group_description")
+    private String priceGroupDescription;
+
+    private String promotion;
+
+    private String currency;
+
+    @Column(name = "original_amount")
+    private String originalAmount;
+
+    private String amount;
+
+    @Column(name = "begin_time")
+    private String beginTime;
+
+    @Column(name = "end_time")
+    private String endTime;
+
+    @Column(name = "resource_type")
+    private String resourceType;
+
+    @Column(name = "album_id")
+    private String albumId;
+
+    @Column(name = "gmt_created")
+    private Date gmtCreated;
+
+    @Column(name = "gmt_modified")
+    private Date gmtModified;
+
+}

+ 133 - 0
src/main/java/cn/efunbox/audio/impl/hag/HagContentServiceImpl.java

@@ -0,0 +1,133 @@
+package cn.efunbox.audio.impl.hag;
+
+import cn.efunbox.audio.entity.hag.HagAlbum;
+import cn.efunbox.audio.entity.hag.HagContent;
+import cn.efunbox.audio.repository.hag.HagAlbumRepository;
+import cn.efunbox.audio.repository.hag.HagContentRepository;
+import cn.efunbox.audio.service.hag.HagContentService;
+import cn.efunbox.audio.vo.hag.*;
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
+
+/**
+ * HagServiceImpl
+ * Created by xusq on 2019/12/25.
+ */
+@Slf4j
+@Service
+public class HagContentServiceImpl implements HagContentService {
+
+    @Autowired
+    private HagContentRepository hagContentRepository;
+    @Autowired
+    private HagAlbumRepository hagAlbumRepository;
+
+    @Override
+    public HagBaseResp list(HagContentReq hagContentReq) {
+
+        List<HagAlbum> hagAlbums = hagAlbumRepository.findAll();
+
+        List<ContentVO> contentVOList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(hagAlbums)) {
+            hagAlbums.forEach(album -> contentVOList.add(AlbumConverter.albumToContentVO(album)));
+        }
+
+        List<HagContent> hagContents = hagContentRepository.findAll();
+        if (!CollectionUtils.isEmpty(hagContents)) {
+            hagContents.forEach(content -> contentVOList.add(ContentConverter.contentToContentVO(content)));
+        }
+
+        Pagination pagination = new Pagination();
+        pagination.setNext("1");
+        pagination.setTotal(Long.valueOf(contentVOList.size()));
+
+        HagContentResp hagContentResp = new HagContentResp();
+        hagContentResp.setSource("test");
+        hagContentResp.setPagination(pagination);
+        hagContentResp.setContentItems(contentVOList);
+        return hagContentResp;
+    }
+
+    @Override
+    public HagSkillResp getResUrl(HagSkillReq skillReq) {
+
+
+        log.info("HAG find resource url param : {}", JSON.toJSONString(skillReq));
+        HagSkillReq.Endpoint endpoint = skillReq.getEndpoint();
+        if (Objects.isNull(endpoint)) {
+            return fillFailResp("400","参数错误");
+        }
+
+        HagSkillReq.Endpoint.Device device = endpoint.getDevice();
+        if (Objects.isNull(device)) {
+            return fillFailResp("400","device信息为空");
+        }
+        String deviceId = device.getDeviceId();
+        if (StringUtils.isBlank(deviceId)) {
+            return fillFailResp("400","deviceId为空");
+        }
+        HagSkillReq.HagInquire inquire = skillReq.getInquire();
+        HagSkillReq.HagInquire.Intent.Slots slots = inquire.getIntent().getSlots();
+        HagSkillReq.HagInquire.Intent.Slots.ContentCode albumCode = slots.getAlbumCode();
+        HagSkillReq.HagInquire.Intent.Slots.ContentCode contentCode = slots.getContentCode();
+
+        List<HagSkillReq.HagInquire.Intent.Slots.ContentCode.Value> values = contentCode.getValues();
+        if (CollectionUtils.isEmpty(values)) {
+            return fillFailResp("400","contentCode为空");
+        }
+
+        String real = values.get(0).getReal();
+        HagContent hagContent = hagContentRepository.find(real);
+        if (Objects.isNull(hagContent)) {
+            return fillFailResp("404","媒资数据未找到");
+        }
+
+
+
+        return fillSuccessResp(hagContent.getUrl());
+    }
+
+    private HagSkillResp fillFailResp(String errorCode,String errorMessage) {
+        HagSkillResp hagSkillResp = new HagSkillResp();
+        hagSkillResp.setErrorCode(errorCode);
+        hagSkillResp.setErrorMessage(errorMessage);
+        hagSkillResp.setVersion("1.0.0");
+        HagSkillResp.Reply<HagSkillReq.HagInquire.Intent> reply = new HagSkillResp.Reply();
+        reply.setIsEndSession(Boolean.TRUE);
+        HagSkillResp.Reply.Command command = new HagSkillResp.Reply.Command();
+        command.setNamespace("AudioPlayer");
+        command.setName("Play");
+        AudioUrl audioUrl = new AudioUrl();
+        audioUrl.setUrl("");
+        command.setBody(audioUrl);
+        reply.setCommands(Arrays.asList(command));
+        hagSkillResp.setReply(reply);
+        return hagSkillResp;
+    }
+
+    private HagSkillResp fillSuccessResp(String url) {
+        HagSkillResp hagSkillResp = new HagSkillResp();
+        hagSkillResp.setErrorCode("0");
+        hagSkillResp.setErrorMessage("OK");
+        hagSkillResp.setVersion("1.0.0");
+        HagSkillResp.Reply<Map<String,List>> reply = new HagSkillResp.Reply();
+        reply.setIsEndSession(Boolean.TRUE);
+        HagSkillResp.Reply.Command command = new HagSkillResp.Reply.Command();
+        command.setNamespace("AudioPlayer");
+        command.setName("Play");
+        AudioUrl audioUrl = new AudioUrl();
+        audioUrl.setUrl(url);
+        Map<String,List<AudioUrl>> map = new HashMap<>();
+        map.put("audioItemList",Arrays.asList(audioUrl));
+        command.setBody(map);
+        reply.setCommands(Arrays.asList(command));
+        hagSkillResp.setReply(reply);
+        return hagSkillResp;
+    }
+}

+ 128 - 0
src/main/java/cn/efunbox/audio/impl/hag/HagOrderServiceImpl.java

@@ -0,0 +1,128 @@
+package cn.efunbox.audio.impl.hag;
+
+import cn.efunbox.audio.entity.hag.HagOrder;
+import cn.efunbox.audio.repository.hag.HagOrderRepository;
+import cn.efunbox.audio.service.hag.HagOrderService;
+import cn.efunbox.audio.vo.hag.HagSkillReq;
+import cn.efunbox.audio.vo.hag.HagSkillResp;
+import cn.efunbox.audio.vo.hag.OrderSyncResult;
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * HagOrderServiceImpl
+ * Created by xusq on 2019/12/25.
+ */
+@Slf4j
+@Service
+public class HagOrderServiceImpl implements HagOrderService {
+
+    @Autowired
+    private HagOrderRepository hagOrderRepository;
+
+    @Override
+    public HagSkillResp save(HagSkillReq skillReq) {
+        log.info("HAG sync order param : {}", JSON.toJSONString(skillReq));
+        HagSkillReq.Endpoint endpoint = skillReq.getEndpoint();
+        if (Objects.isNull(endpoint)) {
+            return fillFailResp("400","参数错误");
+        }
+
+        HagSkillReq.Endpoint.Device device = endpoint.getDevice();
+        if (Objects.isNull(device)) {
+            return fillFailResp("400","device信息为空");
+        }
+        String deviceId = device.getDeviceId();
+        if (StringUtils.isBlank(deviceId)) {
+            return fillFailResp("400","deviceId为空");
+        }
+
+        HagSkillReq.HagInquire inquire = skillReq.getInquire();
+        if (Objects.isNull(inquire) || Objects.isNull(inquire.getOrderRight())) {
+            return fillFailResp("400","订单参数信息为空");
+        }
+
+        HagSkillReq.HagInquire.OrderRight orderRight = inquire.getOrderRight();
+        List<HagSkillReq.HagInquire.OrderRight.ResourceRight> resourceRights = orderRight.getResourceRights();
+        if (CollectionUtils.isEmpty(resourceRights)) {
+            return fillFailResp("400","订单媒资数据为空");
+        }
+
+        String hagOrderId = orderRight.getOrderId();
+
+        HagOrder hagOrder = hagOrderRepository.findByOrderId(hagOrderId);
+        if (Objects.nonNull(hagOrder)) {
+            return fillSuccessResp(hagOrder.getId());
+        }
+
+        hagOrder = convertOrderObj(orderRight,resourceRights,deviceId);
+        if (Objects.isNull(hagOrder)) {
+            return  fillFailResp("500","订单同步失败");
+        }
+
+
+        return fillSuccessResp(hagOrder.getId());
+    }
+
+    private HagOrder convertOrderObj(HagSkillReq.HagInquire.OrderRight orderRight, List<HagSkillReq.HagInquire.OrderRight.ResourceRight> resourceRights, String deviceId) {
+
+        HagOrder hagOrder = new HagOrder();
+        hagOrder.setSkuId(orderRight.getSkuId());
+        hagOrder.setDeviceId(deviceId);
+        hagOrder.setOrderId(orderRight.getOrderId());
+        hagOrder.setAmount(orderRight.getAmount());
+        hagOrder.setBoughtTime(orderRight.getBoughtTime());
+        hagOrder.setCurrency(orderRight.getCurrency());
+        StringBuilder sb = new StringBuilder();
+        resourceRights.forEach(resourceRight -> sb.append(resourceRight.getResourceId()).append(","));
+        hagOrder.setContentId(sb.toString());
+
+        hagOrder  = hagOrderRepository.save(hagOrder);
+
+        return hagOrder;
+    }
+
+    private HagSkillResp fillSuccessResp(String orderId) {
+        HagSkillResp hagSkillResp = new HagSkillResp();
+        hagSkillResp.setVersion("1.0.0");
+        HagSkillResp.Reply<OrderSyncResult> reply = new HagSkillResp.Reply();
+        reply.setIsEndSession(Boolean.TRUE);
+        HagSkillResp.Reply.Command command = new HagSkillResp.Reply.Command();
+        command.setNamespace("Charge");
+        command.setName("SyncOrderRightCommandBody");
+        OrderSyncResult orderSyncResult = new OrderSyncResult();
+        orderSyncResult.setResultCode("SUCCESS");
+        orderSyncResult.setCpOrderId(orderId);
+        command.setBody(orderSyncResult);
+        reply.setCommands(Arrays.asList(command));
+        hagSkillResp.setReply(reply);
+        return hagSkillResp;
+    }
+
+    private HagSkillResp fillFailResp(String errorCode,String errorMessage) {
+        HagSkillResp hagSkillResp = new HagSkillResp();
+        hagSkillResp.setErrorCode(errorCode);
+        hagSkillResp.setErrorMessage(errorMessage);
+        hagSkillResp.setVersion("1.0.0");
+        HagSkillResp.Reply<OrderSyncResult> reply = new HagSkillResp.Reply();
+        reply.setIsEndSession(Boolean.TRUE);
+        HagSkillResp.Reply.Command command = new HagSkillResp.Reply.Command();
+        command.setNamespace("Charge");
+        command.setName("SyncOrderRightCommandBody");
+        OrderSyncResult orderSyncResult = new OrderSyncResult();
+        orderSyncResult.setResultCode("FAIL");
+        orderSyncResult.setCpOrderId("");
+        command.setBody(orderSyncResult);
+        reply.setCommands(Arrays.asList(command));
+        hagSkillResp.setReply(reply);
+        return hagSkillResp;
+    }
+}

+ 98 - 0
src/main/java/cn/efunbox/audio/impl/hag/HagProductServiceImpl.java

@@ -0,0 +1,98 @@
+package cn.efunbox.audio.impl.hag;
+
+import cn.efunbox.audio.entity.hag.HagContent;
+import cn.efunbox.audio.entity.hag.HagProduct;
+import cn.efunbox.audio.repository.hag.HagContentRepository;
+import cn.efunbox.audio.repository.hag.HagProductRepository;
+import cn.efunbox.audio.service.hag.HagProductService;
+import cn.efunbox.audio.utils.DateUtil;
+import cn.efunbox.audio.vo.hag.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
+
+/**
+ * HagProductServiceImpl
+ * Created by xusq on 2019/12/25.
+ */
+@Service
+public class HagProductServiceImpl implements HagProductService {
+
+    @Autowired
+    private HagProductRepository hagProductRepository;
+
+    @Autowired
+    private HagContentRepository hagContentRepository;
+
+    @Override
+    public HagProductResp list(HagProductReq productReq) {
+
+        Pagination paginationReq = productReq.getPagination();
+        Integer limit = paginationReq.getLimit();
+        if (Objects.isNull(limit)) {
+            limit = 10;
+        }
+        if (limit > 10000) {
+            limit = 10000;
+        }
+        Integer start = paginationReq.getStart();
+        if (Objects.isNull(start)) {
+            start = 0;
+        }
+
+        String updateTime = productReq.getUpdateTime();
+
+
+
+        long count = hagProductRepository.countByGmtModifiedAfter(DateUtil.strToDate(updateTime));
+
+        HagProductResp hagProductResp = new HagProductResp();
+        Pagination pagination = new Pagination();
+        pagination.setTotal(count);
+
+        if (count == 0) {
+            pagination.setNext("0");
+            hagProductResp.setPagination(pagination);
+            return hagProductResp;
+        }
+
+        pagination.setNext(start + limit + "");
+
+        List<HagProduct> hagProducts = hagProductRepository.findByGmtModifiedAfterPage(DateUtil.strToDate(updateTime),start,limit);
+
+
+
+        List<String> albumIds = new ArrayList<>();
+
+        hagProducts.forEach(product -> albumIds.add(product.getAlbumId()));
+
+        List<HagContent> contentList = hagContentRepository.findByAlbumIdIn(albumIds);
+
+        Map<String,List<String>> albumContentMap = new HashMap<>();
+        contentList.forEach(content -> {
+
+            List<String> list = albumContentMap.get(content.getAlbumId());
+            if (CollectionUtils.isEmpty(list)) {
+                list = new ArrayList<>();
+            }
+            list.add(content.getId());
+            albumContentMap.remove(content.getAlbumId());
+            albumContentMap.put(content.getAlbumId(),list);
+
+        });
+
+        List<ProductVO> productVOList = new ArrayList<>();
+
+        if (!CollectionUtils.isEmpty(hagProducts)) {
+            hagProducts.forEach(product ->
+                productVOList.add(ProductConverter.productToProductVO(product,albumContentMap.get(product.getAlbumId())))
+            );
+        }
+        hagProductResp.setPagination(pagination);
+        hagProductResp.setContentItems(productVOList);
+
+        return hagProductResp;
+    }
+}

+ 5 - 4
src/main/java/cn/efunbox/audio/repository/base/ProjectSimpleJpaRepository.java

@@ -6,6 +6,7 @@
  */
 package cn.efunbox.audio.repository.base;
 
+import cn.efunbox.audio.utils.SnowflakeIdUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.data.domain.Sort;
@@ -327,7 +328,7 @@ public class ProjectSimpleJpaRepository<E, ID extends Serializable> extends Simp
 	public <S extends E> S save(S entity) {
 
 		if (entityInformation.isNew(entity)) {
-//			setSnowflakeIdId(entity);
+			setSnowflakeIdId(entity);
 			entityManager.persist(entity);
 			return entity;
 		} else {
@@ -556,7 +557,7 @@ public class ProjectSimpleJpaRepository<E, ID extends Serializable> extends Simp
 	}
 
 
-	/*protected void setSnowflakeIdId(E entity){
+	protected void setSnowflakeIdId(E entity){
 		try {
 			Field field = ReflectionUtils.findField(entity.getClass(),entityInformation.getIdAttribute().getName());
 			if(entityInformation.getIdAttribute().getType().getJavaType().getName().equals("java.lang.Long")){
@@ -565,10 +566,10 @@ public class ProjectSimpleJpaRepository<E, ID extends Serializable> extends Simp
 			}else if(entityInformation.getIdAttribute().getType().getJavaType().getName().equals("java.lang.String")) {
 				logger.debug(" uuid  entityInformation.getIdAttribute().getName() ={}",entityInformation.getIdAttribute().getName());
 				ReflectionUtils.makeAccessible(field);
-				ReflectionUtils.setField(field, entity, UUID.randomUUID().toString());
+				ReflectionUtils.setField(field, entity, SnowflakeIdUtil.getSnowflakeIdUtil().nextCode());
 			}
 		}catch (Exception e){
 			logger.error("Reflect set id 出错 mag ={}",e.getMessage(),e);
 		}
-	}*/
+	}
 }

+ 11 - 0
src/main/java/cn/efunbox/audio/repository/hag/HagAlbumRepository.java

@@ -0,0 +1,11 @@
+package cn.efunbox.audio.repository.hag;
+
+import cn.efunbox.audio.entity.hag.HagAlbum;
+import cn.efunbox.audio.repository.base.BasicRepository;
+
+/**
+ * HagAlbumRepository
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagAlbumRepository extends BasicRepository<HagAlbum> {
+}

+ 14 - 0
src/main/java/cn/efunbox/audio/repository/hag/HagContentRepository.java

@@ -0,0 +1,14 @@
+package cn.efunbox.audio.repository.hag;
+
+import cn.efunbox.audio.entity.hag.HagContent;
+import cn.efunbox.audio.repository.base.BasicRepository;
+
+import java.util.List;
+
+/**
+ * HagContentRepository
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagContentRepository extends BasicRepository<HagContent> {
+    List<HagContent> findByAlbumIdIn(List<String> albumIds);
+}

+ 12 - 0
src/main/java/cn/efunbox/audio/repository/hag/HagOrderRepository.java

@@ -0,0 +1,12 @@
+package cn.efunbox.audio.repository.hag;
+
+import cn.efunbox.audio.entity.hag.HagOrder;
+import cn.efunbox.audio.repository.base.BasicRepository;
+
+/**
+ * HagOrderRepository
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagOrderRepository extends BasicRepository<HagOrder> {
+    HagOrder findByOrderId(String hagOrderId);
+}

+ 22 - 0
src/main/java/cn/efunbox/audio/repository/hag/HagProductRepository.java

@@ -0,0 +1,22 @@
+package cn.efunbox.audio.repository.hag;
+
+import cn.efunbox.audio.entity.hag.HagProduct;
+import cn.efunbox.audio.repository.base.BasicRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * HagProductRepository
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagProductRepository extends BasicRepository<HagProduct> {
+
+    List<HagProduct> findByGmtModifiedAfter(Date date);
+
+    long countByGmtModifiedAfter(Date date);
+
+    @Query(value = "select * from hag_product where gmt_modified > ?1 order by gmt_modified LIMIT ?2,?3",nativeQuery = true)
+    List<HagProduct> findByGmtModifiedAfterPage(Date date, Integer start, Integer limit);
+}

+ 16 - 0
src/main/java/cn/efunbox/audio/service/hag/HagContentService.java

@@ -0,0 +1,16 @@
+package cn.efunbox.audio.service.hag;
+
+import cn.efunbox.audio.vo.hag.HagContentReq;
+import cn.efunbox.audio.vo.hag.HagBaseResp;
+import cn.efunbox.audio.vo.hag.HagSkillReq;
+import cn.efunbox.audio.vo.hag.HagSkillResp;
+
+/**
+ * HagContentService
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagContentService {
+    HagBaseResp list(HagContentReq hagContentReq);
+
+    HagSkillResp getResUrl(HagSkillReq skillReq);
+}

+ 12 - 0
src/main/java/cn/efunbox/audio/service/hag/HagOrderService.java

@@ -0,0 +1,12 @@
+package cn.efunbox.audio.service.hag;
+
+import cn.efunbox.audio.vo.hag.HagSkillReq;
+import cn.efunbox.audio.vo.hag.HagSkillResp;
+
+/**
+ * HagOrderService
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagOrderService {
+    HagSkillResp save(HagSkillReq skillReq);
+}

+ 13 - 0
src/main/java/cn/efunbox/audio/service/hag/HagProductService.java

@@ -0,0 +1,13 @@
+package cn.efunbox.audio.service.hag;
+
+import cn.efunbox.audio.vo.hag.HagProductReq;
+import cn.efunbox.audio.vo.hag.HagProductResp;
+
+/**
+ * HagProductService
+ * Created by xusq on 2019/12/25.
+ */
+public interface HagProductService {
+
+    HagProductResp list(HagProductReq productReq);
+}

+ 16 - 3
src/main/java/cn/efunbox/audio/utils/DateUtil.java

@@ -32,6 +32,15 @@ public class DateUtil {
         return dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
     }
 
+    /**
+     * 将日期转换为字符串
+     *
+     * @return
+     */
+    public static String dateFormatStr(Date date) {
+        return dateFormat(date, "yyyyMMddHHmmssSSS");
+    }
+
     public static String dateFormat(String pattern) {
         return dateFormat(new Date(), pattern);
     }
@@ -48,9 +57,13 @@ public class DateUtil {
      * @return
      * @throws ParseException
      */
-    public static Date StrToDate(String source) throws ParseException {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        return sdf.parse(source);
+    public static Date strToDate(String source) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+        try {
+            return sdf.parse(source);
+        } catch (ParseException e) {
+            return null;
+        }
     }
 
     public static Date StrToDate(String source, String pattern) throws ParseException {

+ 63 - 0
src/main/java/cn/efunbox/audio/vo/hag/AlbumConverter.java

@@ -0,0 +1,63 @@
+package cn.efunbox.audio.vo.hag;
+
+import cn.efunbox.audio.entity.hag.HagAlbum;
+
+import java.util.Objects;
+
+/**
+ * AlbumConverter
+ * Created by xusq on 2019/12/26.
+ */
+public class AlbumConverter {
+
+    private AlbumConverter(){}
+
+    public static ContentVO albumToContentVO(HagAlbum album){
+
+        if (Objects.isNull(album)) {
+            return null;
+        }
+
+        ContentVO contentVO = new ContentVO();
+
+        contentVO.setType("ALBUM");
+        ContentVO.Payload payload = new ContentVO.Payload();
+        payload.setAlbumCode(album.getId());
+        payload.setAlbumName(album.getAlbumName());
+        payload.setArtistNames(album.getArtistName());
+        payload.setChapter(album.getChapter());
+        payload.setRelateCpSkuId(album.getRelateCpSkuId());
+        payload.setCrowd(album.getCrowd());
+        payload.setFirstClass(album.getFirstClass());
+        payload.setSecondClass(album.getSecondClass());
+        payload.setThirdClass(album.getThirdClass());
+        payload.setSongNum(album.getSongNum());
+        payload.setStatus(album.getSongNum());
+
+        ContentVO.Payload.AlbumIconVO albumIconVO = new ContentVO.Payload.AlbumIconVO();
+
+        ContentVO.Payload.AlbumIconVO.AlbumIconImageVO largeImageVO = new ContentVO.Payload.AlbumIconVO.AlbumIconImageVO();
+        largeImageVO.setHeightPixels(album.getHeightPixels());
+        largeImageVO.setWidthPixels(album.getWidthPixels());
+        largeImageVO.setUrl(album.getLargeIcon());
+        albumIconVO.setLarge(largeImageVO);
+
+        ContentVO.Payload.AlbumIconVO.AlbumIconImageVO mediumImageVO = new ContentVO.Payload.AlbumIconVO.AlbumIconImageVO();
+        mediumImageVO.setHeightPixels(album.getHeightPixels());
+        mediumImageVO.setWidthPixels(album.getWidthPixels());
+        mediumImageVO.setUrl(album.getMediumIcon());
+        albumIconVO.setMedium(mediumImageVO);
+
+        ContentVO.Payload.AlbumIconVO.AlbumIconImageVO smallImageVO = new ContentVO.Payload.AlbumIconVO.AlbumIconImageVO();
+        smallImageVO.setHeightPixels(album.getHeightPixels());
+        smallImageVO.setWidthPixels(album.getWidthPixels());
+        smallImageVO.setUrl(album.getSmallIcon());
+        albumIconVO.setSmall(smallImageVO);
+
+        payload.setIcon(albumIconVO);
+
+        contentVO.setPayload(payload);
+
+        return contentVO;
+    }
+}

+ 29 - 0
src/main/java/cn/efunbox/audio/vo/hag/AudioUrl.java

@@ -0,0 +1,29 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * AudioUrl
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class AudioUrl implements Serializable {
+
+    private Stream stream;
+
+    public AudioUrl() {
+        this.stream = new Stream();
+    }
+
+    @Data
+    class Stream implements  Serializable {
+        private String url;
+    }
+
+    public void setUrl(String url) {
+        this.stream.setUrl(url);
+    }
+
+}

+ 42 - 0
src/main/java/cn/efunbox/audio/vo/hag/ContentConverter.java

@@ -0,0 +1,42 @@
+package cn.efunbox.audio.vo.hag;
+
+import cn.efunbox.audio.entity.hag.HagContent;
+
+import java.util.Objects;
+
+/**
+ * AlbumConverter
+ * Created by xusq on 2019/12/26.
+ */
+public class ContentConverter {
+
+    private ContentConverter(){}
+
+    public static ContentVO contentToContentVO(HagContent content){
+
+        if (Objects.isNull(content)) {
+            return null;
+        }
+
+        ContentVO contentVO = new ContentVO();
+
+        contentVO.setType("CONTENT");
+        ContentVO.Payload payload = new ContentVO.Payload();
+        payload.setAlbumCode(content.getAlbumId());
+        payload.setChapter(content.getChapter());
+        payload.setContentCode(content.getId());
+        payload.setContentName(content.getContentName());
+        payload.setCrowd(content.getCrowd());
+        payload.setFirstClass(content.getFirstClass());
+        payload.setSecondClass(content.getSecondClass());
+        payload.setThirdClass(content.getThirdClass());
+        payload.setFreeFlag(content.getFreeFlag());
+        payload.setTimeLength(content.getTimeLength());
+        payload.setStatus(content.getStatus());
+        payload.setLanguage(content.getLanguage());
+
+        contentVO.setPayload(payload);
+
+        return contentVO;
+    }
+}

+ 57 - 0
src/main/java/cn/efunbox/audio/vo/hag/ContentVO.java

@@ -0,0 +1,57 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ContentVO
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class ContentVO implements Serializable {
+
+    private Payload payload;
+    private String type;
+
+    @Data
+    public static final class Payload {
+
+        private String albumCode;
+        private String albumName;
+        private String artistNames;
+        private Integer chapter;
+        private Integer chargeType;
+        private String relateCpSkuId;
+        private String crowd;
+        private String firstClass;
+        private String secondClass;
+        private String thirdClass;
+        private Integer songNum;
+        private Integer status;
+        private AlbumIconVO icon;
+        private String contentCode;
+        private String contentName;
+        private String language;
+        private Integer freeFlag;
+        private String timeLength;
+
+        @Data
+        public static final class AlbumIconVO {
+
+            private AlbumIconImageVO large;
+            private AlbumIconImageVO medium;
+            private AlbumIconImageVO small;
+
+            @Data
+            public static final class AlbumIconImageVO {
+
+                private String heightPixels;
+                private String url;
+                private String widthPixels;
+            }
+        }
+
+
+    }
+}

+ 14 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagBaseResp.java

@@ -0,0 +1,14 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+/**
+ * HagBaseResp
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagBaseResp{
+
+    private String errorCode = "0";
+    private String errorMessage = "OK";
+}

+ 17 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagContentReq.java

@@ -0,0 +1,17 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * HagContentReq
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagContentReq implements Serializable {
+
+    private Pagination pagination;
+    private String timestamp;
+    private String dataType;
+}

+ 20 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagContentResp.java

@@ -0,0 +1,20 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * HagContentResp
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagContentResp extends HagBaseResp implements Serializable {
+
+    private String source;
+
+    private Pagination pagination;
+
+    private List<ContentVO> contentItems;
+}

+ 17 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagProductReq.java

@@ -0,0 +1,17 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * HagProductReq
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagProductReq implements Serializable {
+
+    private Pagination pagination;
+    private String updateTime;
+    private String abilityId;
+}

+ 16 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagProductResp.java

@@ -0,0 +1,16 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * HagProductResp
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagProductResp implements Serializable {
+    private Pagination pagination;
+    private List<ProductVO> contentItems;
+}

+ 114 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagSkillReq.java

@@ -0,0 +1,114 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * HagSkillReq
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagSkillReq implements Serializable {
+
+    private String version;
+    private HagSession session;
+    private Endpoint endpoint;
+    private HagHeader header;
+    private HagInquire inquire;
+
+    @Data
+    public static final class HagSession {
+        private Boolean isNew;
+        private String sessionId;
+    }
+
+    @Data
+    public static final class HagHeader {
+        private String type;
+        private String timestamp;
+    }
+
+    @Data
+    public static final class Endpoint {
+        private Auth auth;
+        private Device device;
+        private String locale;
+
+        @Data
+        public static final class Auth {
+
+            private Application application;
+            @Data
+            public static final class Application {
+                private String appId;
+            }
+        }
+        @Data
+        public static final class Device {
+            private String deviceId;
+        }
+
+    }
+
+    @Data
+    public static final class HagInquire {
+
+        private OrderRight orderRight;
+        private String inquireId;
+        private Intent intent;
+
+        @Data
+        public static final class OrderRight {
+
+            private String skuId;
+
+            private String amount;
+
+            private String currency;
+
+            private String orderId;
+
+            private String boughtTime;
+
+            private List<ResourceRight> resourceRights;
+
+
+            @Data
+            public static final class ResourceRight {
+
+                private String resourceType = "ADBK";
+                private String resourceId;
+            }
+        }
+
+        @Data
+        public static final class Intent {
+
+            private String apiKey;
+
+            private Slots slots;
+
+            @Data
+            public static final class Slots {
+                private ContentCode albumCode;
+                private ContentCode contentCode;
+                @Data
+                public static final class ContentCode {
+                    private String name;
+                    private List<Value> values;
+
+                    @Data
+                    public static final class Value {
+                        private String real;
+                    }
+                }
+
+            }
+        }
+
+    }
+
+
+}

+ 51 - 0
src/main/java/cn/efunbox/audio/vo/hag/HagSkillResp.java

@@ -0,0 +1,51 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * HagSkillResp
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class HagSkillResp extends HagBaseResp implements Serializable {
+
+    private String version;
+
+    private Reply reply;
+
+    @Data
+    public static final class Reply<T> implements Serializable {
+
+        private Boolean isEndSession;
+        private List<Command<T>> commands;
+
+        @Data
+        public static final class Command<T> implements Serializable {
+
+            private Head head;
+            private T body;
+
+            public Command(){
+                this.head = new Head();
+            }
+
+            @Data
+            public class Head implements Serializable {
+                private String namespace;
+                private String name;
+            }
+
+            public void setNamespace(String namespace) {
+                head.setNamespace(namespace);
+            }
+
+            public void setName(String name) {
+                head.setName(name);
+            }
+        }
+
+    }
+}

+ 16 - 0
src/main/java/cn/efunbox/audio/vo/hag/OrderSyncResult.java

@@ -0,0 +1,16 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * OrderSyncResult
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class OrderSyncResult implements Serializable {
+
+    private String resultCode;
+    private String cpOrderId;
+}

+ 18 - 0
src/main/java/cn/efunbox/audio/vo/hag/Pagination.java

@@ -0,0 +1,18 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Pagination
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class Pagination implements Serializable{
+
+    private String next;
+    private Long total;
+    private Integer limit;
+    private Integer start;
+}

+ 71 - 0
src/main/java/cn/efunbox/audio/vo/hag/ProductConverter.java

@@ -0,0 +1,71 @@
+package cn.efunbox.audio.vo.hag;
+
+import cn.efunbox.audio.entity.hag.HagProduct;
+import cn.efunbox.audio.utils.DateUtil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * AlbumConverter
+ * Created by xusq on 2019/12/26.
+ */
+public class ProductConverter {
+
+    private ProductConverter(){}
+
+    public static ProductVO productToProductVO(HagProduct product,List<String> contentIds){
+
+        if (Objects.isNull(product)) {
+            return null;
+        }
+
+        ProductVO productVO = new ProductVO();
+        ProductVO.SkuInfo skuInfo = new ProductVO.SkuInfo();
+        skuInfo.setAbilityId(product.getAbilityId());
+        skuInfo.setCpSkuId(product.getId());
+        skuInfo.setSkuName(product.getSkuName());
+        skuInfo.setDescription(product.getDescription());
+        skuInfo.setSkuType(product.getSkuType());
+        skuInfo.setPriceController(product.getPriceController());
+        skuInfo.setRightController(product.getRightController());
+        skuInfo.setSkuReleaseState(product.getSkuReleaseState());
+
+        productVO.setSkuInfo(skuInfo);
+
+        ProductVO.Price productPrice = new ProductVO.Price();
+
+        ProductVO.Price.TimeFilter timeFilter = new ProductVO.Price.TimeFilter();
+        timeFilter.setBeginTime(product.getBeginTime());
+        timeFilter.setEndTime(product.getEndTime());
+
+        productPrice.setCurrency(product.getCurrency());
+        productPrice.setPromotion(product.getPromotion());
+        productPrice.setPriceGroupDescription(product.getPriceGroupDescription());
+        productPrice.setTimeFilter(timeFilter);
+
+        ProductVO.Price.PriceItem priceItem = new ProductVO.Price.PriceItem();
+        priceItem.setAmount(product.getAmount());
+        priceItem.setOriginalAmount(product.getOriginalAmount());
+
+        productPrice.setPricesItems(Arrays.asList(priceItem));
+
+        productVO.setPrices(Arrays.asList(productPrice));
+
+
+        productVO.setUpdateTime(DateUtil.dateFormatStr(product.getGmtModified()));
+
+        List<ProductVO.ResourceRight> resourceRights = new ArrayList<>();
+        contentIds.forEach(id -> {
+            ProductVO.ResourceRight resourceRight = new ProductVO.ResourceRight();
+            resourceRight.setResourceType(product.getResourceType());
+            resourceRight.setResourceId(id);
+            resourceRights.add(resourceRight);
+        });
+        productVO.setResourceRights(resourceRights);
+
+        return productVO;
+    }
+}

+ 67 - 0
src/main/java/cn/efunbox/audio/vo/hag/ProductVO.java

@@ -0,0 +1,67 @@
+package cn.efunbox.audio.vo.hag;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ProductVO
+ * Created by xusq on 2019/12/25.
+ */
+@Data
+public class ProductVO implements Serializable {
+
+    private SkuInfo skuInfo;
+
+    private List<Price> prices;
+
+    private List<ResourceRight> resourceRights;
+
+    private String updateTime;
+
+    @Data
+    public static final class SkuInfo {
+
+        private String abilityId;
+        private String cpSkuId;
+        private String skuName;
+        private String description;
+        private String skuType;
+        private String rightController;
+        private String priceController;
+        private String skuReleaseState;
+
+    }
+
+    @Data
+    public static final class Price {
+
+        private String priceGroupDescription;
+        private String promotion;
+        private String currency;
+        private List<PriceItem> pricesItems;
+        private TimeFilter timeFilter;
+
+        @Data
+        public static final class PriceItem  {
+
+            private String originalAmount;
+            private String amount;
+        }
+
+        @Data
+        public static final class TimeFilter {
+
+            private String beginTime;
+            private String endTime;
+        }
+    }
+
+    @Data
+    public static final class ResourceRight  {
+
+        private String resourceType = "ADBK";
+        private String resourceId;
+    }
+}