Forráskód Böngészése

Merge branch 'master' into 20250428-wyp-api

wangyunpeng 2 hónapja
szülő
commit
eb2ad8288e
25 módosított fájl, 474 hozzáadás és 110 törlés
  1. 40 0
      api-module/src/main/java/com/tzld/piaoquan/api/component/AigcApiService.java
  2. 1 1
      api-module/src/main/java/com/tzld/piaoquan/api/controller/FileController.java
  3. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformDataStatMapperExt.java
  4. 34 14
      api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java
  5. 9 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/CooperateAccountListParam.java
  6. 11 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhPlanVideo.java
  7. 70 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhPlanVideoExample.java
  8. 5 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformDatastatServiceImpl.java
  9. 42 24
      api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java
  10. 1 9
      api-module/src/main/java/com/tzld/piaoquan/api/service/strategy/impl/ThirdPartyPushMessageStrategyV1.java
  11. 3 0
      api-module/src/main/resources/application.properties
  12. 20 3
      api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhPlanVideoMapper.xml
  13. 5 3
      api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformDataStatMapperExt.xml
  14. 18 0
      api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformGzhAccountMapperExt.xml
  15. 0 1
      common-module/src/main/java/com/tzld/piaoquan/growth/common/common/constant/WeComConstant.java
  16. 2 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/component/HttpPoolClient.java
  17. 109 0
      common-module/src/main/java/com/tzld/piaoquan/growth/common/component/ProxyHttpPoolClient.java
  18. 23 1
      common-module/src/main/java/com/tzld/piaoquan/growth/common/config/HttpClientConfig.java
  19. 37 42
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageAttachmentServiceImpl.java
  20. 6 2
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageServiceImpl.java
  21. 12 2
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComAccessTokenServiceImpl.java
  22. 5 1
      common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java
  23. 7 3
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComHistoryDataJob.java
  24. 5 1
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComStaffDataJob.java
  25. 7 2
      offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

+ 40 - 0
api-module/src/main/java/com/tzld/piaoquan/api/component/AigcApiService.java

@@ -245,4 +245,44 @@ public class AigcApiService {
             log.error("closeAccountMessagePublishPlan error", e);
         }
     }
+
+    public boolean checkContainMessagePlan(String publishAccountId) {
+        String url = aigcApiHost + "/publish/plan/list";
+        JSONObject params = JSONObject.parseObject("{\n" +
+                "    \"filterItems\": [\n" +
+                "        {\n" +
+                "            \"itemName\": \"planType\",\n" +
+                "            \"selectValues\": [\n" +
+                "                1\n" +
+                "            ]\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"itemName\": \"publishAccounts\",\n" +
+                "            \"selectValues\": [\n" +
+                "                \"" + publishAccountId + "\"\n" +
+                "            ]\n" +
+                "        },\n" +
+                "        {\n" +
+                "            \"itemName\": \"planStatus\",\n" +
+                "            \"selectValues\": [\n" +
+                "                1\n" +
+                "            ]\n" +
+                "        }\n" +
+                "    ],\n" +
+                "    \"listFieldFormula\": [],\n" +
+                "    \"pageNum\": 1,\n" +
+                "    \"pageSize\": 50,\n" +
+                "    \"channel\": 5,\n" +
+                "    \"contentModal\": 7\n" +
+                "}");
+        try {
+            String post = httpPoolClient.post(url, getAigcPostParam(params));
+            JSONObject res = JSONObject.parseObject(post);
+            Integer totalCount = res.getJSONObject("data").getInteger("totalCount");
+            return totalCount > 0;
+        } catch (Exception e) {
+            log.error("closeAccountMessagePublishPlan error", e);
+        }
+        return false;
+    }
 }

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/controller/FileController.java

@@ -20,9 +20,9 @@ import java.io.IOException;
 
 @RestController
 @RequestMapping("/file")
