3
0

244 Incheckningar b1407d8849 ... 1c4c12f106

Upphovsman SHA1 Meddelande Datum
  guozhaoshun 1c4c12f106 fix 6 år sedan
  guozhaoshun 925d3e0715 fix resource/list find by type 6 år sedan
  guozhaoshun a3c1fea9d7 API support audioImg resource 6 år sedan
  xuchaolang ce6c7b8208 Merge branch 'master' of http://gogs.efunbox.cn:3000/Rankin/rankin 6 år sedan
  xuchaolang 4e69f04b87 Merge branch 'release/1.0.0' 6 år sedan
  guozhaoshun 0eea46bf57 courseware support audioImg resource 6 år sedan
  guozhaoshun 81538f7bf4 courseware support audioImg resource 6 år sedan
  guozhaoshun 21518e8d80 fix url AudioImg 6 år sedan
  guozhaoshun bdc6143ab5 Merge branch 'dev20180611' 6 år sedan
  guozhaoshun 78120e41c4 support AudioImg 6 år sedan
  guozhaoshun af8fd89f3b UserTag support copy from tag 6 år sedan
  guozhaoshun 2e09eec0bf support AudioImg 6 år sedan
  guozhaoshun c18b9479e5 CMS add AudioImg module 6 år sedan
  guozhaoshun 4ffe74f10f support AudioImg 6 år sedan
  guozhaoshun 2bce02f682 fix change video resource url | https:// 6 år sedan
  guozhaoshun 1e5447c99c fix change video resource url | https:// 6 år sedan
  guozhaoshun 8c6c5e2f6f fix 6 år sedan
  guozhaoshun 84fcec2c52 fix 6 år sedan
  guozhaoshun addf733cef optimize change video resource url | https:// 6 år sedan
  guozhaoshun e25a1087b2 API support UserTag UserRecommend module 6 år sedan
  guozhaoshun c1cafa0dde CMS support UserTag UserRecommend module 6 år sedan
  guozhaoshun b7f7ae4fbd CMS support UserTag UserRecommend module 6 år sedan
  guozhaoshun 68e668299a change ItemController package 6 år sedan
  guozhaoshun 179ebf9818 support UserTag UserRecommend module 6 år sedan
  guozhaoshun 53870c5081 add UserTag UserRecommend module 6 år sedan
  guozhaoshun 9a91434191 add UserTag module 6 år sedan
  guozhaoshun 3f669d5d8d add UserRecommend module 6 år sedan
  guozhaoshun f342259060 UserTag UserRecommend UserTagProductRelation 6 år sedan
  guozhaoshun bcf2a31407 img resource replace the blank space 6 år sedan
  guozhaoshun f222501fd2 optimize poster 6 år sedan
  guozhaoshun 13173f2b4d optimize poster 6 år sedan
  guozhaoshun e9a0dde366 optimize 6 år sedan
  guozhaoshun bac3f345a1 video list sort by createTime DESC 6 år sedan
  guozhaoshun 7553ae7a1e video list sort by updateTime DESC 6 år sedan
  guozhaoshun 394cf45ea7 video list sort by createTime DESC 6 år sedan
  guozhaoshun 4e742c737a restore file 6 år sedan
  guozhaoshun 1549a46a4d fix tag support update typeCode,merchant; 6 år sedan
  guozhaoshun 33b5c15d60 change video resource url | https:// 6 år sedan
  guozhaoshun 506effdb57 change video resource url | https:// 6 år sedan
  guozhaoshun 9e8234ef28 terminalUser add deviceStatus 6 år sedan
  guozhaoshun 816b823469 change video resource url | https:// 6 år sedan
  guozhaoshun 6272cefc73 fix optimize the recommended course 6 år sedan
  guozhaoshun b9de4f6722 optimize the recommended course 6 år sedan
  guozhaoshun 3ffe8c3f5e fix updateResource 6 år sedan
  guozhaoshun f3fb2065fc fix updateResource 6 år sedan
  guozhaoshun a387a6d808 fix updateResource 6 år sedan
  guozhaoshun f477dadf3d fix updateResource 6 år sedan
  guozhaoshun 9311a32594 fix updateResource 6 år sedan
  guozhaoshun f9b5490ab0 fix updateResource 6 år sedan
  guozhaoshun 9d1b06ca5e fix poster 6 år sedan
  guozhaoshun b1444f5476 fix poster 6 år sedan
  guozhaoshun 6bdbf70ab7 fix picture list sort by gmtModified DESC 6 år sedan
  guozhaoshun f7dd51ab62 from the update resource document; 1 video | 0 audio 6 år sedan
  xuchaolang 9933ecdbfe Merge branch 'fix_bug.0525' 6 år sedan
  xuchaolang 28d6e829ce Merge branch 'master' of http://gogs.efunbox.cn:3000/Rankin/rankin 6 år sedan
  xuchaolang 56ef2ae8da Fix bug, check idList if empty while find in repo 6 år sedan
  guozhaoshun 1a88c54723 fix tag support update typeCode,merchant; 6 år sedan
  guozhaoshun 7d2928ebf6 fix poster 6 år sedan
  guozhaoshun c8a3defbf6 fix poster 6 år sedan
  guozhaoshun fef1be4ad4 fix saveRemoteResource 6 år sedan
  guozhaoshun 2232e69783 fix poster 6 år sedan
  guozhaoshun d64df3cd1d fix poster 6 år sedan
  guozhaoshun c6323af106 Merge branch 'dev001' 6 år sedan
  xuchaolang 33f4ed14cc cms-web-api, /resource PUT, id pass in body 6 år sedan
  xuchaolang 42d7a7fde9 web-api, /package/<pid>, return goods 6 år sedan
  xuchaolang 80337f7aee Merge branch 'master' of http://gogs.efunbox.cn:3000/Rankin/rankin 6 år sedan
  xuchaolang e0359d50e8 Accomplish /user/messages/productExpiredAlert, /package/<pid> 6 år sedan
  xuchaolang 4f2db3edf5 Merge branch 'master' of http://gogs.efunbox.cn:3000/Rankin/rankin 6 år sedan
  xuchaolang a6153d0f3e ProductService.getRelatedPackages, filter offline pkgs by status 6 år sedan
  xuchaolang 5b06485ee2 return code in /product/<pid>/relatedPkg, move shopQR into Goods 6 år sedan
  xuchaolang a6a6614946 ProductService.getRelatedPkgs, set goods 6 år sedan
  xuchaolang 4c631931cd ProductService.getRelatedPackges, check pkgId but not productId while scaning relatedPkgs 6 år sedan
  xuchaolang 6991a10393 ProductService, move ProductController from controller.cms package to controller package 6 år sedan
  xuchaolang c6b6a14078 Accomplish Api /product/<pid>/relatedPkg 6 år sedan
  xuchaolang e06c345575 Add /merchant prefix to Api /merchant/<merchantId>/posters 6 år sedan
  xuchaolang cdc99ef674 service /user/<uid>/product/valid Resturn [] while user have no valid products 6 år sedan
  xuchaolang 9e62064f53 Print product Log while get valid product from service 6 år sedan
  xuchaolang 9ca21fe5ad Print User 6 år sedan
  xuchaolang 6d90ff45c9 Temporarily add /user/product/valid in product service 6 år sedan
  xuchaolang 027257e268 Merge branch 'dev.3.0' 6 år sedan
  guozhaoshun 279f88c027 change TagTypeController /controller/app to /controller/ 6 år sedan
  guozhaoshun f3ca8a50f5 add support video upload 6 år sedan
  guozhaoshun d8011a4be3 tag create/update support tagType 6 år sedan
  guozhaoshun 2f51c018ab tagType 6 år sedan
  guozhaoshun 3d0665565c Tag create/update support typeCode 6 år sedan
  guozhaoshun 671925bb7c merchant product name change source 6 år sedan
  guozhaoshun 4f4b2067cd add /tagType/{code} 6 år sedan
  guozhaoshun 150ce1a65d add 6 år sedan
  guozhaoshun ebb60529f4 add 6 år sedan
  xuchaolang fdcb5a30ea Fix getTagType request mapping value 6 år sedan
  xuchaolang bb4f968336 restore pom.xml 6 år sedan
  xuchaolang c3df828bef check if sign is empty while get it from header 6 år sedan
  xuchaolang 00103a8f10 use Authentication while sign not Exist, For compatition with 2.x app verions 6 år sedan
  guozhaoshun e35f33f816 recover yml 6 år sedan
  guozhaoshun 967949bded test commit 6 år sedan
  guozhaoshun eec791684a Merge remote-tracking branch 'origin/master' into dev 6 år sedan
  guozhaoshun 75b5a94017 repair bug 6 år sedan
  xuchaolang e554490545 skip shelf in relatedSupport 6 år sedan
  xuchaolang 0ee63c8bde set dateDesc,openTime,closeTime 6 år sedan
  xuchaolang 1cf7041a5d fix /training/{id} request map bug 6 år sedan
  xuchaolang a5feaf286d change service api /app/training/{id} to /training/{id} 6 år sedan
  xuchaolang d55840f63b TrainingController add log 6 år sedan
  xuchaolang 150e531e17 check productid is null in findByIds 6 år sedan
  xuchaolang c01366a887 fix training update 6 år sedan
  xuchaolang 926e20469b return Training type in ProductService 6 år sedan
  xuchaolang c35e78559c training.get only return training entity 6 år sedan
  xuchaolang ba6772a241 add traing cms api 6 år sedan
  xuchaolang 2a2b0f02ff add traing cms api 6 år sedan
  xuchaolang 0839854e30 加入/training/<id>接口 6 år sedan
  xuchaolang 1c593901be add course title to course/lesson 6 år sedan
  huodongdong 8fb41e9d7e fix 6 år sedan
  huodongdong 33dfe9086d fix white user search 6 år sedan
  huodongdong 12ee9bd962 fix white user search request body 6 år sedan
  huodongdong 46bb611eac fix 6 år sedan
  huodongdong a7c33c52fe fix feign pathvariable error 6 år sedan
  huodongdong 7450e47d4f fix 6 år sedan
  huodongdong c9ecf201a9 add merchantId of white user 6 år sedan
  huodongdong 8bb7d1122a add merchant name of white user 6 år sedan
  huodongdong 50a2dd42d0 add api binder cms white user 6 år sedan
  huodongdong ac39c034af add white user model 6 år sedan
  huodongdong 2798495bf0 add white user table 6 år sedan
  huodongdong e03a581e5a fix 6 år sedan
  huodongdong de4cb52101 cms log level 6 år sedan
  huodongdong 445c3c5ae5 cms delete redis app login data 6 år sedan
  huodongdong 83fe73e0b3 add cms unbind device 6 år sedan
  huodongdong db8ea62107 fix tag product sort bug 6 år sedan
  huodongdong aeee85f461 add timeout session 6 år sedan
  huodongdong 973392ebf0 fix 6 år sedan
  huodongdong 6757e24f70 remove session 6 år sedan
  huodongdong 938ebbaf0c fix lesson search 6 år sedan
  huodongdong f37e9b6eb4 fix lesson empty exception 6 år sedan
  huodongdong c635cbc670 add log 6 år sedan
  huodongdong 9edd40418a fix 6 år sedan
  huodongdong 9637fee49d fix group code 6 år sedan
  huodongdong 27c762f9a1 add field of merchant simple 6 år sedan
  huodongdong 473394bd12 fix 6 år sedan
  huodongdong 9e1fe10b8f fix video url error 6 år sedan
  huodongdong 190f0e601b fix bing terminal field null and log error 6 år sedan
  huodongdong c27e8c256a add web login force 6 år sedan
  huodongdong 73c7c88a25 fix terminal name 6 år sedan
  huodongdong 19d3c3e4f7 modifiy terminal name to campusName + terminalName 6 år sedan
  huodongdong fb221ea346 fix campus name remove - 6 år sedan
  huodongdong c561799f73 fix 6 år sedan
  huodongdong e9f308a413 fix 6 år sedan
  huodongdong 5bc08795d5 fix 6 år sedan
  huodongdong 69fe592df2 fix 6 år sedan
  huodongdong 74f882a885 完成pushmsg push 6 år sedan
  huodongdong 9585210305 complete app api 6 år sedan
  huodongdong ed9f6583d9 fix device_code null 6 år sedan
  huodongdong 8b7fc151e6 refresh token not signature 6 år sedan
  huodongdong 53d28c7191 fix api recommend 6 år sedan
  huodongdong 1c36c05943 fix recommend 6 år sedan
  huodongdong 9bca91cc2a add refresh token 6 år sedan
  huodongdong 05927ed824 remove test intercepter, same the terminal user id 6 år sedan
  huodongdong b96f1f4298 fix 6 år sedan
  huodongdong 5913d3072d valid login 6 år sedan
  huodongdong 9c3aaf41f5 fix 6 år sedan
  huodongdong b300458a22 fix 6 år sedan
  huodongdong 5a764d1100 fix 6 år sedan
  huodongdong c817e33b16 add status terminal user filter search 6 år sedan
  huodongdong 4c5881db37 add product merchantId when search 6 år sedan
  huodongdong ca84c38189 add tag sort 6 år sedan
  huodongdong f813b6b318 deploy 6 år sedan
  huodongdong cfbbf4c3c8 fix header and option request bug 6 år sedan
  huodongdong 61522ff50e fix 6 år sedan
  huodongdong 1f54a29d64 fix receive 6 år sedan
  huodongdong 0a7d232e36 web api stash and fix charge 6 år sedan
  huodongdong 8dfc0d3ea3 fix 6 år sedan
  huodongdong b1908c474c add code and name order goods 6 år sedan
  huodongdong 4f2560e16a order detail api 6 år sedan
  huodongdong 1cd5f51282 fix transactional 6 år sedan
  huodongdong 74b94275b4 add charge 6 år sedan
  huodongdong a71b1653d0 add charge api 6 år sedan
  huodongdong 9f8ce28658 fix MySQL5DialectUTF8 6 år sedan
  huodongdong 29fbd94fa5 fix create table utf8 6 år sedan
  huodongdong 23569b09dd fix 6 år sedan
  huodongdong 2e49f4d8bd fix 6 år sedan
  huodongdong 42bb7557bd modified yml config 6 år sedan
  huodongdong 54ebcd3e0c fix 6 år sedan
  huodongdong 43b3b23379 add merchantPrice of pakcageProductVo 6 år sedan
  huodongdong af3de4ab65 add merchant price of product in package 6 år sedan
  huodongdong c73ae0883f add category of courseware 6 år sedan
  huodongdong e3bc647fdb fix 6 år sedan
  huodongdong 504b10c476 config test 6 år sedan
  huodongdong 4ddca8254e profile act 6 år sedan
  huodongdong cc65c80444 test 6 år sedan
  huodongdong 7ed2337ea0 add sub title 6 år sedan
  huodongdong c36277375e modified cancel order api 6 år sedan
  huodongdong 08bd31ccdf order search to post feign 6 år sedan
  huodongdong c2cabfc0ac add goods type auto 6 år sedan
  huodongdong 6b8d5122d3 same order status and order detail status 6 år sedan
  huodongdong 75c5cd1338 fix 7 år sedan
  huodongdong 4ef6d6bb47 add terminal user address 7 år sedan
  huodongdong aa34b15a14 add merchant product list package info 7 år sedan
  huodongdong 049d6eb4c8 add oderdetail and snapshot search api 7 år sedan
  huodongdong d6aef08774 fix log 7 år sedan
  huodongdong 30ccda2563 complete task 7 år sedan
  huodongdong 4a50d6038c size 7 år sedan
  huodongdong db4847d06a fix name 7 år sedan
  huodongdong aa15ceede3 fix 7 år sedan
  huodongdong b28be55f44 add status of goods package when put on sale 7 år sedan
  huodongdong d20807fba1 fix 7 år sedan
  huodongdong 072ea17be3 add sort when put on sale product 7 år sedan
  huodongdong 21aa6d4df2 add cms merchantProduct 7 år sedan
  huodongdong 466c98dfe4 add package update and on sale goods relation add and update 7 år sedan
  huodongdong fc7f9598dd fix lesson api cms 7 år sedan
  huodongdong bd88622c1f fix 7 år sedan
  huodongdong 503a8f4481 fix lesson warelist 7 år sedan
  huodongdong 3c50ba20cd add tag and group info 7 år sedan
  huodongdong ea7d4da2c7 no 7 år sedan
  huodongdong 72c1434dc3 @Modifying remove clearAutomatically=true 7 år sedan
  huodongdong 72ae842ea9 add status product create 7 år sedan
  huodongdong f99e29af74 fix 7 år sedan
  huodongdong 47afdb4c32 product search string format error 7 år sedan
  huodongdong 6b421cec99 fix support 7 år sedan
  huodongdong 446296f16f fix ware data structure 7 år sedan
  huodongdong 187f7f622b 订单分拆初版 7 år sedan
  huodongdong ac7e27719b modified table name and createtime 7 år sedan
  huodongdong 97e636322c api web test remove token check 7 år sedan
  huodongdong 012209cc64 fix resource name 7 år sedan
  huodongdong 723cceb4bb fix 7 år sedan
  huodongdong 3214cf4a72 fix pom config 7 år sedan
  huodongdong 76798122fa fix pom config 7 år sedan
  huodongdong 7f082bf582 fix pom build config 7 år sedan
  huodongdong 120f9de598 tmp 7 år sedan
  huodongdong 1fe47abcc0 complete pay ok 7 år sedan
  huodongdong 2bd43244b7 save 7 år sedan
  huodongdong 857b5bb181 add package 7 år sedan
  huodongdong 3b6e896596 complete product and goods recoding 7 år sedan
  huodongdong 225693bfc7 product idea period 1 7 år sedan
  huodongdong f15b6dbe00 stash 7 år sedan
  huodongdong bbb144a1c9 campus and termianl user complete 7 år sedan
  huodongdong 2ddd9d23e8 add cms web 7 år sedan
  huodongdong 31ca7939f3 tag 7 år sedan
  huodongdong 98f4431dcf version 1.0 dev 7 år sedan
  huodongdong 1d57b2f9f0 shit commit and reset 7 år sedan
  huodongdong 34a6cad675 nothing 7 år sedan
  huodongdong d69395e6a7 version 1.1: id string and relation; hibernate relation 7 år sedan
  huodongdong e428f275b5 resource service complete 7 år sedan
  huodongdong 2f57ba34a8 first version 7 år sedan
  huodongdong 05dfbac277 fix 7 år sedan
  huodongdong bdc9fa3299 rename 7 år sedan
  huodongdong 08fb34581d add ignore 7 år sedan
  huodongdong dd01ec7ace first framework 7 år sedan
