Ver Fonte

规范代码

syh há 5 anos atrás
pai
commit
12261c5ea5
100 ficheiros alterados com 820 adições e 3901 exclusões
  1. 14 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 31 47
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java
  3. 19 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdCoverController.java
  4. 17 22
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  5. 9 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AgentInfoController.java
  6. 12 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java
  7. 5 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  8. 27 49
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  9. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CreativeTitleController.java
  10. 7 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CtopOauthTokenController.java
  11. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java
  12. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  13. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java
  14. 0 250
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonNewController.java
  15. 10 50
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/FileInfoController.java
  16. 7 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/GraphqlController.java
  17. 4 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/HotInformationCtroller.java
  18. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageDownloadController.java
  19. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouCleanMaterialReportController.java
  20. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouDefectMaterialController.java
  21. 14 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAdvertiserController.java
  22. 8 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppAccountController.java
  23. 35 37
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppProductController.java
  24. 7 94
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouChannelRegInfoController.java
  25. 8 92
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialAscriptionController.java
  26. 1 85
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java
  27. 29 115
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java
  28. 1 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  29. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialParameterController.java
  30. 4 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java
  31. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagController.java
  32. 1 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialUploadController.java
  33. 15 108
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  34. 12 98
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  35. 9 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SalePerformanceDetailController.java
  36. 7 91
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ScriptTagInfoController.java
  37. 0 249
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SourceFileController.java
  38. 0 32
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestMqController.java
  39. 9 94
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java
  40. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java
  41. 7 89
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileController.java
  42. 9 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  43. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoMergeTaskController.java
  44. 26 110
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoPartController.java
  45. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java
  46. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTemplateController.java
  47. 16 76
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  48. 0 100
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/EduLessonNew.java
  49. 1 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java
  50. 6 31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  51. 2 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java
  52. 8 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDataLoadJob.java
  53. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java
  54. 0 69
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DataeyeJob.java
  55. 5 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java
  56. 0 62
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java
  57. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCampaignJob.java
  58. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java
  59. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCrawlerJob.java
  60. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/EduLessonNewMapper.java
  61. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/EduLessonNewMapper.xml
  62. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IEduLessonNewService.java
  63. 33 39
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/AdvertiserServiceImpl.java
  64. 0 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/EduLessonNewServiceImpl.java
  65. 11 11
      jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai
  66. 6 24
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  67. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialParameter.java
  68. 0 57
      module-common/src/main/java/cn/com/ctop/common/module/entity/SourceFile.java
  69. 0 14
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SourceFileMapper.java
  70. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java
  71. 0 5
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SourceFileMapper.xml
  72. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  73. 0 4
      module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java
  74. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialParameterService.java
  75. 0 14
      module-common/src/main/java/cn/com/ctop/common/module/service/ISourceFileService.java
  76. 6 7
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  77. 0 53
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  78. 0 4
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java
  79. 60 82
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  80. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialParameterServiceImpl.java
  81. 0 18
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SourceFileServiceImpl.java
  82. 16 26
      module-common/src/main/java/cn/com/ctop/common/module/utils/Check.java
  83. 36 45
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  84. 1 3
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadService.java
  85. 61 138
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  86. 4 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/entity/KuaishouAppProduct.java
  87. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/KuaishouAppProductMapper.java
  88. 15 23
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  89. 14 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  90. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/MaterialReportMapper.java
  91. 0 20
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/MaterialReportMapper.xml
  92. 0 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IMaterialReportService.java
  93. 5 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/MaterialReportServiceImpl.java
  94. 9 72
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceCleanMaterialReportController.java
  95. 9 92
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAdvertiserDailyReportController.java
  96. 5 89
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAdvertiserHourlyReportController.java
  97. 6 90
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCampaignDailyReportController.java
  98. 9 91
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCampaignHourlyReportController.java
  99. 11 93
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCreativeDailyReportController.java
  100. 0 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCreativeHourlyReportController.java