-@CrossOrigin(origins = "*")
 public class FileController {
 
+    @CrossOrigin(origins = "*")
     @PostMapping("/upload")
     public CommonResponse<FileInfo> fileUpload(@Validated FileUploadParam param, BindingResult bindingResult) throws IOException {
         if (bindingResult.hasErrors()) {

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformDataStatMapperExt.java

@@ -63,4 +63,6 @@ public interface ContentPlatformDataStatMapperExt {
     void batchInsertQwDatastatTotal(@Param("records") List<ContentPlatformQwDataStatTotal> saveList);
 
     List<ContentPlatformQwDataStatTotal> getQwTotalDatastatScoreList(@Param("dt") String dt, @Param("channels") List<String> channels);
+
+    void deleteQwDatastatTotal(@Param("dt") String dt);
 }

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

@@ -146,10 +146,10 @@ public class ContentPlatformDatastatJob {
         return gzhDataStatMapper.countByExample(example);
     }
 
-    private long getQwDatastatCount(String dt) {
+    private List<ContentPlatformQwDataStat> getQwDatastatCount(String dt) {
         ContentPlatformQwDataStatExample example = new ContentPlatformQwDataStatExample();
         example.createCriteria().andDateStrEqualTo(dt);
-        return qwDataStatMapper.countByExample(example);
+        return qwDataStatMapper.selectByExample(example);
     }
 
     private long getQwDatastatTotalCount(String dt) {
@@ -161,14 +161,12 @@ public class ContentPlatformDatastatJob {
     @XxlJob("syncContentPlatformQwDatastatJob")
     public ReturnT<String> syncContentPlatformQwDatastatJob(String param) {
         String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
-        long count = getQwDatastatCount(dt);
-        if (count > 0) {
-            return ReturnT.SUCCESS;
-        }
         List<ContentPlatformQwPlan> qwPlanList = getAllQwPlan();
         if (CollectionUtils.isEmpty(qwPlanList)) {
             return ReturnT.SUCCESS;
         }
+        List<ContentPlatformQwDataStat> existList = getQwDatastatCount(dt);
+        List<String> existRootSourceIds = existList.stream().map(ContentPlatformQwDataStat::getRootSourceId).collect(Collectors.toList());
         Map<String, Long> rootSourceIdMap = qwPlanList.stream()
             .collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
         List<Long> planIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).collect(Collectors.toList());
@@ -191,6 +189,9 @@ public class ContentPlatformDatastatJob {
                 if (!rootSourceIds.contains(rootSourceId)) {
                     continue;
                 }
+                if (existRootSourceIds.contains(rootSourceId)) {
+                    continue;
+                }
                 int firstLevelCount = Integer.parseInt((String) record.get(8));
                 if (firstLevelCount == 0) {
                     continue;
@@ -219,6 +220,9 @@ public class ContentPlatformDatastatJob {
                 if (!rootSourceIds.contains(rootSourceId)) {
                     continue;
                 }
+                if (existRootSourceIds.contains(rootSourceId)) {
+                    continue;
+                }
                 int firstLevelCount = Integer.parseInt((String) record.get(8));
                 if (firstLevelCount == 0) {
                     continue;
@@ -253,25 +257,29 @@ public class ContentPlatformDatastatJob {
     @XxlJob("syncContentPlatformQwDatastatTotalJob")
     public ReturnT<String> syncContentPlatformQwDatastatTotalJob(String param) {
         String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
-        long count = getQwDatastatTotalCount(dt);
-        if (count > 0) {
-            return ReturnT.SUCCESS;
-        }
+        dataStatMapperExt.deleteQwDatastatTotal(dt);
         Map<String, ContentPlatformQwDataStatTotal> saveMap = new HashMap<>();
         String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_total WHERE dt=%s;", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
         Long now = System.currentTimeMillis();
         if (CollectionUtils.isNotEmpty(outDataList)) {
             for (Record record : outDataList) {
-                ContentPlatformQwDataStatTotal item = new ContentPlatformQwDataStatTotal();
+                String type = (String) record.get(1);
+                if (!"社群".equals(type) && !"自动回复".equals(type)) {
+                    continue;
+                }
                 String channel = (String) record.get(33);
                 int firstLevelCount = Integer.parseInt((String) record.get(6));
                 if (firstLevelCount == 0) {
                     continue;
                 }
+                ContentPlatformQwDataStatTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatTotal());
                 item.setDateStr(dt);
                 item.setChannel(channel);
-                item.setFirstLevelCount(firstLevelCount);
+                if (item.getFirstLevelCount() == null) {
+                    item.setFirstLevelCount(0);
+                }
+                item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
                 item.setCreateTimestamp(now);
                 saveMap.put(channel, item);
             }
@@ -279,17 +287,29 @@ public class ContentPlatformDatastatJob {
         String out2Sql = String.format("SELECT * FROM loghubods.qw_out2_touliu_behavior_total WHERE dt=%s;", dt);
         List<Record> out2DataList = OdpsUtil.getOdpsData(out2Sql);
         if (CollectionUtils.isNotEmpty(out2DataList)) {
+            List<String> out2Channels = new ArrayList<>();
             for (Record record : out2DataList) {
-                ContentPlatformQwDataStatTotal item = new ContentPlatformQwDataStatTotal();
+                String type = (String) record.get(1);
+                if (!"社群".equals(type) && !"自动回复".equals(type)) {
+                    continue;
+                }
                 String channel = (String) record.get(33);
                 int firstLevelCount = Integer.parseInt((String) record.get(6));
                 if (firstLevelCount == 0) {
                     continue;
                 }
+                if (saveMap.containsKey(channel) && !out2Channels.contains(channel)) {
+                    saveMap.remove(channel);
+                }
+                ContentPlatformQwDataStatTotal item = saveMap.getOrDefault(channel, new ContentPlatformQwDataStatTotal());
                 item.setDateStr(dt);
                 item.setChannel(channel);
-                item.setFirstLevelCount(firstLevelCount);
+                if (item.getFirstLevelCount() == null) {
+                    item.setFirstLevelCount(0);
+                }
+                item.setFirstLevelCount(item.getFirstLevelCount() + firstLevelCount);
                 item.setCreateTimestamp(now);
+                out2Channels.add(channel);
                 saveMap.put(channel, item);
             }
         }

+ 9 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/CooperateAccountListParam.java

@@ -9,4 +9,13 @@ import lombok.Data;
 public class CooperateAccountListParam extends PageParam {
 
 
+    @ApiModelProperty(value = "公众号名称")
+    private String name;
+
+    @ApiModelProperty(value = "ghId")
+    private String ghId;
+
+    @ApiModelProperty(value = "账号类型 0-公众号 1-服务号")
+    private Integer type;
+
 }

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhPlanVideo.java

@@ -19,6 +19,8 @@ public class ContentPlatformGzhPlanVideo {
 
     private String video;
 
+    private String pageUrl;
+
     private Long createAccountId;
 
     private Long createTimestamp;
@@ -95,6 +97,14 @@ public class ContentPlatformGzhPlanVideo {
         this.video = video;
     }
 
+    public String getPageUrl() {
+        return pageUrl;
+    }
+
+    public void setPageUrl(String pageUrl) {
+        this.pageUrl = pageUrl;
+    }
+
     public Long getCreateAccountId() {
         return createAccountId;
     }
@@ -126,6 +136,7 @@ public class ContentPlatformGzhPlanVideo {
         sb.append(", customCover=").append(customCover);
         sb.append(", customCoverType=").append(customCoverType);
         sb.append(", video=").append(video);
+        sb.append(", pageUrl=").append(pageUrl);
         sb.append(", createAccountId=").append(createAccountId);
         sb.append(", createTimestamp=").append(createTimestamp);
         sb.append("]");

+ 70 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/contentplatform/ContentPlatformGzhPlanVideoExample.java

@@ -705,6 +705,76 @@ public class ContentPlatformGzhPlanVideoExample {
             return (Criteria) this;
         }
 
+        public Criteria andPageUrlIsNull() {
+            addCriterion("page_url is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlIsNotNull() {
+            addCriterion("page_url is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlEqualTo(String value) {
+            addCriterion("page_url =", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotEqualTo(String value) {
+            addCriterion("page_url <>", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlGreaterThan(String value) {
+            addCriterion("page_url >", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlGreaterThanOrEqualTo(String value) {
+            addCriterion("page_url >=", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLessThan(String value) {
+            addCriterion("page_url <", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLessThanOrEqualTo(String value) {
+            addCriterion("page_url <=", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlLike(String value) {
+            addCriterion("page_url like", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotLike(String value) {
+            addCriterion("page_url not like", value, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlIn(List<String> values) {
+            addCriterion("page_url in", values, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotIn(List<String> values) {
+            addCriterion("page_url not in", values, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlBetween(String value1, String value2) {
+            addCriterion("page_url between", value1, value2, "pageUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andPageUrlNotBetween(String value1, String value2) {
+            addCriterion("page_url not between", value1, value2, "pageUrl");
+            return (Criteria) this;
+        }
+
         public Criteria andCreateAccountIdIsNull() {
             addCriterion("create_account_id is null");
             return (Criteria) this;

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

@@ -220,7 +220,11 @@ public class ContentPlatformDatastatServiceImpl implements ContentPlatformDatast
             QwDatastatItemVO vo = new QwDatastatItemVO();
             vo.setDateStr(datastat.getDateStr());
             vo.setFirstLevel(datastat.getFirstLevelCount());
-            vo.setScore(datastat.getScore());
+            if (Objects.nonNull(datastat.getScore())) {
+                BigDecimal num = BigDecimal.valueOf(datastat.getScore());
+                BigDecimal rounded = num.setScale(2, RoundingMode.HALF_UP);
+                vo.setScore(rounded.doubleValue());
+            }
             Long planId = qwPlanMap.get(datastat.getRootSourceId());
             if (Objects.nonNull(planId)) {
                 List<ContentPlatformQwPlanVideo> planVideoList = qwPlanVideoMap.get(planId);

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

@@ -7,14 +7,12 @@ import com.tzld.piaoquan.api.common.enums.contentplatform.ContentPlatformGzhPlan
 import com.tzld.piaoquan.api.common.enums.contentplatform.PublishStageEnum;
 import com.tzld.piaoquan.api.common.enums.contentplatform.QwPlanTypeEnum;
 import com.tzld.piaoquan.api.common.exception.CommonException;
-import com.tzld.piaoquan.api.component.AdApiService;
-import com.tzld.piaoquan.api.component.AigcApiService;
-import com.tzld.piaoquan.api.component.ManagerApiService;
-import com.tzld.piaoquan.api.component.VlogApiService;
+import com.tzld.piaoquan.api.component.*;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
 import com.tzld.piaoquan.api.model.bo.AdPutFlowRecordTencent;
 import com.tzld.piaoquan.api.model.bo.BucketDataParam;
+import com.tzld.piaoquan.api.model.bo.SmallPageUrlDetail;
 import com.tzld.piaoquan.api.model.config.LoginUserContext;
 import com.tzld.piaoquan.api.model.param.contentplatform.*;
 import com.tzld.piaoquan.api.model.po.contentplatform.*;
@@ -85,6 +83,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private AdApiService adApiService;
     @Autowired
     private CgiReplyService cgiReplyService;
+    @Autowired
+    private TouLiuHttpClient touLiuHttpClient;
 
 
     @Value("${vlog.share.appType:11}")
@@ -93,6 +93,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Value("${video.min.score:0.6}")
     private Double videoMinScore;
 
+    @Value("${small_page_url}")
+    private String GET_SMALL_PAGE_URL;
+
     @Override
     public Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param) {
         ContentPlatformAccount loginAccount = LoginUserContext.getUser();
@@ -125,8 +128,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         List<String> ghIds = accountList.stream().map(ContentPlatformGzhAccount::getGhId).collect(Collectors.toList());
         List<CgiReplyBucketData> bucketDataList = cgiReplyService.getCgiReplyBucketDataListByGhIds(ghIds, "manual");
         Map<String, Map<Long, CgiReplyBucketData>> bucketDataMap = bucketDataList.stream()
-               .collect(Collectors.groupingBy(CgiReplyBucketData::getGhId,
-                       Collectors.toMap(CgiReplyBucketData::getMiniVideoId, Function.identity())));
+                .collect(Collectors.groupingBy(CgiReplyBucketData::getGhId,
+                        Collectors.toMap(CgiReplyBucketData::getMiniVideoId, Function.identity())));
         List<GzhPlanItemVO> result = new ArrayList<>();
         for (ContentPlatformGzhPlan gzhPlan : planList) {
             GzhPlanItemVO planItemVO = new GzhPlanItemVO();
@@ -157,6 +160,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                     videoItemVO.setCustomCover(video.getCustomCover());
                     videoItemVO.setCustomCoverType(video.getCustomCoverType());
                     videoItemVO.setVideo(video.getVideo());
+                    videoItemVO.setPageUrl(video.getPageUrl());
                     if (Objects.nonNull(bucketDataMapByGhId)) {
                         CgiReplyBucketData bucketData = bucketDataMapByGhId.get(video.getVideoId());
                         if (Objects.nonNull(bucketData)) {
@@ -251,11 +255,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         gzhPlan.setPublishStage(param.getPublishStage());
         gzhPlan.setSelectVideoType(param.getSelectVideoType());
         gzhPlan.setUpdateTimestamp(now);
-        // 更新gh_detail
         List<Long> videoIds = param.getVideoList().stream().map(GzhPlanVideoContentItemParam::getVideoId).collect(Collectors.toList());
-        updateGhDetail(account, param.getSelectVideoType(), videoIds);
-        // 更新cgi_reply_bucket_data
-        updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
+        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
+            // 更新gh_detail
+            updateGhDetail(account, param.getSelectVideoType(), videoIds);
+            // 更新cgi_reply_bucket_data
+            updateCgiReplyBucketData(account.getGhId(), param.getVideoList());
+        }
         if (Objects.isNull(param.getId())) {
             // 调用aigc创建发布计划
             if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
@@ -287,14 +293,16 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             gzhPlanMapper.updateByPrimaryKeySelective(gzhPlan);
         }
         // 保存视频内容
-        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), loginAccount);
+        saveGzhPlanVideo(param, videoIds, gzhPlan.getId(), account, loginAccount);
         // 调用aigc重新拉取视频
-        if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
-            aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
-        } else {
-            BucketDataParam bucketDataParam = new BucketDataParam();
-            bucketDataParam.setGhId(account.getGhId());
-            cgiReplyService.getRgiReplyData(bucketDataParam);
+        if (param.getType() == ContentPlatformGzhPlanTypeEnum.AUTO_REPLY.getVal()) {
+            if (PublishStageEnum.PLATFORM.getVal() == param.getPublishStage()) {
+                aigcApiService.refreshGzhAutoReplyMsgData(account.getGhId());
+            } else {
+                BucketDataParam bucketDataParam = new BucketDataParam();
+                bucketDataParam.setGhId(account.getGhId());
+                cgiReplyService.getRgiReplyData(bucketDataParam);
+            }
         }
     }
 
@@ -314,7 +322,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
     }
 
-    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id, ContentPlatformAccount loginAccount) {
+    private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long id,
+                                  ContentPlatformGzhAccount account, ContentPlatformAccount loginAccount) {
         List<ContentPlatformGzhPlanVideo> existsVideo = getGzhVideoByPlanId(id);
         List<Long> existsVideoIds = existsVideo.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
         Map<Long, ContentPlatformGzhPlanVideo> existsVideoMap = existsVideo.stream()
@@ -343,6 +352,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 item.setCustomCover(vo.getCustomCover());
                 item.setCustomCoverType(vo.getCustomCoverType());
                 item.setVideo(vo.getVideo());
+                if (param.getType() == ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal()) {
+                    String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "fwhdyy",
+                            loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "文字和小程序", account.getGhId());
+                    JSONObject json = JSONObject.parseObject(response);
+                    SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
+                    item.setPageUrl(smallPageUrlDetail.getUrl());
+                }
                 item.setCreateAccountId(loginAccount.getId());
                 item.setCreateTimestamp(System.currentTimeMillis());
                 gzhPlanVideoMapper.insertSelective(item);
@@ -610,7 +626,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             List<String> ghIds = ghDetailList.stream().map(GhDetail::getGhId).collect(Collectors.toList());
             List<ContentPlatformGzhAccount> gzhAccountList = cooperateAccountService.getCooperateAccountListByGhIds(account.getId(), ghIds);
             List<ContentPlatformGzhPlan> existsPlanList = getGzhPlanListByCreateAccountId(account.getId());
-            List<Long> existsAccountIds = existsPlanList.stream().map(ContentPlatformGzhPlan::getAccountId).collect(Collectors.toList());
+            List<Long> existsAccountIds = existsPlanList.stream().map(ContentPlatformGzhPlan::getAccountId).distinct().collect(Collectors.toList());
             Map<String, ContentPlatformGzhAccount> gzhAccountMap = gzhAccountList.stream()
                     .collect(Collectors.toMap(ContentPlatformGzhAccount::getGhId, Function.identity()));
             for (GhDetail ghDetail : ghDetailList) {
@@ -625,11 +641,13 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 gzhPlan.setSelectVideoType(ghDetail.getStrategyStatus());
                 gzhPlan.setPublishStage(PublishStageEnum.USER.getVal());
                 if (StringUtils.hasText(gzhAccount.getExternalId())) {
-                    aigcApiService.closeAccountMessagePublishPlan(gzhAccount.getExternalId());
-                    gzhPlan.setPublishStage(PublishStageEnum.PLATFORM.getVal());
-                    String externalId = aigcApiService.createPublishPlan(gzhAccount.getExternalId(), gzhAccount.getName(), account.getChannel());
-                    gzhPlan.setExternalId(externalId);
-                    gzhPlan.setStagePublishStatus(1);
+                    if (aigcApiService.checkContainMessagePlan(gzhAccount.getExternalId())) {
+                        aigcApiService.closeAccountMessagePublishPlan(gzhAccount.getExternalId());
+                        gzhPlan.setPublishStage(PublishStageEnum.PLATFORM.getVal());
+                        String externalId = aigcApiService.createPublishPlan(gzhAccount.getExternalId(), gzhAccount.getName(), account.getChannel());
+                        gzhPlan.setExternalId(externalId);
+                        gzhPlan.setStagePublishStatus(1);
+                    }
                 }
                 gzhPlan.setCreateAccountId(account.getId());
                 gzhPlan.setCreateTimestamp(now);

+ 1 - 9
api-module/src/main/java/com/tzld/piaoquan/api/service/strategy/impl/ThirdPartyPushMessageStrategyV1.java

@@ -183,15 +183,7 @@ public class ThirdPartyPushMessageStrategyV1 implements ReplyStrategyService {
             SmallPageUrlDetail smallPageUrlDetail = new SmallPageUrlDetail();
             if (CollectionUtils.isEmpty(cgiReplyBucketData)) {
                 // 库里不存在,调用新生成
-                String fwhChannel = contentPlatformPlanService.getGzhChannel(ghId);
-                String response;
-                if (StringUtils.isNotEmpty(fwhChannel)) {
-                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "fwhdyy", fwhChannel,
-                            "自动", "公众号", "文章插小程序", "文字和小程序", ghId);
-                } else {
-                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs",
-                            channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
-                }
+                String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs", channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
                 JSONObject jsonObject = JSON.parseObject(response);
                 if (jsonObject.getInteger("code").equals(0)) {
                     smallPageUrlDetail = jsonObject.getObject("data", SmallPageUrlDetail.class);

+ 3 - 0
api-module/src/main/resources/application.properties

@@ -21,6 +21,9 @@ spring.redis.lettuce.pool.max-wait=-1
 spring.redis.lettuce.pool.max-idle=8
 spring.redis.lettuce.pool.min-idle=0
 
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+
 datalog=/datalog
 
 xxl.job.accessToken=

+ 20 - 3
api-module/src/main/resources/mapper/contentplatform/ContentPlatformGzhPlanVideoMapper.xml

@@ -11,6 +11,7 @@
     <result column="custom_cover" jdbcType="VARCHAR" property="customCover" />
     <result column="custom_cover_type" jdbcType="INTEGER" property="customCoverType" />
     <result column="video" jdbcType="VARCHAR" property="video" />
+    <result column="page_url" jdbcType="VARCHAR" property="pageUrl" />
     <result column="create_account_id" jdbcType="BIGINT" property="createAccountId" />
     <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
   </resultMap>
@@ -74,7 +75,7 @@
   </sql>
   <sql id="Base_Column_List">
     id, plan_id, video_id, title, custom_title, cover, custom_cover, custom_cover_type, 
-    video, create_account_id, create_timestamp
+    video, page_url, create_account_id, create_timestamp
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideoExample" resultMap="BaseResultMap">
     select
@@ -113,11 +114,13 @@
     insert into content_platform_gzh_plan_video (id, plan_id, video_id, 
       title, custom_title, cover, 
       custom_cover, custom_cover_type, video, 
-      create_account_id, create_timestamp)
+      page_url, create_account_id, create_timestamp
+      )
     values (#{id,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, 
       #{title,jdbcType=VARCHAR}, #{customTitle,jdbcType=VARCHAR}, #{cover,jdbcType=VARCHAR}, 
       #{customCover,jdbcType=VARCHAR}, #{customCoverType,jdbcType=INTEGER}, #{video,jdbcType=VARCHAR}, 
-      #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT})
+      #{pageUrl,jdbcType=VARCHAR}, #{createAccountId,jdbcType=BIGINT}, #{createTimestamp,jdbcType=BIGINT}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhPlanVideo">
     insert into content_platform_gzh_plan_video
@@ -149,6 +152,9 @@
       <if test="video != null">
         video,
       </if>
+      <if test="pageUrl != null">
+        page_url,
+      </if>
       <if test="createAccountId != null">
         create_account_id,
       </if>
@@ -184,6 +190,9 @@
       <if test="video != null">
         #{video,jdbcType=VARCHAR},
       </if>
+      <if test="pageUrl != null">
+        #{pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="createAccountId != null">
         #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -228,6 +237,9 @@
       <if test="record.video != null">
         video = #{record.video,jdbcType=VARCHAR},
       </if>
+      <if test="record.pageUrl != null">
+        page_url = #{record.pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="record.createAccountId != null">
         create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       </if>
@@ -250,6 +262,7 @@
       custom_cover = #{record.customCover,jdbcType=VARCHAR},
       custom_cover_type = #{record.customCoverType,jdbcType=INTEGER},
       video = #{record.video,jdbcType=VARCHAR},
+      page_url = #{record.pageUrl,jdbcType=VARCHAR},
       create_account_id = #{record.createAccountId,jdbcType=BIGINT},
       create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
     <if test="_parameter != null">
@@ -283,6 +296,9 @@
       <if test="video != null">
         video = #{video,jdbcType=VARCHAR},
       </if>
+      <if test="pageUrl != null">
+        page_url = #{pageUrl,jdbcType=VARCHAR},
+      </if>
       <if test="createAccountId != null">
         create_account_id = #{createAccountId,jdbcType=BIGINT},
       </if>
@@ -302,6 +318,7 @@
       custom_cover = #{customCover,jdbcType=VARCHAR},
       custom_cover_type = #{customCoverType,jdbcType=INTEGER},
       video = #{video,jdbcType=VARCHAR},
+      page_url = #{pageUrl,jdbcType=VARCHAR},
       create_account_id = #{createAccountId,jdbcType=BIGINT},
       create_timestamp = #{createTimestamp,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}

+ 5 - 3
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformDataStatMapperExt.xml

@@ -108,7 +108,7 @@
         from content_platform_qw_datastat cpqd
          join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
         where cpqp.create_account_id = #{createAccountId}
-          and cpqp.type = 0
+          and cpqp.type = 1
         group by cpqd.date_str) t
     </select>
 
@@ -118,7 +118,7 @@
         from content_platform_qw_datastat cpqd
          join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
         where cpqp.create_account_id = #{createAccountId}
-          and cpqp.type = 0
+          and cpqp.type = 1
         group by cpqd.date_str
         order by cpqd.date_str desc
         limit #{offset}, #{pageSize}
@@ -160,5 +160,7 @@
         group by cpa.channel
     </select>
 
-
+    <delete id="deleteQwDatastatTotal">
+        delete from content_platform_qw_datastat_total where date_str = #{dt}
+    </delete>
 </mapper>

+ 18 - 0
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformGzhAccountMapperExt.xml

@@ -17,6 +17,15 @@
     from content_platform_gzh_account
     where create_account_id = #{createAccountId}
     and status = 1
+    <if test="param.name!= null and param.name!= ''">
+      and name like concat('%', #{param.name}, '%')
+    </if>
+    <if test="param.ghId!= null and param.ghId!= ''">
+      and gh_id = #{param.ghId}
+    </if>
+    <if test="param.type!= null">
+      and type = #{param.type}
+    </if>
   </select>
 
   <select id="getCooperateAccountList"
@@ -25,6 +34,15 @@
     from content_platform_gzh_account
     where create_account_id = #{createAccountId}
       and status = 1
+    <if test="param.name!= null and param.name!= ''">
+      and name like concat('%', #{param.name}, '%')
+    </if>
+    <if test="param.ghId!= null and param.ghId!= ''">
+      and gh_id = #{param.ghId}
+    </if>
+    <if test="param.type!= null">
+      and type = #{param.type}
+    </if>
     order by create_timestamp desc
     limit #{offset}, #{pageSize}
   </select>

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

@@ -38,7 +38,6 @@ public interface WeComConstant {
     //发送新客户欢迎语
     String POST_WE_COM_SEND_WELCOME_MSG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/send_welcome_msg";
 
-
     //用户增加新标签
     String POST_WE_COM_ADD_USER_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/mark_tag";
 }

+ 2 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/component/HttpPoolClient.java

@@ -10,6 +10,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.io.File;
@@ -22,6 +23,7 @@ import java.nio.charset.StandardCharsets;
 public class HttpPoolClient {
 
     @Autowired
+    @Qualifier("httpClient")
     private CloseableHttpClient httpClient;
 
     public String get(String url) throws IOException {

+ 109 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/component/ProxyHttpPoolClient.java

@@ -0,0 +1,109 @@
+package com.tzld.piaoquan.growth.common.component;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.*;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Component
+public class ProxyHttpPoolClient {
+
+    @Autowired
+    @Qualifier("proxyHttpClient")
+    private CloseableHttpClient httpClient;
+
+    public String get(String url) throws IOException {
+        HttpGet httpGet = new HttpGet(url);
+        return request(httpGet);
+    }
+
+    public String post(String url) throws IOException {
+        HttpPost httpPost = new HttpPost(url);
+        return request(httpPost);
+    }
+
+
+    public String post(String url, String json) throws IOException {
+        HttpPost httpPost = new HttpPost(url);
+        if (StringUtils.isBlank(json)) {
+            return request(httpPost);
+        }
+        StringEntity entity = new StringEntity(json, StandardCharsets.UTF_8);
+        entity.setContentEncoding("UTF-8");
+        entity.setContentType("application/json");
+        httpPost.setEntity(entity);
+        return request(httpPost);
+    }
+
+
+    public String post(String url, String json, String contentType) throws IOException {
+        HttpPost httpPost = new HttpPost(url);
+        if (StringUtils.isBlank(json)) {
+            return request(httpPost);
+        }
+        StringEntity entity = new StringEntity(json, StandardCharsets.UTF_8);
+        entity.setContentEncoding("UTF-8");
+        entity.setContentType(contentType);
+        httpPost.setEntity(entity);
+        return request(httpPost);
+    }
+
+    public String post(String url, File file) throws IOException {
+        HttpPost uploadFile = new HttpPost(url);
+        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+        builder.addBinaryBody("media", file);
+        uploadFile.setEntity(builder.build());
+        return request(uploadFile);
+    }
+
+    public String request(HttpRequestBase request) throws IOException {
+
+        HttpEntity entity = null;
+        CloseableHttpResponse response = request((HttpUriRequest) request);
+        if (response == null) {
+            log.error("call api exception no response");
+            throw new RuntimeException("call api exception no response");
+        }
+        entity = response.getEntity();
+        String content = null;
+        if (entity != null) {
+            content = EntityUtils.toString(entity, "UTF-8");
+        }
+        int httpStatus = response.getStatusLine().getStatusCode();
+        if (httpStatus == HttpStatus.SC_OK) {
+            return content;
+        }
+        String path = request.getURI().toString();
+        log.error("http call api {} fail response status {} content {}", path, httpStatus, content);
+        return null;
+    }
+
+
+    public CloseableHttpResponse request(HttpUriRequest request) {
+        try {
+            return httpClient.execute(request);
+        } catch (Exception e) {
+            String path = request.getURI().toString();
+            if (e instanceof SocketTimeoutException) {
+                log.error(String.format("http timeout request url = %s .", path));
+            }
+            throw new RuntimeException(String.format("http exception request url = %s ", path), e);
+        }
+    }
+
+
+}

+ 23 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/config/HttpClientConfig.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.growth.common.config;
 
+import org.apache.http.HttpHost;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
@@ -42,7 +43,7 @@ public class HttpClientConfig {
     private static final int CONNECTION_WAIT_TIMEOUT = 5000;
 
 
-    @Bean
+    @Bean(name = "httpClient")
     public CloseableHttpClient httpClient() {
 
         RequestConfig requestConfig = RequestConfig.custom()
@@ -61,4 +62,25 @@ public class HttpClientConfig {
                 .setRetryHandler(new DefaultHttpRequestRetryHandler(RETRY_COUNT, false))
                 .build();
     }
+
+    @Bean(name = "proxyHttpClient")
+    public CloseableHttpClient proxyHttpClient() {
+        HttpHost proxy = new HttpHost("121.43.150.231", 3128, "http");
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout(CONNECTION_TIMEOUT)
+                .setSocketTimeout(SOCKET_TIMEOUT)
+                .setConnectionRequestTimeout(CONNECTION_WAIT_TIMEOUT)
+                .build();
+
+        PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
+        connectionManager.setMaxTotal(MAX_TOTAL); // 设置最大连接数
+        connectionManager.setDefaultMaxPerRoute(MAX_PER_ROUTE); // 每个路由的最大连接数
+
+        return HttpClientBuilder.create()
+                .setProxy(proxy)
+                .setDefaultRequestConfig(requestConfig)
+                .setConnectionManager(connectionManager)
+                .setRetryHandler(new DefaultHttpRequestRetryHandler(RETRY_COUNT, false))
+                .build();
+    }
 }

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
 import com.tzld.piaoquan.growth.common.common.enums.MessageAttachmentTypeEnum;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.GuaranteesVideoMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.MessageAttachmentMapper;
 import com.tzld.piaoquan.growth.common.model.bo.AdPutFlowParam;
@@ -52,6 +53,9 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
@@ -329,52 +333,43 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
         if (StringUtils.isNotEmpty(mediaId)) {
             return mediaId;
         }
-        if (corpId == 1L) {
-            String filePath = UUID.randomUUID() + ".jpg"; // 临时文件路径
-            try {
-                HttpURLConnection httpUrl = (HttpURLConnection) new URL(cover).openConnection();
-                httpUrl.connect();
-                InputStream inputStream = httpUrl.getInputStream();
-
-                // 将文件内容写入临时文件
-                try (OutputStream outputStream = Files.newOutputStream(Paths.get(filePath))) {
-                    byte[] buffer = new byte[4096];
-                    int bytesRead;
-                    while ((bytesRead = inputStream.read(buffer)) != -1) {
-                        outputStream.write(buffer, 0, bytesRead);
-                    }
-                }
-                inputStream.close();
-                httpUrl.disconnect();
-                File file = new File(filePath);
-                String weComAccessToken = weComAccessTokenService.getWeComAccessToken(corpId);
-                String url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, "image");
-                String res = httpPoolClient.post(url, file);
-                JSONObject jsonObject = JSONObject.parseObject(res);
-                if (jsonObject != null && jsonObject.getInteger("errcode") == 0) {
-                    mediaId = jsonObject.getString("media_id");
-                    redisTemplate.opsForValue().set(key, mediaId, 2, TimeUnit.DAYS);
+
+        String filePath = UUID.randomUUID() + ".jpg"; // 临时文件路径
+        try {
+            HttpURLConnection httpUrl = (HttpURLConnection) new URL(cover).openConnection();
+            httpUrl.connect();
+            InputStream inputStream = httpUrl.getInputStream();
+
+            // 将文件内容写入临时文件
+            try (OutputStream outputStream = Files.newOutputStream(Paths.get(filePath))) {
+                byte[] buffer = new byte[4096];
+                int bytesRead;
+                while ((bytesRead = inputStream.read(buffer)) != -1) {
+                    outputStream.write(buffer, 0, bytesRead);
                 }
-                Files.delete(Paths.get(filePath));
-            } catch (Exception e) {
-                log.error("getPicMediaId error", e);
             }
-            return mediaId;
-        } else {
-            try {
-                String weComAccessToken = weComAccessTokenService.getWeComAccessToken(corpId);
-                String url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, "image");
-                String res = weComSendService.sendPostFile(url, cover);
-                JSONObject jsonObject = JSONObject.parseObject(res);
-                if (jsonObject != null && jsonObject.getInteger("errcode") == 0) {
-                    mediaId = jsonObject.getString("media_id");
-                    redisTemplate.opsForValue().set(key, mediaId, 2, TimeUnit.DAYS);
-                }
-            } catch (Exception e) {
-                log.error("getPicMediaId error", e);
+            inputStream.close();
+            httpUrl.disconnect();
+            File file = new File(filePath);
+            String weComAccessToken = weComAccessTokenService.getWeComAccessToken(corpId);
+            String url = String.format(POST_WE_COM_MEDIA_UPLOAD + "?access_token=%s&type=%s", weComAccessToken, "image");
+            String res;
+            if (corpId == 1L) {
+                res = httpPoolClient.post(url, file);
+            } else {
+                res = proxyHttpPoolClient.post(url, file);
             }
-            return mediaId;
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject != null && jsonObject.getInteger("errcode") == 0) {
+                mediaId = jsonObject.getString("media_id");
+                redisTemplate.opsForValue().set(key, mediaId, 2, TimeUnit.DAYS);
+            }
+            Files.delete(Paths.get(filePath));
+        } catch (Exception e) {
+            log.error("getPicMediaId error", e);
         }
+        return mediaId;
+
     }
 
 

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
 import com.tzld.piaoquan.growth.common.common.constant.MessageConstant;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.PreSpecialSendMessageMapper;
 import com.tzld.piaoquan.growth.common.model.bo.MsgResult;
 import com.tzld.piaoquan.growth.common.model.po.PreSpecialSendMessage;
@@ -31,6 +32,9 @@ public class MessageServiceImpl implements MessageService {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
@@ -51,7 +55,7 @@ public class MessageServiceImpl implements MessageService {
             if (corpId == 1L) {
                 s = httpPoolClient.post(url, jsonObject.toJSONString());
             } else {
-                s = weComSendService.sendPost(url, jsonObject.toJSONString());
+                s = proxyHttpPoolClient.post(url, jsonObject.toJSONString());
             }
             JSONObject res = JSONObject.parseObject(s);
             log.info("pushWeComMessage res={}", res);
@@ -100,7 +104,7 @@ public class MessageServiceImpl implements MessageService {
             if (corpId == 1L) {
                 s = httpPoolClient.post(url, jsonObject.toJSONString());
             } else {
-                s = weComSendService.sendPost(url, jsonObject.toJSONString());
+                s = proxyHttpPoolClient.post(url, jsonObject.toJSONString());
             }
             JSONObject res = JSONObject.parseObject(s);
             log.info("sendAutoReplyMessage res={}", res);

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

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.growth.common.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.growth.common.model.po.Corp;
 import com.tzld.piaoquan.growth.common.model.po.CorpExample;
@@ -28,6 +29,9 @@ public class WeComAccessTokenServiceImpl implements WeComAccessTokenService {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private RedisTemplate<String, Object> redisTemplate;
 
@@ -52,8 +56,14 @@ public class WeComAccessTokenServiceImpl implements WeComAccessTokenService {
             Corp corp = corps.get(0);
             String cropId = corp.getCorpId();
             String secret = corp.getSecret();
-            String res = httpPoolClient.get(String.format(GET_WE_COM_ACCESS_TOKEN_URL +
-                    "?corpid=%s&corpsecret=%s", cropId, secret));
+            String res;
+            if (corpId == 1L) {
+                res = httpPoolClient.get(String.format(GET_WE_COM_ACCESS_TOKEN_URL +
+                        "?corpid=%s&corpsecret=%s", cropId, secret));
+            } else {
+                res = proxyHttpPoolClient.get(String.format(GET_WE_COM_ACCESS_TOKEN_URL +
+                        "?corpid=%s&corpsecret=%s", cropId, secret));
+            }
             JSONObject jsonObject = JSONObject.parseObject(res);
             Long expiresIn = jsonObject.getLong("expires_in");
             String newAccessToken = jsonObject.getString("access_token");

+ 5 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/WeComUserServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
 import com.tzld.piaoquan.growth.common.common.enums.PreSpecialStatusEnum;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.*;
 import com.tzld.piaoquan.growth.common.dao.mapper.ext.WeComUserMapperExt;
 import com.tzld.piaoquan.growth.common.model.bo.GroupSendWeComUserParam;
@@ -40,6 +41,9 @@ public class WeComUserServiceImpl implements WeComUserService {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
@@ -241,7 +245,7 @@ public class WeComUserServiceImpl implements WeComUserService {
             if (corpId == 1L) {
                 res = httpPoolClient.get(url);
             } else {
-                res = weComSendService.sendGet(url);
+                res = proxyHttpPoolClient.get(url);
             }
             JSONObject jsonObject = JSONObject.parseObject(res);
             Integer errcode = jsonObject.getInteger("errcode");

+ 7 - 3
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComHistoryDataJob.java

@@ -7,6 +7,7 @@ import com.tzld.piaoquan.growth.common.common.constant.MessageConstant;
 import com.tzld.piaoquan.growth.common.common.constant.TimeConstant;
 import com.tzld.piaoquan.growth.common.common.enums.MessageAttachmentTypeEnum;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.*;
 import com.tzld.piaoquan.growth.common.model.bo.ExternalUser;
 import com.tzld.piaoquan.growth.common.model.bo.MiniprogramRecord;
@@ -45,6 +46,9 @@ public class WeComHistoryDataJob {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
@@ -454,7 +458,7 @@ public class WeComHistoryDataJob {
         if (corpId == 1L) {
             return httpPoolClient.post(url, param.toJSONString());
         } else {
-            return weComSendService.sendPost(url, param.toJSONString());
+            return proxyHttpPoolClient.post(url, param.toJSONString());
         }
     }
 
@@ -498,7 +502,7 @@ public class WeComHistoryDataJob {
         if (corpId == 1L) {
             return httpPoolClient.post(url, param.toJSONString());
         } else {
-            return weComSendService.sendPost(url, param.toJSONString());
+            return proxyHttpPoolClient.post(url, param.toJSONString());
         }
     }
 
@@ -635,7 +639,7 @@ public class WeComHistoryDataJob {
         if (corpId == 1L) {
             return httpPoolClient.post(url, param.toJSONString());
         } else {
-            return weComSendService.sendPost(url, param.toJSONString());
+            return proxyHttpPoolClient.post(url, param.toJSONString());
         }
     }
 

+ 5 - 1
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComStaffDataJob.java

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.offline.job;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.growth.common.dao.mapper.StaffMapper;
 import com.tzld.piaoquan.growth.common.model.bo.XxlJobParam;
@@ -33,6 +34,9 @@ public class WeComStaffDataJob {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
     @Autowired
     private WeComAccessTokenService weComAccessTokenService;
 
@@ -92,7 +96,7 @@ public class WeComStaffDataJob {
         if (corpId == 1L) {
             res = httpPoolClient.get(url);
         } else {
-            res = weComSendService.sendGet(url);
+            res = proxyHttpPoolClient.get(url);
         }
         log.info("getCarrierIdList corp = {}, res={}", corpId, res);
         JSONObject jsonObject = JSONObject.parseObject(res);

+ 7 - 2
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

@@ -3,6 +3,7 @@ package com.tzld.piaoquan.offline.job;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
+import com.tzld.piaoquan.growth.common.component.ProxyHttpPoolClient;
 import com.tzld.piaoquan.growth.common.dao.mapper.*;
 import com.tzld.piaoquan.growth.common.model.bo.XxlJobParam;
 import com.tzld.piaoquan.growth.common.model.po.*;
@@ -36,6 +37,10 @@ public class WeComUserDataJob {
     @Autowired
     private HttpPoolClient httpPoolClient;
 
+    @Autowired
+    private ProxyHttpPoolClient proxyHttpPoolClient;
+
+
     @Autowired
     private StaffMapper staffMapper;
 
@@ -188,7 +193,7 @@ public class WeComUserDataJob {
         if (corpId == 1L) {
             return httpPoolClient.post(url, param.toJSONString());
         } else {
-            return weComSendService.sendPost(url, param.toJSONString());
+            return proxyHttpPoolClient.post(url, param.toJSONString());
         }
     }
 
@@ -249,7 +254,7 @@ public class WeComUserDataJob {
         if (corpId == 1L) {
             res = httpPoolClient.get(url);
         } else {
-            res = weComSendService.sendGet(url);
+            res = proxyHttpPoolClient.get(url);
         }
         JSONObject jsonObject = JSONObject.parseObject(res);
         Integer errcode = jsonObject.getInteger("errcode");