21 ändrade filer med 631 tillägg och 36 borttagningar
  1. 4 0
      rankin-api-web/src/main/java/cn/rankin/apiweb/service/resource/ResourceService.java
  2. 31 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/resource/ResourceController.java
  3. 30 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/user/UserTagController.java
  4. 3 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/TagService.java
  5. 3 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/proxy/WareServiceProxy.java
  6. 12 0
      rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/resource/ResourceService.java
  7. 2 0
      rankin-common-utils/src/main/java/cn/rankin/common/utils/constant/ResourceType.java
  8. 38 0
      rankin-common-utils/src/main/java/cn/rankin/common/utils/vo/resource/Resource.java
  9. 4 0
      rankin-common-utils/src/main/java/cn/rankin/common/utils/vo/resource/ResourceVo.java
  10. 6 0
      rankin-data-api/src/main/java/cn/rankin/data/api/app/vo/ResourceItemVo.java
  11. 56 0
      rankin-data-api/src/main/java/cn/rankin/data/api/resource/dto/AudioImgDTO.java
  12. 51 0
      rankin-data-api/src/main/java/cn/rankin/data/api/resource/entity/AudioImg.java
  13. 6 0
      rankin-data-api/src/main/java/cn/rankin/data/api/resource/entity/Resource.java
  14. 5 6
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/ItemControllerV0.java
  15. 5 0
      rankin-product-service/src/main/java/cn/rankin/productservice/controller/cms/TagController.java
  16. 9 0
      rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java
  17. 173 1
      rankin-resource-service/src/main/java/cn/rankin/resourceservice/controller/ResourceController.java
  18. 1 1
      rankin-resource-service/src/main/java/cn/rankin/resourceservice/dto/ResourceRemote.java
  19. 20 0
      rankin-resource-service/src/main/java/cn/rankin/resourceservice/repository/AudioImgRepository.java
  20. 77 0
      rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/AudioImgService.java
  21. 95 28
      rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/ResourceService.java