+ 14 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -486,9 +486,13 @@ public class DateUtils extends PropertyEditorSupport {
      * @throws ParseException
      * @throws
      */
-    public static Date parseDate(String src, String pattern) throws ParseException {
-        return getDateFormat(pattern).parse(src);
-
+    public static Date parseDate(String src, String pattern) {
+        try {
+            return getDateFormat(pattern).parse(src);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
     }
 
     /**
@@ -761,9 +765,14 @@ public class DateUtils extends PropertyEditorSupport {
         return sdf.format(calendar.getTime());
     }
 
-    public static String addDay(String dateString, int day) throws ParseException {
+    public static String addDay(String dateString, int day) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        Date date = sdf.parse(dateString);
+        Date date = null;
+        try {
+            date = sdf.parse(dateString);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.add(Calendar.DAY_OF_YEAR, day);

+ 31 - 47
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java

@@ -38,7 +38,7 @@ public class ActorController {
     private IActorVideoService actorVideoService;
 
     @ResponseBody
-    @RequestMapping(value = "/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Actor> getDetail(@RequestParam(name = "actorId") Long actorId) {
         Result<Actor> result = new Result<>();
         Actor actor = actorService.getById(actorId);
@@ -61,9 +61,9 @@ public class ActorController {
                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                               HttpServletRequest req) {
-        Result<IPage<Actor>> result = new Result<IPage<Actor>>();
+        Result<IPage<Actor>> result = new Result<>();
         QueryWrapper<Actor> queryWrapper = QueryGenerator.initQueryWrapper(actor, req.getParameterMap());
-        Page<Actor> page = new Page<Actor>(pageNo, pageSize);
+        Page<Actor> page = new Page<>(pageNo, pageSize);
         IPage<Actor> pageList = actorService.page(page, queryWrapper);
 
         result.setSuccess(true);
@@ -76,10 +76,10 @@ public class ActorController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<ActorPhoto>> result = new Result<IPage<ActorPhoto>>();
+        Result<IPage<ActorPhoto>> result = new Result<>();
 
         QueryWrapper<ActorPhoto> queryWrapper = QueryGenerator.initQueryWrapper(actorPhoto, req.getParameterMap());
-        Page<ActorPhoto> page = new Page<ActorPhoto>(pageNo, pageSize);
+        Page<ActorPhoto> page = new Page<>(pageNo, pageSize);
         IPage<ActorPhoto> pageList = actorPhotoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -91,10 +91,10 @@ public class ActorController {
                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                             HttpServletRequest req) {
-        Result<IPage<ActorComment>> result = new Result<IPage<ActorComment>>();
+        Result<IPage<ActorComment>> result = new Result<>();
 
         QueryWrapper<ActorComment> queryWrapper = QueryGenerator.initQueryWrapper(actorComment, req.getParameterMap());
-        Page<ActorComment> page = new Page<ActorComment>(pageNo, pageSize);
+        Page<ActorComment> page = new Page<>(pageNo, pageSize);
         IPage<ActorComment> pageList = actorCommentService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -103,7 +103,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/comment/delete")
     public Result<ActorComment> deleteComment(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorComment> result = new Result<ActorComment>();
+        Result<ActorComment> result = new Result<>();
         ActorComment actorComment = actorCommentService.getById(id);
         if (actorComment == null) {
             result.error500("未找到对应实体");
@@ -118,7 +118,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/video/delete")
     public Result<ActorVideo> deleteVideo(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorVideo> result = new Result<ActorVideo>();
+        Result<ActorVideo> result = new Result<>();
         ActorVideo actorVideo = actorVideoService.getById(id);
         if (actorVideo == null) {
             result.error500("未找到对应实体");
@@ -133,7 +133,7 @@ public class ActorController {
 
     @DeleteMapping(value = "/photo/delete")
     public Result<ActorPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
-        Result<ActorPhoto> result = new Result<ActorPhoto>();
+        Result<ActorPhoto> result = new Result<>();
         ActorPhoto actorPhoto = actorPhotoService.getById(id);
         if (actorPhoto == null) {
             result.error500("未找到对应实体");
@@ -148,7 +148,7 @@ public class ActorController {
 
     @PostMapping(value = "/comment/add")
     public Result<ActorComment> addComment(ActorComment actorComment) {
-        Result<ActorComment> result = new Result<ActorComment>();
+        Result<ActorComment> result = new Result<>();
         try {
             actorCommentService.save(actorComment);
             result.success("添加成功!");
@@ -161,13 +161,11 @@ public class ActorController {
 
     @PostMapping(value = "/video/add")
     public Result<ActorVideo> addVideo(ActorVideo actorVideo) {
-        Result<ActorVideo> result = new Result<ActorVideo>();
+        Result<ActorVideo> result = new Result<>();
         try {
             String videoUrl = actorVideo.getVideoUrl();
-            if (!Check.isNull(videoUrl)) {
-                if (!videoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actorVideo.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl);
-                }
+            if (!Check.isNull(videoUrl) && !videoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actorVideo.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl);
             }
             actorVideoService.save(actorVideo);
             result.success("添加成功!");
@@ -180,15 +178,12 @@ public class ActorController {
 
     @PostMapping(value = "/photo/add")
     public Result<ActorPhoto> addPhoto(ActorPhoto actorPhoto) {
-        Result<ActorPhoto> result = new Result<ActorPhoto>();
+        Result<ActorPhoto> result = new Result<>();
         try {
             String photoUrl = actorPhoto.getPhotoUrl();
-            if (!Check.isNull(photoUrl)) {
-                if (!photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actorPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
-                }
+            if (!Check.isNull(photoUrl) && !photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actorPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
             }
-
             actorPhotoService.save(actorPhoto);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -203,9 +198,9 @@ public class ActorController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<ActorVideo>> result = new Result<IPage<ActorVideo>>();
+        Result<IPage<ActorVideo>> result = new Result<>();
         QueryWrapper<ActorVideo> queryWrapper = QueryGenerator.initQueryWrapper(actorVideo, req.getParameterMap());
-        Page<ActorVideo> page = new Page<ActorVideo>(pageNo, pageSize);
+        Page<ActorVideo> page = new Page<>(pageNo, pageSize);
         IPage<ActorVideo> pageList = actorVideoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -221,40 +216,33 @@ public class ActorController {
      */
     @PostMapping(value = "/add")
     public Result<Actor> add(@RequestBody Actor actor) {
-        Result<Actor> result = new Result<Actor>();
+        Result<Actor> result = new Result<>();
         try {
             String coverUrl = actor.getCoverUrl();
-            if (!Check.isNull(coverUrl)) {
-                if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
-                }
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
             }
             actorService.save(actor);
-            if (actor.getImageUrl() != null && actor.getImageUrl().size() > 0) {
+            if (null != actor.getImageUrl() && !actor.getImageUrl().isEmpty()) {
                 for (String url : actor.getImageUrl()) {
                     ActorPhoto photo = new ActorPhoto();
                     photo.setActorId(actor.getId());
-                    if (!Check.isNull(url)) {
-                        if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                            photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
-                        }
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
                     }
                     actorPhotoService.save(photo);
                 }
             }
-            if (actor.getVideoUrl() != null && actor.getVideoUrl().size() > 0) {
+            if (actor.getVideoUrl() != null && !actor.getVideoUrl().isEmpty()) {
                 for (String url : actor.getVideoUrl()) {
                     ActorVideo video = new ActorVideo();
                     video.setActorId(actor.getId());
-                    if (!Check.isNull(url)) {
-                        if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                            video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
-                        }
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
                     }
                     actorVideoService.save(video);
                 }
             }
-
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -271,18 +259,15 @@ public class ActorController {
      */
     @PutMapping(value = "/edit")
     public Result<Actor> edit(@RequestBody Actor actor) {
-        Result<Actor> result = new Result<Actor>();
+        Result<Actor> result = new Result<>();
 
         Actor actorEntity = actorService.getById(actor.getId());
         if (actorEntity == null) {
             result.error500("未找到对应实体");
         } else {
-
             String coverUrl = actor.getCoverUrl();
-            if (!Check.isNull(coverUrl)) {
-                if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
-                }
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
             }
 
             boolean ok = actorService.updateById(actor);
@@ -290,7 +275,6 @@ public class ActorController {
                 result.success("修改成功!");
             }
         }
-
         return result;
     }
 }

+ 19 - 21
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdCoverController.java

@@ -36,13 +36,13 @@ public class AdCoverController {
     private ISysCategoryService sysCategoryService;
 
     @ResponseBody
-    @RequestMapping(value = "/summary/today", method = RequestMethod.GET)
+    @GetMapping("/summary/today")
     public Result<Map<String, Object>> getTodaySummary() {
-        Result<Map<String, Object>> result = new Result<Map<String, Object>>();
-        QueryWrapper<AppAd> appAdWrapper = new QueryWrapper<AppAd>();
-        QueryWrapper<AppVideo> appVideoWrapper = new QueryWrapper<AppVideo>();
-        QueryWrapper<KuaishouAdAccount> advertiserWrapper = new QueryWrapper<KuaishouAdAccount>();
-        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
+        Result<Map<String, Object>> result = new Result<>();
+        QueryWrapper<AppAd> appAdWrapper = new QueryWrapper<>();
+        QueryWrapper<AppVideo> appVideoWrapper = new QueryWrapper<>();
+        QueryWrapper<KuaishouAdAccount> advertiserWrapper = new QueryWrapper<>();
+        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<>();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         String now = sdf.format(new Date());
         String startDate = now + " 00:00:00";
@@ -56,7 +56,7 @@ public class AdCoverController {
         int appVideoCount = appVideoService.count(appVideoWrapper);
         int advertiserCount = kuaishouAdAccountService.count(advertiserWrapper);
         int productCount = kuaishouAdAccountService.count(productWrapper);
-        Map<String, Object> map = new HashMap<String, Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adCount", appAdCount);
         map.put("videoCount", appVideoCount);
         map.put("advertiserCount", advertiserCount);
@@ -67,16 +67,16 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/summary/all", method = RequestMethod.GET)
+    @GetMapping("/summary/all")
     public Result<Map<String, Object>> getAllSummary() {
-        Result<Map<String, Object>> result = new Result<Map<String, Object>>();
-        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
+        Result<Map<String, Object>> result = new Result<>();
+        QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<>();
         productWrapper.groupBy("product");
         int appAdCount = appAdService.count();
         int appVideoCount = appVideoService.count();
         int advertiserCount = kuaishouAdAccountService.count();
         int productCount = kuaishouAdAccountService.count(productWrapper);
-        Map<String, Object> map = new HashMap<String, Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adCount", appAdCount);
         map.put("videoCount", appVideoCount);
         map.put("advertiserCount", advertiserCount);
@@ -87,10 +87,9 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value="/feeds", method = RequestMethod.GET)
+    @GetMapping("/feeds")
     public Result<List<AppAd>> getVideoList(HttpServletRequest req){
-        Result<List<AppAd>> result = new Result<List<AppAd>>();
-        AppAd ad = new AppAd();
+        Result<List<AppAd>> result = new Result<>();
         Map<String,String[]> paramMap = req.getParameterMap();
         String industry = paramMap.get("industry")!=null?sysCategoryService.getById(paramMap.get("industry")[0]).getName():null;
         String company = paramMap.get("company")!=null?paramMap.get("company")[0]:null;
@@ -100,8 +99,8 @@ public class AdCoverController {
         String end = paramMap.get("end")!=null?paramMap.get("end")[0]:null;
         String orderByColumn = paramMap.get("orderByColumn")!=null?paramMap.get("orderByColumn")[0]:null;
         String orderByType = paramMap.get("orderByType")!=null?paramMap.get("orderByType")[0]:null;
-        Integer pageSize = paramMap.get("pageSize")!=null?Integer.parseInt(paramMap.get("pageSize")[0]):null;
-        Integer pageNo = paramMap.get("pageNo")!=null?Integer.parseInt(paramMap.get("pageNo")[0]):null;
+        Integer pageSize = paramMap.get("pageSize") != null ? Integer.parseInt(paramMap.get("pageSize")[0]) : 10;
+        Integer pageNo = paramMap.get("pageNo") != null ? Integer.parseInt(paramMap.get("pageNo")[0]) : 1;
         int pageStart = (pageNo-1)*pageSize;
         List<AppAd> list = appAdService.queryAdFeeds(userName, industry, company, product, start, end, orderByColumn, orderByType, pageStart, pageSize);
         result.setResult(list);
@@ -110,7 +109,7 @@ public class AdCoverController {
     }
 
     @ResponseBody
-    @RequestMapping(value="/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Map<String,Object>> getDetail(@RequestParam(name="photoId") Long photoId, @RequestParam(name="userId") Long userId){
         Result<Map<String, Object>> result = new Result<>();
         AppAd ad = new AppAd();
@@ -128,9 +127,9 @@ public class AdCoverController {
             video.setMvUrl(ad.getMvUrl());
         }
 
-        kuaishouAdAccount.setUrl("https://live.kuaishou.com/profile/" + ad.getShareInfo().substring(ad.getShareInfo().indexOf("=") + 1, ad.getShareInfo().indexOf("&")));
+        kuaishouAdAccount.setUrl("https://live.kuaishou.com/profile/" + ad.getShareInfo().substring(ad.getShareInfo().indexOf('=') + 1, ad.getShareInfo().indexOf('&')));
         video.setShareInfo("https://live.kuaishou.com/u/" + ad.getShareInfo().replace("userId=", "").replace("photoId=", "").replace("&", "/"));
-        Map<String,Object> map = new HashMap<String,Object>();
+        Map<String, Object> map = new HashMap<>();
         map.put("adlist",list);
         map.put("user",kuaishouAdAccount);
         map.put("video",video);
@@ -140,14 +139,13 @@ public class AdCoverController {
     }
 
     /**
-     * TODO 需要确认是否可以删除
      *
      * @param photoId
      * @param userId
      * @return
      */
     @ResponseBody
-    @RequestMapping(value="/adlist", method = RequestMethod.GET)
+    @GetMapping(value = "/adlist")
     public Result<List<AppAd>> getAdList(@RequestParam(name = "photoId") String photoId, @RequestParam(name = "userId") Long userId) {
         Result<List<AppAd>> result = new Result<>();
         AppAd ad = new AppAd();

+ 17 - 22
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -40,8 +40,9 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 
 /**
@@ -97,7 +98,6 @@ public class AdvertiserController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
@@ -119,7 +119,7 @@ public class AdvertiserController {
                                                    @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                                    HttpServletRequest req) {
 
-        Result<IPage<Advertiser>> result = new Result<IPage<Advertiser>>();
+        Result<IPage<Advertiser>> result = new Result<>();
         String roleCode = materialReportMapper.getRoleCodeByUserId(advertiser.getUserId());
         String userId = advertiser.getUserId();
         if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
@@ -136,9 +136,9 @@ public class AdvertiserController {
                 queryWrapper.eq("company_id", userCompany.getCompanyId());
             }
         }
-        Page<Advertiser> page = new Page<Advertiser>(pageNo, pageSize);
+        Page<Advertiser> page = new Page<>(pageNo, pageSize);
         IPage<Advertiser> pageList = advertiserService.page(page, queryWrapper);
-        if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
+        if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
             List<Advertiser> list = new ArrayList<>();
             for (int i = 0; i < pageList.getRecords().size(); i++) {
                 Advertiser advertiserRecord = pageList.getRecords().get(i);
@@ -172,7 +172,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-添加", notes = "广告主信息表-添加")
     @PostMapping(value = "/add")
     public Result<Advertiser> add(@RequestBody Advertiser advertiser) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         try {
             String userId = advertiser.getUserId();
             String name = advertiser.getName().trim();
@@ -217,7 +217,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-编辑", notes = "广告主信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<Advertiser> edit(@RequestBody Advertiser advertiser) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         Advertiser advertiserEntity = advertiserService.getById(advertiser.getId());
         if (advertiserEntity == null) {
             result.error500("未找到对应实体");
@@ -251,7 +251,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-通过id删除", notes = "广告主信息表-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<Advertiser> delete(@RequestParam(name = "id", required = true) String id) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         Advertiser advertiser = advertiserService.getById(id);
         if (advertiser == null) {
             result.error500("未找到对应实体");
@@ -287,7 +287,7 @@ public class AdvertiserController {
     @ApiOperation(value = "广告主信息表-批量删除", notes = "广告主信息表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<Advertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<Advertiser> result = new Result<Advertiser>();
+        Result<Advertiser> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -324,7 +324,7 @@ public class AdvertiserController {
      * @return
      */
     @RequestMapping(value = "/ydWeekReportList")
-    public Map<String, Object> ydReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
+    public Map<String, Object> ydReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) {
         Map<String, Object> result = new HashMap<>();
         Long projectId = data.getLong("projectId");
         String startDate = data.getString("startDate");
@@ -343,7 +343,6 @@ public class AdvertiserController {
     @RequestMapping(value = "/exportYdDailyReport")
     @ResponseBody
     public void exportYdWeek(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
-        Map<String, Object> result = new HashMap<>();
         Long projectId = data.getLong("projectId");
         String startDate = data.getString("startDate");
         String endDate = data.getString("endDate");
@@ -368,7 +367,7 @@ public class AdvertiserController {
      */
     @RequestMapping(value = "/xxlDailyReportList")
     @ResponseBody
-    public Map<String, Object> xxlReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) throws Exception {
+    public Map<String, Object> xxlReportList(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject data) {
         Map<String, Object> result = new HashMap<>();
         List<SheetInfoVo> sheets = new ArrayList<>();
         //查询总的消耗信息
@@ -381,14 +380,14 @@ public class AdvertiserController {
         sheets.add(totalSheetVo);
         if (null == systemType) {
             List<SheetInfoVo> vos = advertiserService.getSystemTypeXxlStatisticInfo(projectId);
-            if (null != vos && vos.size() > 0) {
+            if (null != vos && !vos.isEmpty()) {
                 for (SheetInfoVo vo : vos) {
                     sheets.add(vo);
                 }
             }
         }
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && allocations.size() > 0) {
+        if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
                 sheets.add(vo);
@@ -406,7 +405,7 @@ public class AdvertiserController {
      */
     @RequestMapping(value = "/exportXxlDailyReport")
     @ResponseBody
-    public void exportXxl(HttpServletRequest request, HttpServletResponse response, Long projectId, String systemType) throws Exception {
+    public void exportXxl(HttpServletRequest request, HttpServletResponse response, Long projectId, String systemType) throws IOException {
         List<SheetInfoVo> sheets = new ArrayList<>();
         if (null == systemType || "".equals(systemType.trim())) {
             systemType = null;
@@ -416,14 +415,14 @@ public class AdvertiserController {
         sheets.add(totalSheetVo);
         if (null == systemType) {
             List<SheetInfoVo> vos = advertiserService.getSystemTypeXxlStatisticInfo(projectId);
-            if (null != vos && vos.size() > 0) {
+            if (null != vos && !vos.isEmpty()) {
                 for (SheetInfoVo vo : vos) {
                     sheets.add(vo);
                 }
             }
         }
         List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && allocations.size() > 0) {
+        if (null != allocations && !allocations.isEmpty()) {
             for (UserAllocation allocation : allocations) {
                 SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
                 sheets.add(vo);
@@ -447,11 +446,7 @@ public class AdvertiserController {
     //发送响应流方法
     public void setResponseHeader(HttpServletResponse response, String fileName) {
         try {
-            try {
-                fileName = new String(fileName.getBytes(), "ISO8859-1");
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
+            fileName = new String(fileName.getBytes(), StandardCharsets.ISO_8859_1);
             response.setContentType("application/octet-stream;charset=ISO8859-1");
             response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
             response.addHeader("Pargam", "no-cache");

+ 9 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AgentInfoController.java

@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -64,7 +65,7 @@ public class AgentInfoController {
                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                   HttpServletRequest req) {
-        Result<IPage<AgentInfo>> result = new Result<IPage<AgentInfo>>();
+        Result<IPage<AgentInfo>> result = new Result<>();
         agentInfo.setEnabled(1);
         QueryWrapper<AgentInfo> queryWrapper = QueryGenerator.initQueryWrapper(agentInfo, req.getParameterMap());
         Page<AgentInfo> page = new Page<>(pageNo, pageSize);
@@ -84,7 +85,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-添加", notes = "代理商信息-添加")
     @PostMapping(value = "/add")
     public Result<AgentInfo> add(@RequestBody AgentInfo agentInfo) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         try {
             agentInfo.setEnabled(1);
             agentInfo.setEnabled(1);
@@ -107,7 +108,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-编辑", notes = "代理商信息-编辑")
     @PutMapping(value = "/edit")
     public Result<AgentInfo> edit(@RequestBody AgentInfo agentInfo) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         AgentInfo agentInfoEntity = agentInfoService.getById(agentInfo.getId());
         if (agentInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -130,7 +131,7 @@ public class AgentInfoController {
     @AutoLog(value = "代理商信息-通过id删除")
     @ApiOperation(value = "代理商信息-通过id删除", notes = "代理商信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             agentInfoService.removeById(id);
         } catch (Exception e) {
@@ -150,7 +151,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-批量删除", notes = "代理商信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<AgentInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -170,7 +171,7 @@ public class AgentInfoController {
     @ApiOperation(value = "代理商信息-通过id查询", notes = "代理商信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<AgentInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<AgentInfo> result = new Result<AgentInfo>();
+        Result<AgentInfo> result = new Result<>();
         AgentInfo agentInfo = agentInfoService.getById(id);
         if (agentInfo == null) {
             result.error500("未找到对应实体");
@@ -194,7 +195,7 @@ public class AgentInfoController {
         try {
             String paramsStr = request.getParameter("paramsStr");
             if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                String deString = URLDecoder.decode(paramsStr, StandardCharsets.UTF_8.toString());
                 AgentInfo agentInfo = JSON.parseObject(deString, AgentInfo.class);
                 queryWrapper = QueryGenerator.initQueryWrapper(agentInfo, request.getParameterMap());
             }
@@ -220,7 +221,7 @@ public class AgentInfoController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    @PostMapping("/importExcel")
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
@@ -247,5 +248,4 @@ public class AgentInfoController {
         }
         return Result.ok("文件导入失败!");
     }
-
 }

+ 12 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java

@@ -44,7 +44,7 @@ public class BindAccountAuthController {
     @PostMapping(value = "/authorization")
     public Result<IPage<BindAccountAuth>> authorization(@RequestBody JSONObject json) {
         log.info("授权入参:{}", json);
-        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        Result<IPage<BindAccountAuth>> result = new Result<>();
         String codeUrl = null;
         try {
             String advertiserId = json.getString("advertiserId");
@@ -54,13 +54,13 @@ public class BindAccountAuthController {
             }
 
             String authorizationType = json.getString("authorizationType");
-            Integer agentType = json.getInteger("agentType"); // 0 三方代理商 1 本代理商
-
+            // 0 三方代理商 1 本代理商
+            Integer agentType = json.getInteger("agentType");
             if ("kuaishou".equals(authorizationType)) {
-                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(JSONObject.toJSONString(json), agentType);
+                codeUrl = bindAccountAuthService.getKuaishouCodeUrl(json.toJSONString(), agentType);
             }
             if ("bytedance".equals(authorizationType)) {
-                codeUrl = bindAccountAuthService.getByteDanceCodeUrl(JSONObject.toJSONString(json));
+                codeUrl = bindAccountAuthService.getByteDanceCodeUrl(json.toJSONString());
             }
             result.setMessage(codeUrl);
             result.setSuccess(true);
@@ -91,9 +91,9 @@ public class BindAccountAuthController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        Result<IPage<BindAccountAuth>> result = new Result<>();
         QueryWrapper<BindAccountAuth> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountAuth, req.getParameterMap());
-        Page<BindAccountAuth> page = new Page<BindAccountAuth>(pageNo, pageSize);
+        Page<BindAccountAuth> page = new Page<>(pageNo, pageSize);
         IPage<BindAccountAuth> pageList = bindAccountAuthService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -110,7 +110,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-添加", notes = "账号绑定-授权-添加")
     @PostMapping(value = "/add")
     public Result<BindAccountAuth> add(@RequestBody BindAccountAuth bindAccountAuth) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         try {
             bindAccountAuthService.save(bindAccountAuth);
             result.success("添加成功!");
@@ -131,13 +131,12 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-编辑", notes = "账号绑定-授权-编辑")
     @PutMapping(value = "/edit")
     public Result<BindAccountAuth> edit(@RequestBody BindAccountAuth bindAccountAuth) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         BindAccountAuth bindAccountAuthEntity = bindAccountAuthService.getById(bindAccountAuth.getId());
         if (bindAccountAuthEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = bindAccountAuthService.updateById(bindAccountAuth);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -155,7 +154,7 @@ public class BindAccountAuthController {
     @AutoLog(value = "账号绑定-授权-通过id删除")
     @ApiOperation(value = "账号绑定-授权-通过id删除", notes = "账号绑定-授权-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bindAccountAuthService.removeById(id);
         } catch (Exception e) {
@@ -175,7 +174,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-批量删除", notes = "账号绑定-授权-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BindAccountAuth> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -195,7 +194,7 @@ public class BindAccountAuthController {
     @ApiOperation(value = "账号绑定-授权-通过id查询", notes = "账号绑定-授权-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BindAccountAuth> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        Result<BindAccountAuth> result = new Result<>();
         BindAccountAuth bindAccountAuth = bindAccountAuthService.getById(id);
         if (bindAccountAuth == null) {
             result.error500("未找到对应实体");

+ 5 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java

@@ -19,8 +19,6 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -40,8 +38,6 @@ import java.util.Map;
 @RestController
 @RequestMapping("/ctop/bindAccountLogin")
 public class BindAccountLoginController {
-    private static final Logger logger = LoggerFactory.getLogger(BindAccountLoginController.class);
-
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
@@ -99,7 +95,7 @@ public class BindAccountLoginController {
             userAllocation.setSystemType(systemType);
             int i = userAllocationMapper.insert(userAllocation);
             if (i > 0) {
-                logger.info("用户分配入库完成,advertiserId:{}", advertiserId);
+                log.info("用户分配入库完成,advertiserId:{}", advertiserId);
             }
         }
         result.setSuccess(trueOrFalse);
@@ -169,7 +165,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-编辑", notes = "账号绑定-登陆-编辑")
     @PutMapping(value = "/edit")
     public Result<BindAccountLogin> edit(@RequestBody BindAccountLogin bindAccountLogin) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         BindAccountLogin bindAccountLoginEntity = bindAccountLoginService.getById(bindAccountLogin.getId());
         if (bindAccountLoginEntity == null) {
             result.error500("未找到对应实体");
@@ -192,7 +188,7 @@ public class BindAccountLoginController {
     @AutoLog(value = "账号绑定-登陆-通过id删除")
     @ApiOperation(value = "账号绑定-登陆-通过id删除", notes = "账号绑定-登陆-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bindAccountLoginService.removeById(id);
         } catch (Exception e) {
@@ -212,7 +208,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-批量删除", notes = "账号绑定-登陆-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BindAccountLogin> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -232,7 +228,7 @@ public class BindAccountLoginController {
     @ApiOperation(value = "账号绑定-登陆-通过id查询", notes = "账号绑定-登陆-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BindAccountLogin> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        Result<BindAccountLogin> result = new Result<>();
         BindAccountLogin bindAccountLogin = bindAccountLoginService.getById(id);
         if (bindAccountLogin == null) {
             result.error500("未找到对应实体");

+ 27 - 49
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -13,6 +13,7 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataServ
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -22,14 +23,8 @@ import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -41,30 +36,28 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-@Controller
+@Slf4j
+@RestController
 public class CallbackController {
-    private static final Logger logger = LoggerFactory.getLogger(CallbackController.class);
     @Autowired
     private ISysUserService sysUserService;
-
     @Autowired
     private RedisUtil redisUtil;
     @Autowired
     private ISysDepartService sysDepartService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-
     @Autowired
     private UserAllocationMapper allocationMapper;
-
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
 
     @GetMapping("/qywexin")
-    @ResponseBody
     public void qywexin(HttpServletRequest request,
                         HttpServletResponse response,
                         @RequestParam("code") String code,
@@ -92,7 +85,7 @@ public class CallbackController {
         JSONObject obj = new JSONObject();
         List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
         obj.put("departs", departs);
-        if (departs == null || departs.size() == 0) {
+        if (departs == null || departs.isEmpty()) {
             obj.put("multi_depart", 0);
         } else if (departs.size() == 1) {
             sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
@@ -108,7 +101,6 @@ public class CallbackController {
     }
 
     /**
-     * TODO 授权绑定成功/失败 需要跳转特定页面
      *
      * @param request
      * @param response
@@ -117,17 +109,13 @@ public class CallbackController {
      * @return
      */
     @GetMapping("/kuaishou")
-    @ResponseBody
-    public String kuaishou(HttpServletRequest request,
-                           HttpServletResponse response,
-                           @RequestParam("auth_code") String authCode,
-                           @RequestParam("state") String state) {
+    public String kuaishouCallback(HttpServletRequest request, HttpServletResponse response, @RequestParam("auth_code") String authCode, @RequestParam("state") String state) {
         try {
             JSONObject json = JSONObject.parseObject(state);
             if (Check.isNull(json)) {
                 throw new Exception("回调信息为空");
             }
-            logger.info("快手授权返回信息:{}", json);
+            log.info("快手授权返回信息:{}", json);
             Integer agentType = json.getInteger("agentType");
             if (StringUtils.isNotBlank(authCode)) {
                 KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode, agentType);
@@ -151,8 +139,8 @@ public class CallbackController {
                     //创建人
                     String userId = json.getString("userId");
                     Long projectId = json.getLong("projectId");
-                    BigDecimal WarningProportion = json.getBigDecimal("WarningProportion");
-                    BigDecimal WarningAmount = json.getBigDecimal("WarningAmount");
+                    BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
+                    BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
 
                     CtopOauthToken topOauthToken = new CtopOauthToken();
@@ -199,8 +187,8 @@ public class CallbackController {
                     userAllocation.setAccountId(accountId);
                     userAllocation.setProjectId(projectId);
                     userAllocation.setProjectName(projectName);
-                    userAllocation.setWarningProportion(WarningProportion);
-                    userAllocation.setWarningAmount(WarningAmount);
+                    userAllocation.setWarningProportion(warningProportion);
+                    userAllocation.setWarningAmount(warningAmount);
 
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
@@ -211,7 +199,7 @@ public class CallbackController {
                     allocationMapper.deleteByMap(deleteUserMap);
                     int i = allocationMapper.insert(userAllocation);
                     if (i > 0) {
-                        logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
+                        log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
 
                     //账号绑定
@@ -237,7 +225,6 @@ public class CallbackController {
     }
 
     @RequestMapping("/bytedance")
-    @ResponseBody
     public String bytedance(HttpServletRequest request,
                             HttpServletResponse response,
                             @RequestParam("auth_code") String authCode,
@@ -249,23 +236,20 @@ public class CallbackController {
             if (code == 0) {
                 return "授权绑定成功";
             }
-            logger.info("返回信息:{}", map.toString());
+            log.info("返回信息:{}", map.toString());
             return (String) map.get("desc");
         }
         return "授权绑定失败";
     }
 
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-
     public Map<String, Object> getByteDanceAccessToken(String authCode, String state) {
         Map<String, Object> param = new HashMap<>();
         param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "auth_code");
         param.put("auth_code", authCode);
-        logger.info("authCode:{}", authCode);
-        logger.info("state:{}", state);
+        log.info("authCode:{}", authCode);
+        log.info("state:{}", state);
         Map<String, Object> returnMap = new HashMap<>();
         try {
             JSONObject json = JSONObject.parseObject(state);
@@ -274,11 +258,11 @@ public class CallbackController {
             }
             String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + BytedanceInterfaceConstant.AUTH_TOKEN, param, new HashMap<>());
             JSONObject resultObject = JSONObject.parseObject(result);
-            logger.info("返回信息:{}", resultObject);
+            log.info("返回信息:{}", resultObject);
             Integer code = resultObject.getInteger("code");
             String message = resultObject.getString("message");
             if (null == code || code != 0) {
-                logger.error("获取token失败,state:{},message:{}", state, message);
+                log.error("获取token失败,state:{},message:{}", state, message);
                 throw new Exception("token返回码异常");
             }
             //广告主id
@@ -294,8 +278,8 @@ public class CallbackController {
             String userName = json.getString("userName");
             Long projectId = json.getLong("projectId");
             String projectName = json.getString("projectName");
-            BigDecimal WarningProportion = json.getBigDecimal("WarningProportion");
-            BigDecimal WarningAmount = json.getBigDecimal("WarningAmount");
+            BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
+            BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
 
             JSONObject data = resultObject.getJSONObject("data");
             CtopOauthToken token = new CtopOauthToken(advertiserId, data);
@@ -304,7 +288,7 @@ public class CallbackController {
             Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(token.getAccountId() + "");
             Boolean getSuccess = (Boolean) advertiserDataMap.get("success");
             if (null == getSuccess || !getSuccess) {
-                logger.info("获取广告主信息失败,accountId:{},message:{}", token.getAccountId(), (String) advertiserDataMap.get("message"));
+                log.info("获取广告主信息失败,accountId:{},message:{}", token.getAccountId(), (String) advertiserDataMap.get("message"));
                 throw new Exception("获取广告主信息失败");
             }
 
@@ -333,8 +317,8 @@ public class CallbackController {
             userAllocation.setSystemType(systemType);
             userAllocation.setAuthName((String) advertiserDataMap.get("name"));
             userAllocation.setAdvertiserId(advertiserId);
-            userAllocation.setWarningProportion(WarningProportion);
-            userAllocation.setWarningAmount(WarningAmount);
+            userAllocation.setWarningProportion(warningProportion);
+            userAllocation.setWarningAmount(warningAmount);
             userAllocation.setCreateTime(new Date());
             userAllocation.setUpdateTime(new Date());
             allocationMapper.deleteById(userAllocation.getId());
@@ -344,17 +328,11 @@ public class CallbackController {
             allocationMapper.deleteByMap(deleteUserMap);
             int i = allocationMapper.insert(userAllocation);
             if (i > 0) {
-                logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
+                log.info("同步分配用户表完成,task_id:{},accountId:{}", state, token.getAccountId());
             }
             //账号绑定
             bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId);
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    reportService.loadBytedanceHistoryData(token);
-                }
-            };
-            thread.start();
+            new Thread(() -> reportService.loadBytedanceHistoryData(token)).start();
             returnMap.put("code", 0);
             returnMap.put("desc", "success");
         } catch (Exception e) {

+ 0 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CreativeTitleController.java

@@ -22,8 +22,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 
@@ -34,8 +32,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 
@@ -47,8 +43,6 @@ public class CreativeTitleController {
         result.setSuccess(true);
         result.setResult(labelArr);
         return result;
-
-
     }
 
 

+ 7 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CtopOauthTokenController.java

@@ -67,7 +67,7 @@ public class CtopOauthTokenController {
                                                        HttpServletRequest req) {
         Result<IPage<CtopOauthToken>> result = new Result<>();
         QueryWrapper<CtopOauthToken> queryWrapper = QueryGenerator.initQueryWrapper(cTopOauthToken, req.getParameterMap());
-        Page<CtopOauthToken> page = new Page<CtopOauthToken>(pageNo, pageSize);
+        Page<CtopOauthToken> page = new Page<>(pageNo, pageSize);
         IPage<CtopOauthToken> pageList = ctopOauthTokenService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -84,7 +84,7 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-添加", notes = "oauth授权码-添加")
     @PostMapping(value = "/add")
     public Result<CtopOauthToken> add(@RequestBody CtopOauthToken ctopOauthToken) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         try {
             ctopOauthTokenService.save(ctopOauthToken);
             result.success("添加成功!");
@@ -105,13 +105,12 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-编辑", notes = "oauth授权码-编辑")
     @PutMapping(value = "/edit")
     public Result<CtopOauthToken> edit(@RequestBody CtopOauthToken cTopOauthToken) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         CtopOauthToken cTopOauthTokenEntity = ctopOauthTokenService.getById(cTopOauthToken.getId());
         if (cTopOauthTokenEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = ctopOauthTokenService.updateById(cTopOauthToken);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -129,7 +128,7 @@ public class CtopOauthTokenController {
     @AutoLog(value = "oauth授权码-通过id删除")
     @ApiOperation(value = "oauth授权码-通过id删除", notes = "oauth授权码-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             ctopOauthTokenService.removeById(id);
         } catch (Exception e) {
@@ -169,7 +168,7 @@ public class CtopOauthTokenController {
     @ApiOperation(value = "oauth授权码-通过id查询", notes = "oauth授权码-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<CtopOauthToken> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<CtopOauthToken> result = new Result<CtopOauthToken>();
+        Result<CtopOauthToken> result = new Result<>();
         CtopOauthToken cTopOauthToken = ctopOauthTokenService.getById(id);
         if (cTopOauthToken == null) {
             result.error500("未找到对应实体");
@@ -219,8 +218,8 @@ public class CtopOauthTokenController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java

@@ -80,11 +80,11 @@ public class DramaInfoController {
 												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 												  HttpServletRequest req) {
-		Result<IPage<DramaInfo>> result = new Result<IPage<DramaInfo>>();
+        Result<IPage<DramaInfo>> result = new Result<>();
 		QueryWrapper<DramaInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaInfo, req.getParameterMap());
-		Page<DramaInfo> page = new Page<DramaInfo>(pageNo, pageSize);
+        Page<DramaInfo> page = new Page<>(pageNo, pageSize);
 		IPage<DramaInfo> pageList = dramaInfoService.page(page, queryWrapper);
-		if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
+        if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
 			List<DramaInfo> list = new ArrayList<>();
 			for (int i = 0; i < pageList.getRecords().size(); i++) {
 				DramaInfo getDramaInfo = pageList.getRecords().get(i);
@@ -136,7 +136,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-编辑", notes="剧本信息-编辑")
 	@PostMapping(value = "/edit")
 	public Result<DramaInfo> edit(@RequestBody DramaInfo dramaInfo) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		DramaInfo dramaInfoEntity = dramaInfoService.getById(dramaInfo.getId());
 		if(dramaInfoEntity==null) {
 			result.error500("未找到对应实体");
@@ -158,7 +158,7 @@ public class DramaInfoController {
 	@AutoLog(value = "剧本信息-通过id删除")
 	@ApiOperation(value="剧本信息-通过id删除", notes="剧本信息-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			dramaInfoService.removeById(id);
 		} catch (Exception e) {
@@ -177,7 +177,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-批量删除", notes="剧本信息-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<DramaInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -196,7 +196,7 @@ public class DramaInfoController {
 	@ApiOperation(value="剧本信息-通过id查询", notes="剧本信息-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<DramaInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<DramaInfo> result = new Result<DramaInfo>();
+        Result<DramaInfo> result = new Result<>();
 		DramaInfo dramaInfo = dramaInfoService.getById(id);
 		if(dramaInfo==null) {
 			result.error500("未找到对应实体");

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java

@@ -49,9 +49,9 @@ public class DramaItemInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<DramaItemInfo>> result = new Result<IPage<DramaItemInfo>>();
+        Result<IPage<DramaItemInfo>> result = new Result<>();
         QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
-        Page<DramaItemInfo> page = new Page<DramaItemInfo>(pageNo, pageSize);
+        Page<DramaItemInfo> page = new Page<>(pageNo, pageSize);
         queryWrapper.orderByAsc("rank").orderByDesc("update_time");
         IPage<DramaItemInfo> pageList = dramaItemInfoService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -114,7 +114,7 @@ public class DramaItemInfoController {
     @AutoLog(value = "剧本内容信息-通过id删除")
     @ApiOperation(value = "剧本内容信息-通过id删除", notes = "剧本内容信息-通过id删除")
     @PostMapping(value = "/delete")
-    public Result<?> delete(@RequestBody DramaItemInfo dramaItemInfo) {
+    public Result<Object> delete(@RequestBody DramaItemInfo dramaItemInfo) {
         try {
             dramaItemInfoService.removeById(dramaItemInfo.getId());
         } catch (Exception e) {
@@ -134,7 +134,7 @@ public class DramaItemInfoController {
     @ApiOperation(value = "剧本内容信息-批量删除", notes = "剧本内容信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<DramaItemInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        Result<DramaItemInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -154,7 +154,7 @@ public class DramaItemInfoController {
     @ApiOperation(value = "剧本内容信息-通过id查询", notes = "剧本内容信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<DramaItemInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        Result<DramaItemInfo> result = new Result<>();
         DramaItemInfo dramaItemInfo = dramaItemInfoService.getById(id);
         if (dramaItemInfo == null) {
             result.error500("未找到对应实体");

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java

@@ -48,9 +48,9 @@ public class DramaRoleInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<DramaRoleInfo>> result = new Result<IPage<DramaRoleInfo>>();
+        Result<IPage<DramaRoleInfo>> result = new Result<>();
         QueryWrapper<DramaRoleInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaRoleInfo, req.getParameterMap());
-        Page<DramaRoleInfo> page = new Page<DramaRoleInfo>(pageNo, pageSize);
+        Page<DramaRoleInfo> page = new Page<>(pageNo, pageSize);
         IPage<DramaRoleInfo> pageList = dramaRoleInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -67,7 +67,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-添加", notes = "剧本角色信息-添加")
     @PostMapping(value = "/add")
     public Result<DramaRoleInfo> add(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         try {
             dramaRoleInfoService.save(dramaRoleInfo);
             result.success("添加成功!");
@@ -88,7 +88,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-编辑", notes = "剧本角色信息-编辑")
     @PutMapping(value = "/edit")
     public Result<DramaRoleInfo> edit(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         DramaRoleInfo dramaRoleInfoEntity = dramaRoleInfoService.getById(dramaRoleInfo.getId());
         if (dramaRoleInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -111,7 +111,7 @@ public class DramaRoleInfoController {
     @AutoLog(value = "剧本角色信息-通过id删除")
     @ApiOperation(value = "剧本角色信息-通过id删除", notes = "剧本角色信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             dramaRoleInfoService.removeById(id);
         } catch (Exception e) {
@@ -131,7 +131,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-批量删除", notes = "剧本角色信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<DramaRoleInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -151,7 +151,7 @@ public class DramaRoleInfoController {
     @ApiOperation(value = "剧本角色信息-通过id查询", notes = "剧本角色信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<DramaRoleInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<DramaRoleInfo> result = new Result<DramaRoleInfo>();
+        Result<DramaRoleInfo> result = new Result<>();
         DramaRoleInfo dramaRoleInfo = dramaRoleInfoService.getById(id);
         if (dramaRoleInfo == null) {
             result.error500("未找到对应实体");

+ 0 - 250
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonNewController.java

@@ -1,250 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.entity.EduLessonNew;
-import org.jeecg.modules.ctop.service.IEduLessonNewService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 内部培训视频信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-22
- */
-@Slf4j
-@Api(tags = "内部培训视频信息")
-@RestController
-@RequestMapping("/ctop/eduLessonNew")
-public class EduLessonNewController {
-    @Autowired
-    private IEduLessonNewService eduLessonNewService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param eduLessonNew
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-分页列表查询")
-    @ApiOperation(value = "内部培训视频信息-分页列表查询", notes = "内部培训视频信息-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<EduLessonNew>> queryPageList(EduLessonNew eduLessonNew,
-                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                     @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
-                                                     HttpServletRequest req) {
-        Result<IPage<EduLessonNew>> result = new Result<>();
-        eduLessonNew.setEnabled(CtopAdConstant.COMMON_STATUS_ENABLED);
-        QueryWrapper<EduLessonNew> queryWrapper = QueryGenerator.initQueryWrapper(eduLessonNew, req.getParameterMap());
-        Page<EduLessonNew> page = new Page<>(pageNo, pageSize);
-        IPage<EduLessonNew> pageList = eduLessonNewService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param eduLessonNew
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-添加")
-    @ApiOperation(value = "内部培训视频信息-添加", notes = "内部培训视频信息-添加")
-    @PostMapping(value = "/add")
-    public Result<EduLessonNew> add(@RequestBody EduLessonNew eduLessonNew) {
-        Result<EduLessonNew> result = new Result<EduLessonNew>();
-        try {
-            eduLessonNewService.save(eduLessonNew);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param eduLessonNew
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-编辑")
-    @ApiOperation(value = "内部培训视频信息-编辑", notes = "内部培训视频信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<EduLessonNew> edit(@RequestBody EduLessonNew eduLessonNew) {
-        Result<EduLessonNew> result = new Result<EduLessonNew>();
-        EduLessonNew eduLessonNewEntity = eduLessonNewService.getById(eduLessonNew.getId());
-        if (eduLessonNewEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = eduLessonNewService.updateById(eduLessonNew);
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-通过id删除")
-    @ApiOperation(value = "内部培训视频信息-通过id删除", notes = "内部培训视频信息-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            eduLessonNewService.removeById(id);
-        } catch (Exception e) {
-            log.error("删除失败", e.getMessage());
-            return Result.error("删除失败!");
-        }
-        return Result.ok("删除成功!");
-    }
-
-    /**
-     * 批量删除
-     *
-     * @param ids
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-批量删除")
-    @ApiOperation(value = "内部培训视频信息-批量删除", notes = "内部培训视频信息-批量删除")
-    @DeleteMapping(value = "/deleteBatch")
-    public Result<EduLessonNew> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<EduLessonNew> result = new Result<EduLessonNew>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.eduLessonNewService.removeByIds(Arrays.asList(ids.split(",")));
-            result.success("删除成功!");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id查询
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "内部培训视频信息-通过id查询")
-    @ApiOperation(value = "内部培训视频信息-通过id查询", notes = "内部培训视频信息-通过id查询")
-    @GetMapping(value = "/queryById")
-    public Result<EduLessonNew> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<EduLessonNew> result = new Result<EduLessonNew>();
-        EduLessonNew eduLessonNew = eduLessonNewService.getById(id);
-        if (eduLessonNew == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(eduLessonNew);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<EduLessonNew> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                EduLessonNew eduLessonNew = JSON.parseObject(deString, EduLessonNew.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(eduLessonNew, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<EduLessonNew> pageList = eduLessonNewService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "内部培训视频信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, EduLessonNew.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("内部培训视频信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<EduLessonNew> listEduLessonNews = ExcelImportUtil.importExcel(file.getInputStream(), EduLessonNew.class, params);
-                eduLessonNewService.saveBatch(listEduLessonNews);
-                return Result.ok("文件导入成功!数据行数:" + listEduLessonNews.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
-}

+ 10 - 50
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/FileInfoController.java

@@ -3,7 +3,6 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.entity.FileInfo;
 import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.utils.StringUtils;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,23 +12,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -64,9 +56,9 @@ public class FileInfoController {
                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                  HttpServletRequest req) {
-        Result<IPage<FileInfo>> result = new Result<IPage<FileInfo>>();
+        Result<IPage<FileInfo>> result = new Result<>();
         QueryWrapper<FileInfo> queryWrapper = QueryGenerator.initQueryWrapper(fileInfo, req.getParameterMap());
-        Page<FileInfo> page = new Page<FileInfo>(pageNo, pageSize);
+        Page<FileInfo> page = new Page<>(pageNo, pageSize);
         IPage<FileInfo> pageList = fileInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +75,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-添加", notes = "文件信息-添加")
     @PostMapping(value = "/add")
     public Result<FileInfo> add(@RequestBody FileInfo fileInfo) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         try {
             fileInfoService.save(fileInfo);
             result.success("添加成功!");
@@ -104,13 +96,12 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-编辑", notes = "文件信息-编辑")
     @PutMapping(value = "/edit")
     public Result<FileInfo> edit(@RequestBody FileInfo fileInfo) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         FileInfo fileInfoEntity = fileInfoService.getById(fileInfo.getId());
         if (fileInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = fileInfoService.updateById(fileInfo);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -128,7 +119,7 @@ public class FileInfoController {
     @AutoLog(value = "文件信息-通过id删除")
     @ApiOperation(value = "文件信息-通过id删除", notes = "文件信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             fileInfoService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +139,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-批量删除", notes = "文件信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<FileInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +159,7 @@ public class FileInfoController {
     @ApiOperation(value = "文件信息-通过id查询", notes = "文件信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<FileInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<FileInfo> result = new Result<FileInfo>();
+        Result<FileInfo> result = new Result<>();
         FileInfo fileInfo = fileInfoService.getById(id);
         if (fileInfo == null) {
             result.error500("未找到对应实体");
@@ -180,46 +171,14 @@ public class FileInfoController {
     }
 
     /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<FileInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                FileInfo fileInfo = JSON.parseObject(deString, FileInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(fileInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<FileInfo> pageList = fileInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "文件信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, FileInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("文件信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
      * 通过excel导入数据
      *
      * @param request
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
@@ -240,6 +199,7 @@ public class FileInfoController {
                     file.getInputStream().close();
                 } catch (IOException e) {
                     e.printStackTrace();
+                    log.error("服务异常");
                 }
             }
         }

+ 7 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/GraphqlController.java

@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
@@ -20,7 +19,7 @@ import java.util.Map;
 /**
  * @author jeecg-boot
  */
-@Controller
+@RestController
 @RequestMapping("/graphql")
 public class GraphqlController {
     @Autowired
@@ -37,12 +36,11 @@ public class GraphqlController {
         }
     }
 
-    @ResponseBody
-    @RequestMapping(value="/addkuaishouuser", method = RequestMethod.POST)
+    @PostMapping("/addkuaishouuser")
     public Result<Map<String,Object>> addKuaishouUser(@RequestBody JSONObject jsonObject){
         String url = jsonObject.getString("url");
         String uid = kuaishouWebInterfaceService.checkKuaishouUser(url);
-        Map<String,Object> resultMap = new HashMap<String, Object>();
+        Map<String, Object> resultMap = new HashMap<>();
         if(uid == null){
             resultMap.put("hasUser",false);
         }else {
@@ -59,19 +57,15 @@ public class GraphqlController {
             };
             thread.start();
         }
-        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Result<Map<String, Object>> result = new Result<>();
         result.setSuccess(true);
         result.setResult(resultMap);
         return result;
     }
 
-    @ResponseBody
-    @RequestMapping(value="/publicfeeds", method = RequestMethod.GET)
-    public Result<IPage<KuaishouVideo>> getVideoList(@RequestParam("num") Integer num){
-        if(num==null){
-            num=99999999;
-        }
-        Result<IPage<KuaishouVideo>> result = new Result<IPage<KuaishouVideo>>();
+    @GetMapping("/publicfeeds")
+    public Result<IPage<KuaishouVideo>> getVideoList(@RequestParam(name = "num", defaultValue = "99999999") Integer num) {
+        Result<IPage<KuaishouVideo>> result = new Result<>();
         KuaishouVideo video = new KuaishouVideo();
         QueryWrapper<KuaishouVideo> queryWrapper = QueryGenerator.initQueryWrapper(video,null);
         queryWrapper.orderByDesc("num");

+ 4 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/HotInformationCtroller.java

@@ -34,10 +34,9 @@ public class HotInformationCtroller {
     private IHotMaterialService hotMaterialService;
 
     @ResponseBody
-    @RequestMapping(value = "/douyin/feeds", method = RequestMethod.GET)
+    @GetMapping("/douyin/feeds")
     public Result<IPage<DouyinHot>> getVideoList(HttpServletRequest req) {
         Result<IPage<DouyinHot>> result = new Result<>();
-        DouyinHot hot = new DouyinHot();
         Map<String, String[]> paramMap = req.getParameterMap();
         String userName = paramMap.get("userName") != null ? paramMap.get("userName")[0] : null;
         String start = paramMap.get("start") != null ? paramMap.get("start")[0] : null;
@@ -53,7 +52,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/effectcase/feeds", method = RequestMethod.GET)
+    @GetMapping("/effectcase/feeds")
     public Result<IPage<EffectCase>> getEffectcaseList(HttpServletRequest req) {
         Result<IPage<EffectCase>> result = new Result<>();
         Map<String, String[]> paramMap = req.getParameterMap();
@@ -71,7 +70,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/material/feeds", method = RequestMethod.GET)
+    @GetMapping("/material/feeds")
     public Result<IPage<HotMaterial>> getMaterialList(HttpServletRequest req) {
         Result<IPage<HotMaterial>> result = new Result<>();
         Map<String, String[]> paramMap = req.getParameterMap();
@@ -89,7 +88,7 @@ public class HotInformationCtroller {
     }
 
     @ResponseBody
-    @RequestMapping(value = "/video/url", method = RequestMethod.GET)
+    @GetMapping("/video/url")
     public Map<String, Object> getVideoUrl(@RequestParam(name = "id") String id, @RequestParam(name = "type") Integer type) {
         try {
             return effectCaseService.getVideoUrl(id, type);

+ 6 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageDownloadController.java

@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
@@ -23,8 +24,6 @@ import java.util.zip.ZipOutputStream;
 @RestController
 @RequestMapping("/download")
 public class ImageDownloadController {
-
-
     @RequestMapping(value = "/zip")
     @ResponseBody
     public void downloadFiles(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject json) {
@@ -42,9 +41,9 @@ public class ImageDownloadController {
         String agent = request.getHeader("USER-AGENT");
         try {
             if (agent.contains("MSIE") || agent.contains("Trident")) {
-                downloadName = java.net.URLEncoder.encode(downloadName, "UTF-8");
+                downloadName = java.net.URLEncoder.encode(downloadName, StandardCharsets.UTF_8.toString());
             } else {
-                downloadName = new String(downloadName.getBytes("UTF-8"), "ISO-8859-1");
+                downloadName = new String(downloadName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -102,6 +101,7 @@ public class ImageDownloadController {
 
     }
 
+
     //url转file
     private File getFileByUrl(String fileUrl, String suffix) {
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
@@ -123,6 +123,7 @@ public class ImageDownloadController {
             stream = new BufferedOutputStream(fileOutputStream);
             stream.write(outStream.toByteArray());
         } catch (Exception e) {
+            e.printStackTrace();
         } finally {
             try {
                 if (inputStream != null){
@@ -133,6 +134,7 @@ public class ImageDownloadController {
                 }
                 outStream.close();
             } catch (Exception e) {
+                e.printStackTrace();
             }
         }
         return file;

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouCleanMaterialReportController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
 import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 快手素材清洗数据
@@ -64,9 +48,9 @@ public class KuaiShouCleanMaterialReportController {
                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                     HttpServletRequest req) {
-        Result<IPage<KuaiShouCleanMaterialReport>> result = new Result<IPage<KuaiShouCleanMaterialReport>>();
+        Result<IPage<KuaiShouCleanMaterialReport>> result = new Result<>();
         QueryWrapper<KuaiShouCleanMaterialReport> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCleanMaterialReport, req.getParameterMap());
-        Page<KuaiShouCleanMaterialReport> page = new Page<KuaiShouCleanMaterialReport>(pageNo, pageSize);
+        Page<KuaiShouCleanMaterialReport> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouCleanMaterialReport> pageList = kuaiShouCleanMaterialReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class KuaiShouCleanMaterialReportController {
     @ApiOperation(value = "快手素材清洗数据-添加", notes = "快手素材清洗数据-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouCleanMaterialReport> add(@RequestBody KuaiShouCleanMaterialReport kuaiShouCleanMaterialReport) {
-        Result<KuaiShouCleanMaterialReport> result = new Result<KuaiShouCleanMaterialReport>();
+        Result<KuaiShouCleanMaterialReport> result = new Result<>();
         try {
             kuaiShouCleanMaterialReportService.save(kuaiShouCleanMaterialReport);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class KuaiShouCleanMaterialReportController {
     @ApiOperation(value = "快手素材清洗数据-编辑", notes = "快手素材清洗数据-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouCleanMaterialReport> edit(@RequestBody KuaiShouCleanMaterialReport kuaiShouCleanMaterialReport) {
-        Result<KuaiShouCleanMaterialReport> result = new Result<KuaiShouCleanMaterialReport>();
+        Result<KuaiShouCleanMaterialReport> result = new Result<>();
         KuaiShouCleanMaterialReport kuaiShouCleanMaterialReportEntity = kuaiShouCleanMaterialReportService.getById(kuaiShouCleanMaterialReport.getId());
         if (kuaiShouCleanMaterialReportEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class KuaiShouCleanMaterialReportController {
     @AutoLog(value = "快手素材清洗数据-通过id删除")
     @ApiOperation(value = "快手素材清洗数据-通过id删除", notes = "快手素材清洗数据-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouCleanMaterialReportService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class KuaiShouCleanMaterialReportController {
     @ApiOperation(value = "快手素材清洗数据-批量删除", notes = "快手素材清洗数据-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouCleanMaterialReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouCleanMaterialReport> result = new Result<KuaiShouCleanMaterialReport>();
+        Result<KuaiShouCleanMaterialReport> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class KuaiShouCleanMaterialReportController {
     @ApiOperation(value = "快手素材清洗数据-通过id查询", notes = "快手素材清洗数据-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouCleanMaterialReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouCleanMaterialReport> result = new Result<KuaiShouCleanMaterialReport>();
+        Result<KuaiShouCleanMaterialReport> result = new Result<>();
         KuaiShouCleanMaterialReport kuaiShouCleanMaterialReport = kuaiShouCleanMaterialReportService.getById(id);
         if (kuaiShouCleanMaterialReport == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class KuaiShouCleanMaterialReportController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouCleanMaterialReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouCleanMaterialReport kuaiShouCleanMaterialReport = JSON.parseObject(deString, KuaiShouCleanMaterialReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCleanMaterialReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouCleanMaterialReport> pageList = kuaiShouCleanMaterialReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手素材清洗数据列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouCleanMaterialReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手素材清洗数据列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<KuaiShouCleanMaterialReport> listKuaiShouCleanMaterialReports = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouCleanMaterialReport.class, params);
-                kuaiShouCleanMaterialReportService.saveBatch(listKuaiShouCleanMaterialReports);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouCleanMaterialReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouDefectMaterialController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.KuaiShouDefectMaterial;
 import org.jeecg.modules.ctop.service.IKuaiShouDefectMaterialService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 快手缺失素材
@@ -64,9 +48,9 @@ public class KuaiShouDefectMaterialController {
                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
-        Result<IPage<KuaiShouDefectMaterial>> result = new Result<IPage<KuaiShouDefectMaterial>>();
+        Result<IPage<KuaiShouDefectMaterial>> result = new Result<>();
         QueryWrapper<KuaiShouDefectMaterial> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDefectMaterial, req.getParameterMap());
-        Page<KuaiShouDefectMaterial> page = new Page<KuaiShouDefectMaterial>(pageNo, pageSize);
+        Page<KuaiShouDefectMaterial> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouDefectMaterial> pageList = kuaiShouDefectMaterialService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-添加", notes = "快手缺失素材-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouDefectMaterial> add(@RequestBody KuaiShouDefectMaterial kuaiShouDefectMaterial) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         try {
             kuaiShouDefectMaterialService.save(kuaiShouDefectMaterial);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-编辑", notes = "快手缺失素材-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouDefectMaterial> edit(@RequestBody KuaiShouDefectMaterial kuaiShouDefectMaterial) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         KuaiShouDefectMaterial kuaiShouDefectMaterialEntity = kuaiShouDefectMaterialService.getById(kuaiShouDefectMaterial.getId());
         if (kuaiShouDefectMaterialEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class KuaiShouDefectMaterialController {
     @AutoLog(value = "快手缺失素材-通过id删除")
     @ApiOperation(value = "快手缺失素材-通过id删除", notes = "快手缺失素材-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouDefectMaterialService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-批量删除", notes = "快手缺失素材-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouDefectMaterial> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class KuaiShouDefectMaterialController {
     @ApiOperation(value = "快手缺失素材-通过id查询", notes = "快手缺失素材-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouDefectMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouDefectMaterial> result = new Result<KuaiShouDefectMaterial>();
+        Result<KuaiShouDefectMaterial> result = new Result<>();
         KuaiShouDefectMaterial kuaiShouDefectMaterial = kuaiShouDefectMaterialService.getById(id);
         if (kuaiShouDefectMaterial == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class KuaiShouDefectMaterialController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouDefectMaterial> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouDefectMaterial kuaiShouDefectMaterial = JSON.parseObject(deString, KuaiShouDefectMaterial.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDefectMaterial, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouDefectMaterial> pageList = kuaiShouDefectMaterialService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手缺失素材列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouDefectMaterial.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手缺失素材列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<KuaiShouDefectMaterial> listKuaiShouDefectMaterials = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouDefectMaterial.class, params);
-                kuaiShouDefectMaterialService.saveBatch(listKuaiShouDefectMaterials);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouDefectMaterials.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 14 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAdvertiserController.java

@@ -61,7 +61,7 @@ public class KuaishouAdvertiserController {
                                                           @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                           @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<KuaishouAdAccount>> result = new Result<IPage<KuaishouAdAccount>>();
+        Result<IPage<KuaishouAdAccount>> result = new Result<>();
         Map<String, String[]> paramMap = new HashMap<>(req.getParameterMap());
         paramMap.remove("dataProcess");
         paramMap.remove("industry");
@@ -74,7 +74,7 @@ public class KuaishouAdvertiserController {
         QueryWrapper<KuaishouAdAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAdAccount, paramMap);
         String dataProcess = req.getParameter("dataProcess");
         if (name != null) {
-            queryWrapper.like("name", "%" + name + "%");
+            queryWrapper.like("name", name);
         }
         if (sysCategory != null) {
             queryWrapper.eq("industry_category", sysCategory.getName()).or()
@@ -102,7 +102,7 @@ public class KuaishouAdvertiserController {
             }
         }
 
-        Page<KuaishouAdAccount> page = new Page<KuaishouAdAccount>(pageNo, pageSize);
+        Page<KuaishouAdAccount> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouAdAccount> pageList = kuaishouAdAccountService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -118,7 +118,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-添加", notes="快手广告主信息表-添加")
     @PostMapping(value = "/add")
     public Result<KuaishouAdAccount> add(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         try {
             String industry = kuaishouAdAccount.getIndustry();
             SysCategory secondCategory = sysCategoryService.getById(industry);
@@ -145,7 +145,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-编辑", notes="快手广告主信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaishouAdAccount> edit(@RequestBody KuaishouAdAccount kuaishouAdAccount) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         KuaishouAdAccount kuaishouAdAccountEntity = kuaishouAdAccountService.getById(kuaishouAdAccount.getKsid());
 
         if(kuaishouAdAccountEntity==null) {
@@ -158,11 +158,9 @@ public class KuaishouAdvertiserController {
             kuaishouAdAccount.setFirstIndustry(firstCategory.getName());
             SysCategory industryCategory = sysCategoryService.getById(firstCategory.getPid());
             kuaishouAdAccount.setIndustryCategory(industryCategory.getName());
-            QueryWrapper<KuaishouAdAccount> queryWrapper = new QueryWrapper<KuaishouAdAccount>();
+            QueryWrapper<KuaishouAdAccount> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("ksid", kuaishouAdAccount.getKsid());
             boolean ok = kuaishouAdAccountService.update(kuaishouAdAccount, queryWrapper);
-//            boolean ok = kuaishouAdAccountService.updateById(kuaishouAdAccount);
-            //TODO 返回false说明什么?
             if(ok) {
                 result.success("修改成功!");
             }
@@ -179,7 +177,7 @@ public class KuaishouAdvertiserController {
     @AutoLog(value = "快手广告主信息表-通过id删除")
     @ApiOperation(value="快手广告主信息表-通过id删除", notes="快手广告主信息表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaishouAdAccountService.removeById(id);
         } catch (Exception e) {
@@ -217,7 +215,7 @@ public class KuaishouAdvertiserController {
     @ApiOperation(value="快手广告主信息表-通过id查询", notes="快手广告主信息表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaishouAdAccount> queryById(@RequestParam(name="id",required=true) String id) {
-        Result<KuaishouAdAccount> result = new Result<KuaishouAdAccount>();
+        Result<KuaishouAdAccount> result = new Result<>();
         KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(id);
         if(kuaishouAdAccount==null) {
             result.error500("未找到对应实体");
@@ -267,8 +265,8 @@ public class KuaishouAdvertiserController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
@@ -295,19 +293,18 @@ public class KuaishouAdvertiserController {
         return Result.ok("文件导入失败!");
     }
     @ResponseBody
-    @RequestMapping(value="/companysugest", method = RequestMethod.GET)
+    @GetMapping("/companysugest")
     public Result<List<String>> getCompanySugest(@RequestParam("company") String company){
-        Result<List<String>> result = new Result<List<String>>();
+        Result<List<String>> result = new Result<>();
         List<String> list = kuaishouAdAccountService.companySugest(company);
         result.setResult(list);
         result.setSuccess(true);
         return result;
     }
 
-    @ResponseBody
-    @RequestMapping(value="/productsugest", method = RequestMethod.GET)
+    @GetMapping(value = "/productsugest")
     public Result<List<String>> getProductSugest(@RequestParam("product") String product){
-        Result<List<String>> result = new Result<List<String>>();
+        Result<List<String>> result = new Result<>();
         List<String> list = kuaishouAdAccountService.productSugest(product);
         result.setResult(list);
         result.setSuccess(true);

+ 8 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppAccountController.java

@@ -63,9 +63,9 @@ public class KuaishouAppAccountController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<KuaishouAppAccount>> result = new Result<IPage<KuaishouAppAccount>>();
+        Result<IPage<KuaishouAppAccount>> result = new Result<>();
 		QueryWrapper<KuaishouAppAccount> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAppAccount, req.getParameterMap());
-		Page<KuaishouAppAccount> page = new Page<KuaishouAppAccount>(pageNo, pageSize);
+        Page<KuaishouAppAccount> page = new Page<>(pageNo, pageSize);
 		IPage<KuaishouAppAccount> pageList = kuaishouAppAccountService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -81,7 +81,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-添加", notes="快手APP账号表-添加")
 	@PostMapping(value = "/add")
 	public Result<KuaishouAppAccount> add(@RequestBody KuaishouAppAccount kuaishouAppAccount) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		try {
 			kuaishouAppAccountService.save(kuaishouAppAccount);
 			result.success("添加成功!");
@@ -101,13 +101,12 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-编辑", notes="快手APP账号表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<KuaishouAppAccount> edit(@RequestBody KuaishouAppAccount kuaishouAppAccount) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccountEntity = kuaishouAppAccountService.getById(kuaishouAppAccount.getId());
 		if(kuaishouAppAccountEntity==null) {
 			result.error500("未找到对应实体");
 		}else {
 			boolean ok = kuaishouAppAccountService.updateById(kuaishouAppAccount);
-			//TODO 返回false说明什么?
 			if(ok) {
 				result.success("修改成功!");
 			}
@@ -125,7 +124,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-通过id删除", notes="快手APP账号表-通过id删除")
 	@DeleteMapping(value = "/delete")
 	public Result<KuaishouAppAccount> delete(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccount = kuaishouAppAccountService.getById(id);
 		if(kuaishouAppAccount==null) {
 			result.error500("未找到对应实体");
@@ -167,7 +166,7 @@ public class KuaishouAppAccountController {
 	@ApiOperation(value="快手APP账号表-通过id查询", notes="快手APP账号表-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<KuaishouAppAccount> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppAccount> result = new Result<KuaishouAppAccount>();
+        Result<KuaishouAppAccount> result = new Result<>();
 		KuaishouAppAccount kuaishouAppAccount = kuaishouAppAccountService.getById(id);
 		if(kuaishouAppAccount==null) {
 			result.error500("未找到对应实体");
@@ -217,8 +216,8 @@ public class KuaishouAppAccountController {
    * @param response
    * @return
    */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+  @PostMapping("/importExcel")
+  public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 35 - 37
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouAppProductController.java

@@ -1,39 +1,37 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAppProduct;
 import cn.com.ctop.kuaishou.modules.app.service.IKuaishouAppProductService;
-import java.util.Date;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
  /**
  * 快手推广产品
@@ -48,7 +46,7 @@ import io.swagger.annotations.ApiOperation;
 public class KuaishouAppProductController {
 	@Autowired
 	private IKuaishouAppProductService kuaishouAppProductService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param kuaishouAppProduct
@@ -64,15 +62,15 @@ public class KuaishouAppProductController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<KuaishouAppProduct>> result = new Result<IPage<KuaishouAppProduct>>();
+		Result<IPage<KuaishouAppProduct>> result = new Result<>();
 		QueryWrapper<KuaishouAppProduct> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAppProduct, req.getParameterMap());
-		Page<KuaishouAppProduct> page = new Page<KuaishouAppProduct>(pageNo, pageSize);
+		Page<KuaishouAppProduct> page = new Page<>(pageNo, pageSize);
 		IPage<KuaishouAppProduct> pageList = kuaishouAppProductService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param kuaishouAppProduct
@@ -82,7 +80,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-添加", notes="快手推广产品-添加")
 	@PostMapping(value = "/add")
 	public Result<KuaishouAppProduct> add(@RequestBody KuaishouAppProduct kuaishouAppProduct) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		try {
 			kuaishouAppProductService.save(kuaishouAppProduct);
 			result.success("添加成功!");
@@ -92,7 +90,7 @@ public class KuaishouAppProductController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param kuaishouAppProduct
@@ -102,7 +100,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-编辑", notes="快手推广产品-编辑")
 	@PutMapping(value = "/edit")
 	public Result<KuaishouAppProduct> edit(@RequestBody KuaishouAppProduct kuaishouAppProduct) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		KuaishouAppProduct kuaishouAppProductEntity = kuaishouAppProductService.getById(kuaishouAppProduct.getId());
 		if(kuaishouAppProductEntity==null) {
 			result.error500("未找到对应实体");
@@ -112,11 +110,11 @@ public class KuaishouAppProductController {
 				result.success("修改成功!");
 			}
 		}
-		
+
 		return result;
 	}
-	
-	/**
+
+	 /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -124,7 +122,7 @@ public class KuaishouAppProductController {
 	@AutoLog(value = "快手推广产品-通过id删除")
 	@ApiOperation(value="快手推广产品-通过id删除", notes="快手推广产品-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+	public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			kuaishouAppProductService.removeById(id);
 		} catch (Exception e) {
@@ -133,8 +131,8 @@ public class KuaishouAppProductController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+	 /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -143,7 +141,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-批量删除", notes="快手推广产品-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<KuaishouAppProduct> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -152,8 +150,8 @@ public class KuaishouAppProductController {
 		}
 		return result;
 	}
-	
-	/**
+
+	 /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -162,7 +160,7 @@ public class KuaishouAppProductController {
 	@ApiOperation(value="快手推广产品-通过id查询", notes="快手推广产品-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<KuaishouAppProduct> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAppProduct> result = new Result<KuaishouAppProduct>();
+		Result<KuaishouAppProduct> result = new Result<>();
 		KuaishouAppProduct kuaishouAppProduct = kuaishouAppProductService.getById(id);
 		if(kuaishouAppProduct==null) {
 			result.error500("未找到对应实体");
@@ -212,8 +210,8 @@ public class KuaishouAppProductController {
    * @param response
    * @return
    */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+  @PostMapping("/importExcel")
+  public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 7 - 94
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouChannelRegInfoController.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -11,30 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.KuaishouChannelRegInfo;
 import org.jeecg.modules.ctop.service.IKuaishouChannelRegInfoService;
-import org.jeecg.modules.excelutil.ExcelUtils;
-import org.jeecg.modules.excelutil.KuaishouChannelRegInfoExcelListener;
-import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 快手渠道注册信息表
@@ -67,9 +48,9 @@ public class KuaishouChannelRegInfoController {
                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
-        Result<IPage<KuaishouChannelRegInfo>> result = new Result<IPage<KuaishouChannelRegInfo>>();
+        Result<IPage<KuaishouChannelRegInfo>> result = new Result<>();
         QueryWrapper<KuaishouChannelRegInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, req.getParameterMap());
-        Page<KuaishouChannelRegInfo> page = new Page<KuaishouChannelRegInfo>(pageNo, pageSize);
+        Page<KuaishouChannelRegInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -86,7 +67,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-添加", notes = "快手渠道注册信息表-添加")
     @PostMapping(value = "/add")
     public Result<KuaishouChannelRegInfo> add(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         try {
             kuaishouChannelRegInfoService.save(kuaishouChannelRegInfo);
             result.success("添加成功!");
@@ -107,7 +88,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-编辑", notes = "快手渠道注册信息表-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaishouChannelRegInfo> edit(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         KuaishouChannelRegInfo kuaishouChannelRegInfoEntity = kuaishouChannelRegInfoService.getById(kuaishouChannelRegInfo.getId());
         if (kuaishouChannelRegInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -130,7 +111,7 @@ public class KuaishouChannelRegInfoController {
     @AutoLog(value = "快手渠道注册信息表-通过id删除")
     @ApiOperation(value = "快手渠道注册信息表-通过id删除", notes = "快手渠道注册信息表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaishouChannelRegInfoService.removeById(id);
         } catch (Exception e) {
@@ -150,7 +131,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-批量删除", notes = "快手渠道注册信息表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaishouChannelRegInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -170,7 +151,7 @@ public class KuaishouChannelRegInfoController {
     @ApiOperation(value = "快手渠道注册信息表-通过id查询", notes = "快手渠道注册信息表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaishouChannelRegInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        Result<KuaishouChannelRegInfo> result = new Result<>();
         KuaishouChannelRegInfo kuaishouChannelRegInfo = kuaishouChannelRegInfoService.getById(id);
         if (kuaishouChannelRegInfo == null) {
             result.error500("未找到对应实体");
@@ -180,72 +161,4 @@ public class KuaishouChannelRegInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaishouChannelRegInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaishouChannelRegInfo kuaishouChannelRegInfo = JSON.parseObject(deString, KuaishouChannelRegInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手渠道注册信息表列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaishouChannelRegInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手渠道注册信息表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        //1.读Excel
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            FileInputStream fis = null;
-            try {
-                MultipartFile file = entity.getValue();
-                fis = (FileInputStream) file.getInputStream();
-                AnalysisEventListener listener = new KuaishouChannelRegInfoExcelListener();
-                Boolean flag = ExcelUtils.readExcel(fis, KuaishouChannelRegInfoEntity.class, listener);
-                System.out.println("导入是否成功:" + flag);
-            } catch (Exception e) {
-                e.printStackTrace();
-            } finally {
-                if (fis != null) {
-                    try {
-                        fis.close();
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-        return Result.ok("文件导入成功!");
-    }
-
 }

+ 8 - 92
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialAscriptionController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialAscription;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -41,7 +25,7 @@ import java.util.Map;
  * @date 2019-11-23
  */
 @Slf4j
-@Api(tags = "素材归属")
+@Api(tags = "素材归属")
 @RestController
 @RequestMapping("/ctop/materialAscription")
 public class MaterialAscriptionController {
@@ -64,9 +48,9 @@ public class MaterialAscriptionController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<MaterialAscription>> result = new Result<IPage<MaterialAscription>>();
+        Result<IPage<MaterialAscription>> result = new Result<>();
         QueryWrapper<MaterialAscription> queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, req.getParameterMap());
-        Page<MaterialAscription> page = new Page<MaterialAscription>(pageNo, pageSize);
+        Page<MaterialAscription> page = new Page<>(pageNo, pageSize);
         IPage<MaterialAscription> pageList = materialAscriptionService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialAscription> add(@RequestBody MaterialAscription materialAscription) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         try {
             materialAscriptionService.save(materialAscription);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialAscription> edit(@RequestBody MaterialAscription materialAscription) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         MaterialAscription materialAscriptionEntity = materialAscriptionService.getById(materialAscription.getId());
         if (materialAscriptionEntity == null) {
             result.error500("未找到对应实体");
@@ -140,7 +124,7 @@ public class MaterialAscriptionController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialAscriptionService.removeById(id);
         } catch (Exception e) {
@@ -160,7 +144,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialAscription> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -180,7 +164,7 @@ public class MaterialAscriptionController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialAscription> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialAscription> result = new Result<MaterialAscription>();
+        Result<MaterialAscription> result = new Result<>();
         MaterialAscription materialAscription = materialAscriptionService.getById(id);
         if (materialAscription == null) {
             result.error500("未找到对应实体");
@@ -190,72 +174,4 @@ public class MaterialAscriptionController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialAscription> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialAscription materialAscription = JSON.parseObject(deString, MaterialAscription.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialAscription, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialAscription> pageList = materialAscriptionService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialAscription.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialAscription> listMaterialAscriptions = ExcelImportUtil.importExcel(file.getInputStream(), MaterialAscription.class, params);
-                materialAscriptionService.saveBatch(listMaterialAscriptions);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialAscriptions.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 1 - 85
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 
 /**
@@ -44,7 +28,7 @@ import java.util.Map;
 @Slf4j
 @Api(tags = "截屏")
 @RestController
-@RequestMapping("/123/materialCutFrame")
+@RequestMapping("/cutFrame/material")
 public class MaterialCutFrameController {
     @Autowired
     private IMaterialCutFrameService materialCutFrameService;
@@ -178,72 +162,4 @@ public class MaterialCutFrameController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialCutFrame> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialCutFrame materialCutFrame = JSON.parseObject(deString, MaterialCutFrame.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialCutFrame> pageList = materialCutFrameService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "截屏列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialCutFrame.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("截屏列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialCutFrame> listMaterialCutFrames = ExcelImportUtil.importExcel(file.getInputStream(), MaterialCutFrame.class, params);
-                materialCutFrameService.saveBatch(listMaterialCutFrames);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialCutFrames.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 29 - 115
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java

@@ -7,7 +7,6 @@ import cn.com.ctop.common.module.mapper.SysRoleMapper;
 import cn.com.ctop.common.module.service.IMaterialImageInfoService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.Check;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -22,26 +21,14 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -58,7 +45,7 @@ import java.util.Map;
 @RequestMapping("/ctop/MaterialImageInfo")
 public class MaterialImageInfoController {
     @Autowired
-    private IMaterialImageInfoService MaterialImageInfoService;
+    private IMaterialImageInfoService materialImageInfoService;
     @Autowired
     private IMaterialInfoService materialInfoService;
     @Autowired
@@ -75,11 +62,10 @@ public class MaterialImageInfoController {
                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
-        Result<IPage<MaterialImageInfo>> result = new Result<IPage<MaterialImageInfo>>();
-
+        Result<IPage<MaterialImageInfo>> result = new Result<>();
 
         QueryWrapper<MaterialImageInfo> queryWrapper = new QueryWrapper<>();
-        Object createTime = materialImageInfo.getCreateTime();
+        Date createTime = materialImageInfo.getCreateTime();
         materialImageInfo.setCreateTime(null);
         if (!Check.isNull(materialImageInfo.getUserId())) {
             String roleCode = sysRoleMapper.getRoleCodeByUserId(materialImageInfo.getUserId());
@@ -115,9 +101,7 @@ public class MaterialImageInfoController {
             }
         }
         Page<MaterialImageInfo> page = new Page<>(pageNo, pageSize);
-        IPage<MaterialImageInfo> pageList = MaterialImageInfoService.page(page, queryWrapper);
-
-
+        IPage<MaterialImageInfo> pageList = materialImageInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -127,19 +111,17 @@ public class MaterialImageInfoController {
 
     /**
      * 分页列表查询
-     *
-     * @param MaterialImageInfo
      * @param req
      * @return
      */
     @AutoLog(value = "素材-分页列表查询")
     @ApiOperation(value = "素材-分页列表查询", notes = "素材-分页列表查询")
     @GetMapping(value = "/list")
-    public Result<List<MaterialImageInfo>> queryPageList(MaterialImageInfo MaterialImageInfo,
+    public Result<List<MaterialImageInfo>> queryPageList(MaterialImageInfo materialImageInfo,
                                                          HttpServletRequest req) {
         Result<List<MaterialImageInfo>> result = new Result<>();
-        QueryWrapper<MaterialImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(MaterialImageInfo, req.getParameterMap());
-        List<MaterialImageInfo> list = MaterialImageInfoService.list(queryWrapper);
+        QueryWrapper<MaterialImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialImageInfo, req.getParameterMap());
+        List<MaterialImageInfo> list = materialImageInfoService.list(queryWrapper);
         result.setSuccess(true);
         result.setResult(list);
         return result;
@@ -149,7 +131,7 @@ public class MaterialImageInfoController {
     @GetMapping(value = "/getDetail")
     public Result<MaterialImageInfo> getDetail(String id) {
         Result<MaterialImageInfo> result = new Result<>();
-        MaterialImageInfo materialImageInfo = MaterialImageInfoService.getById(id);
+        MaterialImageInfo materialImageInfo = materialImageInfoService.getById(id);
         if (!Check.isNull(materialImageInfo)) {
             MaterialInfo materialmInfo = materialInfoService.getById(materialImageInfo.getVideoId());
             if (!Check.isNull(materialmInfo)) {
@@ -171,16 +153,16 @@ public class MaterialImageInfoController {
     /**
      * 添加
      *
-     * @param MaterialImageInfo
+     * @param materialImageInfo
      * @return
      */
     @AutoLog(value = "素材-添加")
     @ApiOperation(value = "素材-添加", notes = "素材-添加")
     @PostMapping(value = "/add")
-    public Result<MaterialImageInfo> add(@RequestBody MaterialImageInfo MaterialImageInfo) {
-        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+    public Result<MaterialImageInfo> add(@RequestBody MaterialImageInfo materialImageInfo) {
+        Result<MaterialImageInfo> result = new Result<>();
         try {
-            MaterialImageInfoService.save(MaterialImageInfo);
+            materialImageInfoService.save(materialImageInfo);
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -199,16 +181,16 @@ public class MaterialImageInfoController {
 
     @ApiOperation(value = "素材-编辑", notes = "素材-编辑")
     @PutMapping(value = "/edit")
-    public Result<MaterialImageInfo> edit(@RequestBody MaterialImageInfo MaterialImageInfo) {
+    public Result<MaterialImageInfo> edit(@RequestBody MaterialImageInfo materialImageInfo) {
         Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
-        MaterialImageInfo MaterialImageInfoEntity = MaterialImageInfoService.getById(MaterialImageInfo.getId());
-        if (MaterialImageInfoEntity == null) {
+        MaterialImageInfo materialImageInfoEntity = materialImageInfoService.getById(materialImageInfo.getId());
+        if (materialImageInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
-            String url = (String) MaterialImageInfo.getUrl();
+            String url = (String) materialImageInfo.getUrl();
             String urlStr = "https:" + url;
-            MaterialImageInfo.setUrl(urlStr);
-            boolean ok = MaterialImageInfoService.updateById(MaterialImageInfo);
+            materialImageInfo.setUrl(urlStr);
+            boolean ok = materialImageInfoService.updateById(materialImageInfoEntity);
             if (ok) {
                 result.success("修改成功!");
             }
@@ -222,7 +204,7 @@ public class MaterialImageInfoController {
     @ApiOperation(value = "素材-编辑", notes = "素材-编辑")
     @PutMapping(value = "/batchEdit")
     public Result<MaterialImageInfo> batchEdit(@RequestBody JSONArray updateArr) {
-        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        Result<MaterialImageInfo> result = new Result<>();
         try {
             if (!Check.isNull(updateArr)) {
                 LoginUser user = (LoginUser) SecurityUtils.getSubject()
@@ -239,7 +221,7 @@ public class MaterialImageInfoController {
                             materialImageInfo.setRefuseReason(updateJson.getString("refuseReason"));
                         }
                         materialImageInfo.setAuditorId(user.getId());
-                        MaterialImageInfoService.updateById(materialImageInfo);
+                        materialImageInfoService.updateById(materialImageInfo);
                     }
                 }
             }
@@ -263,9 +245,9 @@ public class MaterialImageInfoController {
     @AutoLog(value = "素材-通过id删除")
     @ApiOperation(value = "素材-通过id删除", notes = "素材-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
-            MaterialImageInfoService.removeById(id);
+            materialImageInfoService.removeById(id);
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");
@@ -283,11 +265,11 @@ public class MaterialImageInfoController {
     @ApiOperation(value = "素材-批量删除", notes = "素材-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialImageInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        Result<MaterialImageInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.MaterialImageInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            materialImageInfoService.removeByIds(Arrays.asList(ids.split(",")));
             result.success("删除成功!");
         }
         return result;
@@ -303,82 +285,14 @@ public class MaterialImageInfoController {
     @ApiOperation(value = "素材-通过id查询", notes = "素材-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialImageInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
-        MaterialImageInfo MaterialImageInfo = MaterialImageInfoService.getById(id);
-        if (MaterialImageInfo == null) {
+        Result<MaterialImageInfo> result = new Result<>();
+        MaterialImageInfo materialImageInfo = materialImageInfoService.getById(id);
+        if (materialImageInfo == null) {
             result.error500("未找到对应实体");
         } else {
-            result.setResult(MaterialImageInfo);
+            result.setResult(materialImageInfo);
             result.setSuccess(true);
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialImageInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialImageInfo MaterialImageInfo = JSON.parseObject(deString, MaterialImageInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(MaterialImageInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialImageInfo> pageList = MaterialImageInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialImageInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialImageInfo> listMaterialImageInfos = ExcelImportUtil.importExcel(file.getInputStream(), MaterialImageInfo.class, params);
-                MaterialImageInfoService.saveBatch(listMaterialImageInfos);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialImageInfos.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 1 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -82,9 +82,7 @@ public class MaterialInfoController {
 
     @PostMapping("/correlationUpload")
     public Map<String, Object> insertFile(@RequestBody JSONObject json) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject()
-                .getPrincipal();
-
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         json.put("userId", user.getId());
         return materialInfoService.correlationUpload(json);
     }
@@ -246,12 +244,6 @@ public class MaterialInfoController {
                     material.setKuaiShou(JSONObject.parseObject(kuaiShouString));
                 }
 
-                /*JSONObject generalizationJson = materialInfoService.getGeneralizationInfo(material.getCode());
-                if (!Check.isNull(generalizationJson)) {
-                    material.setGeneralization(generalizationJson);
-                }*/
-
-
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", material.getId());
                 imageInfoQueryWrapper.eq("status", 0);

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialParameterController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -64,9 +48,9 @@ public class MaterialParameterController {
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<MaterialParameter>> result = new Result<IPage<MaterialParameter>>();
+        Result<IPage<MaterialParameter>> result = new Result<>();
         QueryWrapper<MaterialParameter> queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, req.getParameterMap());
-        Page<MaterialParameter> page = new Page<MaterialParameter>(pageNo, pageSize);
+        Page<MaterialParameter> page = new Page<>(pageNo, pageSize);
         IPage<MaterialParameter> pageList = materialParameterService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialParameter> add(@RequestBody MaterialParameter materialParameter) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         try {
             materialParameterService.save(materialParameter);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialParameter> edit(@RequestBody MaterialParameter materialParameter) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         MaterialParameter materialParameterEntity = materialParameterService.getById(materialParameter.getId());
         if (materialParameterEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class MaterialParameterController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialParameterService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialParameter> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class MaterialParameterController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialParameter> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialParameter> result = new Result<MaterialParameter>();
+        Result<MaterialParameter> result = new Result<>();
         MaterialParameter materialParameter = materialParameterService.getById(id);
         if (materialParameter == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class MaterialParameterController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialParameter> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialParameter materialParameter = JSON.parseObject(deString, MaterialParameter.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialParameter, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialParameter> pageList = materialParameterService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialParameter.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialParameter> listMaterialParameters = ExcelImportUtil.importExcel(file.getInputStream(), MaterialParameter.class, params);
-                materialParameterService.saveBatch(listMaterialParameters);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialParameters.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 4 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java

@@ -44,7 +44,7 @@ public class MaterialPartController {
     @ApiOperation(value = "片段合成", notes = "片段合成")
     @PostMapping(value = "/merge")
     public Result<Object> merge(@RequestBody JSONArray jsonArray, HttpServletRequest req) {
-        Result<Object> result = new Result<Object>();
+        Result<Object> result = new Result<>();
         List<String> jobIdList = new ArrayList<>();
         List<VideoMerge> videoMergeList = jsonArray.toJavaList(VideoMerge.class);
         try {
@@ -56,19 +56,18 @@ public class MaterialPartController {
                 for (String part :parts){
                     MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(part);
                     String url = materialInfo.getUrl();
-                    int i = url.indexOf("/",10);
+                    int i = url.indexOf('/', 10);
                     partUrlList.add(url.substring(i+1,url.length()));
                 }
                 String startUrl = start.getUrl();
-                String startPath = startUrl.substring(startUrl.indexOf("/",10)+1,startUrl.length());
+                String startPath = startUrl.substring(startUrl.indexOf('/', 10) + 1, startUrl.length());
                 String endUrl = end.getUrl();
-                String endPath = endUrl.substring(endUrl.indexOf("/",10)+1,endUrl.length());
+                String endPath = endUrl.substring(endUrl.indexOf('/', 10) + 1, endUrl.length());
                 String jobId = MpsUtils.mergeOneVideo(startPath,partUrlList,endPath);
                 QueryJobListResponse.Job job = MpsUtils.getJobStatus(jobId);
                 VideoMergeTask videoMergeTask = new VideoMergeTask();
                 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
                 videoMergeTask.setUserId(sysUser.getId());
-//                videoMergeTask.setUserId("1");
                 videoMergeTask.setJobId(jobId);
                 videoMergeTask.setStatus(job.getState());
                 videoMergeTaskService.save(videoMergeTask);

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialTag;
 import cn.com.ctop.common.module.service.IMaterialTagService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 素材归属标
@@ -64,9 +48,9 @@ public class MaterialTagController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-        Result<IPage<MaterialTag>> result = new Result<IPage<MaterialTag>>();
+        Result<IPage<MaterialTag>> result = new Result<>();
         QueryWrapper<MaterialTag> queryWrapper = QueryGenerator.initQueryWrapper(materialTag, req.getParameterMap());
-        Page<MaterialTag> page = new Page<MaterialTag>(pageNo, pageSize);
+        Page<MaterialTag> page = new Page<>(pageNo, pageSize);
         IPage<MaterialTag> pageList = materialTagService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
     public Result<MaterialTag> add(@RequestBody MaterialTag materialTag) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         try {
             materialTagService.save(materialTag);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
     public Result<MaterialTag> edit(@RequestBody MaterialTag materialTag) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         MaterialTag materialTagEntity = materialTagService.getById(materialTag.getId());
         if (materialTagEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class MaterialTagController {
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialTagService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<MaterialTag> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class MaterialTagController {
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialTag> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialTag> result = new Result<MaterialTag>();
+        Result<MaterialTag> result = new Result<>();
         MaterialTag materialTag = materialTagService.getById(id);
         if (materialTag == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class MaterialTagController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialTag> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialTag materialTag = JSON.parseObject(deString, MaterialTag.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialTag, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialTag> pageList = materialTagService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材归属标列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialTag.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("素材归属标列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MaterialTag> listMaterialTags = ExcelImportUtil.importExcel(file.getInputStream(), MaterialTag.class, params);
-                materialTagService.saveBatch(listMaterialTags);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialTags.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 1 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialUploadController.java

@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -45,18 +44,8 @@ public class MaterialUploadController {
             if (Check.isNull(materialArray) || Check.isNull(accountArray)) {
                 throw new Exception("请选择账号或素材");
             }
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    try {
-                        materialUploadService.uploadAccount(mediaId, materialArray, accountArray);
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-            };
-            thread.start();
 
+            new Thread(() -> materialUploadService.uploadAccount(mediaId, materialArray, accountArray)).start();
             returnMap.put("success", true);
             returnMap.put("message", "开始上传文件");
             returnMap.put("code", 0);

+ 15 - 108
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -1,10 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -16,7 +15,6 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Advertiser;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
@@ -29,22 +27,10 @@ import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.*;
 
 /**
@@ -70,14 +56,11 @@ public class ProjectController {
     @Autowired
     private ProjectMapper projectMapper;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
-    @Autowired
     private ITransferAccountService transferAccountService;
     @Autowired
     private IUserAllocationService userAllocationService;
 
     /**
-     * 根据 项目 媒体类型 查看项目
      *
      * @param advertiserId
      * @param mediaId
@@ -97,7 +80,6 @@ public class ProjectController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
@@ -114,7 +96,7 @@ public class ProjectController {
     @GetMapping(value = "/responsibleList")
     public Map<String, Object> responsibleList(String userId) {
         Map<String, Object> map = new HashMap<>();
-        String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
         List<Project> projects = new ArrayList<>();
         if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
@@ -186,18 +168,12 @@ public class ProjectController {
                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                 HttpServletRequest req) {
-        Result<IPage<Project>> result = new Result<IPage<Project>>();
+        Result<IPage<Project>> result = new Result<>();
         QueryWrapper<Project> queryWrapper = QueryGenerator.initQueryWrapper(project, req.getParameterMap());
-        Page<Project> page = new Page<Project>(pageNo, pageSize);
-
+        Page<Project> page = new Page<>(pageNo, pageSize);
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        if (Check.isNull(sysUser)) {
-            result.setSuccess(false);
-            return result;
-        }
-
-        String roleCode = materialReportMapper.getRoleCodeByUserId(sysUser.getId());
-        if (!"admin".equals(roleCode) && "sale".equals(roleCode) && "saleDirector".equals(roleCode)) {
+        String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+        if (!("admin".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode))) {
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
         }
@@ -220,7 +196,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-添加", notes = "项目-添加")
     @PostMapping(value = "/add")
     public Result<Project> add(@RequestBody Project project) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         try {
             String advertiserId = project.getAdvertiserId();
             Advertiser advertiser = advertiserService.getById(advertiserId);
@@ -245,7 +221,6 @@ public class ProjectController {
 
             Long id = project.getId();
             for (Map.Entry<String, String> projectMember : memberMap.entrySet()) {
-
                 String userId = projectMember.getKey();
                 String userName = projectMember.getValue();
                 Map<String, Object> map = new HashMap<>();
@@ -257,14 +232,12 @@ public class ProjectController {
                 member.setProjectName(project.getProjectName());
                 member.setUserId(userId);
                 member.setUserName(userName);
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+                String roleCode = sysRoleService.getRoleCodeByUserId(userId);
                 if (!Check.isNull(roleCode)) {
                     member.setRoleCode(roleCode);
                 }
                 projectMemberService.save(member);
             }
-
-
             result.success("添加成功!");
         } catch (Exception e) {
             e.printStackTrace();
@@ -273,6 +246,9 @@ public class ProjectController {
         return result;
     }
 
+    @Autowired
+    private ISysRoleService sysRoleService;
+
     /**
      * 编辑
      *
@@ -283,8 +259,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-编辑", notes = "项目-编辑")
     @PutMapping(value = "/edit")
     public Result<Project> edit(@RequestBody Project project) {
-        Result<Project> result = new Result<Project>();
-
+        Result<Project> result = new Result<>();
         SysUser sysUser = sysUserService.getById(project.getResponsibleId());
         if (!Check.isNull(sysUser)) {
             project.setResponsibleName(sysUser.getRealname());
@@ -332,7 +307,7 @@ public class ProjectController {
     @AutoLog(value = "项目-通过id删除")
     @ApiOperation(value = "项目-通过id删除", notes = "项目-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             projectService.removeById(id);
             Map<String, Object> deleteMap = new HashMap<>();
@@ -356,7 +331,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-批量删除", notes = "项目-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<Project> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -376,7 +351,7 @@ public class ProjectController {
     @ApiOperation(value = "项目-通过id查询", notes = "项目-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<Project> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<Project> result = new Result<Project>();
+        Result<Project> result = new Result<>();
         Project project = projectService.getById(id);
         if (project == null) {
             result.error500("未找到对应实体");
@@ -386,72 +361,4 @@ public class ProjectController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<Project> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                Project project = JSON.parseObject(deString, Project.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(project, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<Project> pageList = projectService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "项目列表");
-        mv.addObject(NormalExcelConstants.CLASS, Project.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("项目列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<Project> listProjects = ExcelImportUtil.importExcel(file.getInputStream(), Project.class, params);
-                projectService.saveBatch(listProjects);
-                return Result.ok("文件导入成功!数据行数:" + listProjects.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 12 - 98
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -1,8 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -14,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
@@ -22,22 +20,10 @@ import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.*;
 
 /**
@@ -59,7 +45,7 @@ public class ProjectMemberController {
     @Autowired
     private IProjectService projectService;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ISysUserService sysUserService;
 
@@ -105,7 +91,7 @@ public class ProjectMemberController {
         Map<String, Object> map = new HashMap<>();
         try {
             QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
@@ -120,10 +106,6 @@ public class ProjectMemberController {
                     }
                     Project project = projectService.getById(projectMember.getProjectId());
                     if (!Check.isNull(project)) {
-                        String mediaId = project.getMediaId();
-                        /*if ("1".equals(mediaId)) {
-                            continue;
-                        }*/
                         projectMember.setResponsibleName(project.getResponsibleName());
                         projectMember.setDesignResponsibleName(project.getDesignResponsibleName());
                         projectMember.setAdvertiserName(project.getAdvertiserName());
@@ -164,9 +146,9 @@ public class ProjectMemberController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<ProjectMember>> result = new Result<IPage<ProjectMember>>();
+        Result<IPage<ProjectMember>> result = new Result<>();
         QueryWrapper<ProjectMember> queryWrapper = QueryGenerator.initQueryWrapper(projectMember, req.getParameterMap());
-        Page<ProjectMember> page = new Page<ProjectMember>(pageNo, pageSize);
+        Page<ProjectMember> page = new Page<>(pageNo, pageSize);
         IPage<ProjectMember> pageList = projectMemberService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -186,7 +168,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/batchAdd")
     public Result<ProjectMember> batchAdd(@RequestBody JSONObject jsonObject) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         try {
             if (Check.isNull(jsonObject)) {
                 throw new Exception("入参不能为空");
@@ -208,7 +190,7 @@ public class ProjectMemberController {
                         continue;
                     }
                     ProjectMember member = new ProjectMember();
-                    String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+                    String roleCode = sysRoleService.getRoleCodeByUserId(userId);
                     if (!Check.isNull(roleCode)) {
                         member.setRoleCode(roleCode);
                     }
@@ -242,7 +224,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/add")
     public Result<ProjectMember> add(@RequestBody ProjectMember projectMember) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         try {
             projectMemberService.save(projectMember);
             result.success("添加成功!");
@@ -263,7 +245,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-编辑", notes = "项目成员-编辑")
     @PutMapping(value = "/edit")
     public Result<ProjectMember> edit(@RequestBody ProjectMember projectMember) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         ProjectMember projectMemberEntity = projectMemberService.getById(projectMember.getId());
         if (projectMemberEntity == null) {
             result.error500("未找到对应实体");
@@ -286,7 +268,7 @@ public class ProjectMemberController {
     @AutoLog(value = "项目成员-通过id删除")
     @ApiOperation(value = "项目成员-通过id删除", notes = "项目成员-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             projectMemberService.removeById(id);
         } catch (Exception e) {
@@ -306,7 +288,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-批量删除", notes = "项目成员-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ProjectMember> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -326,7 +308,7 @@ public class ProjectMemberController {
     @ApiOperation(value = "项目成员-通过id查询", notes = "项目成员-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ProjectMember> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ProjectMember> result = new Result<ProjectMember>();
+        Result<ProjectMember> result = new Result<>();
         ProjectMember projectMember = projectMemberService.getById(id);
         if (projectMember == null) {
             result.error500("未找到对应实体");
@@ -336,72 +318,4 @@ public class ProjectMemberController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ProjectMember> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ProjectMember projectMember = JSON.parseObject(deString, ProjectMember.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(projectMember, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ProjectMember> pageList = projectMemberService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "项目成员列表");
-        mv.addObject(NormalExcelConstants.CLASS, ProjectMember.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("项目成员列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<ProjectMember> listProjectMembers = ExcelImportUtil.importExcel(file.getInputStream(), ProjectMember.class, params);
-                projectMemberService.saveBatch(listProjectMembers);
-                return Result.ok("文件导入成功!数据行数:" + listProjectMembers.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 9 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SalePerformanceDetailController.java

@@ -64,9 +64,9 @@ public class SalePerformanceDetailController {
                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                               HttpServletRequest req) {
-        Result<IPage<SalePerformanceDetail>> result = new Result<IPage<SalePerformanceDetail>>();
+        Result<IPage<SalePerformanceDetail>> result = new Result<>();
         QueryWrapper<SalePerformanceDetail> queryWrapper = QueryGenerator.initQueryWrapper(salePerformanceDetail, req.getParameterMap());
-        Page<SalePerformanceDetail> page = new Page<SalePerformanceDetail>(pageNo, pageSize);
+        Page<SalePerformanceDetail> page = new Page<>(pageNo, pageSize);
         IPage<SalePerformanceDetail> pageList = salePerformanceDetailService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +83,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-添加", notes = "销售绩效详细信息-添加")
     @PostMapping(value = "/add")
     public Result<SalePerformanceDetail> add(@RequestBody SalePerformanceDetail salePerformanceDetail) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         try {
             salePerformanceDetailService.save(salePerformanceDetail);
             result.success("添加成功!");
@@ -104,7 +104,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-编辑", notes = "销售绩效详细信息-编辑")
     @PutMapping(value = "/edit")
     public Result<SalePerformanceDetail> edit(@RequestBody SalePerformanceDetail salePerformanceDetail) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         SalePerformanceDetail salePerformanceDetailEntity = salePerformanceDetailService.getById(salePerformanceDetail.getId());
         if (salePerformanceDetailEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +127,7 @@ public class SalePerformanceDetailController {
     @AutoLog(value = "销售绩效详细信息-通过id删除")
     @ApiOperation(value = "销售绩效详细信息-通过id删除", notes = "销售绩效详细信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             salePerformanceDetailService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +147,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-批量删除", notes = "销售绩效详细信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<SalePerformanceDetail> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +167,7 @@ public class SalePerformanceDetailController {
     @ApiOperation(value = "销售绩效详细信息-通过id查询", notes = "销售绩效详细信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<SalePerformanceDetail> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<SalePerformanceDetail> result = new Result<SalePerformanceDetail>();
+        Result<SalePerformanceDetail> result = new Result<>();
         SalePerformanceDetail salePerformanceDetail = salePerformanceDetailService.getById(id);
         if (salePerformanceDetail == null) {
             result.error500("未找到对应实体");
@@ -186,7 +186,6 @@ public class SalePerformanceDetailController {
      */
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
         QueryWrapper<SalePerformanceDetail> queryWrapper = null;
         try {
             String paramsStr = request.getParameter("paramsStr");
@@ -217,8 +216,8 @@ public class SalePerformanceDetailController {
      * @param response
      * @return
      */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+    @PostMapping("/importExcel")
+    public Result<Object> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

+ 7 - 91
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ScriptTagInfoController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.ScriptTagInfo;
 import org.jeecg.modules.ctop.service.IScriptTagInfoService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 脚本库标签信息
@@ -64,9 +48,9 @@ public class ScriptTagInfoController {
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
-        Result<IPage<ScriptTagInfo>> result = new Result<IPage<ScriptTagInfo>>();
+        Result<IPage<ScriptTagInfo>> result = new Result<>();
         QueryWrapper<ScriptTagInfo> queryWrapper = QueryGenerator.initQueryWrapper(scriptTagInfo, req.getParameterMap());
-        Page<ScriptTagInfo> page = new Page<ScriptTagInfo>(pageNo, pageSize);
+        Page<ScriptTagInfo> page = new Page<>(pageNo, pageSize);
         IPage<ScriptTagInfo> pageList = scriptTagInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-添加", notes = "脚本库标签信息-添加")
     @PostMapping(value = "/add")
     public Result<ScriptTagInfo> add(@RequestBody ScriptTagInfo scriptTagInfo) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         try {
             scriptTagInfoService.save(scriptTagInfo);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-编辑", notes = "脚本库标签信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ScriptTagInfo> edit(@RequestBody ScriptTagInfo scriptTagInfo) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         ScriptTagInfo scriptTagInfoEntity = scriptTagInfoService.getById(scriptTagInfo.getId());
         if (scriptTagInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -127,7 +111,7 @@ public class ScriptTagInfoController {
     @AutoLog(value = "脚本库标签信息-通过id删除")
     @ApiOperation(value = "脚本库标签信息-通过id删除", notes = "脚本库标签信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             scriptTagInfoService.removeById(id);
         } catch (Exception e) {
@@ -147,7 +131,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-批量删除", notes = "脚本库标签信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ScriptTagInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -167,7 +151,7 @@ public class ScriptTagInfoController {
     @ApiOperation(value = "脚本库标签信息-通过id查询", notes = "脚本库标签信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ScriptTagInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ScriptTagInfo> result = new Result<ScriptTagInfo>();
+        Result<ScriptTagInfo> result = new Result<>();
         ScriptTagInfo scriptTagInfo = scriptTagInfoService.getById(id);
         if (scriptTagInfo == null) {
             result.error500("未找到对应实体");
@@ -177,72 +161,4 @@ public class ScriptTagInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ScriptTagInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ScriptTagInfo scriptTagInfo = JSON.parseObject(deString, ScriptTagInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(scriptTagInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ScriptTagInfo> pageList = scriptTagInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "脚本库标签信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ScriptTagInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("脚本库标签信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<ScriptTagInfo> listScriptTagInfos = ExcelImportUtil.importExcel(file.getInputStream(), ScriptTagInfo.class, params);
-                scriptTagInfoService.saveBatch(listScriptTagInfos);
-                return Result.ok("文件导入成功!数据行数:" + listScriptTagInfos.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 0 - 249
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SourceFileController.java

@@ -1,249 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.entity.SourceFile;
-import cn.com.ctop.common.module.service.ISourceFileService;
-import cn.com.ctop.common.module.utils.StringUtils;
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 统一资源库文件信息
- * @author jeecg-boot
- * @date 2019-09-02
- * @version V1.0
- */
-@Slf4j
-@Api(tags = "统一资源库文件信息")
-@RestController
-@RequestMapping("/ctop/sourceFile")
-public class SourceFileController {
-    @Autowired
-    private ISourceFileService sourceFileService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param sourceFile
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-分页列表查询")
-    @ApiOperation(value = "统一资源库文件信息-分页列表查询", notes = "统一资源库文件信息-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<SourceFile>> queryPageList(SourceFile sourceFile,
-                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                   HttpServletRequest req) {
-        Result<IPage<SourceFile>> result = new Result<IPage<SourceFile>>();
-        QueryWrapper<SourceFile> queryWrapper = QueryGenerator.initQueryWrapper(sourceFile, req.getParameterMap());
-        Page<SourceFile> page = new Page<SourceFile>(pageNo, pageSize);
-        IPage<SourceFile> pageList = sourceFileService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param sourceFile
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-添加")
-    @ApiOperation(value = "统一资源库文件信息-添加", notes = "统一资源库文件信息-添加")
-    @PostMapping(value = "/add")
-    public Result<SourceFile> add(@RequestBody SourceFile sourceFile) {
-        Result<SourceFile> result = new Result<SourceFile>();
-        try {
-            sourceFileService.save(sourceFile);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param sourceFile
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-编辑")
-    @ApiOperation(value = "统一资源库文件信息-编辑", notes = "统一资源库文件信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<SourceFile> edit(@RequestBody SourceFile sourceFile) {
-        Result<SourceFile> result = new Result<SourceFile>();
-        SourceFile sourceFileEntity = sourceFileService.getById(sourceFile.getId());
-        if (sourceFileEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = sourceFileService.updateById(sourceFile);
-            //TODO 返回false说明什么?
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-通过id删除")
-    @ApiOperation(value = "统一资源库文件信息-通过id删除", notes = "统一资源库文件信息-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            sourceFileService.removeById(id);
-        } catch (Exception e) {
-            log.error("删除失败", e.getMessage());
-            return Result.error("删除失败!");
-        }
-        return Result.ok("删除成功!");
-    }
-
-    /**
-     * 批量删除
-     *
-     * @param ids
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-批量删除")
-    @ApiOperation(value = "统一资源库文件信息-批量删除", notes = "统一资源库文件信息-批量删除")
-    @DeleteMapping(value = "/deleteBatch")
-    public Result<SourceFile> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<SourceFile> result = new Result<SourceFile>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.sourceFileService.removeByIds(Arrays.asList(ids.split(StringUtils.COMMA)));
-            result.success("删除成功!");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id查询
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "统一资源库文件信息-通过id查询")
-    @ApiOperation(value = "统一资源库文件信息-通过id查询", notes = "统一资源库文件信息-通过id查询")
-    @GetMapping(value = "/queryById")
-    public Result<SourceFile> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<SourceFile> result = new Result<SourceFile>();
-        SourceFile sourceFile = sourceFileService.getById(id);
-        if (sourceFile == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(sourceFile);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<SourceFile> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                SourceFile sourceFile = JSON.parseObject(deString, SourceFile.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(sourceFile, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<SourceFile> pageList = sourceFileService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "统一资源库文件信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, SourceFile.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("统一资源库文件信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<SourceFile> listSourceFiles = ExcelImportUtil.importExcel(file.getInputStream(), SourceFile.class, params);
-                sourceFileService.saveBatch(listSourceFiles);
-                return Result.ok("文件导入成功!数据行数:" + listSourceFiles.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
-}

+ 0 - 32
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestMqController.java

@@ -1,32 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
-import org.jeecg.modules.mq.Sender;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author jeecg-boot
- * 2019年12月5日19:57:58
- */
-@RestController
-@RequestMapping("mq")
-public class TestMqController {
-    @Autowired
-    private Sender sender;
-
-
-    @GetMapping("hello")
-    public Map<String, Object> sayHello() {
-        Map<String, Object> result = new HashMap<>();
-        sender.send();
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
-        return result;
-    }
-}

+ 9 - 94
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java

@@ -3,11 +3,9 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.IMailLogService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -15,32 +13,18 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.entity.TransferAccount;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 转户记录表
@@ -69,9 +53,6 @@ public class TransferAccountController {
     @Autowired
     private IProjectMemberService projectMemberService;
 
-    @Autowired
-    private IMaterialInfoService materialInfoService;
-
     /**
      * 添加
      *
@@ -82,7 +63,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-添加", notes = "转户记录表-添加")
     @PostMapping(value = "/add")
     public Result<TransferAccount> add(@RequestBody TransferAccount transferAccount) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         try {
             QueryWrapper<TransferAccount> transferAccountQueryWrapper = new QueryWrapper<>();
             transferAccountQueryWrapper.eq("account_id", transferAccount.getAccountId());
@@ -126,9 +107,11 @@ public class TransferAccountController {
         List<TransferAccount> records = transferAccountService.list(queryWrapper);
         if (!Check.isNull(records)) {
             for (TransferAccount transfer : records) {
-                String transferorName = mailLogMapper.getUserNameByUserId(transfer.getTransferor()); // 转让人姓名
+                // 转让人姓名
+                String transferorName = mailLogMapper.getUserNameByUserId(transfer.getTransferor());
                 transfer.setTransferorName(transferorName);
-                String assigneeName = mailLogMapper.getUserNameByUserId(transfer.getAssignee()); // 转让人姓名
+                // 转让人姓名
+                String assigneeName = mailLogMapper.getUserNameByUserId(transfer.getAssignee());
                 transfer.setAssigneeName(assigneeName);
             }
         }
@@ -149,7 +132,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-编辑", notes = "转户记录表-编辑")
     @PutMapping(value = "/edit")
     public Result<TransferAccount> edit(@RequestBody TransferAccount transferAccount) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         TransferAccount transferAccountEntity = transferAccountService.getById(transferAccount.getId());
         if (transferAccountEntity == null) {
             result.error500("未找到对应实体");
@@ -203,7 +186,7 @@ public class TransferAccountController {
     @AutoLog(value = "转户记录表-通过id删除")
     @ApiOperation(value = "转户记录表-通过id删除", notes = "转户记录表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             transferAccountService.removeById(id);
         } catch (Exception e) {
@@ -223,7 +206,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-批量删除", notes = "转户记录表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<TransferAccount> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -243,7 +226,7 @@ public class TransferAccountController {
     @ApiOperation(value = "转户记录表-通过id查询", notes = "转户记录表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<TransferAccount> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<TransferAccount> result = new Result<TransferAccount>();
+        Result<TransferAccount> result = new Result<>();
         TransferAccount transferAccount = transferAccountService.getById(id);
         if (transferAccount == null) {
             result.error500("未找到对应实体");
@@ -253,72 +236,4 @@ public class TransferAccountController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<TransferAccount> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                TransferAccount transferAccount = JSON.parseObject(deString, TransferAccount.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(transferAccount, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<TransferAccount> pageList = transferAccountService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "转户记录表列表");
-        mv.addObject(NormalExcelConstants.CLASS, TransferAccount.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("转户记录表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<TransferAccount> listTransferAccounts = ExcelImportUtil.importExcel(file.getInputStream(), TransferAccount.class, params);
-                transferAccountService.saveBatch(listTransferAccounts);
-                return Result.ok("文件导入成功!数据行数:" + listTransferAccounts.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java

@@ -157,7 +157,7 @@ public class UReportFileBindUserController {
     @AutoLog(value = "用户绑定报表信息-通过id删除")
     @ApiOperation(value = "用户绑定报表信息-通过id删除", notes = "用户绑定报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             uReportFileBindUserService.removeById(id);
         } catch (Exception e) {

+ 7 - 89
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileController.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -11,27 +10,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.UReportFile;
 import org.jeecg.modules.ctop.service.IUReportFileService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -65,7 +50,7 @@ public class UReportFileController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-        Result<IPage<UReportFile>> result = new Result<IPage<UReportFile>>();
+        Result<IPage<UReportFile>> result = new Result<>();
         String name = null;
         if (null != uReportFile.getName() && !"".equals(uReportFile.getName().trim())) {
             name = uReportFile.getName();
@@ -75,7 +60,7 @@ public class UReportFileController {
         if (null != name) {
             queryWrapper.like("name", name);
         }
-        Page<UReportFile> page = new Page<UReportFile>(pageNo, pageSize);
+        Page<UReportFile> page = new Page<>(pageNo, pageSize);
         IPage<UReportFile> pageList = uReportFileService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -92,7 +77,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-添加", notes = "报表文件存储-添加")
     @PostMapping(value = "/add")
     public Result<UReportFile> add(@RequestBody UReportFile uReportFile) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         try {
             uReportFileService.save(uReportFile);
             result.success("添加成功!");
@@ -113,7 +98,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-编辑", notes = "报表文件存储-编辑")
     @PutMapping(value = "/edit")
     public Result<UReportFile> edit(@RequestBody UReportFile uReportFile) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         UReportFile uReportFileEntity = uReportFileService.getById(uReportFile.getId());
         if (uReportFileEntity == null) {
             result.error500("未找到对应实体");
@@ -155,7 +140,7 @@ public class UReportFileController {
     @AutoLog(value = "报表文件存储-通过id删除")
     @ApiOperation(value = "报表文件存储-通过id删除", notes = "报表文件存储-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             uReportFileService.removeById(id);
         } catch (Exception e) {
@@ -175,7 +160,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-批量删除", notes = "报表文件存储-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<UReportFile> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -195,7 +180,7 @@ public class UReportFileController {
     @ApiOperation(value = "报表文件存储-通过id查询", notes = "报表文件存储-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<UReportFile> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<UReportFile> result = new Result<UReportFile>();
+        Result<UReportFile> result = new Result<>();
         UReportFile uReportFile = uReportFileService.getById(id);
         if (uReportFile == null) {
             result.error500("未找到对应实体");
@@ -205,71 +190,4 @@ public class UReportFileController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<UReportFile> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                UReportFile uReportFile = JSON.parseObject(deString, UReportFile.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(uReportFile, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<UReportFile> pageList = uReportFileService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "报表文件存储列表");
-        mv.addObject(NormalExcelConstants.CLASS, UReportFile.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("报表文件存储列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<UReportFile> listUReportFiles = ExcelImportUtil.importExcel(file.getInputStream(), UReportFile.class, params);
-                uReportFileService.saveBatch(listUReportFiles);
-                return Result.ok("文件导入成功!数据行数:" + listUReportFiles.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
 }

+ 9 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -56,8 +56,8 @@ public class UserAllocationController {
 
 
     @GetMapping(value = "/accountTurnProject")
-    public Result getAccountList(Long accountId, Long projectId) {
-        Result result = new Result<>();
+    public Result<Object> getAccountList(Long accountId, Long projectId) {
+        Result<Object> result = new Result<>();
         try {
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("account_id", accountId);
@@ -154,8 +154,7 @@ public class UserAllocationController {
             }
 
             String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)
-                    && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
+            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
             queryWrapper.orderByDesc("create_time");
@@ -219,7 +218,7 @@ public class UserAllocationController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
+        Result<IPage<UserAllocation>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
         String roleCode = materialReportMapper.getRoleCodeByUserId(user.getId());
@@ -227,7 +226,7 @@ public class UserAllocationController {
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.orderByDesc("id");
         }
-        Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
+        Page<UserAllocation> page = new Page<>(pageNo, pageSize);
         IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -244,7 +243,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-添加", notes = "用户分配-添加")
     @PostMapping(value = "/add")
     public Result<UserAllocation> add(@RequestBody UserAllocation userAllocation) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         try {
             userAllocationService.save(userAllocation);
             result.success("添加成功!");
@@ -265,7 +264,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-编辑", notes = "用户分配-编辑")
     @PutMapping(value = "/edit")
     public Result<UserAllocation> edit(@RequestBody UserAllocation userAllocation) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         UserAllocation userAllocationEntity = userAllocationService.getById(userAllocation.getId());
         if (userAllocationEntity == null) {
             result.error500("未找到对应实体");
@@ -306,7 +305,7 @@ public class UserAllocationController {
     @AutoLog(value = "用户分配-通过id删除")
     @ApiOperation(value = "用户分配-通过id删除", notes = "用户分配-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             userAllocationService.removeById(id);
         } catch (Exception e) {
@@ -326,7 +325,7 @@ public class UserAllocationController {
     @ApiOperation(value = "用户分配-批量删除", notes = "用户分配-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<UserAllocation> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<UserAllocation> result = new Result<UserAllocation>();
+        Result<UserAllocation> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoMergeTaskController.java

@@ -46,9 +46,9 @@ public class VideoMergeTaskController {
 													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 													   HttpServletRequest req) {
-		Result<IPage<VideoMergeTask>> result = new Result<IPage<VideoMergeTask>>();
+        Result<IPage<VideoMergeTask>> result = new Result<>();
 		QueryWrapper<VideoMergeTask> queryWrapper = QueryGenerator.initQueryWrapper(videoMergeTask, req.getParameterMap());
-		Page<VideoMergeTask> page = new Page<VideoMergeTask>(pageNo, pageSize);
+        Page<VideoMergeTask> page = new Page<>(pageNo, pageSize);
 		IPage<VideoMergeTask> pageList = videoMergeTaskService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -64,7 +64,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-添加", notes="视频合成任务-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoMergeTask> add(@RequestBody VideoMergeTask videoMergeTask) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		try {
 			videoMergeTaskService.save(videoMergeTask);
 			result.success("添加成功!");
@@ -84,7 +84,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-编辑", notes="视频合成任务-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoMergeTask> edit(@RequestBody VideoMergeTask videoMergeTask) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		VideoMergeTask videoMergeTaskEntity = videoMergeTaskService.getById(videoMergeTask.getId());
 		if(videoMergeTaskEntity==null) {
 			result.error500("未找到对应实体");
@@ -106,7 +106,7 @@ public class VideoMergeTaskController {
 	@AutoLog(value = "视频合成任务-通过id删除")
 	@ApiOperation(value="视频合成任务-通过id删除", notes="视频合成任务-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoMergeTaskService.removeById(id);
 		} catch (Exception e) {
@@ -125,7 +125,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-批量删除", notes="视频合成任务-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoMergeTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -144,7 +144,7 @@ public class VideoMergeTaskController {
 	@ApiOperation(value="视频合成任务-通过id查询", notes="视频合成任务-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoMergeTask> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoMergeTask> result = new Result<VideoMergeTask>();
+        Result<VideoMergeTask> result = new Result<>();
 		VideoMergeTask videoMergeTask = videoMergeTaskService.getById(id);
 		if(videoMergeTask==null) {
 			result.error500("未找到对应实体");

+ 26 - 110
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoPartController.java

@@ -1,37 +1,21 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import cn.com.ctop.common.module.entity.VideoPart;
 import cn.com.ctop.common.module.service.IVideoPartService;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
 
  /**
  * 视频片段
@@ -46,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
 public class VideoPartController {
 	@Autowired
 	private IVideoPartService videoPartService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param videoPart
@@ -62,15 +46,15 @@ public class VideoPartController {
 												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 												  HttpServletRequest req) {
-		Result<IPage<VideoPart>> result = new Result<IPage<VideoPart>>();
+        Result<IPage<VideoPart>> result = new Result<>();
 		QueryWrapper<VideoPart> queryWrapper = QueryGenerator.initQueryWrapper(videoPart, req.getParameterMap());
-		Page<VideoPart> page = new Page<VideoPart>(pageNo, pageSize);
+        Page<VideoPart> page = new Page<>(pageNo, pageSize);
 		IPage<VideoPart> pageList = videoPartService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param videoPart
@@ -80,7 +64,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-添加", notes="视频片段-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoPart> add(@RequestBody VideoPart videoPart) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		try {
 			videoPartService.save(videoPart);
 			result.success("添加成功!");
@@ -90,7 +74,7 @@ public class VideoPartController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param videoPart
@@ -100,7 +84,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-编辑", notes="视频片段-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoPart> edit(@RequestBody VideoPart videoPart) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		VideoPart videoPartEntity = videoPartService.getById(videoPart.getId());
 		if(videoPartEntity==null) {
 			result.error500("未找到对应实体");
@@ -110,11 +94,11 @@ public class VideoPartController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -122,7 +106,7 @@ public class VideoPartController {
 	@AutoLog(value = "视频片段-通过id删除")
 	@ApiOperation(value="视频片段-通过id删除", notes="视频片段-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoPartService.removeById(id);
 		} catch (Exception e) {
@@ -131,8 +115,8 @@ public class VideoPartController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -141,7 +125,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-批量删除", notes="视频片段-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoPart> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -150,8 +134,8 @@ public class VideoPartController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -160,7 +144,7 @@ public class VideoPartController {
 	@ApiOperation(value="视频片段-通过id查询", notes="视频片段-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoPart> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoPart> result = new Result<VideoPart>();
+        Result<VideoPart> result = new Result<>();
 		VideoPart videoPart = videoPartService.getById(id);
 		if(videoPart==null) {
 			result.error500("未找到对应实体");
@@ -170,72 +154,4 @@ public class VideoPartController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<VideoPart> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              VideoPart videoPart = JSON.parseObject(deString, VideoPart.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(videoPart, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<VideoPart> pageList = videoPartService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "视频片段列表");
-      mv.addObject(NormalExcelConstants.CLASS, VideoPart.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("视频片段列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
-
-  /**
-      * 通过excel导入数据
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();
-          ImportParams params = new ImportParams();
-          params.setTitleRows(2);
-          params.setHeadRows(1);
-          params.setNeedSave(true);
-          try {
-              List<VideoPart> listVideoParts = ExcelImportUtil.importExcel(file.getInputStream(), VideoPart.class, params);
-              videoPartService.saveBatch(listVideoParts);
-              return Result.ok("文件导入成功!数据行数:" + listVideoParts.size());
-          } catch (Exception e) {
-              log.error(e.getMessage(),e);
-              return Result.error("文件导入失败:"+e.getMessage());
-          } finally {
-              try {
-                  file.getInputStream().close();
-              } catch (IOException e) {
-                  e.printStackTrace();
-              }
-          }
-      }
-      return Result.ok("文件导入失败!");
-  }
-
 }

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java

@@ -46,9 +46,9 @@ public class VideoWatermarkTaskController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<VideoWatermarkTask>> result = new Result<IPage<VideoWatermarkTask>>();
+        Result<IPage<VideoWatermarkTask>> result = new Result<>();
 		QueryWrapper<VideoWatermarkTask> queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTask, req.getParameterMap());
-		Page<VideoWatermarkTask> page = new Page<VideoWatermarkTask>(pageNo, pageSize);
+        Page<VideoWatermarkTask> page = new Page<>(pageNo, pageSize);
 		IPage<VideoWatermarkTask> pageList = videoWatermarkTaskService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -64,7 +64,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-添加", notes="水印任务表-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoWatermarkTask> add(@RequestBody VideoWatermarkTask videoWatermarkTask) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		try {
 			videoWatermarkTaskService.save(videoWatermarkTask);
 			result.success("添加成功!");
@@ -84,7 +84,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-编辑", notes="水印任务表-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoWatermarkTask> edit(@RequestBody VideoWatermarkTask videoWatermarkTask) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		VideoWatermarkTask videoWatermarkTaskEntity = videoWatermarkTaskService.getById(videoWatermarkTask.getId());
 		if(videoWatermarkTaskEntity==null) {
 			result.error500("未找到对应实体");
@@ -106,7 +106,7 @@ public class VideoWatermarkTaskController {
 	@AutoLog(value = "水印任务表-通过id删除")
 	@ApiOperation(value="水印任务表-通过id删除", notes="水印任务表-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoWatermarkTaskService.removeById(id);
 		} catch (Exception e) {
@@ -125,7 +125,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-批量删除", notes="水印任务表-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoWatermarkTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -144,7 +144,7 @@ public class VideoWatermarkTaskController {
 	@ApiOperation(value="水印任务表-通过id查询", notes="水印任务表-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoWatermarkTask> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoWatermarkTask> result = new Result<VideoWatermarkTask>();
+        Result<VideoWatermarkTask> result = new Result<>();
 		VideoWatermarkTask videoWatermarkTask = videoWatermarkTaskService.getById(id);
 		if(videoWatermarkTask==null) {
 			result.error500("未找到对应实体");

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTemplateController.java

@@ -46,9 +46,9 @@ public class VideoWatermarkTemplateController {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<VideoWatermarkTemplate>> result = new Result<IPage<VideoWatermarkTemplate>>();
+        Result<IPage<VideoWatermarkTemplate>> result = new Result<>();
 		QueryWrapper<VideoWatermarkTemplate> queryWrapper = QueryGenerator.initQueryWrapper(videoWatermarkTemplate, req.getParameterMap());
-		Page<VideoWatermarkTemplate> page = new Page<VideoWatermarkTemplate>(pageNo, pageSize);
+        Page<VideoWatermarkTemplate> page = new Page<>(pageNo, pageSize);
 		IPage<VideoWatermarkTemplate> pageList = videoWatermarkTemplateService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
@@ -64,7 +64,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-添加", notes="水印模板-添加")
 	@PostMapping(value = "/add")
 	public Result<VideoWatermarkTemplate> add(@RequestBody VideoWatermarkTemplate videoWatermarkTemplate) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		try {
 			videoWatermarkTemplateService.save(videoWatermarkTemplate);
 			result.success("添加成功!");
@@ -84,7 +84,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-编辑", notes="水印模板-编辑")
 	@PutMapping(value = "/edit")
 	public Result<VideoWatermarkTemplate> edit(@RequestBody VideoWatermarkTemplate videoWatermarkTemplate) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		VideoWatermarkTemplate videoWatermarkTemplateEntity = videoWatermarkTemplateService.getById(videoWatermarkTemplate.getId());
 		if(videoWatermarkTemplateEntity==null) {
 			result.error500("未找到对应实体");
@@ -106,7 +106,7 @@ public class VideoWatermarkTemplateController {
 	@AutoLog(value = "水印模板-通过id删除")
 	@ApiOperation(value="水印模板-通过id删除", notes="水印模板-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			videoWatermarkTemplateService.removeById(id);
 		} catch (Exception e) {
@@ -125,7 +125,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-批量删除", notes="水印模板-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<VideoWatermarkTemplate> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -144,7 +144,7 @@ public class VideoWatermarkTemplateController {
 	@ApiOperation(value="水印模板-通过id查询", notes="水印模板-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<VideoWatermarkTemplate> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<VideoWatermarkTemplate> result = new Result<VideoWatermarkTemplate>();
+        Result<VideoWatermarkTemplate> result = new Result<>();
 		VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(id);
 		if(videoWatermarkTemplate==null) {
 			result.error500("未找到对应实体");

+ 16 - 76
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java

@@ -20,8 +20,8 @@ import javax.servlet.http.HttpServletRequest;
  * @author yumeng
  * 2019年11月12日10:04:00
  */
-@RestController
 @Slf4j
+@RestController
 @RequestMapping("/ctop/yard")
 public class YardController {
     @Autowired
@@ -35,28 +35,10 @@ public class YardController {
     @Autowired
     private IYardCommentService yardCommentService;
 
-    @ResponseBody
-    @RequestMapping(value = "/detail", method = RequestMethod.GET)
+    @GetMapping("/detail")
     public Result<Yard> getDetail(@RequestParam(name = "id") Long id) {
         Result<Yard> result = new Result<>();
         Yard yard = yardService.getById(id);
-//        YardPhoto yardPhoto = new YardPhoto();
-//        YardVideo yardVideo = new YardVideo();
-//        YardScheduler yardScheduler = new YardScheduler();
-//        yardPhoto.setYardId(yardId);
-//        yardVideo.setYardId(yardId);
-//        yardScheduler.setYardId(yardId);
-//        QueryWrapper<YardPhoto> yardPhotoQueryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, null);
-//        QueryWrapper<YardVideo> yardVideoQueryWrapper = QueryGenerator.initQueryWrapper(yardVideo, null);
-//        QueryWrapper<YardScheduler> yardSchedulerQueryWrapper = QueryGenerator.initQueryWrapper(yardScheduler, null);
-//        List<YardPhoto> yardPhotoList = yardPhotoService.list(yardPhotoQueryWrapper);
-//        List<YardVideo> yardVideoList = yardVideoService.list(yardVideoQueryWrapper);
-//        List<YardScheduler> yardSchedulerList = yardSchedulerService.list(yardSchedulerQueryWrapper);
-//        Map<String, Object> map = new HashMap<String, Object>();
-//        map.put("yard", yard);
-//        map.put("yardPhotoList", yardPhotoList);
-//        map.put("yardVideoList", yardVideoList);
-//        map.put("yardSchedulerList", yardSchedulerList);
         result.setResult(yard);
         result.setSuccess(true);
         return result;
@@ -64,25 +46,9 @@ public class YardController {
 
     @PostMapping(value = "/add")
     public Result<Yard> add(@RequestBody Yard yard) {
-        Result<Yard> result = new Result<Yard>();
+        Result<Yard> result = new Result<>();
         try {
             yardService.save(yard);
-//            if (yard.getImageUrl() != null && yard.getImageUrl().size() > 0) {
-//                for (String url : yard.getImageUrl()) {
-//                    YardPhoto yardPhoto = new YardPhoto();
-//                    yardPhoto.setYardId(yard.getId());
-//                    yardPhoto.setPhotoUrl("http:" + url);
-//                    yardPhotoService.save(yardPhoto);
-//                }
-//            }
-//            if (yard.getVideoUrl() != null && yard.getVideoUrl().size() > 0) {
-//                for (String url : yard.getVideoUrl()) {
-//                    YardVideo yardVideo = new YardVideo();
-//                    yardVideo.setYardId(yard.getId());
-//                    yardVideo.setVideoUrl("http:" + url);
-//                    yardVideoService.save(yardVideo);
-//                }
-//            }
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -93,39 +59,13 @@ public class YardController {
 
     @PutMapping(value = "/edit")
     public Result<Yard> edit(@RequestBody Yard yard) {
-        Result<Yard> result = new Result<Yard>();
+        Result<Yard> result = new Result<>();
 
         Yard yardEntity = yardService.getById(yard.getId());
         if (yardEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = yardService.updateById(yard);
-//            YardPhoto yardPhoto = new YardPhoto();
-//            yardPhoto.setYardId(yard.getId());
-//            QueryWrapper photoQueryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, null);
-//            yardPhotoService.remove(photoQueryWrapper);
-//
-//            YardVideo yardVideo = new YardVideo();
-//            yardVideo.setYardId(yard.getId());
-//            QueryWrapper videoQueryWrapper = QueryGenerator.initQueryWrapper(yardVideo, null);
-//            yardVideoService.remove(videoQueryWrapper);
-//            if (yard.getImageUrl() != null && yard.getImageUrl().size() > 0) {
-//                for (String url : yard.getImageUrl()) {
-//                    YardPhoto photo = new YardPhoto();
-//                    photo.setYardId(yard.getId());
-//                    photo.setPhotoUrl("http:" + url);
-//                    yardPhotoService.save(photo);
-//                }
-//            }
-//            if (yard.getVideoUrl() != null && yard.getVideoUrl().size() > 0) {
-//                for (String url : yard.getVideoUrl()) {
-//                    YardVideo video = new YardVideo();
-//                    video.setYardId(yard.getId());
-//                    video.setVideoUrl("http:" + url);
-//                    yardVideoService.save(video);
-//                }
-//            }
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -153,10 +93,10 @@ public class YardController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<YardPhoto>> result = new Result<IPage<YardPhoto>>();
+        Result<IPage<YardPhoto>> result = new Result<>();
 
         QueryWrapper<YardPhoto> queryWrapper = QueryGenerator.initQueryWrapper(yardPhoto, req.getParameterMap());
-        Page<YardPhoto> page = new Page<YardPhoto>(pageNo, pageSize);
+        Page<YardPhoto> page = new Page<>(pageNo, pageSize);
         IPage<YardPhoto> pageList = yardPhotoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -168,10 +108,10 @@ public class YardController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<YardComment>> result = new Result<IPage<YardComment>>();
+        Result<IPage<YardComment>> result = new Result<>();
 
         QueryWrapper<YardComment> queryWrapper = QueryGenerator.initQueryWrapper(yardComment, req.getParameterMap());
-        Page<YardComment> page = new Page<YardComment>(pageNo, pageSize);
+        Page<YardComment> page = new Page<>(pageNo, pageSize);
         IPage<YardComment> pageList = yardCommentService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -180,7 +120,7 @@ public class YardController {
 
     @DeleteMapping(value = "/comment/delete")
     public Result<YardComment> deleteComment(@RequestParam(name = "id", required = true) String id) {
-        Result<YardComment> result = new Result<YardComment>();
+        Result<YardComment> result = new Result<>();
         YardComment yardComment = yardCommentService.getById(id);
         if (yardComment == null) {
             result.error500("未找到对应实体");
@@ -195,7 +135,7 @@ public class YardController {
 
     @DeleteMapping(value = "/video/delete")
     public Result<YardVideo> deleteVideo(@RequestParam(name = "id", required = true) String id) {
-        Result<YardVideo> result = new Result<YardVideo>();
+        Result<YardVideo> result = new Result<>();
         YardVideo yardVideo = yardVideoService.getById(id);
         if (yardVideo == null) {
             result.error500("未找到对应实体");
@@ -210,7 +150,7 @@ public class YardController {
 
     @DeleteMapping(value = "/photo/delete")
     public Result<YardPhoto> deletePhoto(@RequestParam(name = "id", required = true) String id) {
-        Result<YardPhoto> result = new Result<YardPhoto>();
+        Result<YardPhoto> result = new Result<>();
         YardPhoto yardPhoto = yardPhotoService.getById(id);
         if (yardPhoto == null) {
             result.error500("未找到对应实体");
@@ -225,7 +165,7 @@ public class YardController {
 
     @PostMapping(value = "/comment/add")
     public Result<YardComment> addComment(YardComment yardComment) {
-        Result<YardComment> result = new Result<YardComment>();
+        Result<YardComment> result = new Result<>();
         try {
             yardCommentService.save(yardComment);
             result.success("添加成功!");
@@ -238,7 +178,7 @@ public class YardController {
 
     @PostMapping(value = "/video/add")
     public Result<YardVideo> addVideo(YardVideo yardVideo) {
-        Result<YardVideo> result = new Result<YardVideo>();
+        Result<YardVideo> result = new Result<>();
         try {
             yardVideoService.save(yardVideo);
             result.success("添加成功!");
@@ -251,7 +191,7 @@ public class YardController {
 
     @PostMapping(value = "/photo/add")
     public Result<YardPhoto> addPhoto(YardPhoto yardPhoto) {
-        Result<YardPhoto> result = new Result<YardPhoto>();
+        Result<YardPhoto> result = new Result<>();
         try {
             yardPhotoService.save(yardPhoto);
             result.success("添加成功!");
@@ -267,10 +207,10 @@ public class YardController {
                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                        HttpServletRequest req) {
-        Result<IPage<YardVideo>> result = new Result<IPage<YardVideo>>();
+        Result<IPage<YardVideo>> result = new Result<>();
 
         QueryWrapper<YardVideo> queryWrapper = QueryGenerator.initQueryWrapper(yardVideo, req.getParameterMap());
-        Page<YardVideo> page = new Page<YardVideo>(pageNo, pageSize);
+        Page<YardVideo> page = new Page<>(pageNo, pageSize);
         IPage<YardVideo> pageList = yardVideoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 0 - 100
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/EduLessonNew.java

@@ -1,100 +0,0 @@
-package org.jeecg.modules.ctop.entity;
-
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-
-import java.util.Date;
-
-/**
- * 内部培训视频信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-22
- */
-@Data
-@TableName("ctop_edu_lesson_new")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_edu_lesson_new对象", description = "内部培训视频信息")
-public class EduLessonNew {
-
-    /**
-     * id
-     */
-    @TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
-    private Integer id;
-    /**
-     * name
-     */
-    @Excel(name = "name", width = 15)
-    @ApiModelProperty(value = "name")
-    private String name;
-    /**
-     * 文件类型
-     */
-    @Excel(name = "文件类型", width = 15)
-    @ApiModelProperty(value = "文件类型")
-    private Integer fileType;
-    /**
-     * 节点类型
-     */
-    @Excel(name = "节点类型", width = 15)
-    @ApiModelProperty(value = "节点类型")
-    private Integer nodeType;
-    /**
-     * 父id
-     */
-    @Excel(name = "父id", width = 15)
-    @ApiModelProperty(value = "父id")
-    private Integer parentId;
-    /**
-     * author
-     */
-    @Excel(name = "author", width = 15)
-    @ApiModelProperty(value = "author")
-    private String author;
-    /**
-     * desc
-     */
-    @Excel(name = "desc", width = 15)
-    @ApiModelProperty(value = "desc")
-    private String desc;
-    /**
-     * fileId
-     */
-    @Excel(name = "fileId", width = 15)
-    @ApiModelProperty(value = "fileId")
-    private String fileId;
-    /**
-     * enabled
-     */
-    @Excel(name = "enabled", width = 15)
-    @ApiModelProperty(value = "enabled")
-    private Integer enabled;
-    /**
-     * createTime
-     */
-    @ApiModelProperty(value = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @ApiModelProperty(value = "updateTime")
-    private Date updateTime;
-
-    public EduLessonNew() {
-        this.enabled = CtopAdConstant.COMMON_STATUS_ENABLED;
-        this.createTime = new Date();
-        this.updateTime = new Date();
-    }
-}

+ 1 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountBidJob.java

@@ -21,13 +21,6 @@ public class AccountBidJob implements Job {
      */
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                bidWarningService.BidWarning();
-            }
-        };
-        thread.start();
-
+        bidWarningService.BidWarning();
     }
 }

+ 6 - 31
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -23,8 +22,6 @@ import java.util.concurrent.Executors;
 public class AccountCpaBidJob implements Job {
     @Autowired
     private ICpaBidWarningService cpaBidWarningService;
-    @Autowired
-    private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = null;
     @Autowired
     private IProjectService projectService;
@@ -37,33 +34,11 @@ public class AccountCpaBidJob implements Job {
      */
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
-        Thread thread = new Thread() {
-
-
-            @Override
-            public void run() {
-                executorService = Executors.newFixedThreadPool(4);
-                QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
-                List<Project> projects = projectService.list(queryWrapper);
-                if (!Check.isNull(projects)) {
-                    for (Project project : projects) {
-                        if (BigDecimalUtil.compareToDecimal(project.getMaxDeepCpaBid(), new BigDecimal(0)) <= 0) {
-                            continue;
-                        }
-                        executorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                cpaBidWarningService.CpaBidWarning(project);
-                            }
-
-                        });
-                    }
-                    executorService.shutdown();
-
-                }
-            }
-        };
-        thread.start();
-
+        executorService = Executors.newFixedThreadPool(4);
+        QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+        List<Project> projects = projectService.list(queryWrapper);
+        if (!Check.isNull(projects)) {
+            projects.stream().filter(project -> BigDecimalUtil.compareToDecimal(project.getMaxDeepCpaBid(), new BigDecimal(0)) <= 0).forEach(project -> executorService.submit(() -> cpaBidWarningService.CpaBidWarning(project)));
+        }
     }
 }

+ 2 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java

@@ -29,27 +29,16 @@ public class BytedanceAdvertiserDailyReportLoadJob implements Job {
     private IReportService reportService;
     static ExecutorService executorService = null;
 
-
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         Date getDate = DateUtils.addDay(new Date(), -1);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("定时获取头条数据异常:为获取到可用的token");
             return;
         }
         executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //获取广告主信息数据
-                    reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                }
-            });
-        });
+        tokens.forEach(token -> executorService.submit(() -> reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY)));
     }
-
-
 }

+ 8 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDataLoadJob.java

@@ -38,24 +38,14 @@ public class BytedanceAdvertiserDataLoadJob implements Job {
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //1:获取当日广告组数据
-                        advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
-                        //2:获取当日广告计划数据
-                        advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
-                        //3:获取当日创意数据
-                        creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
+        tokens.forEach(token -> executorService.submit(() -> {
+            //1:获取当日广告组数据
+            advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
+            //2:获取当日广告计划数据
+            advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
+            //3:获取当日创意数据
+            creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
+        }));
         log.info("物料数据同步完成");
     }
 }

+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java

@@ -31,8 +31,6 @@ public class DailyFlowsJob implements Job {
             for (CtopOauthToken ctopOauthToken : tokens) {
                 kuaishouInterfaceService.getDailyFlows(ctopOauthToken);
             }
-
         }
-
     }
 }

+ 0 - 69
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DataeyeJob.java

@@ -1,87 +1,18 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.crawler.modules.dataeye.entity.DataeyeCompany;
-import cn.com.ctop.crawler.modules.dataeye.entity.DataeyeProduct;
-import cn.com.ctop.crawler.modules.dataeye.service.DataeyeCompanyService;
 import cn.com.ctop.crawler.modules.dataeye.service.DataeyeMediaService;
-import cn.com.ctop.crawler.modules.dataeye.service.DataeyeProductService;
-import cn.com.ctop.crawler.modules.dataeye.service.impl.DataeyeProductServiceImpl;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Iterator;
-import java.util.List;
-
 @Slf4j
 public class DataeyeJob implements Job {
     @Autowired
-    private DataeyeCompanyService dataeyeCompanyService;
-    @Autowired
-    private DataeyeProductService dataeyeProductService;
-    @Autowired
     private DataeyeMediaService dataeyeMediaService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         dataeyeMediaService.getMediaList();
-//        List<DataeyeCompany> list = dataeyeCompanyService.list();
-//        if (list != null && list.size() > 0){
-//            for(DataeyeCompany dataeyeCompany : list){
-//                try {
-//                    String result = HttpUtils.httpPostFormRequest("https://blzs.dataeye.com/company/listProductDistribution?companyId="+dataeyeCompany.getCompanyId(),null,null);
-//                    ObjectMapper mapper = new ObjectMapper();
-//                    mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-//                    JsonNode rootNode = mapper.readTree(result);
-//                    int statusCode = rootNode.get("statusCode").asInt();
-//                    if (statusCode == 200) {
-//                        Iterator<JsonNode> nodes = rootNode.get("content").elements();
-//                        while (nodes.hasNext()){
-//                            JsonNode node = nodes.next();
-//                            Long productId = node.get("id").asLong();
-//                            dataeyeProductService.getProductInfo(dataeyeCompany.getCompanyId(),productId);
-//                        }
-//                    }
-//                }catch (Exception e){
-//                    e.printStackTrace();
-//                }
-//            }
-//        }
-//        int pageId=1;
-//        while(pageId <= 100){
-//            try {
-//                System.out.println("pageId:"+pageId);
-//                String result = HttpUtils.httpPostFormRequest("https://blzs.dataeye.com/ranking/listCompanyRanking?type=all&pageId="+pageId+"&pageSize=10&mediaId&playRuleId&themeId&searchKey&days=90&top=500",null,null);
-//                ObjectMapper mapper = new ObjectMapper();
-//                mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-//                JsonNode rootNode = mapper.readTree(result);
-//                int statusCode = rootNode.get("statusCode").asInt();
-//                if (statusCode == 200){
-//                    Iterator<JsonNode> nodes = rootNode.get("content").elements();
-//                    while (nodes.hasNext()){
-//                        JsonNode node = nodes.next();
-//                        int companyId = node.get("companyId").asInt();
-//                        System.out.println(companyId);
-//                        dataeyeCompanyService.getCompanyInfo(companyId);
-//                    }
-//
-//                }
-//            }catch (Exception e){
-//
-//            }
-//            pageId++;
-//        }
-//        for (int i = 3528; i < 1000000; i++){
-//            try {
-//                dataeyeProductService.getProductInfo(i);
-//            } catch (Exception e) {
-//                e.printStackTrace();
-//            }
-//        }
     }
 }

+ 5 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAdvertiserCrawlerJob.java

@@ -18,26 +18,11 @@ public class KuaishouAdvertiserCrawlerJob implements Job {
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        try {
-
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    List<KuaishouAdAccount> list = kuaishouAdAccountService.querySyncAccount();
-                    if (list != null) {
-                        for (KuaishouAdAccount account : list) {
-                            kuaishouAppService.adAccountFetch(account, "");
-                        }
-                    }
-                }
-
-
-            };
-            thread.start();
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
+        List<KuaishouAdAccount> list = kuaishouAdAccountService.querySyncAccount();
+        if (list != null) {
+            for (KuaishouAdAccount account : list) {
+                kuaishouAppService.adAccountFetch(account, "");
+            }
         }
     }
 }

+ 0 - 62
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java

@@ -1,62 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import lombok.extern.slf4j.Slf4j;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 获取广告计划分时报表
- */
-@Slf4j
-public class KuaishouAppListJob implements Job {
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-
-
-    static ExecutorService executorService = Executors.newFixedThreadPool(2);
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
-                for (CtopOauthToken token : tokens) {
-                    if (Check.isNull(token)) {
-                        continue;
-                    }
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    });
-                }
-
-            }
-
-        };
-        thread.start();
-
-
-    }
-}

+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCampaignJob.java

@@ -24,8 +24,6 @@ public class KuaishouCampaignJob implements Job {
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-
-
         Thread thread = new Thread() {
             @Override
             public void run() {

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java

@@ -28,7 +28,7 @@ public class KuaishouCommentAutoDelete implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<BindAccountLogin>();
+                QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("login_type", "kuaishou");
                 queryWrapper.eq("status", 1);
                 List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
@@ -46,7 +46,7 @@ public class KuaishouCommentAutoDelete implements Job {
                             } else {
                                 log.info("error,删除评论调用shell脚本执行失败");
                             }
-                            Thread.sleep(5 * 1000);
+                            Thread.sleep(5 * 1000L);
                         } catch (Exception e) {
                             e.printStackTrace();
                         }

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCrawlerJob.java

@@ -53,4 +53,15 @@ public class KuaishouCrawlerJob implements Job {
             e.printStackTrace();
         }
     }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 100; i++) {
+            System.out.println(i);
+            try {
+                System.out.println(1 / 0);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }

+ 0 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/EduLessonNewMapper.java

@@ -1,15 +0,0 @@
-package org.jeecg.modules.ctop.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.EduLessonNew;
-
-/**
- * 内部培训视频信息
- *
- * @author: jeecg-boot
- * @date: 2020-04-22
- * @cersion: V1.0
- */
-public interface EduLessonNewMapper extends BaseMapper<EduLessonNew> {
-
-}

+ 0 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/EduLessonNewMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ctop.mapper.EduLessonNewMapper">
-
-</mapper>

+ 0 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IEduLessonNewService.java

@@ -1,15 +0,0 @@
-package org.jeecg.modules.ctop.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.EduLessonNew;
-
-/**
- * 内部培训视频信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-22
- */
-public interface IEduLessonNewService extends IService<EduLessonNew> {
-
-}

+ 33 - 39
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/AdvertiserServiceImpl.java

@@ -17,7 +17,6 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -73,44 +72,39 @@ public class AdvertiserServiceImpl extends ServiceImpl<AdvertiserMapper, Adverti
     @Override
     public List<SheetInfoVo> getYdStatisticInfo(Long projectId, String startDate, String endDate) {
         List<SheetInfoVo> sheetInfoVos = new ArrayList<>();
-        try {
-            Date start = DateUtils.parseDate(startDate, "yyyy-MM-dd");
-            Date end = DateUtils.parseDate(endDate, "yyyy-MM-dd");
-            String lastWeekStart = DateUtils.formatDate(DateUtils.addDay(start, -7));
-            String lastWeekEnd = DateUtils.formatDate(DateUtils.addDay(end, -7));
-            //1:获取周报汇总数据
-            SheetInfoVo voFirst = new SheetInfoVo();
-            List<YdWeekAggregateEntity> weekEntities = new ArrayList<>();
-            YdWeekAggregateEntity lastWeek = advertiserMapper.getYdWeekStatisticInfo(projectId, lastWeekStart + " 00:00:00", lastWeekEnd + " 00:00:00");
-            weekEntities.add(lastWeek);
-            YdWeekAggregateEntity thWeek = advertiserMapper.getYdWeekStatisticInfo(projectId, startDate + " 00:00:00", endDate + " 00:00:00");
-            weekEntities.add(thWeek);
-            YdWeekAggregateEntity qoq = new YdWeekAggregateEntity();
-            qoq.setDate("环比数据");
-            BigDecimal qoqActive = (new BigDecimal(thWeek.getActive()).subtract(new BigDecimal(lastWeek.getActive()))).divide(
-                    new BigDecimal(lastWeek.getActive()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
-            qoq.setActive(qoqActive.toString() + "%");
-            BigDecimal qoqCost = (new BigDecimal(thWeek.getCost()).subtract(new BigDecimal(lastWeek.getCost()))).divide(
-                    new BigDecimal(lastWeek.getCost()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
-            qoq.setCost(qoqCost.toString() + "%");
-            BigDecimal qoqActiveAvg = (new BigDecimal(thWeek.getActiveAvg()).subtract(new BigDecimal(lastWeek.getActiveAvg()))).divide(
-                    new BigDecimal(lastWeek.getActiveAvg()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
-            qoq.setActiveAvg(qoqActiveAvg.toString() + "%");
-            weekEntities.add(qoq);
-            voFirst.setSheetName("周数据");
-            voFirst.setDetails(weekEntities);
-            sheetInfoVos.add(voFirst);
-            //2:获取主力计划汇总
-            SheetInfoVo secondVo = new SheetInfoVo();
-            secondVo.setSheetName("主力计划汇总");
-            List<YdPlanAggregateEntity> planAggregateEntities = getYdPlanStatisticInfo(projectId, startDate, endDate);
-            secondVo.setDetails(planAggregateEntities);
-            sheetInfoVos.add(secondVo);
-            return sheetInfoVos;
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        return null;
+        Date start = DateUtils.parseDate(startDate, "yyyy-MM-dd");
+        Date end = DateUtils.parseDate(endDate, "yyyy-MM-dd");
+        String lastWeekStart = DateUtils.formatDate(DateUtils.addDay(start, -7));
+        String lastWeekEnd = DateUtils.formatDate(DateUtils.addDay(end, -7));
+        //1:获取周报汇总数据
+        SheetInfoVo voFirst = new SheetInfoVo();
+        List<YdWeekAggregateEntity> weekEntities = new ArrayList<>();
+        YdWeekAggregateEntity lastWeek = advertiserMapper.getYdWeekStatisticInfo(projectId, lastWeekStart + " 00:00:00", lastWeekEnd + " 00:00:00");
+        weekEntities.add(lastWeek);
+        YdWeekAggregateEntity thWeek = advertiserMapper.getYdWeekStatisticInfo(projectId, startDate + " 00:00:00", endDate + " 00:00:00");
+        weekEntities.add(thWeek);
+        YdWeekAggregateEntity qoq = new YdWeekAggregateEntity();
+        qoq.setDate("环比数据");
+        BigDecimal qoqActive = (new BigDecimal(thWeek.getActive()).subtract(new BigDecimal(lastWeek.getActive()))).divide(
+                new BigDecimal(lastWeek.getActive()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
+        qoq.setActive(qoqActive.toString() + "%");
+        BigDecimal qoqCost = (new BigDecimal(thWeek.getCost()).subtract(new BigDecimal(lastWeek.getCost()))).divide(
+                new BigDecimal(lastWeek.getCost()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
+        qoq.setCost(qoqCost.toString() + "%");
+        BigDecimal qoqActiveAvg = (new BigDecimal(thWeek.getActiveAvg()).subtract(new BigDecimal(lastWeek.getActiveAvg()))).divide(
+                new BigDecimal(lastWeek.getActiveAvg()), 5, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
+        qoq.setActiveAvg(qoqActiveAvg.toString() + "%");
+        weekEntities.add(qoq);
+        voFirst.setSheetName("周数据");
+        voFirst.setDetails(weekEntities);
+        sheetInfoVos.add(voFirst);
+        //2:获取主力计划汇总
+        SheetInfoVo secondVo = new SheetInfoVo();
+        secondVo.setSheetName("主力计划汇总");
+        List<YdPlanAggregateEntity> planAggregateEntities = getYdPlanStatisticInfo(projectId, startDate, endDate);
+        secondVo.setDetails(planAggregateEntities);
+        sheetInfoVos.add(secondVo);
+        return sheetInfoVos;
     }
 
     @Override

+ 0 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/EduLessonNewServiceImpl.java

@@ -1,19 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.EduLessonNew;
-import org.jeecg.modules.ctop.mapper.EduLessonNewMapper;
-import org.jeecg.modules.ctop.service.IEduLessonNewService;
-import org.springframework.stereotype.Service;
-
-/**
- * 内部培训视频信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-04-22
- */
-@Service
-public class EduLessonNewServiceImpl extends ServiceImpl<EduLessonNewMapper, EduLessonNew> implements IEduLessonNewService {
-
-}

+ 11 - 11
jeecg-boot-module-system/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai

@@ -48,7 +48,7 @@ import io.swagger.annotations.ApiOperation;
 public class ${entityName}Controller {
 	@Autowired
 	private I${entityName}Service ${entityName?uncap_first}Service;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param ${entityName?uncap_first}
@@ -64,7 +64,7 @@ public class ${entityName}Controller {
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<${entityName}>> result = new Result<IPage<${entityName}>>();
+		Result<IPage<${entityName}>> result = new Result<>();
 		QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
 		Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
 		IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
@@ -72,7 +72,7 @@ public class ${entityName}Controller {
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param ${entityName?uncap_first}
@@ -82,7 +82,7 @@ public class ${entityName}Controller {
 	@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
 	@PostMapping(value = "/add")
 	public Result<${entityName}> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
-		Result<${entityName}> result = new Result<${entityName}>();
+		Result<${entityName}> result = new Result<>();
 		try {
 			${entityName?uncap_first}Service.save(${entityName?uncap_first});
 			result.success("添加成功!");
@@ -92,7 +92,7 @@ public class ${entityName}Controller {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param ${entityName?uncap_first}
@@ -112,10 +112,10 @@ public class ${entityName}Controller {
 				result.success("修改成功!");
 			}
 		}
-		
+
 		return result;
 	}
-	
+
 	/**
 	  *   通过id删除
 	 * @param id
@@ -133,7 +133,7 @@ public class ${entityName}Controller {
 		}
 		return Result.ok("删除成功!");
 	}
-	
+
 	/**
 	  *  批量删除
 	 * @param ids
@@ -143,7 +143,7 @@ public class ${entityName}Controller {
 	@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<${entityName}> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<${entityName}> result = new Result<${entityName}>();
+		Result<${entityName}> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -152,7 +152,7 @@ public class ${entityName}Controller {
 		}
 		return result;
 	}
-	
+
 	/**
 	  * 通过id查询
 	 * @param id
@@ -162,7 +162,7 @@ public class ${entityName}Controller {
 	@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<${entityName}> result = new Result<${entityName}>();
+		Result<${entityName}> result = new Result<>();
 		${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
 		if(${entityName?uncap_first}==null) {
 			result.error500("未找到对应实体");

+ 6 - 24
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -3,10 +3,8 @@ package org.jeecg;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
@@ -17,16 +15,11 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IPerformanceSaleService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.opencv.core.Mat;
-import org.opencv.videoio.VideoCapture;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -55,12 +48,6 @@ public class SampleTest {
 
     @Autowired
     private ICtopOauthTokenService tokenService;
-    private static ExecutorService executorService = Executors.newFixedThreadPool(10);
-    private static CountDownLatch countDownLatch = null;
-
-    @Autowired
-    private IUserAllocationService userAllocationService;
-
     @Test
     public void wanHuaTong() {
         String url = "https://ad.oceanengine.com/open_api/2/kaleidoscope/job/smart_cut/submit/";
@@ -116,9 +103,6 @@ public class SampleTest {
     }
 
 
-    @Autowired
-    private IKuaiShouCreativeService creativeService;
-
     @Test
     public void testSalePerformance() {
         performanceSaleService.loadSalsePerformance();
@@ -158,16 +142,14 @@ public class SampleTest {
     }
 
     @Test
-    public void test() throws Exception {
-        VideoCapture capture = new VideoCapture("D:\\data\\模板视频\\模板3\\原始模板3.mp4");
-        int frameCnt = 0;
-        int num = 0;
-        Mat mat = new Mat();
-        capture.read(mat);
-
+    public void testLog() {
+        try {
+            System.out.println(1 / 0);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
     }
 
-
 }
 
 

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialParameter.java

@@ -23,7 +23,7 @@ import java.util.Date;
 @TableName("ctop_material_parameter")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value = "ctop_material_parameter对象", description = "素材归属")
+@ApiModel(value = "ctop_material_parameter对象", description = "素材归属")
 public class MaterialParameter {
 
     /**

+ 0 - 57
module-common/src/main/java/cn/com/ctop/common/module/entity/SourceFile.java

@@ -1,57 +0,0 @@
-package cn.com.ctop.common.module.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-
-import java.util.Date;
-
-/**
- * 统一资源库文件信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2019-09-02
- */
-@Data
-@TableName("ctop_source_file")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_source_file对象", description = "统一资源库文件信息")
-public class SourceFile {
-
-    /**
-     * id
-     */
-    @TableId(type = IdType.AUTO)
-    @ApiModelProperty(value = "id")
-    private Long id;
-    /**
-     * MD5code码(唯一性校验)
-     */
-    @Excel(name = "MD5code码(唯一性校验)", width = 15)
-    @ApiModelProperty(value = "MD5code码(唯一性校验)")
-    private String code;
-    /**
-     * url
-     */
-    @Excel(name = "url", width = 15)
-    @ApiModelProperty(value = "url")
-    private String url;
-    /**
-     * createTime
-     */
-    @ApiModelProperty(value = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @ApiModelProperty(value = "updateTime")
-    private Date updateTime;
-}

+ 0 - 14
module-common/src/main/java/cn/com/ctop/common/module/mapper/SourceFileMapper.java

@@ -1,14 +0,0 @@
-package cn.com.ctop.common.module.mapper;
-
-import cn.com.ctop.common.module.entity.SourceFile;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @Description: 统一资源库文件信息
- * @Author: jeecg-boot
- * @Date: 2019-09-02
- * @Version: V1.0
- */
-public interface SourceFileMapper extends BaseMapper<SourceFile> {
-
-}

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysRoleMapper.java

@@ -17,7 +17,9 @@ import java.util.List;
  * @since 2018-12-19
  */
 public interface SysRoleMapper extends BaseMapper<SysRole> {
-    //根据roleCode获取相对应的用户信息
+    /**
+     * 根据roleCode获取相对应的用户信息
+     */
     List<UserDto> getUserByRoleCode(@Param("roleCode") String roleCode);
 
     String getRoleIdByRoleCode(@Param("roleCode") String roleCode);

+ 0 - 5
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SourceFileMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.common.module.mapper.SourceFileMapper">
-
-</mapper>

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java

@@ -2,7 +2,6 @@ package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import com.baomidou.mybatisplus.extension.service.IService;
-import io.swagger.models.auth.In;
 
 import java.util.List;
 import java.util.Map;

+ 0 - 4
module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java

@@ -18,14 +18,10 @@ public interface IFileInfoService extends IService<FileInfo> {
 
     Map<String, Object> uploadVideoToBytedance(String accountId, String videoUrl);
 
-    Map<String, Object> upload3ImagesToBytedance(String accountId, String imageFileUrls);
-
     Map<String, Object> uploadImageToBytedance(String accountId, String imageFileId);
 
     List<FileInfo> getFileInfoByMd5(String md5);
 
-    Map<String, Object> checkFileInfo(String code);
-
     Map<String, Object> getCreativeWords(Long accountId);
 
     public JSONObject getSiteList(Long accountId);

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialParameterService.java

@@ -11,5 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @date 2019-11-23
  */
 public interface IMaterialParameterService extends IService<MaterialParameter> {
-
+    MaterialParameter getOneByMaterialId(String materialInfoId);
 }

+ 0 - 14
module-common/src/main/java/cn/com/ctop/common/module/service/ISourceFileService.java

@@ -1,14 +0,0 @@
-package cn.com.ctop.common.module.service;
-
-import cn.com.ctop.common.module.entity.SourceFile;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * @Description: 统一资源库文件信息
- * @Author: jeecg-boot
- * @Date: 2019-09-02
- * @Version: V1.0
- */
-public interface ISourceFileService extends IService<SourceFile> {
-
-}

+ 6 - 7
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -57,14 +58,14 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
 
     @Override
     public String getKuaishouCodeUrl(String state, Integer agentType) throws UnsupportedEncodingException {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         if (agentType == 1) {
             sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
                     .append(KuaishouInterfaceConstant.AUTH_PATH)
                     .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_appid"))
                     .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
                     .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
-                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
+                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), StandardCharsets.UTF_8.toString()));
         } else if (agentType == 0) {
 
             // &scope=%5B%22ad_query%22%2C%22ad_manage%22%5D&
@@ -74,7 +75,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
                     .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_third_appid"))
                     .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
                     .append("&scope=%5B%22ad_query%22%2C%22ad_manage%22%5D&")
-                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));
+                    .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), StandardCharsets.UTF_8.toString()));
         }
 
         return sb.toString();
@@ -82,14 +83,12 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
 
     @Override
     public String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException {
-        StringBuffer sb = new StringBuffer();
-
-
+        StringBuilder sb = new StringBuilder();
         sb.append(PropertiesUtils.getValue("bytedance_config", "bytedance_auth_url"))
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))
                 .append("&state=" + URLEncoder.encode(state))
-                .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
+                .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), StandardCharsets.UTF_8.toString()));
         return sb.toString();
     }
 

+ 0 - 53
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -2,11 +2,9 @@ package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.FileInfo;
-import cn.com.ctop.common.module.entity.SourceFile;
 import cn.com.ctop.common.module.mapper.FileInfoMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IFileInfoService;
-import cn.com.ctop.common.module.service.ISourceFileService;
 import cn.com.ctop.common.module.utils.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -50,18 +48,13 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     @Autowired
     FileInfoMapper fileInfoMapper;
     @Autowired
-    private ISourceFileService sourceFileService;
-    @Autowired
     private ICtopOauthTokenService tokenService;
 
     @Override
     public Map<String, Object> uploadVideoToBytedance(String accountId, String videoUrl) {
-
-
         try {
             CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
             uploadAdvideo(token, videoUrl, token.getAccountId() + "");
-            //    String localUrl = LoadFileUtil.downLoadFromUrl(videoUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
             JSONObject jsonObject = videoUpload(token, videoUrl);
             log.info("头条上传素材返回信息:{},accountId:{}", jsonObject, accountId);
         } catch (Exception e) {
@@ -74,34 +67,6 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     }
 
     @Override
-    public Map<String, Object> upload3ImagesToBytedance(String accountId, String imageFileUrls) {
-        Map<String, Object> resultMap = new HashMap<>();
-        String[] imageUrls = imageFileUrls.split(",");
-        if (null == imageUrls || imageUrls.length < 3) {
-            ResultMapUtils.setResultMap(resultMap, StatusCode.IMAGE_NUMBER_SHORTAGE.getCode());
-            return resultMap;
-        }
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-        JSONArray imageIds = new JSONArray();
-        for (int i = 0; i < imageUrls.length; i++) {
-            JSONObject resultObject = uploadAdImage(token, imageUrls[i], token.getAccountId() + "");
-            Integer code = resultObject.getInteger("code");
-            String message = resultObject.getString("message");
-            if (null == code || code != 0) {
-                log.info("图片文件上传失败,accountId:{},message:{}", accountId, message);
-                ResultMapUtils.setResultMap(resultMap, StatusCode.BYTEDANCE_VIDEO_UPLOAD_FAIL.getCode());
-                return resultMap;
-            }
-            FileInfo fileInfo = (FileInfo) resultObject.get("file");
-            imageIds.add(fileInfo.getFileId());
-        }
-        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
-        resultMap.put("imageIds", imageIds);
-        return resultMap;
-    }
-
-
-    @Override
     public Map<String, Object> uploadImageToBytedance(String accountId, String imageUrl) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
@@ -124,24 +89,6 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     }
 
     @Override
-    public Map<String, Object> checkFileInfo(String code) {
-        Map<String, Object> result = new HashMap<>();
-        QueryWrapper<SourceFile> wrapper = new QueryWrapper<>();
-        wrapper.eq("code", code).orderByDesc("id").last("limit 1");
-        SourceFile file = sourceFileService.getOne(wrapper);
-        if (null != file) {
-            //文件已存在
-            ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_UPLOAD.getCode());
-            result.put("url", file.getUrl());
-            return result;
-        } else {
-            //文件尚未上传
-            ResultMapUtils.setResultMap(result, StatusCode.FILE_HAS_NOT_UPLOAD.getCode());
-            return result;
-        }
-    }
-
-    @Override
     public Map<String, Object> getCreativeWords(Long accountId) {
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId + "");
         return getCreativeWord(token, accountId);

+ 0 - 4
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -43,11 +43,7 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
      */
     @Override
     public void getCutFrame(String url, String materialId, String height, String width) throws IOException {
-
-
         try {
-
-
             String zeroFrameUrl = url + "?x-oss-process=video/snapshot,t_00000,m_fast";
 
             // String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));

+ 60 - 82
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -5,7 +5,10 @@ import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
 import cn.com.ctop.common.module.utils.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -13,6 +16,7 @@ import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import it.sauronsoftware.jave.Encoder;
+import it.sauronsoftware.jave.MultimediaInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -20,7 +24,6 @@ import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.nio.channels.FileChannel;
@@ -67,7 +70,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
-        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length());
+        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf('/', 10) + 1, materialInfo.getUrl().length());
         String jobId = mpsUtils.videoWaterMark(path, videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = MpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
@@ -113,16 +116,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         }
     }
 
-    public boolean imgLocation(String fileName) throws IOException {
+    public boolean imgLocation(String fileName) {
         String reg = "(mp4|flv|avi|rm|rmvb|wmv|MP4)";
         Pattern p = Pattern.compile(reg);
         return p.matcher(fileName).find();
     }
 
-    public static void main(String[] args) {
-        String reg = "(mp4|flv|avi|rm|rmvb|wmv)";
-        Pattern p = Pattern.compile(reg);
-    }
     @Override
     public Map<String, Object> insert(JSONObject jsonObject) {
         Map<String, Object> resultMap = new HashMap<>();
@@ -142,7 +141,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                             String md5 = LoadFileUtil.getMD5(localPath);
                             jsonObject.put("code", md5);
                             LoadFileUtil.delFile(localPath);
-                            String fileName = url.substring(url.lastIndexOf("/") + 1);
+                            String fileName = url.substring(url.lastIndexOf('/') + 1);
                             String fileNameStr = null;
                             if (!Check.isNull(fileName)) {
                                 String[] split = fileName.split("-");
@@ -151,10 +150,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                             jsonObject.put("materialName", AesEncryptUtil.getUrlDecoderString(fileNameStr));
                             insertMaterialInfo(url, type, jsonObject);
                         }
-
                     }
                 }
-
             } else {
                 String url = "";
                 if (!Check.isNull(jsonObject.getString("url"))) {
@@ -166,7 +163,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
 
         }
 
@@ -315,74 +312,54 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     @Override
     public void getFile(MaterialInfo materialInfo) {
-        uploadExecutorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    log.info("获取素材基本信息,code:{}", materialInfo.getCode());
-                    if (!Check.isNull(materialInfo)) {
-                        long l = System.currentTimeMillis();
-                        String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
-                        log.info("replaceUrl:{}", url);
-                        String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-                        File file = new File(localUrl);
-                        it.sauronsoftware.jave.Encoder encoder = new Encoder();
-                        try {
-                            it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
-                            long duration = m.getDuration();
-                            long secondDuration = duration / 1000;
-                            MaterialParameter materialParameter = new MaterialParameter();
-                            materialParameter.setMaterialId(materialInfo.getId());
-                            // 视频秒数
-                            materialParameter.setSecond(secondDuration);
-                            // 视频格式
-                            materialParameter.setFormat(m.getFormat());
-                            // 视频宽
-                            String width = String.valueOf(m.getVideo().getSize().getWidth());
-                            materialParameter.setWidth(width);
-                            // 视频高
-                            String height = String.valueOf(m.getVideo().getSize().getHeight());
-                            materialParameter.setHeight(height);
-                            FileInputStream fis = new FileInputStream(file);
-                            FileChannel fc = fis.getChannel();
-                            BigDecimal fileSize = new BigDecimal(fc.size());
-                            String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
-                            materialParameter.setSize(size);
-                            materialParameter.setUpdateTime(new Date());
-
-                            Map<String, Object> deleteMap = new HashMap<>();
-                            deleteMap.put("material_id", materialInfo.getId());
-                            materialParameterMapper.deleteByMap(deleteMap);
-                            int insert = materialParameterMapper.insert(materialParameter);
-                            if (insert > 0) {
-                                log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
-
-                            }
-                            /*Thread thread = new Thread() {
-                                @Override
-                                public void run() {
-                                    try {
-                                        Thread.sleep(5 * 1000);
-                                        materialCutFrameService.getCutFrame(url, materialInfo.getCode(), height, width);
-                                    } catch (Exception e) {
-                                        e.printStackTrace();
-                                    }
-                                }
-                            };
-                            thread.start();*/
-
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        } finally {
-                            file.delete();
-                        }
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
+        uploadExecutorService.submit(() -> {
+            File file = null;
+            try {
+                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+                file = new File(localUrl);
+                log.info("获取素材基本信息,code:{}", materialInfo.getCode());
+
+                long start = System.currentTimeMillis();
+                log.info("replaceUrl:{}", url);
+                it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                MultimediaInfo m = encoder.getInfo(file);
+                long duration = m.getDuration();
+                long secondDuration = duration / 1000;
+                MaterialParameter materialParameter = new MaterialParameter();
+                materialParameter.setMaterialId(materialInfo.getId());
+                // 视频秒数
+                materialParameter.setSecond(secondDuration);
+                // 视频格式
+                materialParameter.setFormat(m.getFormat());
+                // 视频宽
+                String width = String.valueOf(m.getVideo().getSize().getWidth());
+                materialParameter.setWidth(width);
+                // 视频高
+                String height = String.valueOf(m.getVideo().getSize().getHeight());
+                materialParameter.setHeight(height);
+                FileInputStream fis = new FileInputStream(file);
+                FileChannel fc = fis.getChannel();
+                BigDecimal fileSize = new BigDecimal(fc.size());
+                String size = fileSize.divide(new BigDecimal(1024 * 1024), 2, RoundingMode.HALF_UP) + "MB";
+                materialParameter.setSize(size);
+                materialParameter.setUpdateTime(new Date());
+
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("material_id", materialInfo.getId());
+                materialParameterMapper.deleteByMap(deleteMap);
+                int insert = materialParameterMapper.insert(materialParameter);
+                if (insert > 0) {
+                    log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - start) / 1000);
+                }
+                /*new Thread(() -> materialCutFrameService.getCutFrame(url, materialInfo.getCode(), height, width)).start();*/
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                if (null != file) {
+                    file.delete();
                 }
             }
-
-
         });
     }
 
@@ -418,6 +395,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     /**
      * 素材库关联上传素材 1
+     *
      * @param json
      * @return
      */
@@ -524,18 +502,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public List<String> getEffiCode(){
+    public List<String> getEffiCode() {
         return materialInfoMapper.getEffiSignature();
     }
 
     @Override
-    public List<MaterialInfo> effiMaterialInfo(){
+    public List<MaterialInfo> effiMaterialInfo() {
         List<MaterialInfo> materialInfoList = new ArrayList<>();
         List<String> effiSignatureList = materialInfoMapper.getEffiSignature();
-        for(String code:effiSignatureList){
+        for (String code : effiSignatureList) {
             MaterialInfo materialInfo = materialInfoMapper.getMaterialInfoByCode(code);
 
-            if (materialInfo == null){
+            if (materialInfo == null) {
                 continue;
             }
             //判断是否已经同步到快手平台

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialParameterServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -16,4 +17,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class MaterialParameterServiceImpl extends ServiceImpl<MaterialParameterMapper, MaterialParameter> implements IMaterialParameterService {
 
+    @Override
+    public MaterialParameter getOneByMaterialId(String materialInfoId) {
+        QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+        parameterQueryWrapper.eq("material_id", materialInfoId);
+        parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
+        return getOne(parameterQueryWrapper);
+    }
 }

+ 0 - 18
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SourceFileServiceImpl.java

@@ -1,18 +0,0 @@
-package cn.com.ctop.common.module.service.impl;
-
-import cn.com.ctop.common.module.entity.SourceFile;
-import cn.com.ctop.common.module.mapper.SourceFileMapper;
-import cn.com.ctop.common.module.service.ISourceFileService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * @Description: 统一资源库文件信息
- * @Author: jeecg-boot
- * @Date: 2019-09-02
- * @Version: V1.0
- */
-@Service
-public class SourceFileServiceImpl extends ServiceImpl<SourceFileMapper, SourceFile> implements ISourceFileService {
-
-}

+ 16 - 26
module-common/src/main/java/cn/com/ctop/common/module/utils/Check.java

@@ -1,41 +1,39 @@
 package cn.com.ctop.common.module.utils;
 
 import com.alibaba.fastjson.JSONArray;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
+@Slf4j
 public class Check {
-    public static boolean isNull(List list) {
-        return list == null || list.size() == 0 ? true : false;
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
     }
 
     public static boolean isNull(Long l) {
         return l == null || l == 0;
     }
 
-    public static boolean isNull(Collection collection) {
-        return collection == null || collection.size() == 0 ? true : false;
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
     }
 
     public static boolean isNull(JSONArray jsonArray) {
-        return jsonArray == null || jsonArray.size() == 0 ? true : false;
+        return jsonArray == null || jsonArray.isEmpty();
     }
 
 
     public static boolean isNull(String str) {
-        return str == null || str.length() <= 0;
-    }
-
-    public static boolean isNullSet(Set set) {
-        return set == null || set.size() == 0 ? true : false;
+        return str == null || str.isEmpty();
     }
 
     public static boolean isNull(byte[] bytes) {
-        return bytes == null || bytes.length == 0 ? true : false;
+        return bytes == null || bytes.length == 0;
     }
 
     public static boolean hasNull(Object... objects) {
@@ -56,19 +54,11 @@ public class Check {
         return true;
     }
 
-    public static boolean blankStr(String str) {
-        return str == null || str.length() == 0 ? true : false;
-    }
-
-    public static boolean isBlank(String str) {
-        return str == null || "".equals(str) ? true : false;
-    }
-
     public static boolean isNull(Object object) {
-        return object == null ? true : false;
+        return object == null;
     }
 
-    public static boolean isNullMap(Map map) {
-        return map == null || map.size() == 0 ? true : false;
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
     }
 }

+ 36 - 45
module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -9,6 +9,8 @@ import java.net.URLEncoder;
 import java.util.Map;
 
 public class LoadFileUtil {
+    private LoadFileUtil() {
+    }
     /**
      * 上传文件
      *
@@ -17,43 +19,38 @@ public class LoadFileUtil {
      * @return
      * @throws IOException
      */
-    public static String downLoadFromUrl(String urlStr, String savePath) throws IOException {
-        String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
-        URL url = new URL(urlStr);
-
-        System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        //设置超时间为3秒
-        conn.setConnectTimeout(60 * 1000);
-        //防止屏蔽程序抓取而返回403错误
-        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
-        //得到输入流
-        InputStream inputStream = conn.getInputStream();
-        //获取自己数组
-        byte[] getData = readInputStream(inputStream);
-
-        //文件保存位置
-        File saveDir = new File(savePath);
-        if (!saveDir.exists()) {
-//            saveDir.mkdir();
-            saveDir.mkdirs();
-        }
-        String localPath = saveDir + File.separator + fileName;
-        File file = new File(localPath);
-        if (!file.exists()){
-            file.getParentFile().mkdirs();
-        }
-        FileOutputStream fos = new FileOutputStream(file);
-        fos.write(getData);
-        if (fos != null) {
+    public static String downLoadFromUrl(String urlStr, String savePath) {
+        try {
+            String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf('/') + 1));
+            URL url = new URL(urlStr);
+            System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setConnectTimeout(60 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String localPath = saveDir + File.separator + fileName;
+            File file = new File(localPath);
+            if (!file.exists()) {
+                file.getParentFile().mkdirs();
+            }
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
             fos.close();
-        }
-        if (inputStream != null) {
             inputStream.close();
+            return localPath;
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
         }
-        return localPath;
-
-
     }
 
 
@@ -64,17 +61,16 @@ public class LoadFileUtil {
      * @return
      */
     public static boolean delFile(String path) {
-        boolean flag = false;
         File file = new File(path);
         if (!file.exists()) {
-            return flag;
+            return true;
         }
         try {
-            flag = file.delete();
+            return file.delete();
         } catch (Exception e) {
             e.printStackTrace();
+            return false;
         }
-        return flag;
     }
 
     /**
@@ -142,13 +138,8 @@ public class LoadFileUtil {
             File file = new File(saveDir + File.separator + fileName);
             FileOutputStream fos = new FileOutputStream(file);
             fos.write(getData);
-            if (fos != null) {
-                fos.close();
-            }
-            if (inputStream != null) {
-                inputStream.close();
-            }
-
+            fos.close();
+            inputStream.close();
             return filePath;
         } catch (IOException e) {
             e.printStackTrace();

+ 1 - 3
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadService.java

@@ -2,8 +2,6 @@ package cn.com.ctop.manage.modules.material.service;
 
 import com.alibaba.fastjson.JSONArray;
 
-import java.io.IOException;
-
 public interface IMaterialUploadService {
 
     /**
@@ -13,5 +11,5 @@ public interface IMaterialUploadService {
      * @param materialArray
      * @param accountArray
      */
-    void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) throws IOException;
+    void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray);
 }

+ 61 - 138
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -4,26 +4,21 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.enums.MaterialEnum;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
-import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
-import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IFileInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.http.ParseException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
@@ -37,7 +32,6 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
@@ -56,20 +50,14 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
 
 
     @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
+    private ICtopOauthTokenService oauthTokenService;
     @Autowired
-    private MaterialInfoMapper materialInfoMapper;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
+    private IMaterialInfoService materialInfoService;
     @Autowired
     private IFileInfoService fileInfoService;
     @Autowired
-    private IKuaiShouImageGetService iKuaiShouImageGetService;
-    @Autowired
     private IMaterialParameterService materialParameterService;
     @Autowired
-    private MaterialParameterMapper parameterMapper;
-    @Autowired
     private IKuaiShouVideoGetService kuaiShouVideoGetService;
     @Autowired
     private IMaterialUploadImageService materialUploadImageService;
@@ -87,9 +75,9 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     public void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         try {
             if ("2".equals(mediaId)) {
-                this.kuaiShouUpload(mediaId, materialArray, accountArray);
+                this.kuaiShouUpload(materialArray, accountArray);
             } else if ("1".equals(mediaId)) {
-                this.touTiaoUpload(mediaId, materialArray, accountArray);
+                this.touTiaoUpload(materialArray, accountArray);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -99,64 +87,38 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     }
 
 
-    private void touTiaoUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
+    private void touTiaoUpload(JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
             String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
-            if (Check.isNull(materialInfo)) {
+            MaterialInfo materialInfo = materialInfoService.getById(materialId);
+            if (Check.isNull(materialInfo) || Check.isNull(materialInfo.getUrl())) {
                 continue;
             }
-            if (Check.isNull(materialInfo.getUrl())) {
-                continue;
-            }
-
-
-            try {
-                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
-                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-
-                for (int i = 0; i < accountArray.size(); i++) {
-                    Long accountId = accountArray.getLong(i);
-                    if (Check.isNull(accountId)) {
-                        continue;
-                    }
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                                if ("VIDEO".equals(materialInfo.getType())) {
-                                    fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl);
-
-                                } else if ("IMAGE".equals(materialInfo.getType())) {
-                                    fileInfoService.uploadImageToBytedance(String.valueOf(accountId), localUrl);
-                                }
-
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    });
+            String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+            String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+            for (int i = 0; i < accountArray.size(); i++) {
+                Long accountId = accountArray.getLong(i);
+                if (Check.isNull(accountId)) {
+                    continue;
                 }
-            } catch (Exception e) {
-                e.printStackTrace();
+                executorService.submit(() -> {
+                    log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
+                    if ("VIDEO".equals(materialInfo.getType())) {
+                        fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl);
+                    } else if ("IMAGE".equals(materialInfo.getType())) {
+                        fileInfoService.uploadImageToBytedance(String.valueOf(accountId), localUrl);
+                    }
+                });
             }
-
-
         }
-
-
     }
 
 
-    private void kuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
+    private void kuaiShouUpload(JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
             String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
-            if (Check.isNull(materialInfo)) {
-                continue;
-            }
-            if (Check.isNull(materialInfo.getUrl())) {
+            MaterialInfo materialInfo = materialInfoService.getById(materialId);
+            if (Check.isNull(materialInfo) || Check.isNull(materialInfo.getUrl())) {
                 continue;
             }
             try {
@@ -169,10 +131,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 JSONObject requestJson = new JSONObject();
                 requestJson.put("file", resource);
                 requestJson.put("signature", materialInfo.getCode());
-                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                parameterQueryWrapper.eq("material_id", materialInfo.getId());
-                parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
-                MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
+                MaterialParameter materialParameter = materialParameterService.getOneByMaterialId(materialInfo.getId());
                 if (!Check.isNull(materialParameter)) {
                     Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
                     if (!Check.isNull(type) && type != 0) {
@@ -181,94 +140,58 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    tokenQueryWrapper.eq("media_id", mediaId);
-                    tokenQueryWrapper.orderByDesc("create_time");
-                    tokenQueryWrapper.last("limit 1");
-                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken ctopOauthToken = oauthTokenService.getTokenByAccountId(accountId);
                     if (Check.isNull(ctopOauthToken)) {
                         continue;
                     }
                     requestJson.put("advertiser_id", accountId);
                     headerMap.put("Access-Token", ctopOauthToken.getAccessToken());
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-
-                                String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
-                                JSONObject resultJson = JSONObject.parseObject(result);
-                                if (!Check.isNull(resultJson)) {
-                                    if (resultJson.getInteger("code") == 0) {
-                                        JSONObject dataJson = resultJson.getJSONObject("data");
-                                        if (!Check.isNull(dataJson)) {
-
-
-                                            // kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
-                                            String photoId = dataJson.getString("photo_id");
-                                            String signature = dataJson.getString("signature");
-                                            KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
-                                            videoGet.setAccountId(accountId);
-                                            videoGet.setId(accountId + photoId);
-                                            videoGet.setUrl(materialInfo.getUrl());
-                                            QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                                            parameterQueryWrapper.eq("material_id", materialId);
-                                            parameterQueryWrapper.last("limit 1");
-
-                                            MaterialParameter materialParameter = parameterMapper.selectOne(parameterQueryWrapper);
-                                            if (!Check.isNull(materialParameter)) {
-                                                String width = materialParameter.getWidth();
-                                                String height = materialParameter.getHeight();
-                                                videoGet.setWidth(Integer.valueOf(width));
-                                                videoGet.setHeight(Integer.valueOf(height));
-                                                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
-                                                if (!Check.isNull(type)) {
-                                                    videoGet.setMaterialType(type);
-                                                }
-                                            }
-                                            videoGet.setPhotoId(photoId);
-                                            //    videoGet.setCoverUrl(dataJson.getString("cover_url"));
-                                            videoGet.setSignature(signature);
-                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);
-                                            materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
-
-                                        }
-                                        log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
-                                    } else {
-                                        log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                    executorService.submit(() -> {
+                        log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
+                        String videoUploadUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+                        String result = exceptInfoForRestTemplate(videoUploadUrl, requestJson, headerMap);
+                        JSONObject resultJson = JSONObject.parseObject(result);
+                        if (!Check.isNull(resultJson) && resultJson.getInteger("code") == 0) {
+                            JSONObject dataJson = resultJson.getJSONObject("data");
+                            if (!Check.isNull(dataJson)) {
+                                String photoId = dataJson.getString("photo_id");
+                                String signature = dataJson.getString("signature");
+                                KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
+                                videoGet.setAccountId(accountId);
+                                videoGet.setId(accountId + photoId);
+                                videoGet.setUrl(materialInfo.getUrl());
+
+                                if (!Check.isNull(materialParameter)) {
+                                    String width = materialParameter.getWidth();
+                                    String height = materialParameter.getHeight();
+                                    videoGet.setWidth(Integer.valueOf(width));
+                                    videoGet.setHeight(Integer.valueOf(height));
+                                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
+                                    if (!Check.isNull(type)) {
+                                        videoGet.setMaterialType(type);
                                     }
                                 }
-
-                            } catch (Exception e) {
-                                e.printStackTrace();
+                                videoGet.setPhotoId(photoId);
+                                videoGet.setSignature(signature);
+                                kuaiShouVideoGetService.saveOrUpdate(videoGet);
+                                materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
                             }
+                            log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
+                        } else {
+                            log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
                         }
                     });
-
                 }
-                /*boolean isTrue = LoadFileUtil.delFile(localUrl);
-                if (isTrue) {
-                    log.info("删除本地缓存素材成功,code:{}", materialInfo.getCode());
-                }*/
-
-            } catch (IOException e) {
+            } catch (Exception e) {
                 e.printStackTrace();
             }
-
-
         }
-
-
     }
 
-
     @Autowired
     private RestTemplate rest;
 
-    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) throws ParseException {
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) {
         try {
             MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
             if (!Check.isNullMap(paramMap)) {
@@ -281,7 +204,7 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                         headers.add(key, headerMap.get(key));
                     }
                 }
-                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(param, headers);
+                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
                 ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
                 return responseEntity.getBody();
             }

+ 4 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/entity/KuaishouAppProduct.java

@@ -1,20 +1,17 @@
 package cn.com.ctop.kuaishou.modules.app.entity;
 
-import java.io.Serializable;
-import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.Date;
+
 /**
  * 快手推广产品
  * @author jeecg-boot
@@ -27,8 +24,8 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @Accessors(chain = true)
 @ApiModel(value="ctop_kuaishou_app_product对象", description="快手推广产品")
 public class KuaishouAppProduct {
-    
-	/**ID*/
+
+    /**ID*/
 	@TableId(type = IdType.INPUT)
     @ApiModelProperty(value = "ID")
 	private Integer id;

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/KuaishouAppProductMapper.java

@@ -1,8 +1,5 @@
 package cn.com.ctop.kuaishou.modules.app.mapper;
 
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
 import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAppProduct;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 

+ 15 - 23
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java

@@ -79,17 +79,13 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                             ad.setType(appFeeds.getType());
                             ad.setAppName(ad.getAppName().replace(".apk","").replace(".APK","").replace("ios","").replace("IOS",""));
                             appAdService.saveOrUpdate(ad);
-                            try {
-                                KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
-                                if (kuaishouAdAccount == null) {
-                                    kuaishouAdAccount = new KuaishouAdAccount();
-                                    kuaishouAdAccount.setKsid(ad.getUserId());
-                                    kuaishouAdAccount.setName(ad.getUserName());
-                                    kuaishouAdAccountService.save(kuaishouAdAccount);
-                                    this.adAccountFetch(kuaishouAdAccount, "");
-                                }
-                            } catch (Exception e) {
-                                e.printStackTrace();
+                            KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
+                            if (kuaishouAdAccount == null) {
+                                kuaishouAdAccount = new KuaishouAdAccount();
+                                kuaishouAdAccount.setKsid(ad.getUserId());
+                                kuaishouAdAccount.setName(ad.getUserName());
+                                kuaishouAdAccountService.save(kuaishouAdAccount);
+                                this.adAccountFetch(kuaishouAdAccount, "");
                             }
                         }
                     }
@@ -108,7 +104,7 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
         try {
             JsonNode userProfileNode = mapper.readTree(userProfileStr);
             int photoCount = userProfileNode.get("userProfile").get("ownerCount").get("photo").asInt();
-            QueryWrapper<AppVideo> queryWrapper = new QueryWrapper<AppVideo>();
+            QueryWrapper<AppVideo> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("user_id", kuaishouAdAccount.getKsid());
             int videoCount = appVideoService.count(queryWrapper);
             if (photoCount <= videoCount) {
@@ -179,17 +175,13 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                             ad.setAppName(ad.getAppName().replace(".apk", "").replace(".APK", "").replace("ios", "").replace("IOS", ""));
                         }
                         appAdService.saveOrUpdate(ad);
-                        try {
-                            KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
-                            if (kuaishouAdAccount == null) {
-                                kuaishouAdAccount = new KuaishouAdAccount();
-                                kuaishouAdAccount.setKsid(ad.getUserId());
-                                kuaishouAdAccount.setName(ad.getUserName());
-                                kuaishouAdAccountService.save(kuaishouAdAccount);
-                                this.adAccountFetch(kuaishouAdAccount, "");
-                            }
-                        } catch (Exception e) {
-                            e.printStackTrace();
+                        KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
+                        if (kuaishouAdAccount == null) {
+                            kuaishouAdAccount = new KuaishouAdAccount();
+                            kuaishouAdAccount.setKsid(ad.getUserId());
+                            kuaishouAdAccount.setName(ad.getUserName());
+                            kuaishouAdAccountService.save(kuaishouAdAccount);
+                            this.adAccountFetch(kuaishouAdAccount, "");
                         }
                     }
                 }

+ 14 - 15
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -90,7 +90,6 @@ public class BatchController {
     public Result<SpendVo> spend(Long accountId) {
         Result<SpendVo> result = new Result<>();
         try {
-
             CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
             if (Check.isNull(oauthToken)) {
                 throw new Exception("未获取到账户信息");
@@ -98,7 +97,8 @@ public class BatchController {
             SpendVo spendVo = new SpendVo();
             JSONObject fundJson = iKuaishouInterfaceService.fundGet(oauthToken);
             if (!Check.isNull(fundJson)) {
-                spendVo.setBalance(fundJson.getBigDecimal("balance")); // 余额
+                // 余额
+                spendVo.setBalance(fundJson.getBigDecimal("balance"));
             }
             BigDecimal cost = batchService.getCost(accountId);
             spendVo.setCost(cost);
@@ -107,9 +107,8 @@ public class BatchController {
             spendVo.setBudget(budget);
             result.setSuccess(true);
             result.setResult(spendVo);
-
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage());
             result.setSuccess(false);
             result.setMessage(e.getMessage());
         }
@@ -132,10 +131,10 @@ public class BatchController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<KuaiShouCampaign>> result = new Result<IPage<KuaiShouCampaign>>();
+        Result<IPage<KuaiShouCampaign>> result = new Result<>();
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
         queryWrapper.orderByDesc("put_create_time");
-        Page<KuaiShouCampaign> page = new Page<KuaiShouCampaign>(pageNo, pageSize);
+        Page<KuaiShouCampaign> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouCampaign> pageList = kuaiShouCampaignService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -340,10 +339,10 @@ public class BatchController {
                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
-        Result<IPage<KuaiShouGroup>> result = new Result<IPage<KuaiShouGroup>>();
+        Result<IPage<KuaiShouGroup>> result = new Result<>();
         QueryWrapper<KuaiShouGroup> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroup, req.getParameterMap());
         queryWrapper.orderByDesc("group_create_time");
-        Page<KuaiShouGroup> page = new Page<KuaiShouGroup>(pageNo, pageSize);
+        Page<KuaiShouGroup> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouGroup> pageList = kuaiShouGroupService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -369,7 +368,7 @@ public class BatchController {
             result.setSuccess(true);
             result.setResult(pageList);
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage());
             result.setSuccess(false);
 
         }
@@ -1015,17 +1014,17 @@ public class BatchController {
     @GetMapping(value = "/getVideoList")
     public Result<IPage<KuaiShouVideoGet>> getVideoList(KuaiShouVideoGet kuaiShouVideoGet, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
-        Result<IPage<KuaiShouVideoGet>> result = new Result<IPage<KuaiShouVideoGet>>();
+        Result<IPage<KuaiShouVideoGet>> result = new Result<>();
         try {
             QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
             queryWrapper.orderByDesc("create_time");
-            Page<KuaiShouVideoGet> page = new Page<KuaiShouVideoGet>(pageNo, pageSize);
+            Page<KuaiShouVideoGet> page = new Page<>(pageNo, pageSize);
             IPage<KuaiShouVideoGet> pageList = kuaiShouVideoGetService.page(page, queryWrapper);
             result.setSuccess(true);
             result.setResult(pageList);
             return result;
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage());
             result.setSuccess(false);
         }
 
@@ -1194,7 +1193,7 @@ public class BatchController {
      */
     @PostMapping(value = "/addDirectionalTemplate")
     public Result<KuaiShouDirectionalTemplate> add(@RequestBody KuaiShouDirectionalTemplate kuaiShouDirectionalTemplate) {
-        Result<KuaiShouDirectionalTemplate> result = new Result<KuaiShouDirectionalTemplate>();
+        Result<KuaiShouDirectionalTemplate> result = new Result<>();
         try {
             kuaiShouDirectionalTemplateService.save(kuaiShouDirectionalTemplate);
             result.success("添加成功!");
@@ -1214,7 +1213,7 @@ public class BatchController {
      */
     @PutMapping(value = "/editDirectionalTemplate")
     public Result<KuaiShouDirectionalTemplate> editDirectionalTemplate(@RequestBody KuaiShouDirectionalTemplate kuaiShouDirectionalTemplate) {
-        Result<KuaiShouDirectionalTemplate> result = new Result<KuaiShouDirectionalTemplate>();
+        Result<KuaiShouDirectionalTemplate> result = new Result<>();
         KuaiShouDirectionalTemplate kuaiShouDirectionalTemplateEntity = kuaiShouDirectionalTemplateService.getById(kuaiShouDirectionalTemplate.getId());
         if (kuaiShouDirectionalTemplateEntity == null) {
             result.error500("未找到对应实体");
@@ -1665,7 +1664,7 @@ public class BatchController {
             result.setSuccess(true);
 
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
             result.setSuccess(false);
             result.setMessage(e.getMessage());
         }

+ 0 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/MaterialReportMapper.java

@@ -7,8 +7,6 @@ import java.util.List;
 import java.util.Map;
 
 public interface MaterialReportMapper {
-    String getRoleCodeByUserId(@Param("userId") String userId);
-
     List<JSONObject> selectByMap(Map<String, Object> paramsMap);
 
     Integer selectMaxHourByDate(@Param("statDate") String statDate);

+ 0 - 20
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/MaterialReportMapper.xml

@@ -1,26 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper">
-
-
-    <select id="getRoleCodeByUserId" parameterType="Object" resultType="java.lang.String">
-	SELECT
-    role_code
-    FROM
-    sys_role
-    WHERE
-    id = (
-    SELECT
-    t2.role_id
-    FROM
-    sys_user t1
-    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
-    WHERE
-    t1.id = #{userId,jdbcType=VARCHAR}
-    )
-	</select>
-
-
     <select id="selectMaxHourByDate" resultType="java.lang.Integer">
         select
         max(stat_hour)

+ 0 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IMaterialReportService.java

@@ -6,9 +6,6 @@ import com.alibaba.fastjson.JSONObject;
 import java.util.List;
 
 public interface IMaterialReportService {
-    String getRoleCodeByUserId(String userId);
-
-
     /**
      * 获取快手大盘素材报表
      *

+ 5 - 14
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/MaterialReportServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.SysRoleMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
@@ -32,11 +33,8 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
 
     @Autowired
     private UserAllocationMapper userAllocationMapper;
-
-    @Override
-    public String getRoleCodeByUserId(String userId) {
-        return materialReportMapper.getRoleCodeByUserId(userId);
-    }
+    @Autowired
+    private SysRoleMapper sysRoleMapper;
 
 
     /**
@@ -48,21 +46,17 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
 
     @Override
     public List<JSONObject> getKuaiShouMaterialMarket(JSONObject json) {
-
-
         long startTime = System.currentTimeMillis();
-
         List<JSONObject> marketJsonList = new ArrayList<>();
         try {
             if (Check.isNull(json)) {
                 return marketJsonList;
             }
-
             String userId = json.getString("userId");
             if (Check.isNull(userId)) {
                 return marketJsonList;
             }
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String roleCode = sysRoleMapper.getRoleCodeByUserId(userId);
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
             String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
             Integer type = json.getInteger("type");
@@ -90,19 +84,16 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
                 paramsMap.put("startDate", anotherDay);
                 paramsMap.put("endDate", endDate);
                 marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
-
             } else if (type == 4) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -14);
                 paramsMap.put("startDate", anotherDay);
                 paramsMap.put("endDate", endDate);
                 marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
-
             } else if (type == 5) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
                 paramsMap.put("startDate", anotherDay);
                 paramsMap.put("endDate", endDate);
                 marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
-
             } else if (type == 6) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
                 paramsMap.put("startDate", anotherDay);
@@ -427,7 +418,7 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
      */
     @Override
     public List<UserAllocation> selectAccountIds(String userId) {
-        String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+        String roleCode = sysRoleMapper.getRoleCodeByUserId(userId);
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", 2);
         if ("operator".equals(roleCode)) {

+ 9 - 72
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceCleanMaterialReportController.java

@@ -1,8 +1,8 @@
-package org.jeecg.modules.ctop.controller;
+package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,20 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
 
 /**
  * 头条-数据清洗
@@ -58,9 +49,9 @@ public class ByteDanceCleanMaterialReportController {
                                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                      HttpServletRequest req) {
-        Result<IPage<ByteDanceCleanMaterialReport>> result = new Result<IPage<ByteDanceCleanMaterialReport>>();
+        Result<IPage<ByteDanceCleanMaterialReport>> result = new Result<>();
         QueryWrapper<ByteDanceCleanMaterialReport> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCleanMaterialReport, req.getParameterMap());
-        Page<ByteDanceCleanMaterialReport> page = new Page<ByteDanceCleanMaterialReport>(pageNo, pageSize);
+        Page<ByteDanceCleanMaterialReport> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCleanMaterialReport> pageList = byteDanceCleanMaterialReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -77,7 +68,7 @@ public class ByteDanceCleanMaterialReportController {
     @ApiOperation(value = "头条-数据清洗-添加", notes = "头条-数据清洗-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceCleanMaterialReport> add(@RequestBody ByteDanceCleanMaterialReport byteDanceCleanMaterialReport) {
-        Result<ByteDanceCleanMaterialReport> result = new Result<ByteDanceCleanMaterialReport>();
+        Result<ByteDanceCleanMaterialReport> result = new Result<>();
         try {
             byteDanceCleanMaterialReportService.save(byteDanceCleanMaterialReport);
             result.success("添加成功!");
@@ -98,7 +89,7 @@ public class ByteDanceCleanMaterialReportController {
     @ApiOperation(value = "头条-数据清洗-编辑", notes = "头条-数据清洗-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceCleanMaterialReport> edit(@RequestBody ByteDanceCleanMaterialReport byteDanceCleanMaterialReport) {
-        Result<ByteDanceCleanMaterialReport> result = new Result<ByteDanceCleanMaterialReport>();
+        Result<ByteDanceCleanMaterialReport> result = new Result<>();
         ByteDanceCleanMaterialReport byteDanceCleanMaterialReportEntity = byteDanceCleanMaterialReportService.getById(byteDanceCleanMaterialReport.getId());
         if (byteDanceCleanMaterialReportEntity == null) {
             result.error500("未找到对应实体");
@@ -121,7 +112,7 @@ public class ByteDanceCleanMaterialReportController {
     @AutoLog(value = "头条-数据清洗-通过id删除")
     @ApiOperation(value = "头条-数据清洗-通过id删除", notes = "头条-数据清洗-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceCleanMaterialReportService.removeById(id);
         } catch (Exception e) {
@@ -141,67 +132,13 @@ public class ByteDanceCleanMaterialReportController {
     @ApiOperation(value = "头条-数据清洗-批量删除", notes = "头条-数据清洗-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceCleanMaterialReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceCleanMaterialReport> result = new Result<ByteDanceCleanMaterialReport>();
+        Result<ByteDanceCleanMaterialReport> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.byteDanceCleanMaterialReportService.removeByIds(Arrays.asList(ids.split(",")));
+            this.byteDanceCleanMaterialReportService.removeByIds(Arrays.asList(ids.split(StringUtils.COMMA)));
             result.success("删除成功!");
         }
         return result;
     }
-
-    /**
-     * 通过id查询
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "头条-数据清洗-通过id查询")
-    @ApiOperation(value = "头条-数据清洗-通过id查询", notes = "头条-数据清洗-通过id查询")
-    @GetMapping(value = "/queryById")
-    public Result<ByteDanceCleanMaterialReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceCleanMaterialReport> result = new Result<ByteDanceCleanMaterialReport>();
-        ByteDanceCleanMaterialReport byteDanceCleanMaterialReport = byteDanceCleanMaterialReportService.getById(id);
-        if (byteDanceCleanMaterialReport == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(byteDanceCleanMaterialReport);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceCleanMaterialReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceCleanMaterialReport byteDanceCleanMaterialReport = JSON.parseObject(deString, ByteDanceCleanMaterialReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCleanMaterialReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceCleanMaterialReport> pageList = byteDanceCleanMaterialReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "头条-数据清洗列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceCleanMaterialReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("头条-数据清洗列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
 }

+ 9 - 92
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAdvertiserDailyReportController.java

@@ -1,8 +1,8 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAdvertiserDailyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceAdvertiserDailyReportService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 广告主日报表
@@ -63,9 +48,9 @@ public class BytedanceAdvertiserDailyReportController {
                                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                        HttpServletRequest req) {
-        Result<IPage<BytedanceAdvertiserDailyReport>> result = new Result<IPage<BytedanceAdvertiserDailyReport>>();
+        Result<IPage<BytedanceAdvertiserDailyReport>> result = new Result<>();
         QueryWrapper<BytedanceAdvertiserDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAdvertiserDailyReport, req.getParameterMap());
-        Page<BytedanceAdvertiserDailyReport> page = new Page<BytedanceAdvertiserDailyReport>(pageNo, pageSize);
+        Page<BytedanceAdvertiserDailyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedanceAdvertiserDailyReport> pageList = bytedanceAdvertiserDailyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -82,7 +67,7 @@ public class BytedanceAdvertiserDailyReportController {
     @ApiOperation(value = "广告主日报表-添加", notes = "广告主日报表-添加")
     @PostMapping(value = "/add")
     public Result<BytedanceAdvertiserDailyReport> add(@RequestBody BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport) {
-        Result<BytedanceAdvertiserDailyReport> result = new Result<BytedanceAdvertiserDailyReport>();
+        Result<BytedanceAdvertiserDailyReport> result = new Result<>();
         try {
             bytedanceAdvertiserDailyReportService.save(bytedanceAdvertiserDailyReport);
             result.success("添加成功!");
@@ -103,7 +88,7 @@ public class BytedanceAdvertiserDailyReportController {
     @ApiOperation(value = "广告主日报表-编辑", notes = "广告主日报表-编辑")
     @PutMapping(value = "/edit")
     public Result<BytedanceAdvertiserDailyReport> edit(@RequestBody BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport) {
-        Result<BytedanceAdvertiserDailyReport> result = new Result<BytedanceAdvertiserDailyReport>();
+        Result<BytedanceAdvertiserDailyReport> result = new Result<>();
         BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReportEntity = bytedanceAdvertiserDailyReportService.getById(bytedanceAdvertiserDailyReport.getId());
         if (bytedanceAdvertiserDailyReportEntity == null) {
             result.error500("未找到对应实体");
@@ -128,7 +113,7 @@ public class BytedanceAdvertiserDailyReportController {
     @AutoLog(value = "广告主日报表-通过id删除")
     @ApiOperation(value = "广告主日报表-通过id删除", notes = "广告主日报表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bytedanceAdvertiserDailyReportService.removeById(id);
         } catch (Exception e) {
@@ -148,11 +133,11 @@ public class BytedanceAdvertiserDailyReportController {
     @ApiOperation(value = "广告主日报表-批量删除", notes = "广告主日报表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BytedanceAdvertiserDailyReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BytedanceAdvertiserDailyReport> result = new Result<BytedanceAdvertiserDailyReport>();
+        Result<BytedanceAdvertiserDailyReport> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.bytedanceAdvertiserDailyReportService.removeByIds(Arrays.asList(ids.split(",")));
+            this.bytedanceAdvertiserDailyReportService.removeByIds(Arrays.asList(ids.split(StringUtils.COMMA)));
             result.success("删除成功!");
         }
         return result;
@@ -168,7 +153,7 @@ public class BytedanceAdvertiserDailyReportController {
     @ApiOperation(value = "广告主日报表-通过id查询", notes = "广告主日报表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BytedanceAdvertiserDailyReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BytedanceAdvertiserDailyReport> result = new Result<BytedanceAdvertiserDailyReport>();
+        Result<BytedanceAdvertiserDailyReport> result = new Result<>();
         BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport = bytedanceAdvertiserDailyReportService.getById(id);
         if (bytedanceAdvertiserDailyReport == null) {
             result.error500("未找到对应实体");
@@ -178,72 +163,4 @@ public class BytedanceAdvertiserDailyReportController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BytedanceAdvertiserDailyReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport = JSON.parseObject(deString, BytedanceAdvertiserDailyReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAdvertiserDailyReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BytedanceAdvertiserDailyReport> pageList = bytedanceAdvertiserDailyReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告主日报表列表");
-        mv.addObject(NormalExcelConstants.CLASS, BytedanceAdvertiserDailyReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告主日报表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BytedanceAdvertiserDailyReport> listBytedanceAdvertiserDailyReports = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceAdvertiserDailyReport.class, params);
-                bytedanceAdvertiserDailyReportService.saveBatch(listBytedanceAdvertiserDailyReports);
-                return Result.ok("文件导入成功!数据行数:" + listBytedanceAdvertiserDailyReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 5 - 89
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAdvertiserHourlyReportController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.report.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAdvertiserHourlyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceAdvertiserHourlyReportService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 广告主小时级别报表信息
@@ -64,9 +48,9 @@ public class BytedanceAdvertiserHourlyReportController {
                                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                         HttpServletRequest req) {
-        Result<IPage<BytedanceAdvertiserHourlyReport>> result = new Result<IPage<BytedanceAdvertiserHourlyReport>>();
+        Result<IPage<BytedanceAdvertiserHourlyReport>> result = new Result<>();
         QueryWrapper<BytedanceAdvertiserHourlyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAdvertiserHourlyReport, req.getParameterMap());
-        Page<BytedanceAdvertiserHourlyReport> page = new Page<BytedanceAdvertiserHourlyReport>(pageNo, pageSize);
+        Page<BytedanceAdvertiserHourlyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedanceAdvertiserHourlyReport> pageList = bytedanceAdvertiserHourlyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class BytedanceAdvertiserHourlyReportController {
     @ApiOperation(value = "广告主小时级别报表信息-添加", notes = "广告主小时级别报表信息-添加")
     @PostMapping(value = "/add")
     public Result<BytedanceAdvertiserHourlyReport> add(@RequestBody BytedanceAdvertiserHourlyReport bytedanceAdvertiserHourlyReport) {
-        Result<BytedanceAdvertiserHourlyReport> result = new Result<BytedanceAdvertiserHourlyReport>();
+        Result<BytedanceAdvertiserHourlyReport> result = new Result<>();
         try {
             bytedanceAdvertiserHourlyReportService.save(bytedanceAdvertiserHourlyReport);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class BytedanceAdvertiserHourlyReportController {
     @ApiOperation(value = "广告主小时级别报表信息-编辑", notes = "广告主小时级别报表信息-编辑")
     @PutMapping(value = "/edit")
     public Result<BytedanceAdvertiserHourlyReport> edit(@RequestBody BytedanceAdvertiserHourlyReport bytedanceAdvertiserHourlyReport) {
-        Result<BytedanceAdvertiserHourlyReport> result = new Result<BytedanceAdvertiserHourlyReport>();
+        Result<BytedanceAdvertiserHourlyReport> result = new Result<>();
         BytedanceAdvertiserHourlyReport bytedanceAdvertiserHourlyReportEntity = bytedanceAdvertiserHourlyReportService.getById(bytedanceAdvertiserHourlyReport.getId());
         if (bytedanceAdvertiserHourlyReportEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +113,7 @@ public class BytedanceAdvertiserHourlyReportController {
     @AutoLog(value = "广告主小时级别报表信息-通过id删除")
     @ApiOperation(value = "广告主小时级别报表信息-通过id删除", notes = "广告主小时级别报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bytedanceAdvertiserHourlyReportService.removeById(id);
         } catch (Exception e) {
@@ -179,72 +163,4 @@ public class BytedanceAdvertiserHourlyReportController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BytedanceAdvertiserHourlyReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BytedanceAdvertiserHourlyReport bytedanceAdvertiserHourlyReport = JSON.parseObject(deString, BytedanceAdvertiserHourlyReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAdvertiserHourlyReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BytedanceAdvertiserHourlyReport> pageList = bytedanceAdvertiserHourlyReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告主小时级别报表信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, BytedanceAdvertiserHourlyReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告主小时级别报表信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BytedanceAdvertiserHourlyReport> listBytedanceAdvertiserHourlyReports = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceAdvertiserHourlyReport.class, params);
-                bytedanceAdvertiserHourlyReportService.saveBatch(listBytedanceAdvertiserHourlyReports);
-                return Result.ok("文件导入成功!数据行数:" + listBytedanceAdvertiserHourlyReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 6 - 90
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCampaignDailyReportController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.report.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCampaignDailyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceCampaignDailyReportService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 广告组日报表信息
@@ -64,9 +48,9 @@ public class BytedanceCampaignDailyReportController {
                                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                      HttpServletRequest req) {
-        Result<IPage<BytedanceCampaignDailyReport>> result = new Result<IPage<BytedanceCampaignDailyReport>>();
+        Result<IPage<BytedanceCampaignDailyReport>> result = new Result<>();
         QueryWrapper<BytedanceCampaignDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCampaignDailyReport, req.getParameterMap());
-        Page<BytedanceCampaignDailyReport> page = new Page<BytedanceCampaignDailyReport>(pageNo, pageSize);
+        Page<BytedanceCampaignDailyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedanceCampaignDailyReport> pageList = bytedanceCampaignDailyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class BytedanceCampaignDailyReportController {
     @ApiOperation(value = "广告组日报表信息-添加", notes = "广告组日报表信息-添加")
     @PostMapping(value = "/add")
     public Result<BytedanceCampaignDailyReport> add(@RequestBody BytedanceCampaignDailyReport bytedanceCampaignDailyReport) {
-        Result<BytedanceCampaignDailyReport> result = new Result<BytedanceCampaignDailyReport>();
+        Result<BytedanceCampaignDailyReport> result = new Result<>();
         try {
             bytedanceCampaignDailyReportService.save(bytedanceCampaignDailyReport);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class BytedanceCampaignDailyReportController {
     @ApiOperation(value = "广告组日报表信息-编辑", notes = "广告组日报表信息-编辑")
     @PutMapping(value = "/edit")
     public Result<BytedanceCampaignDailyReport> edit(@RequestBody BytedanceCampaignDailyReport bytedanceCampaignDailyReport) {
-        Result<BytedanceCampaignDailyReport> result = new Result<BytedanceCampaignDailyReport>();
+        Result<BytedanceCampaignDailyReport> result = new Result<>();
         BytedanceCampaignDailyReport bytedanceCampaignDailyReportEntity = bytedanceCampaignDailyReportService.getById(bytedanceCampaignDailyReport.getId());
         if (bytedanceCampaignDailyReportEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +113,7 @@ public class BytedanceCampaignDailyReportController {
     @AutoLog(value = "广告组日报表信息-通过id删除")
     @ApiOperation(value = "广告组日报表信息-通过id删除", notes = "广告组日报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bytedanceCampaignDailyReportService.removeById(id);
         } catch (Exception e) {
@@ -169,7 +153,7 @@ public class BytedanceCampaignDailyReportController {
     @ApiOperation(value = "广告组日报表信息-通过id查询", notes = "广告组日报表信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BytedanceCampaignDailyReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BytedanceCampaignDailyReport> result = new Result<BytedanceCampaignDailyReport>();
+        Result<BytedanceCampaignDailyReport> result = new Result<>();
         BytedanceCampaignDailyReport bytedanceCampaignDailyReport = bytedanceCampaignDailyReportService.getById(id);
         if (bytedanceCampaignDailyReport == null) {
             result.error500("未找到对应实体");
@@ -179,72 +163,4 @@ public class BytedanceCampaignDailyReportController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BytedanceCampaignDailyReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BytedanceCampaignDailyReport bytedanceCampaignDailyReport = JSON.parseObject(deString, BytedanceCampaignDailyReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCampaignDailyReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BytedanceCampaignDailyReport> pageList = bytedanceCampaignDailyReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告组日报表信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, BytedanceCampaignDailyReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告组日报表信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BytedanceCampaignDailyReport> listBytedanceCampaignDailyReports = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceCampaignDailyReport.class, params);
-                bytedanceCampaignDailyReportService.saveBatch(listBytedanceCampaignDailyReports);
-                return Result.ok("文件导入成功!数据行数:" + listBytedanceCampaignDailyReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 9 - 91
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCampaignHourlyReportController.java

@@ -1,8 +1,8 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCampaignHourlyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceCampaignHourlyReportService;
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 广告组时报表信息
@@ -63,9 +48,9 @@ public class BytedanceCampaignHourlyReportController {
                                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                       HttpServletRequest req) {
-        Result<IPage<BytedanceCampaignHourlyReport>> result = new Result<IPage<BytedanceCampaignHourlyReport>>();
+        Result<IPage<BytedanceCampaignHourlyReport>> result = new Result<>();
         QueryWrapper<BytedanceCampaignHourlyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCampaignHourlyReport, req.getParameterMap());
-        Page<BytedanceCampaignHourlyReport> page = new Page<BytedanceCampaignHourlyReport>(pageNo, pageSize);
+        Page<BytedanceCampaignHourlyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedanceCampaignHourlyReport> pageList = bytedanceCampaignHourlyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -82,7 +67,7 @@ public class BytedanceCampaignHourlyReportController {
     @ApiOperation(value = "广告组时报表信息-添加", notes = "广告组时报表信息-添加")
     @PostMapping(value = "/add")
     public Result<BytedanceCampaignHourlyReport> add(@RequestBody BytedanceCampaignHourlyReport bytedanceCampaignHourlyReport) {
-        Result<BytedanceCampaignHourlyReport> result = new Result<BytedanceCampaignHourlyReport>();
+        Result<BytedanceCampaignHourlyReport> result = new Result<>();
         try {
             bytedanceCampaignHourlyReportService.save(bytedanceCampaignHourlyReport);
             result.success("添加成功!");
@@ -103,7 +88,7 @@ public class BytedanceCampaignHourlyReportController {
     @ApiOperation(value = "广告组时报表信息-编辑", notes = "广告组时报表信息-编辑")
     @PutMapping(value = "/edit")
     public Result<BytedanceCampaignHourlyReport> edit(@RequestBody BytedanceCampaignHourlyReport bytedanceCampaignHourlyReport) {
-        Result<BytedanceCampaignHourlyReport> result = new Result<BytedanceCampaignHourlyReport>();
+        Result<BytedanceCampaignHourlyReport> result = new Result<>();
         BytedanceCampaignHourlyReport bytedanceCampaignHourlyReportEntity = bytedanceCampaignHourlyReportService.getById(bytedanceCampaignHourlyReport.getId());
         if (bytedanceCampaignHourlyReportEntity == null) {
             result.error500("未找到对应实体");
@@ -128,7 +113,7 @@ public class BytedanceCampaignHourlyReportController {
     @AutoLog(value = "广告组时报表信息-通过id删除")
     @ApiOperation(value = "广告组时报表信息-通过id删除", notes = "广告组时报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bytedanceCampaignHourlyReportService.removeById(id);
         } catch (Exception e) {
@@ -148,11 +133,11 @@ public class BytedanceCampaignHourlyReportController {
     @ApiOperation(value = "广告组时报表信息-批量删除", notes = "广告组时报表信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BytedanceCampaignHourlyReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BytedanceCampaignHourlyReport> result = new Result<BytedanceCampaignHourlyReport>();
+        Result<BytedanceCampaignHourlyReport> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.bytedanceCampaignHourlyReportService.removeByIds(Arrays.asList(ids.split(",")));
+            this.bytedanceCampaignHourlyReportService.removeByIds(Arrays.asList(ids.split(StringUtils.COMMA)));
             result.success("删除成功!");
         }
         return result;
@@ -168,7 +153,7 @@ public class BytedanceCampaignHourlyReportController {
     @ApiOperation(value = "广告组时报表信息-通过id查询", notes = "广告组时报表信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BytedanceCampaignHourlyReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BytedanceCampaignHourlyReport> result = new Result<BytedanceCampaignHourlyReport>();
+        Result<BytedanceCampaignHourlyReport> result = new Result<>();
         BytedanceCampaignHourlyReport bytedanceCampaignHourlyReport = bytedanceCampaignHourlyReportService.getById(id);
         if (bytedanceCampaignHourlyReport == null) {
             result.error500("未找到对应实体");
@@ -179,71 +164,4 @@ public class BytedanceCampaignHourlyReportController {
         return result;
     }
 
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BytedanceCampaignHourlyReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BytedanceCampaignHourlyReport bytedanceCampaignHourlyReport = JSON.parseObject(deString, BytedanceCampaignHourlyReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCampaignHourlyReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BytedanceCampaignHourlyReport> pageList = bytedanceCampaignHourlyReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告组时报表信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, BytedanceCampaignHourlyReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告组时报表信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BytedanceCampaignHourlyReport> listBytedanceCampaignHourlyReports = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceCampaignHourlyReport.class, params);
-                bytedanceCampaignHourlyReportService.saveBatch(listBytedanceCampaignHourlyReports);
-                return Result.ok("文件导入成功!数据行数:" + listBytedanceCampaignHourlyReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 11 - 93
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCreativeDailyReportController.java

@@ -1,8 +1,8 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceCreativeDailyReportService;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -13,26 +13,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 广告创意日报表信息
@@ -64,9 +51,9 @@ public class BytedanceCreativeDailyReportController {
                                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                      HttpServletRequest req) {
-        Result<IPage<BytedanceCreativeDailyReport>> result = new Result<IPage<BytedanceCreativeDailyReport>>();
+        Result<IPage<BytedanceCreativeDailyReport>> result = new Result<>();
         QueryWrapper<BytedanceCreativeDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCreativeDailyReport, req.getParameterMap());
-        Page<BytedanceCreativeDailyReport> page = new Page<BytedanceCreativeDailyReport>(pageNo, pageSize);
+        Page<BytedanceCreativeDailyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedanceCreativeDailyReport> pageList = bytedanceCreativeDailyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +70,7 @@ public class BytedanceCreativeDailyReportController {
     @ApiOperation(value = "广告创意日报表信息-添加", notes = "广告创意日报表信息-添加")
     @PostMapping(value = "/add")
     public Result<BytedanceCreativeDailyReport> add(@RequestBody BytedanceCreativeDailyReport bytedanceCreativeDailyReport) {
-        Result<BytedanceCreativeDailyReport> result = new Result<BytedanceCreativeDailyReport>();
+        Result<BytedanceCreativeDailyReport> result = new Result<>();
         try {
             bytedanceCreativeDailyReportService.save(bytedanceCreativeDailyReport);
             result.success("添加成功!");
@@ -104,7 +91,7 @@ public class BytedanceCreativeDailyReportController {
     @ApiOperation(value = "广告创意日报表信息-编辑", notes = "广告创意日报表信息-编辑")
     @PutMapping(value = "/edit")
     public Result<BytedanceCreativeDailyReport> edit(@RequestBody BytedanceCreativeDailyReport bytedanceCreativeDailyReport) {
-        Result<BytedanceCreativeDailyReport> result = new Result<BytedanceCreativeDailyReport>();
+        Result<BytedanceCreativeDailyReport> result = new Result<>();
         BytedanceCreativeDailyReport bytedanceCreativeDailyReportEntity = bytedanceCreativeDailyReportService.getById(bytedanceCreativeDailyReport.getId());
         if (bytedanceCreativeDailyReportEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +116,7 @@ public class BytedanceCreativeDailyReportController {
     @AutoLog(value = "广告创意日报表信息-通过id删除")
     @ApiOperation(value = "广告创意日报表信息-通过id删除", notes = "广告创意日报表信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             bytedanceCreativeDailyReportService.removeById(id);
         } catch (Exception e) {
@@ -149,11 +136,11 @@ public class BytedanceCreativeDailyReportController {
     @ApiOperation(value = "广告创意日报表信息-批量删除", notes = "广告创意日报表信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<BytedanceCreativeDailyReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BytedanceCreativeDailyReport> result = new Result<BytedanceCreativeDailyReport>();
+        Result<BytedanceCreativeDailyReport> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.bytedanceCreativeDailyReportService.removeByIds(Arrays.asList(ids.split(",")));
+            this.bytedanceCreativeDailyReportService.removeByIds(Arrays.asList(ids.split(StringUtils.COMMA)));
             result.success("删除成功!");
         }
         return result;
@@ -169,7 +156,7 @@ public class BytedanceCreativeDailyReportController {
     @ApiOperation(value = "广告创意日报表信息-通过id查询", notes = "广告创意日报表信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<BytedanceCreativeDailyReport> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BytedanceCreativeDailyReport> result = new Result<BytedanceCreativeDailyReport>();
+        Result<BytedanceCreativeDailyReport> result = new Result<>();
         BytedanceCreativeDailyReport bytedanceCreativeDailyReport = bytedanceCreativeDailyReportService.getById(id);
         if (bytedanceCreativeDailyReport == null) {
             result.error500("未找到对应实体");
@@ -181,75 +168,7 @@ public class BytedanceCreativeDailyReportController {
     }
 
     /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BytedanceCreativeDailyReport> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BytedanceCreativeDailyReport bytedanceCreativeDailyReport = JSON.parseObject(deString, BytedanceCreativeDailyReport.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCreativeDailyReport, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BytedanceCreativeDailyReport> pageList = bytedanceCreativeDailyReportService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告创意日报表信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, BytedanceCreativeDailyReport.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告创意日报表信息列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<BytedanceCreativeDailyReport> listBytedanceCreativeDailyReports = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceCreativeDailyReport.class, params);
-                bytedanceCreativeDailyReportService.saveBatch(listBytedanceCreativeDailyReports);
-                return Result.ok("文件导入成功!数据行数:" + listBytedanceCreativeDailyReports.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
-    /**
-     * bytedanceCreativeDailyReportList
-     *
+     * TODO 需要重写 avg问题
      * @param json
      * @return
      */
@@ -266,8 +185,7 @@ public class BytedanceCreativeDailyReportController {
     }
 
     /**
-     * bytedanceCreativeAccountReportList
-     *
+     * TODO 需要重写 avg问题
      * @param json
      * @return
      */

+ 0 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceCreativeHourlyReportController.java


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff