Sfoglia il codice sorgente

Merge branch 'master' into test

wangyunpeng 2 settimane fa
parent
commit
0c15ab2319

+ 15 - 0
api-module/src/main/java/com/tzld/piaoquan/api/component/VlogApiService.java

@@ -15,6 +15,7 @@ public class VlogApiService {
     private HttpPoolClient httpPoolClient;
 
     private final static String SHARE_IMG_URL = "https://vlogapi.piaoquantv.com/longvideoapi/video/share/web/qrImg";
+    private final static String SHARE_LINK_URL = "https://vlogapi.piaoquantv.com/longvideoapi/video/share/web/link";
 
     public String getSharePic(String path, String appType) {
         JSONObject requestParam = new JSONObject();
@@ -29,4 +30,18 @@ public class VlogApiService {
         }
         return null;
     }
+
+    public String getShareUrlLink(String path, String appType) {
+        JSONObject requestParam = new JSONObject();
+        requestParam.put("page", path);
+        requestParam.put("appType", appType);
+        try {
+            String resultStr = httpPoolClient.post(SHARE_LINK_URL, requestParam.toJSONString());
+            JSONObject result = JSON.parseObject(resultStr);
+            return result.getString("data");
+        } catch (Exception e) {
+            log.error("获取分享链接失败", e);
+        }
+        return null;
+    }
 }

+ 3 - 2
api-module/src/main/java/com/tzld/piaoquan/api/controller/MessageController.java

@@ -43,9 +43,10 @@ public class MessageController {
                                                  @RequestParam(required = false) String page,
                                                  @RequestParam(required = false) String title,
                                                  @RequestParam(required = false) String desc,
-                                                 @RequestParam(required = false) String appId
+                                                 @RequestParam(required = false) String appId,
+                                                 @RequestParam(required = false) Integer extType
     ) {
-        return messageAttachmentService.createAttachment(type, file, url, picUrl, page, title, desc, appId);
+        return messageAttachmentService.createAttachment(type, file, url, picUrl, page, title, desc, appId, extType);
     }
 
 }

+ 13 - 0
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java