+ 4 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/service/resource/ResourceService.java

@@ -80,6 +80,10 @@ public class ResourceService {
                     resourceItemVo.setType(resourceType);
                     if (resourceType.equals(ResourceType.VIDEO)) {
                         type = ResourceType.VIDEO;
+                    }else if (resourceType.equals(ResourceType.AUDIO_IMG)) {
+                        type = ResourceType.AUDIO_IMG;
+                        resourceItemVo.setImg(resourceVo.getImg());
+                        resourceItemVo.setAudio(resourceVo.getAudio());
                     }
                     resourceVoList.add(resourceItemVo);
                 }

+ 31 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/resource/ResourceController.java

@@ -8,6 +8,8 @@ import cn.rankin.common.utils.dto.resource.ResourceDTO;
 import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
 import cn.rankin.common.utils.util.BeanUtil;
 import cn.rankin.common.utils.vo.resource.ResourceVo;
+import cn.rankin.data.api.resource.dto.AudioImgDTO;
+import cn.rankin.data.api.resource.entity.AudioImg;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -42,4 +44,33 @@ public class ResourceController {
         }
         return resourceService.update(id,resourceDTO);
     }
+
+
+    //创建有声读物
+    @RequestMapping(value="/audioImg",method = RequestMethod.POST)
+    public APIResult<AudioImg> createAudioImg(@RequestBody AudioImgDTO dto) {
+        AudioImg audioImg = resourceService.createAudioImg(dto);
+        if(null == audioImg){
+            return APIResult.error(CmsWebAPICode.PARAMETER_ERROR);
+        }else{
+            return APIResult.ok(audioImg);
+        }
+    }
+
+    //修改有声读物
+    @RequestMapping(value="/audioImg",method = RequestMethod.PUT)
+    public APIResult<AudioImg> updateAudioImg(@RequestBody AudioImgDTO dto) {
+        String id = dto.getId();
+        if (null == id || id.isEmpty()){
+            log.error("id Is Null");
+            return APIResult.error(CmsWebAPICode.PARAMETER_ERROR);
+        }
+
+        AudioImg audioImg = resourceService.updateAudioImg(dto);
+        if(null == audioImg){
+            return APIResult.error(CmsWebAPICode.PARAMETER_ERROR);
+        }else{
+            return APIResult.ok(audioImg);
+        }
+    }
 }

