Jelajahi Sumber

gzh_autoreply_behavior_uv_total 同步

wangyunpeng 1 hari lalu
induk
melakukan
0fe0f0c058

+ 6 - 0
api-module/src/main/java/com/tzld/piaoquan/api/controller/AccountDetailController.java

@@ -72,4 +72,10 @@ public class AccountDetailController {
         gzhReplyVideoRefreshJob.gzhReplyVideoRefreshJob(null);
         return CommonResponse.success();
     }
+
+    @GetMapping("/job/syncGzhAutoreplyBehaviorUvTotalJob")
+    public CommonResponse<Void> syncGzhAutoreplyBehaviorUvTotalJob() {
+        gzhReplyVideoRefreshJob.syncGzhAutoreplyBehaviorUvTotalJob(null);
+        return CommonResponse.success();
+    }
 }

+ 5 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/GhDetailMapperExt.java

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.api.dao.mapper;
 
 import com.tzld.piaoquan.api.model.po.GhDetailExt;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -16,4 +17,8 @@ public interface GhDetailMapperExt {
     void batchInsertGhDetailExt(@Param("records") List<GhDetailExt> records);
 
     List<GhDetailExt> getGhDetailExtList(@Param("ghId") String ghId, @Param("type") Integer type);
+
+    void deleteGzhAutoreplyBehaviorUvTotal(@Param("dt") String dt);
+
+    void batchInsertGzhAutoreplyBehaviorUvTotal(@Param("records") List<GzhAutoreplyBehaviorUvTotal> saveList);
 }