@@ -93,10 +93,23 @@ public class ContentPlatformPlanController {
 
     @ApiOperation(value = "获取分享二维码")
     @GetMapping("/qw/getSharePic")
+    public CommonResponse<String> getQwSharePic(@RequestParam String pageUrl) {
+        return CommonResponse.success(planService.getSharePic(pageUrl));
+    }
+
+    @ApiOperation(value = "获取分享二维码")
+    @GetMapping("/getSharePic")
     public CommonResponse<String> getSharePic(@RequestParam String pageUrl) {
         return CommonResponse.success(planService.getSharePic(pageUrl));
     }
 
+    @ApiOperation(value = "获取分享链接")
+    @GetMapping("/getShareUrlLink")
+    @JwtIgnore
+    public CommonResponse<String> getShareUrlLink(@RequestParam String pageUrl) {
+        return CommonResponse.success(planService.getShareUrlLink(pageUrl));
+    }
+
     @ApiOperation(value = "同步最近top1000视频", hidden = true)
     @JwtIgnore
     @GetMapping("/job/syncContentPlatformVideoJob")

+ 14 - 9
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java

@@ -154,7 +154,7 @@ public class ContentPlatformDatastatJob {
                 int firstLevelCount = Integer.parseInt((String) record.get(3));
                 Integer fissionCount = parseInteger(record.get(4));
                 item.setDateStr(dt);
-                if (!ghIds.contains(ghId) || videoId == 0) {
+                if (!ghIds.contains(ghId) || videoId == 0 || firstLevelCount == 0) {
                     continue;
                 }
                 ContentPlatformGzhAccount gzhAccount = accountMap.get(ghId);
@@ -228,10 +228,12 @@ public class ContentPlatformDatastatJob {
                 }
                 List<ContentPlatformGzhAccount> gzhAccounts = gzhAccountMap.get(account.getId());
                 int fansIncreaseCount = 0;
-                for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
-                    WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
-                    if (Objects.nonNull(wxAccountDatastatVO)) {
-                        fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
+                if (CollectionUtils.isNotEmpty(gzhAccounts)) {
+                    for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
+                        WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
+                        if (Objects.nonNull(wxAccountDatastatVO)) {
+                            fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
+                        }
                     }
                 }
                 item.setFansIncreaseCount(fansIncreaseCount);
@@ -376,10 +378,12 @@ public class ContentPlatformDatastatJob {
                 }
                 List<ContentPlatformGzhAccount> gzhAccounts = gzhAccountMap.get(account.getId());
                 int fansIncreaseCount = 0;
-                for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
-                    WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
-                    if (Objects.nonNull(wxAccountDatastatVO)) {
-                        fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
+                if (CollectionUtils.isNotEmpty(gzhAccounts)) {
+                    for (ContentPlatformGzhAccount gzhAccount : gzhAccounts) {
+                        WxAccountDatastatVO wxAccountDatastatVO = wxAccountDatastatMap.get(gzhAccount.getExternalId());
+                        if (Objects.nonNull(wxAccountDatastatVO)) {
+                            fansIncreaseCount += wxAccountDatastatVO.getFansIncreaseCount();
+                        }
                     }
                 }
                 item.setFansIncreaseCount(fansIncreaseCount);
@@ -683,6 +687,7 @@ public class ContentPlatformDatastatJob {
                     .collect(Collectors.toList());
             List<ContentPlatformQwDataStatReplyTotal> channelScoreList = dataStatMapperExt.getQwTotalDatastatReplyScoreList(dt, channels);
             Map<String, Double> channelScoreMap = channelScoreList.stream()
+                    .filter(o -> Objects.nonNull(o.getScore()))
                     .collect(Collectors.toMap(ContentPlatformQwDataStatReplyTotal::getChannel,
                             ContentPlatformQwDataStatReplyTotal::getScore, (a, b) -> a));
             for (ContentPlatformQwDataStatReplyTotal item : saveList) {

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -42,6 +42,8 @@ public interface ContentPlatformPlanService {
 
     String getSharePic(String pageUrl);
 
+    String getShareUrlLink(String pageUrl);
+
     List<ContentPlatformGzhPlan> getGzhPlanListByCooperateAccountId(Long accountId);
 
     List<ContentPlatformGzhPlan> getGzhPlanListByCreateAccountId(Long createAccountId);

+ 5 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -707,6 +707,11 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         return vlogApiService.getSharePic(pageUrl, shareAppType);
     }
 
+    @Override
+    public String getShareUrlLink(String pageUrl) {
+        return vlogApiService.getShareUrlLink(pageUrl, shareAppType);
+    }
+
     @Override
     public List<ContentPlatformGzhPlanVideo> getGzhPlanVideoListByCooperateAccountId(String ghId) {
         return planMapperExt.getGzhPlanVideoListByCooperateAccountId(ghId);

+ 3 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/common/constant/WeComConstant.java

@@ -23,6 +23,9 @@ public interface WeComConstant {
     //上传临时素材
     String POST_WE_COM_MEDIA_UPLOAD = "https://qyapi.weixin.qq.com/cgi-bin/media/upload";
 
+    //上传附件素材
+    String POST_WE_COM_MEDIA_UPLOAD_ATTACHMENT = "https://qyapi.weixin.qq.com/cgi-bin/media/upload_attachment";
+
     //获取客户列表
     String GET_WE_COM_EXTERNAL_CONTACT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list";
 

+ 12 - 6
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageAttachmentServiceImpl.java

@@ -48,6 +48,7 @@ import static com.tzld.piaoquan.growth.common.common.constant.OtherServerURL.POS
 import static com.tzld.piaoquan.growth.common.common.constant.OtherServerURL.POST_VIDEO_DETAIL_URL;
 import static com.tzld.piaoquan.growth.common.common.constant.TimeConstant.MILLISECOND_DAY;
 import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.POST_WE_COM_MEDIA_UPLOAD;
+import static com.tzld.piaoquan.growth.common.common.constant.WeComConstant.POST_WE_COM_MEDIA_UPLOAD_ATTACHMENT;
 
 
 @Slf4j
@@ -507,7 +508,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     }
 
     @Override
-    public CommonResponse<Long> createAttachment(Integer type, MultipartFile file, String url, String picUrl, String page, String title, String desc, String appId) {
+    public CommonResponse<Long> createAttachment(Integer type, MultipartFile file, String url, String picUrl, String page, String title, String desc, String appId, Integer extType) {
         if (type == null) {
             return CommonResponse.create(500, "附件类型不能为空");
         }
@@ -521,7 +522,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             if (file == null || file.isEmpty()) {
                 return CommonResponse.create(500, "封面文件不能为空");
             }
-            String mediaId = uploadFile(file, "image");
+            String mediaId = uploadFile(file, "image", extType);
             if (StringUtils.isEmpty(mediaId)) {
                 return CommonResponse.create(500, "封面上传失败");
             }
@@ -566,7 +567,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             if (file == null || file.isEmpty()) {
                 return CommonResponse.create(500, "图片不能为空");
             }
-            String mediaId = uploadFile(file, "image");
+            String mediaId = uploadFile(file, "image", extType);
             if (StringUtils.isEmpty(mediaId)) {
                 return CommonResponse.create(500, "图片上传失败");
             }
@@ -581,7 +582,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             if (file == null || file.isEmpty()) {
                 return CommonResponse.create(500, "视频不能为空");
             }
-            String mediaId = uploadFile(file, "video");
+            String mediaId = uploadFile(file, "video", extType);
             if (StringUtils.isEmpty(mediaId)) {
                 return CommonResponse.create(500, "视频上传失败");
             }
@@ -594,7 +595,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
         return CommonResponse.create(500, "没有对应类型");
     }
 
-    private String uploadFile(MultipartFile multipartFile, String fileType) {
+    private String uploadFile(MultipartFile multipartFile, String fileType, Integer extType) {
         String mediaId = null;
         try {
             String extension = FileUtils.getExtension(multipartFile);
@@ -612,7 +613,12 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             File file = new File(filePath);
             //暂时不区分主体
             String weComAccessToken = weComAccessTokenService.getWeComAccessToken(1L);
-            String url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, fileType);
+            String url;
+            if (extType != null && extType == 1) {
+                url = String.format(POST_WE_COM_MEDIA_UPLOAD_ATTACHMENT + "?access_token=%s&media_type=%s&attachment_type=1", weComAccessToken, fileType);
+            } else {
+                url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, fileType);
+            }
             String res = httpPoolClient.post(url, file);
 
             JSONObject jsonObject = JSONObject.parseObject(res);

+ 1 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/MessageAttachmentService.java

@@ -29,5 +29,5 @@ public interface MessageAttachmentService {
 
     String getPage(String channel, String carrierId, String scene, String putTypeOne, String putTypeTwo, String putTypeThree, Long videoId);
 
-    CommonResponse<Long> createAttachment(Integer type, MultipartFile file, String url, String picUrl, String page, String title, String desc, String appId);
+    CommonResponse<Long> createAttachment(Integer type, MultipartFile file, String url, String picUrl, String page, String title, String desc, String appId, Integer extType);
 }

+ 11 - 4
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComHistoryDataJob.java

@@ -164,14 +164,17 @@ public class WeComHistoryDataJob {
             if (CollectionUtils.isEmpty(sendCountList)) {
                 continue;
             }
-            stringBuilder.append(sendDetail.getRemark());
             long count = sendCountList.get(0) + sendCountList.get(1) + sendCountList.get(2) + sendCountList.get(3);
+            if (count == 0) {
+                continue;
+            }
+            stringBuilder.append(sendDetail.getRemark());
             allCount += count;
             notSendCount += sendCountList.get(0);
             successSendCount += sendCountList.get(1);
             notFriendCount += sendCountList.get(2);
             failSendCount += sendCountList.get(3);
-            if (count != 0 && sendCountList.get(0) > 0 && !specialStaffIdList.contains(sendDetail.getStaffId())) {
+            if (sendCountList.get(0) > 0 && !specialStaffIdList.contains(sendDetail.getStaffId())) {
                 LarkRobotUtil.sendMessage(sendDetail.getRemark() + "存在未发送记录,请检查");
                 LarkRobotUtil.sendTipMessage(sendDetail.getRemark() + "存在未发送记录,请检查");
                 //8点前报警
@@ -275,9 +278,13 @@ public class WeComHistoryDataJob {
             if (CollectionUtils.isEmpty(sendCountList)) {
                 continue;
             }
-            stringBuilder.append(sendDetail.getRemark());
             long count = sendCountList.get(0) + sendCountList.get(1) + sendCountList.get(2) + sendCountList.get(3);
-            if (count != 0 && count == sendCountList.get(0)) {
+            if (count == 0) {
+                continue;
+            }
+            stringBuilder.append(sendDetail.getRemark());
+
+            if (count == sendCountList.get(0)) {
                 LarkRobotUtil.sendMessage(sendDetail.getRemark() + "存在未发送记录,请检查");
                 if (sendDetail.getStaffId() == 3) {
                     LarkRobotUtil.sendTipMessage(sendDetail.getRemark() + "存在未发送记录,请检查");

+ 2 - 3
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComMomentDataJob.java

@@ -55,8 +55,8 @@ public class WeComMomentDataJob {
             JSONObject text = new JSONObject();
             if (StringUtils.isNotEmpty(momentSendMessage.getContent())) {
                 text.put("content", momentSendMessage.getContent());
+                jsonObject.put("text", text);
             }
-            jsonObject.put("text", text);
             String attachmentIds = momentSendMessage.getAttachmentIds();
             JSONArray attachments = new JSONArray();
             if (StringUtils.isNotEmpty(attachmentIds)) {
@@ -70,8 +70,7 @@ public class WeComMomentDataJob {
                                 JSONObject linkAttachment = new JSONObject();
                                 JSONObject link = new JSONObject();
                                 link.put("title", messageAttachment.getTitle());
-                                link.put("picurl", messageAttachment.getPicUrl());
-                                link.put("desc", messageAttachment.getDesc());
+                                link.put("media_id", messageAttachment.getMediaId());
                                 link.put("url", messageAttachment.getUrl());
                                 linkAttachment.put("msgtype", "link");
                                 linkAttachment.put("link", link);