+ 30 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/controller/user/UserTagController.java

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

+ 3 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/TagService.java

@@ -26,4 +26,7 @@ public interface TagService {
 
     @RequestMapping(value = "/tag/{id}", method = RequestMethod.GET)
     APIResult<TagVo> getTag(@PathVariable("id") String id);
+
+    @RequestMapping(value = "/tag/v2/{id}", method = RequestMethod.GET)
+    TagVo getTagInfo(@PathVariable("id") String id);
 }

+ 3 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/product/proxy/WareServiceProxy.java

@@ -156,9 +156,12 @@ public class WareServiceProxy {
             if (resourceVo != null) {
                 resourceVoList.add(resourceVo);
             }
+
         }
+
         courseWareVo.setResourceList(resourceVoList);
 
         return courseWareVo;
     }
+
 }

+ 12 - 0
rankin-cms-web/src/main/java/cn/rankin/cmsweb/service/resource/ResourceService.java

@@ -4,6 +4,8 @@ import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.common.utils.dto.resource.ResourceDTO;
 import cn.rankin.common.utils.vo.resource.ResourceVo;
+import cn.rankin.data.api.resource.dto.AudioImgDTO;
+import cn.rankin.data.api.resource.entity.AudioImg;
 import cn.rankin.data.api.resource.vo.OSSSignature;
 import org.springframework.cloud.netflix.feign.FeignClient;
 import org.springframework.web.bind.annotation.*;