+ 30 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/GzhAutoreplyBehaviorUvTotalMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.api.dao.mapper;
+
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface GzhAutoreplyBehaviorUvTotalMapper {
+    long countByExample(GzhAutoreplyBehaviorUvTotalExample example);
+
+    int deleteByExample(GzhAutoreplyBehaviorUvTotalExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(GzhAutoreplyBehaviorUvTotal record);
+
+    int insertSelective(GzhAutoreplyBehaviorUvTotal record);
+
+    List<GzhAutoreplyBehaviorUvTotal> selectByExample(GzhAutoreplyBehaviorUvTotalExample example);
+
+    GzhAutoreplyBehaviorUvTotal selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") GzhAutoreplyBehaviorUvTotal record, @Param("example") GzhAutoreplyBehaviorUvTotalExample example);
+
+    int updateByExample(@Param("record") GzhAutoreplyBehaviorUvTotal record, @Param("example") GzhAutoreplyBehaviorUvTotalExample example);
+
+    int updateByPrimaryKeySelective(GzhAutoreplyBehaviorUvTotal record);
+
+    int updateByPrimaryKey(GzhAutoreplyBehaviorUvTotal record);
+}

+ 63 - 0
api-module/src/main/java/com/tzld/piaoquan/api/job/GzhReplyVideoRefreshJob.java

@@ -7,10 +7,14 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.piaoquan.api.component.AdApiService;
 import com.tzld.piaoquan.api.component.AigcApiService;
 import com.tzld.piaoquan.api.component.DeepSeekApiService;
+import com.tzld.piaoquan.api.dao.mapper.GhDetailMapperExt;
+import com.tzld.piaoquan.api.dao.mapper.GzhAutoreplyBehaviorUvTotalMapper;
 import com.tzld.piaoquan.api.model.bo.AdPutCreativeComponentCostData;
 import com.tzld.piaoquan.api.model.bo.GoogleLLMResult;
 import com.tzld.piaoquan.api.model.bo.VideoDetail;
 import com.tzld.piaoquan.api.model.dto.AIResult;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample;
 import com.tzld.piaoquan.api.model.vo.GhDetailVo;
 import com.tzld.piaoquan.api.service.GhDetailService;
 import com.tzld.piaoquan.api.util.AliOssFileTool;
@@ -44,6 +48,10 @@ public class GzhReplyVideoRefreshJob {
     AigcApiService aigcApiService;
     @Autowired
     DeepSeekApiService deepSeekApiService;
+    @Autowired
+    GhDetailMapperExt ghDetailMapperExt;
+    @Autowired
+    GzhAutoreplyBehaviorUvTotalMapper gzhAutoreplyBehaviorUvTotalMapper;
 
     @ApolloJsonValue("${gzh.reply.video.refresh.job.filter.wxIds:[]}")
     private List<String> filterWxIds;
@@ -346,4 +354,59 @@ public class GzhReplyVideoRefreshJob {
         }
         return title;
     }
+
+    @XxlJob("syncGzhAutoreplyBehaviorUvTotalJob")
+    public ReturnT<String> syncGzhAutoreplyBehaviorUvTotalJob(String param) {
+        String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
+        if (StringUtils.isNotEmpty(param)) {
+            dt = param;
+        }
+        Long now = System.currentTimeMillis();
+        GzhAutoreplyBehaviorUvTotalExample example = new GzhAutoreplyBehaviorUvTotalExample();
+        example.createCriteria().andDtEqualTo(dt);
+        List<GzhAutoreplyBehaviorUvTotal> list = gzhAutoreplyBehaviorUvTotalMapper.selectByExample(example);
+        if (CollectionUtils.isNotEmpty(list)) {
+            return ReturnT.SUCCESS;
+        }
+        // 公众号自动回复数据统计
+        String sql = String.format(
+                "SELECT 合作方\n" +
+                        ",公众号id\n" +
+                        ",访问人数\n" +
+                        ",首层访问人数\n" +
+                        ",dt\n" +
+                        "FROM loghubods.gzh_autoreply_behavior_uv_total\n" +
+                        "WHERE dt = %s ;", dt);
+        List<Record> dataList = OdpsUtil.getOdpsData(sql);
+        if (CollectionUtils.isNotEmpty(dataList)) {
+            List<GzhAutoreplyBehaviorUvTotal> saveList = new ArrayList<>();
+            for (Record record : dataList) {
+                String channel = (String) record.get(0);
+                String ghId = (String) record.get(1);
+                Integer uv = parseInteger(record.get(2));
+                Integer firstLevel = parseInteger(record.get(3));
+                GzhAutoreplyBehaviorUvTotal item = new GzhAutoreplyBehaviorUvTotal();
+                item.setDt(dt);
+                item.setChannel(channel);
+                item.setUv(uv);
+                item.setFirstLevel(firstLevel);
+                item.setGhId(ghId);
+                item.setCreateTimestamp(now);
+                saveList.add(item);
+            }
+            if (CollectionUtils.isNotEmpty(saveList)) {
+                ghDetailMapperExt.deleteGzhAutoreplyBehaviorUvTotal(dt);
+                ghDetailMapperExt.batchInsertGzhAutoreplyBehaviorUvTotal(saveList);
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    private Integer parseInteger(Object value) {
+        try {
+            return Integer.parseInt((String) value);
+        } catch (NumberFormatException e) {
+            return 0;
+        }
+    }
 }

+ 90 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/GzhAutoreplyBehaviorUvTotal.java

@@ -0,0 +1,90 @@
+package com.tzld.piaoquan.api.model.po;
+
+public class GzhAutoreplyBehaviorUvTotal {
+    private Long id;
+
+    private String dt;
+
+    private String channel;
+
+    private String ghId;
+
+    private Integer uv;
+
+    private Integer firstLevel;
+
+    private Long createTimestamp;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDt() {
+        return dt;
+    }
+
+    public void setDt(String dt) {
+        this.dt = dt;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    public String getGhId() {
+        return ghId;
+    }
+
+    public void setGhId(String ghId) {
+        this.ghId = ghId;
+    }
+
+    public Integer getUv() {
+        return uv;
+    }
+
+    public void setUv(Integer uv) {
+        this.uv = uv;
+    }
+
+    public Integer getFirstLevel() {
+        return firstLevel;
+    }
+
+    public void setFirstLevel(Integer firstLevel) {
+        this.firstLevel = firstLevel;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", dt=").append(dt);
+        sb.append(", channel=").append(channel);
+        sb.append(", ghId=").append(ghId);
+        sb.append(", uv=").append(uv);
+        sb.append(", firstLevel=").append(firstLevel);
+        sb.append(", createTimestamp=").append(createTimestamp);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 661 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/GzhAutoreplyBehaviorUvTotalExample.java

@@ -0,0 +1,661 @@
+package com.tzld.piaoquan.api.model.po;
+
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GzhAutoreplyBehaviorUvTotalExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public GzhAutoreplyBehaviorUvTotalExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNull() {
+            addCriterion("dt is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNotNull() {
+            addCriterion("dt is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtEqualTo(String value) {
+            addCriterion("dt =", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotEqualTo(String value) {
+            addCriterion("dt <>", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThan(String value) {
+            addCriterion("dt >", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThanOrEqualTo(String value) {
+            addCriterion("dt >=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThan(String value) {
+            addCriterion("dt <", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThanOrEqualTo(String value) {
+            addCriterion("dt <=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLike(String value) {
+            addCriterion("dt like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotLike(String value) {
+            addCriterion("dt not like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIn(List<String> values) {
+            addCriterion("dt in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotIn(List<String> values) {
+            addCriterion("dt not in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtBetween(String value1, String value2) {
+            addCriterion("dt between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotBetween(String value1, String value2) {
+            addCriterion("dt not between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNull() {
+            addCriterion("channel is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIsNotNull() {
+            addCriterion("channel is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelEqualTo(String value) {
+            addCriterion("channel =", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotEqualTo(String value) {
+            addCriterion("channel <>", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThan(String value) {
+            addCriterion("channel >", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelGreaterThanOrEqualTo(String value) {
+            addCriterion("channel >=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThan(String value) {
+            addCriterion("channel <", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLessThanOrEqualTo(String value) {
+            addCriterion("channel <=", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelLike(String value) {
+            addCriterion("channel like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotLike(String value) {
+            addCriterion("channel not like", value, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelIn(List<String> values) {
+            addCriterion("channel in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotIn(List<String> values) {
+            addCriterion("channel not in", values, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelBetween(String value1, String value2) {
+            addCriterion("channel between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andChannelNotBetween(String value1, String value2) {
+            addCriterion("channel not between", value1, value2, "channel");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIsNull() {
+            addCriterion("gh_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIsNotNull() {
+            addCriterion("gh_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdEqualTo(String value) {
+            addCriterion("gh_id =", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotEqualTo(String value) {
+            addCriterion("gh_id <>", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdGreaterThan(String value) {
+            addCriterion("gh_id >", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdGreaterThanOrEqualTo(String value) {
+            addCriterion("gh_id >=", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLessThan(String value) {
+            addCriterion("gh_id <", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLessThanOrEqualTo(String value) {
+            addCriterion("gh_id <=", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLike(String value) {
+            addCriterion("gh_id like", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotLike(String value) {
+            addCriterion("gh_id not like", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIn(List<String> values) {
+            addCriterion("gh_id in", values, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotIn(List<String> values) {
+            addCriterion("gh_id not in", values, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdBetween(String value1, String value2) {
+            addCriterion("gh_id between", value1, value2, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotBetween(String value1, String value2) {
+            addCriterion("gh_id not between", value1, value2, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvIsNull() {
+            addCriterion("uv is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvIsNotNull() {
+            addCriterion("uv is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvEqualTo(Integer value) {
+            addCriterion("uv =", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvNotEqualTo(Integer value) {
+            addCriterion("uv <>", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvGreaterThan(Integer value) {
+            addCriterion("uv >", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvGreaterThanOrEqualTo(Integer value) {
+            addCriterion("uv >=", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvLessThan(Integer value) {
+            addCriterion("uv <", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvLessThanOrEqualTo(Integer value) {
+            addCriterion("uv <=", value, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvIn(List<Integer> values) {
+            addCriterion("uv in", values, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvNotIn(List<Integer> values) {
+            addCriterion("uv not in", values, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvBetween(Integer value1, Integer value2) {
+            addCriterion("uv between", value1, value2, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andUvNotBetween(Integer value1, Integer value2) {
+            addCriterion("uv not between", value1, value2, "uv");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNull() {
+            addCriterion("first_level is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIsNotNull() {
+            addCriterion("first_level is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelEqualTo(Integer value) {
+            addCriterion("first_level =", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotEqualTo(Integer value) {
+            addCriterion("first_level <>", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThan(Integer value) {
+            addCriterion("first_level >", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelGreaterThanOrEqualTo(Integer value) {
+            addCriterion("first_level >=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThan(Integer value) {
+            addCriterion("first_level <", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelLessThanOrEqualTo(Integer value) {
+            addCriterion("first_level <=", value, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelIn(List<Integer> values) {
+            addCriterion("first_level in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotIn(List<Integer> values) {
+            addCriterion("first_level not in", values, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelBetween(Integer value1, Integer value2) {
+            addCriterion("first_level between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andFirstLevelNotBetween(Integer value1, Integer value2) {
+            addCriterion("first_level not between", value1, value2, "firstLevel");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNull() {
+            addCriterion("create_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNotNull() {
+            addCriterion("create_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampEqualTo(Long value) {
+            addCriterion("create_timestamp =", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotEqualTo(Long value) {
+            addCriterion("create_timestamp <>", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThan(Long value) {
+            addCriterion("create_timestamp >", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp >=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThan(Long value) {
+            addCriterion("create_timestamp <", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp <=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIn(List<Long> values) {
+            addCriterion("create_timestamp in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotIn(List<Long> values) {
+            addCriterion("create_timestamp not in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp not between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 14 - 9
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/impl/ThirdPartyServiceImpl.java

@@ -2,9 +2,11 @@ package com.tzld.piaoquan.api.service.wecom.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.aliyun.odps.data.Record;
 import com.tzld.piaoquan.api.common.enums.ReplyStrategyServiceEnum;
+import com.tzld.piaoquan.api.dao.mapper.GzhAutoreplyBehaviorUvTotalMapper;
 import com.tzld.piaoquan.api.model.bo.*;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal;
+import com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample;
 import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount;
 import com.tzld.piaoquan.api.model.vo.PushMessageParam;
 import com.tzld.piaoquan.api.model.vo.PushMessageVo;
@@ -56,6 +58,9 @@ public class ThirdPartyServiceImpl implements ThirdPartyService {
     @Autowired
     private GhDetailMapper ghDetailMapper;
 
+    @Autowired
+    private GzhAutoreplyBehaviorUvTotalMapper gzhAutoreplyBehaviorUvTotalMapper;
+
     private static final String canViewReportDate = "2024-10-31";
 
     private Map<String, ReplyStrategyService> strategyServiceMap;
@@ -149,18 +154,18 @@ public class ThirdPartyServiceImpl implements ThirdPartyService {
         if (targetTime > limitTime) {
             return CommonResponse.create(500, "数据不存在");
         }
-        String dt = date.replace("-", "").substring(0, 8);
-        String sql = String.format("SELECT * FROM gzh_autoreply_behavior_uv_total WHERE dt = %s AND 合作方 = '%s';",
-                dt, desc);
         List<ReportUvVo> res = new ArrayList<>();
-        List<Record> recordList = odpsManager.query(sql);
-        if (CollectionUtils.isEmpty(recordList)) {
+        String dt = date.replace("-", "").substring(0, 8);
+        GzhAutoreplyBehaviorUvTotalExample example = new GzhAutoreplyBehaviorUvTotalExample();
+        example.createCriteria().andDtEqualTo(dt).andChannelEqualTo(desc);
+        List<GzhAutoreplyBehaviorUvTotal> list = gzhAutoreplyBehaviorUvTotalMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(list)) {
             return CommonResponse.success(res);
         }
-        for (Record record : recordList) {
+        for (GzhAutoreplyBehaviorUvTotal record : list) {
             ReportUvVo reportUvVo = new ReportUvVo();
-            reportUvVo.setGhId(record.getString(1));
-            reportUvVo.setUv(record.getBigint(3));
+            reportUvVo.setGhId(record.getGhId());
+            reportUvVo.setUv(Long.valueOf(record.getFirstLevel()));
             res.add(reportUvVo);
         }
         return CommonResponse.success(res);

+ 12 - 0
api-module/src/main/resources/mapper/GhDetailMapperExt.xml

@@ -30,4 +30,16 @@
           and gde.is_delete = 0
     </select>
 
+    <delete id="deleteGzhAutoreplyBehaviorUvTotal">
+        delete from gzh_autoreply_behavior_uv_total where dt = #{dt}
+    </delete>
+
+    <insert id="batchInsertGzhAutoreplyBehaviorUvTotal">
+        insert into gzh_autoreply_behavior_uv_total (dt, channel, gh_id, uv, first_level, create_timestamp)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.dt}, #{item.channel}, #{item.ghId}, #{item.uv}, #{item.firstLevel}, #{item.createTimestamp})
+        </foreach>
+    </insert>
+
 </mapper>

+ 246 - 0
api-module/src/main/resources/mapper/GzhAutoreplyBehaviorUvTotalMapper.xml

@@ -0,0 +1,246 @@
+<?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="com.tzld.piaoquan.api.dao.mapper.GzhAutoreplyBehaviorUvTotalMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="dt" jdbcType="VARCHAR" property="dt" />
+    <result column="channel" jdbcType="VARCHAR" property="channel" />
+    <result column="gh_id" jdbcType="VARCHAR" property="ghId" />
+    <result column="uv" jdbcType="INTEGER" property="uv" />
+    <result column="first_level" jdbcType="INTEGER" property="firstLevel" />
+    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, dt, channel, gh_id, uv, first_level, create_timestamp
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from gzh_autoreply_behavior_uv_total
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from gzh_autoreply_behavior_uv_total
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from gzh_autoreply_behavior_uv_total
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample">
+    delete from gzh_autoreply_behavior_uv_total
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal">
+    insert into gzh_autoreply_behavior_uv_total (id, dt, channel, 
+      gh_id, uv, first_level, 
+      create_timestamp)
+    values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, 
+      #{ghId,jdbcType=VARCHAR}, #{uv,jdbcType=INTEGER}, #{firstLevel,jdbcType=INTEGER}, 
+      #{createTimestamp,jdbcType=BIGINT})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal">
+    insert into gzh_autoreply_behavior_uv_total
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="dt != null">
+        dt,
+      </if>
+      <if test="channel != null">
+        channel,
+      </if>
+      <if test="ghId != null">
+        gh_id,
+      </if>
+      <if test="uv != null">
+        uv,
+      </if>
+      <if test="firstLevel != null">
+        first_level,
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="dt != null">
+        #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="ghId != null">
+        #{ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="uv != null">
+        #{uv,jdbcType=INTEGER},
+      </if>
+      <if test="firstLevel != null">
+        #{firstLevel,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotalExample" resultType="java.lang.Long">
+    select count(*) from gzh_autoreply_behavior_uv_total
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update gzh_autoreply_behavior_uv_total
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.dt != null">
+        dt = #{record.dt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.channel != null">
+        channel = #{record.channel,jdbcType=VARCHAR},
+      </if>
+      <if test="record.ghId != null">
+        gh_id = #{record.ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.uv != null">
+        uv = #{record.uv,jdbcType=INTEGER},
+      </if>
+      <if test="record.firstLevel != null">
+        first_level = #{record.firstLevel,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTimestamp != null">
+        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update gzh_autoreply_behavior_uv_total
+    set id = #{record.id,jdbcType=BIGINT},
+      dt = #{record.dt,jdbcType=VARCHAR},
+      channel = #{record.channel,jdbcType=VARCHAR},
+      gh_id = #{record.ghId,jdbcType=VARCHAR},
+      uv = #{record.uv,jdbcType=INTEGER},
+      first_level = #{record.firstLevel,jdbcType=INTEGER},
+      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal">
+    update gzh_autoreply_behavior_uv_total
+    <set>
+      <if test="dt != null">
+        dt = #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        channel = #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="ghId != null">
+        gh_id = #{ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="uv != null">
+        uv = #{uv,jdbcType=INTEGER},
+      </if>
+      <if test="firstLevel != null">
+        first_level = #{firstLevel,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.GzhAutoreplyBehaviorUvTotal">
+    update gzh_autoreply_behavior_uv_total
+    set dt = #{dt,jdbcType=VARCHAR},
+      channel = #{channel,jdbcType=VARCHAR},
+      gh_id = #{ghId,jdbcType=VARCHAR},
+      uv = #{uv,jdbcType=INTEGER},
+      first_level = #{firstLevel,jdbcType=INTEGER},
+      create_timestamp = #{createTimestamp,jdbcType=BIGINT}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 2 - 1
api-module/src/main/resources/mybatis-api-generator-config.xml

@@ -59,7 +59,8 @@
 <!--        <table tableName="we_com_send_msg_result" domainObjectName="SendMsgResult" alias=""/>-->
 <!--        <table tableName="we_com_corp" domainObjectName="Corp" alias=""/>-->
 <!--        <table tableName="workwx_auto_reply_msg_send_record" domainObjectName="AutoReplyMsgSendRecord" alias=""/>-->
-        <table tableName="gh_detail_ext" domainObjectName="GhDetailExt" alias=""/>
+<!--        <table tableName="gh_detail_ext" domainObjectName="GhDetailExt" alias=""/>-->
+        <table tableName="gzh_autoreply_behavior_uv_total" domainObjectName="GzhAutoreplyBehaviorUvTotal" alias=""/>
 
 
     </context>