@@ -28,5 +30,15 @@ public interface ResourceService {
 
     @RequestMapping(value = "/resource/{id}", method = RequestMethod.PUT)
     APIResult<ResourceVo> update(@PathVariable("id") String id, @RequestBody ResourceDTO resourceDTO);
+
+    //有声读物
+    @RequestMapping(value = "/resource/audioImg", method = RequestMethod.POST)
+    AudioImg createAudioImg(@RequestBody AudioImgDTO dto);
+
+    @RequestMapping(value = "/resource/audioImg", method = RequestMethod.PUT)
+    AudioImg updateAudioImg(@RequestBody AudioImgDTO dto);
+
+    @RequestMapping(value = "/resource/audioImg/batch", method = RequestMethod.GET)
+    Map<String, ResourceVo> getAudioImgBatch(@RequestParam("ids") List<String> ids);
 }
 

+ 2 - 0
rankin-common-utils/src/main/java/cn/rankin/common/utils/constant/ResourceType.java

@@ -9,4 +9,6 @@ public class ResourceType {
     public final static int LIVE = 2;
 
     public final static int IMG = 3;
+
+    public final static int AUDIO_IMG = 4;
 }

+ 38 - 0
rankin-common-utils/src/main/java/cn/rankin/common/utils/vo/resource/Resource.java

@@ -0,0 +1,38 @@
+package cn.rankin.common.utils.vo.resource;
+
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@ToString
+public class Resource implements Serializable {
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private Integer type;
+
+    private String format;
+
+    private String quality;
+
+    private Long size;
+
+    private String path;
+
+    private BaseStatusEnum status;
+
+    private Date gmtCreated;
+
+    private Date gmtModified;
+
+    private String url;
+
+}

+ 4 - 0
rankin-common-utils/src/main/java/cn/rankin/common/utils/vo/resource/ResourceVo.java

@@ -35,4 +35,8 @@ public class ResourceVo implements Serializable {
 
     private String url;
 
+    private Resource img;
+
+    private Resource audio;
+
 }

+ 6 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/app/vo/ResourceItemVo.java

@@ -1,5 +1,6 @@
 package cn.rankin.data.api.app.vo;
 
+import cn.rankin.common.utils.vo.resource.Resource;
 import lombok.Data;
 import lombok.ToString;
 
@@ -14,4 +15,9 @@ public class ResourceItemVo implements Serializable {
     private Integer type;
 
     private String url;
+
+    private Resource img;
+
+    private Resource audio;
+
 }

+ 56 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/resource/dto/AudioImgDTO.java

@@ -0,0 +1,56 @@
+package cn.rankin.data.api.resource.dto;
+
+import cn.rankin.common.utils.enums.BaseStatusEnum;
+import cn.rankin.data.api.resource.entity.Resource;
+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;
+
+@Data
+@ToString
+public class AudioImgDTO implements Serializable {
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private Integer type;       //type,{4}, 表示{有声读物}
+
+    private BaseStatusEnum status;
+
+    private Resource img;
+
+    private String imgPath;
+
+    private String imgFormat;
+
+    private String imgQuality;
+
+    private Long imgSize;
+
+    private String imgUrl;
+
+
+    private Resource audio;
+
+    private String audioPath;
+
+    private String audioFormat;
+
+    private String audioQuality;
+
+    private Long audioSize;
+
+    private String audioUrl;
+
+
+
+
+}

+ 51 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/resource/entity/AudioImg.java

@@ -0,0 +1,51 @@
+package cn.rankin.data.api.resource.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;
+
+@Data
+@ToString
+@Entity
+@Table(name = "r_audio_img")
+@DynamicInsert
+@DynamicUpdate
+public class AudioImg implements Serializable {
+
+    @Id
+    private String id;
+
+    @Column
+    private String code;
+
+    @Column
+    private String name;
+
+    @Column
+    private Integer type;       //type,{4}, 表示{有声读物}
+
+    @Column(name = "img_id")
+    private String imgId;
+
+    @Column(name = "audio_id")
+    private String audioId;
+
+    @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;
+
+}

+ 6 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/resource/entity/Resource.java

@@ -58,4 +58,10 @@ public class Resource implements Serializable {
 
     @Transient
     private String url;
+
+    @Transient
+    private Resource img;
+
+    @Transient
+    private Resource audio;
 }

+ 5 - 6
rankin-product-service/src/main/java/cn/rankin/productservice/controller/app/ItemControllerV0.java

@@ -10,6 +10,11 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+/**
+ * 已弃用,
+ *
+ * 以 cn.rankin.productservice.controller.ItemController 替代
+ */
 @RestController
 @RequestMapping(value = "/v0/app/item")
 public class ItemControllerV0 {
@@ -33,10 +38,4 @@ public class ItemControllerV0 {
         return itemService.findPageByTagIdAndPids(merchantId, tagId, productIdList, pageNo, pageSize);
     }
 
-    @RequestMapping(value = "/pids", method = RequestMethod.POST)
-    public List<ItemVo> findItemByPids(@RequestBody List<String> productIdList, @RequestParam("merchantId") String merchantId) {
-        List<ItemVo> itemVoList = itemService.findByIds(merchantId,productIdList);
-        return itemVoList;
-    }
-
 }

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

@@ -57,4 +57,9 @@ public class TagController {
         return tagService.delete(tagId);
     }
 
+    @RequestMapping(value = "/v2/{tagId}", method = RequestMethod.GET)
+    public Tag getTagInfo(@PathVariable("tagId") String tagId) {
+        return tagService.getTagInfo(tagId);
+    }
+
 }

+ 9 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java

@@ -217,4 +217,13 @@ public class TagService {
             tag.setSort(index);
         }
     }
+
+    public Tag getTagInfo(String tagId) {
+        Tag tag = tagRepository.find(tagId);
+        String merchantId = tag.getMerchantId();
+
+        List<MerchantProduct> merchantProductList = getMerchantProductList(tagId, merchantId);
+        tag.setProductList(merchantProductList);
+        return tag;
+    }
 }

+ 173 - 1
rankin-resource-service/src/main/java/cn/rankin/resourceservice/controller/ResourceController.java

@@ -5,14 +5,21 @@ import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
 import cn.rankin.common.utils.constant.ResourceType;
 import cn.rankin.common.utils.dto.resource.ResourceSearchDTO;
+import cn.rankin.common.utils.util.DateUtil;
+import cn.rankin.data.api.resource.dto.AudioImgDTO;
+import cn.rankin.data.api.resource.entity.AudioImg;
 import cn.rankin.data.api.resource.entity.Resource;
+import cn.rankin.resourceservice.service.AudioImgService;
 import cn.rankin.resourceservice.service.ResourceService;
 import com.alibaba.fastjson.JSON;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -24,6 +31,9 @@ public class ResourceController {
     @Autowired
     private ResourceService resourceService;
 
+    @Autowired
+    private AudioImgService audioImgService;
+
     public static String HTTP_VIDEO_DOMAIN = "http://efunvideo.ai160.com";
     public static String LJ_VIDEO_DOMAIN = "http://ljvideo.ai160.com";
 
@@ -39,10 +49,11 @@ public class ResourceController {
         }
 
         Integer type = resourceSearchDTO.getType();
-        if (type.intValue() == ResourceType.IMG) {
+        if (type.intValue() == ResourceType.IMG || type.intValue() == ResourceType.AUDIO) {
             // 图片本地取
             Resource resource = new Resource();
 
+            resource.setType(type);
             String code = resourceSearchDTO.getCode();
             if (!StringUtils.isEmpty(code)) {
                 resource.setCode("%" + code.trim() + "%");
@@ -53,6 +64,41 @@ public class ResourceController {
                 resource.setName("%" + name.trim() + "%");
             }
             return resourceService.search(resource, resourceSearchDTO.getPageNo(), resourceSearchDTO.getPageSize());
+        }else if(type.intValue() == ResourceType.AUDIO_IMG){
+            // 本地取
+            AudioImg audioImg = new AudioImg();
+
+            String code = resourceSearchDTO.getCode();
+            if (!StringUtils.isEmpty(code)) {
+                audioImg.setCode("%" + code.trim() + "%");
+            }
+
+            String name = resourceSearchDTO.getName();
+            if (!StringUtils.isEmpty(name)) {
+                audioImg.setName("%" + name.trim() + "%");
+            }
+            Page<AudioImg> audioImgPage = audioImgService.search(audioImg, resourceSearchDTO.getPageNo(), resourceSearchDTO.getPageSize());
+
+            //创建一个默认为0
+            Page<Resource> page = new Page(0L, resourceSearchDTO.getPageNo(), resourceSearchDTO.getPageSize());
+
+            if(audioImgPage.getPageSize() > 0 ){
+                List<AudioImg> audioImgList = audioImgPage.getList();
+
+                if(!CollectionUtils.isEmpty(audioImgList)){
+                    List<Resource> resourceList = new ArrayList<>();
+                    page.setTotalSize(audioImgList.size());
+
+                    //有声读物   转  资源
+                    audioImgList.forEach(ai -> {
+                        Resource resource = resourceService.audioImgToResource(ai);
+                        resourceList.add(resource);
+                    });
+                    page.setList(resourceList);
+                }
+            }
+            return APIResult.ok(page);
+
         }else {
             // 其他去云平台
             if (resourceSearchDTO.getCode() != null) {
@@ -63,6 +109,8 @@ public class ResourceController {
         }
     }
 
+
+
     @RequestMapping(method = RequestMethod.POST)
     public APIResult<Resource> create(@RequestBody Resource resource) {
 
@@ -102,4 +150,128 @@ public class ResourceController {
 
         return APIResult.ok();
     }
+
+    /* ------------ 有声读物  audioImg    ---------------------start---------------------------------*/
+    @RequestMapping(value = "/audioImg/batch", method = RequestMethod.GET)
+    public Map<String, Resource> getAudioImgBatch(@RequestParam("ids") List<String> ids) {
+        Map<String, Resource> audioImgMap= new HashMap<>();
+        List<AudioImg> audioImgs = audioImgService.findMixByIds(ids);
+        if(CollectionUtils.isEmpty(audioImgs)){
+            return audioImgMap;
+        }
+
+        audioImgs.forEach(ai -> {
+            Resource resource = resourceService.audioImgToResource(ai);
+            audioImgMap.put(ai.getId(),resource);
+
+        });
+
+        return audioImgMap;
+    }
+
+    @RequestMapping(value="/audioImg",method = RequestMethod.POST)
+    public AudioImg createAudioImg(@RequestBody AudioImgDTO dto) {
+        if (audioImgService.exists(dto.getCode())) {
+            log.error("audioImg code Is exist");
+            return null;
+        }
+
+        Resource a = dto.getAudio();
+        Resource i = dto.getImg();
+
+        //设置code  name
+        setCodeName(a, dto);
+        setCodeName(i, dto);
+
+        Resource img = saveOrUpdateResource(i);
+        Resource audio = saveOrUpdateResource(a);
+
+        if(null != audio && null != img){
+            AudioImg ai = new AudioImg();
+            ai.setStatus(dto.getStatus());
+            ai.setName(dto.getName());
+            ai.setCode(dto.getCode());
+            ai.setType(ResourceType.AUDIO_IMG);
+
+            //audio  info
+            ai.setAudioId(audio.getId());
+
+            //img  info
+            ai.setImgId(img.getId());
+
+            AudioImg audioImg = audioImgService.save(ai);
+
+            return audioImg;
+        }else{
+            log.error("create AudioImg is error,audio={},img={}",audio, img);
+            return null;
+        }
+    }
+
+    @RequestMapping(value="/audioImg",method = RequestMethod.PUT)
+    public AudioImg updateAudioImg(@RequestBody AudioImgDTO dto) {
+        if(StringUtils.isBlank(dto.getCode())){
+            return null;
+        }
+        Resource a = dto.getAudio();
+        Resource i = dto.getImg();
+        setCodeName(a, dto);
+        setCodeName(i, dto);
+
+        Resource img = saveOrUpdateResource(i);
+        Resource audio = saveOrUpdateResource(a);
+
+        if(null != audio && null != img){
+            AudioImg ai = audioImgService.get(dto.getId());
+            ai.setStatus(dto.getStatus());
+            ai.setName(dto.getName());
+            ai.setCode(dto.getCode());
+
+            //audio  info
+            ai.setAudioId(audio.getId());
+            //img  info
+            ai.setImgId(img.getId());
+
+            AudioImg audioImg = audioImgService.update(ai);
+
+            return audioImg;
+        }else{
+            return null;
+        }
+    }
+
+    private void setCodeName(Resource resource, AudioImgDTO dto) {
+        resource.setCode(dto.getCode()+"_"+ resource.getType() + DateUtil.getTimeStamp());
+        resource.setName(dto.getName()+"_"+ resource.getType() + DateUtil.getTimeStamp());
+    }
+
+    /**
+     * 更新/存储资源
+     * @param resource
+     * @return
+     */
+    private Resource saveOrUpdateResource(Resource resource) {
+
+        if (StringUtils.isEmpty(resource.getCode()) || StringUtils.isEmpty(resource.getPath())) {
+            return null;
+        }
+
+        Resource result = null;
+        if(StringUtils.isBlank(resource.getId())){
+            if (resourceService.exists(resource.getCode())) {
+                log.error("resource code Is exist");
+                return null;
+            }
+            resource.setId(null);
+            //图片,音频类型  存本地
+            result = resourceService.save(resource);
+        }else{
+            //图片,音频类型  存本地
+            result = resourceService.updateResource(resource);
+        }
+
+        return result;
+    }
+
+    /* ------------ 有声读物  audioImg    ---------------------start---------------------------------*/
 }

+ 1 - 1
rankin-resource-service/src/main/java/cn/rankin/resourceservice/dto/ResourceRemote.java

@@ -61,7 +61,7 @@ public class ResourceRemote implements Serializable {
         List<Resource> resourceList = new ArrayList<>();
         videos.forEach(v -> {
             Resource resource = new Resource();
-            resource.setId(v.getRid());
+            resource.setId(v.getId());
             resource.setCode(no);
             resource.setName(title);
             resource.setType(type);

+ 20 - 0
rankin-resource-service/src/main/java/cn/rankin/resourceservice/repository/AudioImgRepository.java

@@ -0,0 +1,20 @@
+package cn.rankin.resourceservice.repository;
+
+import cn.rankin.common.utils.jpa.BasicJpaRepository;
+import cn.rankin.data.api.resource.entity.AudioImg;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface AudioImgRepository extends BasicJpaRepository<AudioImg, String> {
+
+    Long countByCode(String code);
+
+    /**
+     * find resource by code
+      * @param code
+     * @return
+     */
+    List<AudioImg> findByCode(String code);
+}

+ 77 - 0
rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/AudioImgService.java

@@ -0,0 +1,77 @@
+package cn.rankin.resourceservice.service;
+
+import cn.rankin.common.utils.api.model.APIResult;
+import cn.rankin.common.utils.api.page.Page;
+import cn.rankin.common.utils.exception.DuplicateValueException;
+import cn.rankin.common.utils.exception.NotFoundException;
+import cn.rankin.common.utils.exception.UnsupportedOperationException;
+import cn.rankin.data.api.resource.entity.AudioImg;
+import cn.rankin.data.api.resource.entity.Resource;
+import cn.rankin.resourceservice.dto.ResourceDetail;
+import cn.rankin.resourceservice.repository.AudioImgRepository;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+
+@Slf4j
+@Service
+public class AudioImgService {
+
+    @Autowired
+    private AudioImgRepository audioImgRepository;
+
+    public boolean exists(String code) {
+        Long count = audioImgRepository.countByCode(code);
+        return count > 0L;
+    }
+
+    public AudioImg get(String id) {
+        return audioImgRepository.find(id);
+    }
+
+    public AudioImg save(AudioImg audioImg) {
+        return audioImgRepository.save(audioImg);
+    }
+
+    public Page<AudioImg> search(AudioImg ai, Integer pageNo, Integer pageSize) {
+        Long count = audioImgRepository.count(ai);
+        Page<AudioImg> page = new Page(count, pageNo, pageSize);
+
+        if (count == 0) {
+            return page;
+        }
+
+        List<AudioImg> audioImgList = audioImgRepository.find(ai, page.getStart(), pageSize, new Sort(Sort.Direction.DESC, "gmtModified"));
+        page.setList(audioImgList);
+
+        return page;
+    }
+
+    /**
+     *
+      * @param audioImg
+     * @throws DuplicateValueException
+     * @throws NotFoundException
+     */
+    public AudioImg update(AudioImg audioImg) throws DuplicateValueException, NotFoundException, UnsupportedOperationException {
+        if (null == audioImg){
+            log.error("audioImg is null");
+            return null;
+        }
+
+        AudioImg result = audioImgRepository.update(audioImg);
+        return result;
+    }
+
+    public List<AudioImg>  findMixByIds(List<String> ids) {
+
+        // 取本地
+        List<AudioImg> audioImgs = audioImgRepository.findByIds(ids);
+        return audioImgs;
+    }
+}
+

+ 95 - 28
rankin-resource-service/src/main/java/cn/rankin/resourceservice/service/ResourceService.java

@@ -9,11 +9,13 @@ import cn.rankin.common.utils.enums.BaseOrderEnum;
 import cn.rankin.common.utils.exception.DuplicateValueException;
 import cn.rankin.common.utils.exception.NotFoundException;
 import cn.rankin.common.utils.exception.UnsupportedOperationException;
+import cn.rankin.data.api.resource.entity.AudioImg;
 import cn.rankin.data.api.resource.entity.Resource;
 import cn.rankin.resourceservice.dto.ResourceDetail;
 import cn.rankin.resourceservice.dto.ResourceRemote;
 import cn.rankin.resourceservice.dto.ResourceVideo;
 import cn.rankin.resourceservice.proxy.RemoteResourceProxy;
+import cn.rankin.resourceservice.repository.AudioImgRepository;
 import cn.rankin.resourceservice.repository.ResourceRepository;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +32,9 @@ import java.util.*;
 public class ResourceService {
 
     @Autowired
+    private AudioImgRepository audioImgRepository;
+
+    @Autowired
     private ResourceRepository resourceRepository;
 
     @Autowired
@@ -38,6 +43,9 @@ public class ResourceService {
     @Value("${resource.img.domain}")
     private String imgDomain;
 
+    @Value("${resource.audio.domain}")
+    private String audioDomain;
+
     @Value("${resource.video.domain}")
     private String videoDomain;
 
@@ -46,6 +54,10 @@ public class ResourceService {
         return count > 0L;
     }
 
+    public Resource get(String id) {
+        return resourceRepository.find(id);
+    }
+
     public Resource save(Resource resource) {
         return resourceRepository.save(resource);
     }
@@ -78,6 +90,19 @@ public class ResourceService {
             resourceMap.put(resource.getId(), resource);
         });
 
+        // 本地基础资源取够了不取了
+        if (nativeResourceList.size() == ids.size() && nativeResourceList.size() > 0) {
+            return APIResult.ok(resourceMap);
+        }
+
+        // 取本地,有声读物资源
+        List<AudioImg> audioImgList = audioImgRepository.findByIds(ids);
+        audioImgList.forEach(ai -> {
+            Resource resource = audioImgToResource(ai);
+            resourceMap.put(resource.getId(), resource);
+        });
+
+
         // 本地取够了不取了
         if (nativeResourceList.size() == ids.size() && nativeResourceList.size() > 0) {
             return APIResult.ok(resourceMap);
@@ -159,6 +184,8 @@ public class ResourceService {
         String path = resource.getPath();
         if (ResourceType.VIDEO == resource.getType()) {
             resource.setUrl(concatUrl(videoDomain, path));
+        }else if (ResourceType.AUDIO == resource.getType()) {
+            resource.setUrl(concatUrl(audioDomain, path));
         }else if (ResourceType.IMG == resource.getType()) {
             resource.setUrl(concatUrl(imgDomain, path).replace(" ", ""));
         }
@@ -183,14 +210,14 @@ public class ResourceService {
      * @throws DuplicateValueException
      * @throws NotFoundException
      */
-    public void update(Resource resource) throws DuplicateValueException, NotFoundException, UnsupportedOperationException {
+    public Resource update(Resource resource) throws DuplicateValueException, NotFoundException, UnsupportedOperationException {
         if (null == resource){
             log.error("Resource is null");
-            return;
+            return null;
         }
 
-        if (ResourceType.IMG == resource.getType()){
-            updateImg(resource);
+        if (ResourceType.IMG == resource.getType() || ResourceType.AUDIO == resource.getType() ){
+            return updateResource(resource);
         }
         else{
             log.error("Not-Supported-Resource-Type, id={}, type={}", resource.getId(), resource.getType());
@@ -237,38 +264,50 @@ public class ResourceService {
     }
 
     /**
-     * saveRemoteResource
-     * type 0 video , 1 audio
+     * update Img,audio
      * @param resource
-     * @return
+     * @throws DuplicateValueException
+     * @throws NotFoundException
      */
-    public APIResult<Resource> saveRemoteResource(Resource resource) {
+    public Resource updateResource(Resource resource) throws DuplicateValueException, NotFoundException {
 
-/*        List<Map<String, Object>> videos = new ArrayList<>();
-        Map<String, Object> video = new HashMap<>();
-        video.put("bucket","efunbox");
-        video.put("path",resource.getPath());
-        video.put("format",resource.getFormat());
-        video.put("quality",resource.getQuality());
-        video.put("size",resource.getSize());
+        if (ResourceType.IMG != resource.getType() && ResourceType.AUDIO!= resource.getType()){
+            log.error("Not-Img/audio -Resource");
+            return null;
+        }
 
-        videos.add(video);
+        //find target resource
+        Resource targetResouce = resourceRepository.find(resource.getId());
 
+        if(null == targetResouce){
+            log.error("Cannot Find Resource, id={}", resource.getId());
+            throw new NotFoundException("Resource-Not-Found");
+        }
 
-        APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(new HashMap<String, Object>(){
-            {
-                this.put("no", resource.getCode());
-                this.put("title", resource.getName());
-                this.put("type", resource.getType());
-                this.put("videos", videos);
+        //only support code,title,path
+        //first, make sure code is not duplicated
+        List<Resource> foundedResource = resourceRepository.findByCode(resource.getCode());
+        foundedResource.forEach( (each) -> {
+            if ( !resource.getId().equals(each.getId()) ){
+                log.error("Code-Already-Exist, code={}", resource.getCode());
+                throw new DuplicateValueException("Code-Already-Exist");
             }
         });
 
+        //set and save
+        targetResouce.setCode(resource.getCode());
+        targetResouce.setName(resource.getName());
+        targetResouce.setPath(resource.getPath());
+        return resourceRepository.save(targetResouce);
+    }
 
-
-
-
-        */
+    /**
+     * saveRemoteResource
+     * type 0 video , 1 audio
+     * @param resource
+     * @return
+     */
+    public APIResult<Resource> saveRemoteResource(Resource resource) {
 
         Set<ResourceVideo> videos = new HashSet<>();
         ResourceVideo video = new ResourceVideo();
@@ -287,8 +326,6 @@ public class ResourceService {
         resourceRemote.setVideos(videos);
 
 
-
-
         APIResult<ResourceDetail> apiResult = resourceProxy.saveResources(resourceRemote);
         if (!apiResult.getSuccess()) {
             return errorResourceAPIResult(apiResult);
@@ -344,5 +381,35 @@ public class ResourceService {
         return errResult;
     }
 
+    /**
+     * 有声读物 转  资源
+     * @param ai
+     * @return
+     */
+    public Resource audioImgToResource(AudioImg ai) {
+        String audioId = ai.getAudioId();
+        Resource audio = resourceRepository.find(audioId);
+        initResourceUrl(audio);
+        String imgId = ai.getImgId();
+        Resource img = resourceRepository.find(imgId);
+        initResourceUrl(img);
+
+        Resource resource = new Resource();
+        //有声读物info
+        resource.setType(ai.getType());
+        resource.setId(ai.getId());
+        resource.setCode(ai.getCode());
+        resource.setName(ai.getName());
+        resource.setStatus(ai.getStatus());
+        resource.setGmtCreated(ai.getGmtCreated());
+        resource.setGmtModified(ai.getGmtModified());
+
+        //图片info
+        resource.setImg(img);
+        //音频info
+        resource.setAudio(audio);
+        return resource;
+    }
+
 }