Commit c7b3103e authored by 王明生's avatar 王明生

Merge branch 'v13.17.0' into uat

parents 8a729c00 a28cbd2f
...@@ -118,6 +118,12 @@ ...@@ -118,6 +118,12 @@
<version>1.0.2</version> <version>1.0.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.afanticar</groupId>
<artifactId>common-es</artifactId>
<version>1.3.0</version>
</dependency>
<!-- mybatis的分页插件 --> <!-- mybatis的分页插件 -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
......
...@@ -21,6 +21,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -21,6 +21,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
public class AfantiOpenApiApplication { public class AfantiOpenApiApplication {
public static void main(String[] args) { public static void main(String[] args) {
System.setProperty("mybatis - plus.configuration.log - impl", "org.apache.ibatis.logging.stdout.StdOutImpl");
SpringApplication.run(AfantiOpenApiApplication.class, args); SpringApplication.run(AfantiOpenApiApplication.class, args);
} }
......
...@@ -27,8 +27,14 @@ public class RedissonConfig { ...@@ -27,8 +27,14 @@ public class RedissonConfig {
@Bean @Bean
public RedissonClient getRedisson() { public RedissonClient getRedisson() {
Config config = new Config(); Config config = new Config();
SingleServerConfig singleServerConfig = config.useSingleServer().setAddress("redis://" + this.redisProperties.getHost() + ":" + this.redisProperties.getPort()) SingleServerConfig singleServerConfig = config
.setDatabase(this.redisProperties.getDatabase()).setConnectTimeout(10000).setTimeout(3000).setRetryInterval(1500).setRetryAttempts(3); .useSingleServer()
.setAddress("redis://" + this.redisProperties.getHost() + ":" + this.redisProperties.getPort())
.setDatabase(this.redisProperties.getDatabase())
.setConnectTimeout(10000)
.setTimeout(3000)
.setRetryInterval(1500)
.setRetryAttempts(3);
if (StringUtil.isNotBlank(this.redisProperties.getPassword())) { if (StringUtil.isNotBlank(this.redisProperties.getPassword())) {
singleServerConfig.setPassword(this.redisProperties.getPassword()); singleServerConfig.setPassword(this.redisProperties.getPassword());
} }
......
package com.afanticar.afantiopenapi.config; package com.afanticar.afantiopenapi.config;
import com.afanticar.afantiopenapi.controller.BydOpenController;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
...@@ -18,14 +19,19 @@ public class WebMvcConfig implements WebMvcConfigurer { ...@@ -18,14 +19,19 @@ public class WebMvcConfig implements WebMvcConfigurer {
// @Resource // @Resource
// TokenInterceptor tokenInterceptor; // TokenInterceptor tokenInterceptor;
@Resource
BydOpenController bydOpenController;
@Bean @Bean
public TokenInterceptor getLoginInterceptor(){ public TokenInterceptor getLoginInterceptor(){
return new TokenInterceptor(); return new TokenInterceptor();
} }
@Override @Override
public void addInterceptors(InterceptorRegistry register) { public void addInterceptors(InterceptorRegistry register) {
register.addInterceptor(getLoginInterceptor()); register.addInterceptor(getLoginInterceptor());
register.addInterceptor(bydOpenController);
} }
} }
\ No newline at end of file
package com.afanticar.afantiopenapi.constant;
import java.util.Arrays;
import java.util.Optional;
public enum PrincipalEnum {
BYD_WC("1270917477950984192", "比亚迪-王朝"),
BYD_HY("1270917477950984192", "比亚迪-海洋"),
BYD_TS("1270917477950984192", "比亚迪-腾势"),
BYD_FCB("1270917477950984192", "比亚迪-方程豹"),
SQDZ("869753088184930304", "SWM斯威汽车");
// TODO: 修改ID
public final String id;
public final String shortName;
PrincipalEnum(String id, String shortName) {
this.id = id;
this.shortName = shortName;
}
public static void main(String[] args) {
System.out.println(PrincipalEnum.BYD_HY.name());
}
public static Optional<PrincipalEnum> getPrincipal(String principalCode) {
return Arrays.stream(PrincipalEnum.values()).filter(x -> x.name().equals(principalCode)).findFirst();
}
}
...@@ -4,13 +4,19 @@ import cn.hutool.core.date.DateException; ...@@ -4,13 +4,19 @@ import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.afanticar.afantiopenapi.constant.ExceptionEnum;
import com.afanticar.afantiopenapi.model.BaseResponse; import com.afanticar.afantiopenapi.model.BaseResponse;
import com.afanticar.afantiopenapi.model.dto.FawActivityDTO; import com.afanticar.afantiopenapi.model.dto.FawActivityDTO;
import com.alibaba.fastjson.JSONObject;
import lombok.SneakyThrows;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -22,7 +28,7 @@ import java.util.Map; ...@@ -22,7 +28,7 @@ import java.util.Map;
* @author LSZ 2021/01/07 16:34 * @author LSZ 2021/01/07 16:34
* @contact 648748030@qq.com * @contact 648748030@qq.com
*/ */
public class BaseController { public class BaseController extends HandlerInterceptorAdapter{
private static String CODE_SUCCESS = "200"; private static String CODE_SUCCESS = "200";
...@@ -114,4 +120,12 @@ public class BaseController { ...@@ -114,4 +120,12 @@ public class BaseController {
return null; return null;
} }
@SneakyThrows
public static void setResponse(HttpServletResponse response, Integer errorCode, String msg) {
response.setCharacterEncoding("UTF-8");
response.setStatus(errorCode);
response.setContentType("application/json");
response.getWriter().append(JSONObject.toJSONString(BaseController.error(errorCode.toString(), msg)));
}
} }
...@@ -8,6 +8,7 @@ import com.afanticar.activity.domain.vo.ApiActivityInfoVO; ...@@ -8,6 +8,7 @@ import com.afanticar.activity.domain.vo.ApiActivityInfoVO;
import com.afanticar.afantiopenapi.constant.Constant; import com.afanticar.afantiopenapi.constant.Constant;
import com.afanticar.afantiopenapi.model.BaseResponse; import com.afanticar.afantiopenapi.model.BaseResponse;
import com.afanticar.afantiopenapi.model.dto.FawActivityDTO; import com.afanticar.afantiopenapi.model.dto.FawActivityDTO;
import com.afanticar.afantiopenapi.model.entity.HongqiProjectStoreExpectedValueInfo;
import com.afanticar.afantiopenapi.model.vo.*; import com.afanticar.afantiopenapi.model.vo.*;
import com.afanticar.afantiopenapi.service.BaseService; import com.afanticar.afantiopenapi.service.BaseService;
import com.afanticar.afantiopenapi.service.FawOpenService; import com.afanticar.afantiopenapi.service.FawOpenService;
...@@ -87,6 +88,23 @@ public class FawOpenController extends BaseController { ...@@ -87,6 +88,23 @@ public class FawOpenController extends BaseController {
static String monthly = "monthly", quarter = "quarter"; static String monthly = "monthly", quarter = "quarter";
@ApiOperation(value = "红旗项目门店月度预值", notes = "红旗项目门店月度预值", produces = "application/json")
@ApiImplicitParams({
@ApiImplicitParam(name = "store_code", value = "门店编码", paramType = "path", dataType = "String"),
@ApiImplicitParam(name = "expected_month", value = "预值月份", paramType = "path", dataType = "Integer"),
@ApiImplicitParam(name = "upload_month", value = "上传月份", paramType = "path", dataType = "Integer"),
@ApiImplicitParam(name = "current_page", value = "页码", paramType = "path", dataType = "Integer"),
@ApiImplicitParam(name = "page_size", value = "页数", paramType = "path", dataType = "Integer"),
})
@GetMapping("/statistics")
public BaseResponse<BasePageVO<HongqiProjectStoreExpectedValueInfo>> getStatisticsInfo(@Max(value = 500, message = "单页数据page_size过大") @RequestParam(name = "page_size", defaultValue = "100", required = false) Integer pageSize,
@RequestParam(name = "current_page", defaultValue = "1", required = false) Integer pageNum,
@RequestParam(name = "store_code", required = false) String storeCode,
@RequestParam(name = "expected_month", required = false) Integer expectedMonth,
@RequestParam(name = "upload_month", required = false) Integer uploadMonth) {
return success(fawOpenService.getStatisticsInfo(storeCode, expectedMonth, uploadMonth, pageNum, pageSize));
}
@ApiOperation(value = "视频数据信息", notes = "视频数据", produces = "application/json") @ApiOperation(value = "视频数据信息", notes = "视频数据", produces = "application/json")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "publish_date_start", value = "开始时间,格式:2023-02-01 00:00:00", required = true, paramType = "path", dataType = "Date"), @ApiImplicitParam(name = "publish_date_start", value = "开始时间,格式:2023-02-01 00:00:00", required = true, paramType = "path", dataType = "Date"),
......
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.HongqiProjectStoreExpectedValueInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
@DS("tmp")
public interface HongqiProjectStoreExpectedValueInfoMapper extends BaseMapper<HongqiProjectStoreExpectedValueInfo> {
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.MemberInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
@DS("afanti-bi-app")
public interface MemberInfoMapper extends BaseMapper<MemberInfo> {
@Select("<script>" +
"select * \n" +
"from dim_matrix_member_info \n" +
"where end_time ='2099-01-01'\n" +
"and is_valid =1\n" +
"and matrix_member_id in " +
"<foreach collection='memberIds' item='item' open='(' separator=',' close=')'>" +
" #{item} " +
"</foreach>" +
"</script>"
)
List<MemberInfo> queryMemberInfoListByMemberIds(List<String> memberIds);
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorDay;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
@Mapper
@DS("afanti-bi-app")
public interface XiaoHongShuAuthorDayMapper extends BaseMapper<XiaoHongShuAuthorDay> {
@Select("select * " +
"from dws_xiaohongshu_author_action_day \n" +
"where author_id in (\n" +
" select author_id from ads_xiaohongshu_author_info \n" +
" where contains(principal_ids, #{principalId}) and is_deleted=0 \n" +
")\n" +
"and statistics_day >= #{startDate} \n" +
"and statistics_day <= #{endDate} \n" +
"order by statistics_day,author_id"
)
Page<XiaoHongShuAuthorDay> queryAuthorDayByPrincipalId(
Page page,
@Param("principalId") String principalId,
@Param("startDate") LocalDate startDate,
@Param("endDate") LocalDate endDate
);
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.MemberInfo;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
@DS("afanti-bi-app")
public interface XiaoHongShuAuthorInfoMapper extends BaseMapper<XiaoHongShuAuthorInfo> {
@Select("<script>" +
"select * \n" +
"from ads_xiaohongshu_author_info \n" +
"where 1=1\n" +
"and author_id in \n" +
"<foreach collection='authorIds' item='item' open='(' separator=',' close=')'>" +
" #{item} " +
"</foreach>" +
"</script>"
)
List<XiaoHongShuAuthorInfo> queryAuthorInfoListByAuthorIds(List<String> authorIds);
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuMemberDay;
import com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuMemberDayVO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
@Mapper
@DS("afanti-bi-app")
public interface XiaoHongShuMemberDayMapper extends BaseMapper<XiaoHongShuMemberDay> {
@Select("select a.matrix_member_id,b.matrix_member_name as member_name,b.matrix_member_code as member_code,\n" +
" b.area_name,b.village_name,b.principal_name,b.province_name,b.city_name,\n" +
" a.statistics_day as stats_date,a.fans_count_total as fans_cnt_total,\n" +
" a.fans_count_total_di as fans_cnt_di,a.note_count_di as note_cnt_di,\n" +
" a.note_digg_count_di as note_like_cnt_di,a.note_collect_count_di as note_collect_count_di,\n" +
" a.note_share_count_di as note_share_cnt_di \n" +
"from dws_xiaohongshu_member_action_day a \n" +
"inner join dim_matrix_member_info b on a.matrix_member_id =b.matrix_member_id\n" +
"where 1=1 \n" +
"and statistics_day >= #{startDate}\n" +
"and statistics_day <= #{endDate}\n" +
"and principal_id=#{principalId} \n" +
"and end_time='2099-01-01' \n" +
"and is_valid=1 \n" +
"order by statistics_day,a.matrix_member_id"
)
Page<BydXiaoHongShuMemberDayVO> queryMemberDayByPrincipalId(
Page page,
@Param("principalId") String principalId,
@Param("startDate") LocalDate startDate,
@Param("endDate") LocalDate endDate
);
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuNoteDay;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
@Mapper
@DS("afanti-bi-app")
public interface XiaoHongShuNoteDayMapper extends BaseMapper<XiaoHongShuNoteDay> {
@Select("<script> \n" +
"select * \n" +
"from dws_xiaohongshu_note_action_day \n" +
"where author_id in (\n" +
" select author_id from ads_xiaohongshu_author_info \n" +
" where contains(principal_ids, #{principalId}) and is_deleted=0 \n" +
") \n" +
"<if test=\"pubStart != null and pubEnd != null\">" +
"and note_id in (\n" +
" select note_id from ads_xiaohongshu_note_info \n" +
" where publish_time between #{pubStart} and #{pubEnd} \n" +
")\n" +
"</if>" +
"and statistics_day &gt;= #{statsStart} \n" +
"and statistics_day &gt;= #{statsEnd} \n" +
"order by statistics_day,note_id \n" +
"</script>"
)
Page<XiaoHongShuNoteDay> queryNoteDayByPrincipalId(
Page page,
@Param("principalId") String principalId,
@Param("statsStart") LocalDate statsStart,
@Param("statsEnd") LocalDate statsEnd,
@Param("pubStart") LocalDate pubStart,
@Param("pubEnd") LocalDate pubEnd
);
}
package com.afanticar.afantiopenapi.mapper;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuAuthorInfo;
import com.afanticar.afantiopenapi.model.entity.XiaoHongShuNoteInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
@DS("afanti-bi-app")
public interface XiaoHongShuNoteInfoMapper extends BaseMapper<XiaoHongShuNoteInfo> {
@Select("<script>" +
"select * \n" +
"from ads_xiaohongshu_note_info \n" +
"where 1=1\n" +
"and note_id in \n" +
"<foreach collection='noteIds' item='item' open='(' separator=',' close=')'>" +
" #{item} " +
"</foreach>" +
"</script>"
)
List<XiaoHongShuNoteInfo> queryNoteInfoListByNoteIds(List<String> noteIds);
}
package com.afanticar.afantiopenapi.model.entity;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class BaseADB {
public List<String> getList(String text) {
return Arrays.stream(
Optional.ofNullable(text).orElse("")
.replace("[","")
.replace("]", "")
.replace("\"", "")
.split(",")
)
.map(String::trim)
.filter(x -> !"".equals(x))
.collect(Collectors.toList());
}
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.math.BigDecimal;
import java.util.Date;
/**
* 红旗项目门店月度预值表
*/
@Data
@TableName("hongqi_project_store_expected_value_info")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class HongqiProjectStoreExpectedValueInfo {
@Id
private Integer id;
private String groupName;
private String storeCode;
private String storeName;
private Integer expectedMonth;
private Integer uploadMonth;
private BigDecimal dailyAwemeValue;
private BigDecimal dailyLiveValue;
private BigDecimal hotAwemeValue;
private BigDecimal hotLiveValue;
private BigDecimal growthIncentiveValue;
private BigDecimal negativeIncentiveValue;
private BigDecimal teamIncentiveValue;
private BigDecimal specialProjectValue;
private BigDecimal innovateAwemeRechargeValue;
private BigDecimal replyMinute3Rate;
private BigDecimal msgConversionRate;
private BigDecimal cpl;
private BigDecimal innovateAwemeValue;
private BigDecimal hotLiveLineValue;
private String remark;
private Date ctime;
private Date mtime;
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.util.Date;
@Data
@TableName("dim_matrix_member_info")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class MemberInfo {
/**
* 成员id
*/
private String matrixMemberId;
/**
* 成员名称
*/
private String matrixMemberName;
/**
* 成员类型 1:经销商 2:官号 3:直营店 4:二网 5:城市站 6:KOL/KOC
*/
private Byte matrixMemberType;
/**
* 成员编码
*/
private String matrixMemberCode;
/**
* 联络人
*/
private String username;
/**
* 联络人手机号
*/
private String mobile;
/**
* 邀请码
*/
private String invitationCode;
/**
* 省份ID
*/
private String provinceId;
/**
* 省份名称
*/
private String provinceName;
/**
* 城市ID
*/
private String cityId;
/**
* 城市名称
*/
private String cityName;
/**
* 主体ID
*/
private String principalId;
/**
* 主体名称
*/
private String principalName;
/**
* 大区ID
*/
private String areaId;
/**
* 大区名称
*/
private String areaName;
/**
* 小区ID
*/
private String villageId;
/**
* 小区名称
*/
private String villageName;
/**
* 0:默认值,1:正常,2:退网
*/
private Byte status;
/**
* 操作时间
*/
private Date atime;
/**
* 创建时间
*/
private Date ctime;
/**
* 更新时间
*/
private Date mtime;
/**
* 创建人
*/
private String creator;
/**
* 操作人
*/
private String actor;
/**
* 是否已删除,(1:是;0:否)
*/
private Byte isDeleted;
/**
* 是否有效,0:无效,1:有效
*/
private Integer isValid;
/**
* 记录有效开始时间
*/
private Date startTime;
/**
* 记录有效结束时间
*/
private Date endTime;
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
@Data
@TableName("dws_xiaohongshu_author_action_day")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class XiaoHongShuAuthorDay extends BaseADB{
/**
* 统计日期,格式为YYYY-MM-DD 00:00:00
*/
private LocalDate statisticsDay;
/**
* 主播ID
*/
private String authorId;
/**
* 粉丝总数
*/
private Integer fansCountTotal;
/**
* 本日新增粉丝数
*/
private Integer fansCountTotalDi;
/**
* 获赞+收藏总数
*/
private Integer favedCount;
/**
* 本日新增获赞+收藏数
*/
private Integer favedCountDi;
/**
* 关注总数
*/
private Integer followingCount;
/**
* 本日新增关注数
*/
private Integer followingCountDi;
/**
* 本日笔记发布数
*/
private Integer noteCountDi;
/**
* 本日笔记新增观看数
*/
private Integer noteReadCountDi;
/**
* 本日笔记新增点赞数
*/
private Integer noteDiggCountDi;
/**
* 本日笔记新增收藏数
*/
private Integer noteCollectCountDi;
/**
* 本日笔记新增评论数
*/
private Integer noteCommentCountDi;
/**
* 本日笔记新增分享数
*/
private Integer noteShareCountDi;
/**
* 是否取自前一天的数据,0表示否,1表示是
*/
private Boolean isFromP0;
/**
* 数据更新时间
*/
private Date mtime;
/**
* 数据创建时间
*/
private Date ctime;
/**
* 成员ID数组
*/
private String matrixMemberIds;
/**
* 是否为推测数据
*/
private Boolean isSimulateData;
/**
* 总点赞数
*/
private Integer diggCountTotal;
/**
* 本日新增点赞数
*/
private Integer diggCountDi;
/**
* 总收藏数
*/
private Integer collectCountTotal;
/**
* 本日新增收藏数
*/
private Integer collectCountDi;
/**
* 本日总作品数
*/
private Integer noteCountTotal;
/**
* 本日直播总场次
*/
private Integer liveTotalCount;
/**
* 本日直播总点赞数
*/
private Integer liveTotalLikeCount;
/**
* 本日直播总点赞人数
*/
private Integer liveTotalLikeUserCount;
/**
* 本日直播总评论数
*/
private Integer liveTotalCommentCount;
/**
* 本日直播总评论人数
*/
private Integer liveTotalCommentUserCount;
/**
* 本日直播总送礼数
*/
private Integer liveTotalGiftCount;
/**
* 本日直播总送礼人数
*/
private Integer liveTotalGiftUserCount;
/**
* 本日直播总互动数(评论数+点赞数+送礼数)
*/
private Integer liveTotalPollingCount;
/**
* 本日直播总互动人数
*/
private Integer liveTotalPollingUserCount;
/**
* 本日直播总时长
*/
private Integer liveTotalTime;
/**
* 本日直播总新增粉丝数
*/
private Integer liveTotalFansAdd;
/**
* 本日直播总薯钻
*/
private Integer liveTotalDiamondCount;
/**
* 本日直播总观看人数
*/
private Integer liveTotalWatchUserCount;
/**
* 本日直播总观看人次
*/
private Integer liveTotalWatchUserTime;
public List<String> getMemberIds() {
return getList(this.matrixMemberIds);
}
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
@TableName("ads_xiaohongshu_author_info")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class XiaoHongShuAuthorInfo extends BaseADB{
/**
* 主播ID
*/
private String authorId;
/**
* 主播签名
*/
private String signature;
/**
* 主播昵称
*/
private String nickname;
/**
* 主播头像
*/
private String avatar;
/**
* 主播小红书号
*/
private String code;
/**
* 主播主页背景图链接
*/
private String coverUrl;
/**
* 主播性别
*/
private Byte gender;
/**
* 主播生日
*/
private String birthday;
/**
* 主播所在城市code
*/
private String authorCityCode;
/**
* 主播所在城市名称
*/
private String authorCityName;
/**
* 主播所在省code
*/
private String authorProvinceCode;
/**
* 主播所在省名称
*/
private String authorProvinceName;
/**
* 主播总粉丝数
*/
private Integer fansCountTotal;
/**
* 小红书返回的主播状态,0正常、1注销、2封禁
*/
private Byte platformAuthorStatus;
/**
* 经销商id
*/
private String dealerId;
/**
* 经销商名称
*/
private String dealerName;
/**
* 经销商城市code
*/
private String dealerCityCode;
/**
* 经销商城市名称
*/
private String dealerCityName;
/**
* 经销商地区code
*/
private String dealerCountyCode;
/**
* 经销商地区名称
*/
private String dealerCountyName;
/**
* 经销商省份code
*/
private String dealerProvinceCode;
/**
* 经销商省份名称
*/
private String dealerProvinceName;
/**
* 经销商公司名
*/
private String dealerCompanyName;
/**
* 主机厂ids
*/
private List<String> manufactorIds;
/**
* 主机厂名称
*/
private List<String> manufactorNames;
/**
* 品牌ids
*/
private List<String> brandIds;
/**
* 品牌名称
*/
private List<String> brandNames;
/**
* 主体ids
*/
private List<String> principalIds;
/**
* 主体名称
*/
private List<String> principalNames;
/**
* 运营主体:1:品牌,2:主机厂,3:主体大区,4:经销商,5:KOIP,6:二手车商
*/
private String operateType;
/**
* 经销商大区id,多列值
*/
private List<String> dealerAreaIds;
/**
* 经销商大区名称,多列值
*/
private List<String> dealerAreaNames;
/**
* 经销商原始门店编码
*/
private String originStoreCode;
/**
* 排序权重
*/
private String sortWeight;
/**
* 主播状态是否删除, 0正常;1删除
*/
private Byte isDeleted;
/**
* 数据同步更新的时间点
*/
private LocalDateTime dataUpdateTime;
/**
* 账号收录时间
*/
private LocalDateTime includedTime;
/**
* 创建时间
*/
private LocalDateTime ctime;
/**
* 更新时间
*/
private LocalDateTime mtime;
/**
* 成员ids
*/
private String matrixMemberIds;
/**
* 获赞+收藏
*/
// private Integer favedCount;
/**
* 关注数
*/
// private Integer followingCount;
/**
* 点赞数
*/
// private Integer likeCountTotal;
/**
* 收藏数
*/
// private Integer collectCountTotal;
/**
* 主播总作品数
*/
// private Integer noteCountTotal;
/**
* 认证类型: 0-未认证, 1-个人认证,2-企业认证(蓝v),3-机构认证
*/
private Integer verificationType;
/**
* 是否代运营账号,1:是,0否
*/
// private Integer isAgentAuthor;
public List<String> getMemberIds() {
return getList(this.matrixMemberIds);
}
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.util.Date;
@Data
@TableName("dws_xiaohongshu_member_action_day")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class XiaoHongShuMemberDay {
/**
* 成员id
*/
private String matrixMemberId;
/**
* 获赞与收藏
*/
private Integer favedCount;
/**
* 关注数
*/
private Integer followingCount;
/**
* 粉丝数
*/
private Integer fansCountTotal;
/**
* 本日新增获赞与收藏数
*/
private Integer favedCountDi;
/**
* 本日新增关注数
*/
private Integer followingCountDi;
/**
* 本日新增粉丝数
*/
private Integer fansCountTotalDi;
/**
* 统计日期,YYYY-MM-DD 00:00:00
*/
private Date statisticsDay;
/**
* 数据更新时间
*/
private Date mtime;
/**
* 数据创建时间
*/
private Date ctime;
/**
* 本日笔记发布数
*/
private Integer noteCountDi;
/**
* 本日笔记新增观看数
*/
private Integer noteReadCountDi;
/**
* 本日笔记新增点赞数
*/
private Integer noteDiggCountDi;
/**
* 本日笔记新增收藏数
*/
private Integer noteCollectCountDi;
/**
* 本日笔记新增评论数
*/
private Integer noteCommentCountDi;
/**
* 本日笔记新增分享数
*/
private Integer noteShareCountDi;
/**
* 本日有发布笔记的主播账号数
*/
private Integer notePublishAuthorCount;
/**
* 是否删除
*/
private Byte isDeleted;
/**
* 0:默认值,1:正常,2:退网
*/
private Byte status;
/**
* 主播数量
*/
private Integer authorCount;
/**
* 总点赞数
*/
private Integer diggCountTotal;
/**
* 本日新增点赞数
*/
private Integer diggCountDi;
/**
* 总收藏数
*/
private Integer collectCountTotal;
/**
* 本日新增收藏数
*/
private Integer collectCountDi;
/**
* 本日总作品数
*/
private Integer noteCountTotal;
/**
* 本日直播总场次
*/
private Integer liveTotalCount;
/**
* 本日直播总点赞数
*/
private Integer liveTotalLikeCount;
/**
* 本日直播总点赞人数
*/
private Integer liveTotalLikeUserCount;
/**
* 本日直播总评论数
*/
private Integer liveTotalCommentCount;
/**
* 本日直播总评论人数
*/
private Integer liveTotalCommentUserCount;
/**
* 本日直播总送礼数
*/
private Integer liveTotalGiftCount;
/**
* 本日直播总送礼人数
*/
private Integer liveTotalGiftUserCount;
/**
* 本日直播总互动数(评论数+点赞数+送礼数)
*/
private Integer liveTotalPollingCount;
/**
* 本日直播总互动人数
*/
private Integer liveTotalPollingUserCount;
/**
* 本日直播总时长
*/
private Integer liveTotalTime;
/**
* 本日直播总新增粉丝数
*/
private Integer liveTotalFansAdd;
/**
* 本日直播总薯钻
*/
private Integer liveTotalDiamondCount;
/**
* 本日直播总观看人数
*/
private Integer liveTotalWatchUserCount;
/**
* 本日直播总观看人次
*/
private Integer liveTotalWatchUserTime;
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Data
@TableName("dws_xiaohongshu_note_action_day")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class XiaoHongShuNoteDay extends BaseADB{
/**
* 小红书号
*/
private String authorId;
/**
* 笔记id
*/
private String noteId;
/**
* 阅读量
*/
private Integer readCount;
/**
* 直接涨粉数
*/
private Integer fansTotalAdd;
/**
* 点赞量
*/
private Integer diggCount;
/**
* 收藏数
*/
private Integer collectCount;
/**
* 评论数
*/
private Integer commentCount;
/**
* 分享数
*/
private Integer shareCount;
/**
* 阅读量增量
*/
private Integer readCountDi;
/**
* 直接涨粉数增量
*/
private Integer fansTotalAddDi;
/**
* 点赞量增量
*/
private Integer diggCountDi;
/**
* 收藏数增量
*/
private Integer collectCountDi;
/**
* 评论数增量
*/
private Integer commentCountDi;
/**
* 分享数增量
*/
private Integer shareCountDi;
/**
* 该行是否取自自前一天, 0:否;1:是
*/
private Boolean isFromP0;
/**
* 统计日期,格式为YYYY-MM-DD 00:00:00
*/
private LocalDate statisticsDay;
/**
* 入库时间
*/
private LocalDateTime ctime;
/**
* 修改时间
*/
private LocalDateTime mtime;
/**
* 成员ID数组
*/
private String matrixMemberIds;
/**
* 是否为推测数据
*/
private Boolean isSimulateData;
/**
* 笔记状态: 1-可见,0-不可见
*/
private Integer noteStatus;
/**
* 预估的模拟阅读量:(点赞+评论+收藏+转发)*20
*/
private Integer simulateReadCount;
/**
* 预估的模拟阅读增量:(点赞增量+评论增量+收藏增量+转发增量)*20
*/
private Integer simulateReadCountDi;
public List<String> getMemberIds() {
return getList(this.matrixMemberIds);
}
}
package com.afanticar.afantiopenapi.model.entity;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Data
@TableName("ads_xiaohongshu_note_info")
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class XiaoHongShuNoteInfo extends BaseADB{
/**
* 小红书号
*/
private String authorId;
/**
* 笔记id
*/
private String noteId;
/**
* 笔记封面
*/
private String coverUrl;
/**
* 笔记标题
*/
private String noteTitle;
/**
* 笔记类型(normal:图文,video:视频)
*/
private String noteType;
/**
* 笔记链接
*/
private String shareUrl;
/**
* 阅读量
*/
private Integer readCount;
/**
* 直接涨粉数
*/
private Integer fansTotalAdd;
/**
* 点赞量
*/
private Integer diggCount;
/**
* 收藏数
*/
private Integer collectCount;
/**
* 评论数
*/
private Integer commentCount;
/**
* 分享数
*/
private Integer shareCount;
/**
* 入库时间
*/
private Date ctime;
/**
* 修改时间
*/
private Date mtime;
/**
* 成员ids
*/
private String matrixMemberIds;
/**
* 笔记发布时间
*/
private LocalDateTime publishTime;
/**
* 数据同步更新的时间点
*/
private LocalDateTime dataUpdateTime;
/**
* 笔记状态: 1-可见,0-不可见
*/
private Integer noteStatus;
/**
* 话题ID列表
*/
private String topicIds;
/**
* 话题名
*/
private String noteTopic;
/**
* 预估的模拟阅读量:(点赞+评论+收藏+转发)*20
*/
private Integer simulateReadCount;
/**
* 笔记图片数
*/
private Integer noteImageCount;
/**
* 笔记正文字数
*/
private Integer noteDescriptionWordCount;
/**
* 1级标签 id
*/
private String tagLevelOneId;
/**
* 1级标签 名
*/
private String tagLevelOneName;
/**
* 2级标签 id
*/
private String tagLevelTwoId;
/**
* 2级标签 名
*/
private String tagLevelTwoName;
/**
* 3级标签 id
*/
private String tagLevelThreeId;
/**
* 3级标签 名
*/
private String tagLevelThreeName;
/**
* 发布渠道,FENGHUOLUN=风火轮,SHARE_LINK=分享链接,BAIFUZHANG=百夫长
*/
private String publishChannel;
/**
* 产品id
*/
private String goodsId;
/**
* 产品名称
*/
private String goodsName;
public List<String> getMemberIds() {
return getList(this.matrixMemberIds);
}
public List<String> getTopicNames() {
return getList(this.noteTopic);
}
}
package com.afanticar.afantiopenapi.model.qto;
import com.afanticar.core.annotation.Id;
import com.afanticar.core.annotation.Index;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@JSONType(naming = PropertyNamingStrategy.SnakeCase)
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel(value = "小红书笔记正文", description = "小红书笔记正文")
@Index(name = "dwd-xiaohongshu-note-info")
public class XiaoHongShuNoteDocQTO implements Serializable {
private static final long serialVersionUID = -8753897697871869807L;
@Id
private String id;
@ApiModelProperty("笔记ID")
private String noteId;
/**
* 违规类型:22:画面提及违禁词
*/
@ApiModelProperty("正文")
private String description;
}
package com.afanticar.afantiopenapi.model.vo;
import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Data
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class BydXiaoHongShuAuthorDayVO {
@ApiModelProperty(value = "主播ID", example = "123456")
private String authorId;
@ApiModelProperty(value = "主播昵称", example = "张三")
private String nickname;
@ApiModelProperty(value = "主播code", example = "a123456")
private String code;
@ApiModelProperty(value = "主播头像", example = "http://xxxxx")
private String avatarUrl;
@ApiModelProperty(value = "是否蓝V", example = "true|false")
private boolean isBlueV;
@ApiModelProperty(value = "账号收录时间", example = "2024-11-01 14:21:12")
private LocalDateTime includeTime;
@ApiModelProperty(value = "成员信息", example = "[{...},{...}]")
private List<MemberInfo> memberInfos;
@ApiModelProperty(value = "统计日期", example = "2023-03-03")
private LocalDate statsDate;
@ApiModelProperty(value = "粉丝数", example = "200")
private Integer fansCntTotal;
@ApiModelProperty(value = "粉丝新增数", example = "200")
private Integer fansCntDi;
@ApiModelProperty(value = "笔记新增数", example = "200")
private Integer noteCntDi;
@ApiModelProperty(value = "笔记点赞新增数", example = "200")
private Integer noteLikeCntDi;
@ApiModelProperty(value = "笔记评论新增数", example = "200")
private Integer noteCommentCntDi;
@ApiModelProperty(value = "笔记收藏新增数", example = "200")
private Integer noteFavoriteCntDi;
@ApiModelProperty(value = "笔记分享新增数", example = "200")
private Integer noteShareCntDi;
@Data
public static class MemberInfo {
@ApiModelProperty(value = "品牌名称", example = "比亚迪-海洋")
private String principalName;
@ApiModelProperty(value = "门店ID", example = "A11111")
private String memberId;
@ApiModelProperty(value = "门店名称", example = "南京宁星")
private String memberName;
@ApiModelProperty(value = "门店编码", example = "ABC123")
private String memberCode;
@ApiModelProperty(value = "大区名称", example = "大区名称1")
private String areaName;
@ApiModelProperty(value = "小区名称", example = "200")
private String villageName;
@ApiModelProperty(value = "省份名称", example = "广东")
private String provinceName;
@ApiModelProperty(value = "城市名称", example = "深圳")
private String cityName;
}
}
package com.afanticar.afantiopenapi.model.vo;
import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.util.List;
@Data
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class BydXiaoHongShuMemberDayVO {
/**
* BydXiaoHongShuMemberDayVO(storeName=null, storeCode=null, storeId=null, storeType=null, areaName=南区,
* villageName=, principalName=SWM斯威汽车, provinceName=广东省, cityName=广州市, statsDate=null, fansCntTotal=null,
* fansCntDi=null, noteCntDi=null, noteLikeCntDi=null, noteCommentCntDi=null, noteFavoriteCntDi=null, noteShareCntDi=null)
*
* b.matrix_member_name as member_name,b.matrix_member_code as member_code,\n" +
* " b.area_name,b.village_name,b.principal_name,b.province_name,b.city_name,\n" +
* " a.statistics_day,a.fans_count_total,a.fans_count_total_di,a.note_count_di,\n" +
* " a.note_digg_count_di,a.note_collect_count_di,a.note_share_count_di \n" +
*/
@ApiModelProperty(value = "品牌名称", example = "比亚迪-海洋")
private String principalName;
@ApiModelProperty(value = "门店名称", example = "南京宁星")
private String memberName;
@ApiModelProperty(value = "门店编码", example = "ABC123")
private String memberCode;
@ApiModelProperty(value = "大区名称", example = "大区名称1")
private String areaName;
@ApiModelProperty(value = "小区名称", example = "200")
private String villageName;
@ApiModelProperty(value = "省份名称", example = "广东")
private String provinceName;
@ApiModelProperty(value = "城市名称", example = "深圳")
private String cityName;
@ApiModelProperty(value = "统计日期", example = "2023-03-03")
private LocalDate statsDate;
@ApiModelProperty(value = "粉丝数", example = "200")
private Integer fansCntTotal;
@ApiModelProperty(value = "粉丝新增数", example = "200")
private Integer fansCntDi;
@ApiModelProperty(value = "笔记新增数", example = "200")
private Integer noteCntDi;
@ApiModelProperty(value = "笔记点赞新增数", example = "200")
private Integer noteLikeCntDi;
@ApiModelProperty(value = "笔记评论新增数", example = "200")
private Integer noteCommentCntDi;
@ApiModelProperty(value = "笔记收藏新增数", example = "200")
private Integer noteFavoriteCntDi;
@ApiModelProperty(value = "笔记分享新增数", example = "200")
private Integer noteShareCntDi;
}
package com.afanticar.afantiopenapi.model.vo;
import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Data
@JsonNaming(value = com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy.class)
@JSONType(naming = com.alibaba.fastjson.PropertyNamingStrategy.SnakeCase)
public class BydXiaoHongShuNoteDayVO {
@ApiModelProperty(value = "笔记ID", example = "123456")
private String noteId;
@ApiModelProperty(value = "统计日期", example = "2023-03-03")
private LocalDate statsDate;
@ApiModelProperty(value = "笔记标题", example = "...")
private String noteTitle;
@ApiModelProperty(value = "主播ID", example = "123456")
private String authorId;
@ApiModelProperty(value = "发布时间", example = "2024-11-01 00:10:23")
private LocalDateTime publishTime;
@ApiModelProperty(value = "笔记类型", example = "笔记类型(normal:图文,video:视频)")
private String noteType;
@ApiModelProperty(value = "分享链接", example = "...")
private String shareUrl;
@ApiModelProperty(value = "封面链接", example = "...")
private String coverUrl;
@ApiModelProperty(value = "话题列表", example = "...")
private List<String> topicNames;
@ApiModelProperty(value = "笔记点赞数", example = "200")
private Integer likeCnt;
@ApiModelProperty(value = "笔记评论数", example = "200")
private Integer commentCnt;
@ApiModelProperty(value = "笔记收藏数", example = "200")
private Integer collectCnt;
@ApiModelProperty(value = "笔记分享数", example = "200")
private Integer shareCnt;
@ApiModelProperty(value = "笔记正文", example = "...")
private String description;
@ApiModelProperty(value = "数据更新时间", example = "....")
private LocalDateTime dataUpdateTime;
}
...@@ -49,7 +49,12 @@ public class BaseService { ...@@ -49,7 +49,12 @@ public class BaseService {
return null; return null;
} }
public BaseResponse pageApiLimit(String dataType, Integer limit, Integer limitPeriod) { /**
* @param dataType
* @param limit 对应trySetRate中的rate
* @param limitPeriod 对应trySetRate中的rateInterval,即rate time interval
*/
public <T> BaseResponse<T> pageApiLimit(String dataType, Integer limit, Integer limitPeriod) {
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
package com.afanticar.afantiopenapi.service;
import com.afanticar.afantiopenapi.constant.PrincipalEnum;
import com.afanticar.afantiopenapi.mapper.*;
import com.afanticar.afantiopenapi.model.entity.*;
import com.afanticar.afantiopenapi.model.qto.XiaoHongShuNoteDocQTO;
import com.afanticar.afantiopenapi.model.vo.BasePageVO;
import com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuAuthorDayVO;
import com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuMemberDayVO;
import com.afanticar.afantiopenapi.model.vo.BydXiaoHongShuNoteDayVO;
import com.afanticar.core.entity.EsBaseQuery;
import com.afanticar.core.entity.InnerHits;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class BydOpenService {
@Resource
MemberInfoMapper memberInfoMapper;
@Resource
XiaoHongShuMemberDayMapper memberDayMapper;
@Resource
XiaoHongShuAuthorInfoMapper authorInfoMapper;
@Resource
XiaoHongShuAuthorDayMapper authorDayMapper;
@Resource
XiaoHongShuNoteInfoMapper noteInfoMapper;
@Resource
XiaoHongShuNoteDayMapper noteDayMapper;
@Resource
XiaoHongShuNoteDocService noteDocService;
public BasePageVO<BydXiaoHongShuMemberDayVO> fetchMemberDaySnap(PrincipalEnum principal,
LocalDate startDate, LocalDate endDate, Integer currentPage, Integer pageSize){
Page<BydXiaoHongShuMemberDayVO> page = new Page<>(currentPage, pageSize);
Page<BydXiaoHongShuMemberDayVO> data = memberDayMapper.queryMemberDayByPrincipalId(page, principal.id, startDate, endDate);
// List<String> memberIds = data.stream().map(XiaoHongShuMemberDay::getMatrixMemberId).collect(Collectors.toList());
// List<MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds);
return BasePageVO.restPage((int) data.getCurrent(), (int) data.getSize(), (int) data.getTotal(), (int) data.getPages(), data.getRecords());
}
public BasePageVO<BydXiaoHongShuAuthorDayVO> fetchAuthorDaySnap(PrincipalEnum principal,
LocalDate startDate, LocalDate endDate, Integer currentPage, Integer pageSize){
Page<XiaoHongShuAuthorDay> page = new Page<>(currentPage, pageSize);
Page<XiaoHongShuAuthorDay> data = authorDayMapper.queryAuthorDayByPrincipalId(page, principal.id, startDate, endDate);
List<String> authorIds = data.getRecords().stream().map(XiaoHongShuAuthorDay::getAuthorId).distinct().collect(Collectors.toList());
// QueryWrapper<XiaoHongShuAuthorInfo> wrapper = new QueryWrapper<>();
// wrapper.in("author_id", authorIds);
Map<String, XiaoHongShuAuthorInfo> authorInfos = authorInfoMapper.queryAuthorInfoListByAuthorIds(authorIds).stream().distinct()
.collect(Collectors.toMap(XiaoHongShuAuthorInfo::getAuthorId, Function.identity()));
List<String> memberIds = authorInfos.values().stream()
.flatMap(o-> o.getMemberIds().stream())
.collect(Collectors.toList());
Map<String, MemberInfo> memberInfos = memberInfoMapper.queryMemberInfoListByMemberIds(memberIds).stream().distinct()
.collect(Collectors.toMap(MemberInfo::getMatrixMemberId, Function.identity()));
List<BydXiaoHongShuAuthorDayVO> voList = data.getRecords().stream().map(x->{
BydXiaoHongShuAuthorDayVO vo = new BydXiaoHongShuAuthorDayVO();
XiaoHongShuAuthorInfo authorInfo = authorInfos.get(x.getAuthorId());
vo.setAuthorId(x.getAuthorId());
vo.setNickname(authorInfo.getNickname());
vo.setCode(authorInfo.getCode());
vo.setAvatarUrl(authorInfo.getAvatar());
vo.setBlueV(Optional.ofNullable(authorInfo.getVerificationType()).orElse(100).equals(2));
vo.setIncludeTime(authorInfo.getIncludedTime());
if (Optional.ofNullable(authorInfo.getMemberIds()).isPresent()) {
vo.setMemberInfos(authorInfo.getMemberIds().stream().map(id->{
System.out.println("memberId: " + id);
MemberInfo info = memberInfos.get(id);
BydXiaoHongShuAuthorDayVO.MemberInfo infoVo = new BydXiaoHongShuAuthorDayVO.MemberInfo();
infoVo.setMemberId(info.getMatrixMemberId());
infoVo.setMemberCode(info.getMatrixMemberCode());
infoVo.setMemberName(info.getMatrixMemberName());
infoVo.setAreaName(info.getAreaName());
infoVo.setVillageName(info.getVillageName());
infoVo.setPrincipalName(info.getPrincipalName());
infoVo.setCityName(info.getCityName());
infoVo.setProvinceName(info.getProvinceName());
return infoVo;
}).collect(Collectors.toList()));
} else {
vo.setMemberInfos(new ArrayList<>());
System.out.println(authorInfo.getAuthorId());
}
vo.setStatsDate(x.getStatisticsDay());
vo.setFansCntTotal(x.getFansCountTotal());
vo.setFansCntDi(x.getFansCountTotalDi());
vo.setNoteCntDi(x.getNoteCountDi());
vo.setNoteLikeCntDi(x.getDiggCountDi());
vo.setNoteCommentCntDi(x.getNoteCommentCountDi());
vo.setNoteFavoriteCntDi(x.getCollectCountDi());
vo.setNoteShareCntDi(x.getNoteShareCountDi());
return vo;
}).collect(Collectors.toList());
return BasePageVO.restPage((int) data.getCurrent(), (int) data.getSize(), (int) data.getTotal(), (int) data.getPages(), voList);
}
public BasePageVO<BydXiaoHongShuNoteDayVO> fetchNoteDaySnap(PrincipalEnum principal,
LocalDate statsStart, LocalDate statsEnd,
LocalDate pubStart, LocalDate pubEnd,
Integer currentPage, Integer pageSize){
Page<XiaoHongShuNoteDay> page = new Page<>(currentPage, pageSize);
Page<XiaoHongShuNoteDay> data = noteDayMapper.queryNoteDayByPrincipalId(page, principal.id, statsStart, statsEnd, pubStart, pubEnd);
List<String> noteIds = data.getRecords().stream().map(XiaoHongShuNoteDay::getNoteId).distinct().collect(Collectors.toList());
Map<String, XiaoHongShuNoteInfo> noteInfos = noteInfoMapper.queryNoteInfoListByNoteIds(noteIds).stream().distinct()
.collect(Collectors.toMap(XiaoHongShuNoteInfo::getNoteId, Function.identity()));
EsBaseQuery esQuery = new EsBaseQuery();
esQuery.terms("note_id", noteIds);
List<InnerHits<XiaoHongShuNoteDocQTO>> searchResult = noteDocService.search(esQuery).getHits().getHits();
Map<String, String> noteDocs = CollectionUtils.isNotEmpty(searchResult) ? searchResult.stream()
.map(InnerHits::getSource)
.collect(Collectors.toMap(XiaoHongShuNoteDocQTO::getNoteId, XiaoHongShuNoteDocQTO::getDescription))
: new HashMap<>();
List<BydXiaoHongShuNoteDayVO> voList = data.getRecords().stream().map(x->{
BydXiaoHongShuNoteDayVO vo = new BydXiaoHongShuNoteDayVO();
vo.setNoteId(x.getNoteId());
vo.setStatsDate(x.getStatisticsDay());
XiaoHongShuNoteInfo noteInfo = noteInfos.get(x.getNoteId());
if (Optional.ofNullable(noteInfo).isPresent()) {
vo.setNoteTitle(noteInfo.getNoteTitle());
vo.setPublishTime(noteInfo.getPublishTime());
vo.setNoteType(noteInfo.getNoteType());
vo.setShareUrl(noteInfo.getShareUrl());
vo.setCoverUrl(noteInfo.getCoverUrl());
vo.setTopicNames(noteInfo.getTopicNames());
}else {
System.out.println(x.getNoteId());
}
vo.setAuthorId(x.getAuthorId());
vo.setLikeCnt(x.getDiggCount());
vo.setCommentCnt(x.getCommentCount());
vo.setCollectCnt(x.getCollectCount());
vo.setShareCnt(x.getShareCount());
vo.setDescription(noteDocs.get(x.getNoteId()));
vo.setDataUpdateTime(x.getMtime());
return vo;
}).collect(Collectors.toList());
return BasePageVO.restPage((int) data.getCurrent(), (int) data.getSize(), (int) data.getTotal(), (int) data.getPages(), voList);
}
}
...@@ -4,16 +4,14 @@ import com.afanticar.afantiopenapi.mapper.*; ...@@ -4,16 +4,14 @@ import com.afanticar.afantiopenapi.mapper.*;
import com.afanticar.afantiopenapi.mapper.struct.HongqiAwemeIncentiveStructMapper; import com.afanticar.afantiopenapi.mapper.struct.HongqiAwemeIncentiveStructMapper;
import com.afanticar.afantiopenapi.mapper.struct.HongqiLiveIncentiveStructMapper; import com.afanticar.afantiopenapi.mapper.struct.HongqiLiveIncentiveStructMapper;
import com.afanticar.afantiopenapi.model.dto.FawActivityDTO; import com.afanticar.afantiopenapi.model.dto.FawActivityDTO;
import com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveMonthly; import com.afanticar.afantiopenapi.model.entity.*;
import com.afanticar.afantiopenapi.model.entity.HongqiAwemeIncentiveQuarter;
import com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveMonthly;
import com.afanticar.afantiopenapi.model.entity.HongqiLiveIncentiveQuarter;
import com.afanticar.afantiopenapi.model.vo.*; import com.afanticar.afantiopenapi.model.vo.*;
import com.afanticar.afantiopenapi.utils.BaseUtils; import com.afanticar.afantiopenapi.utils.BaseUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,10 +43,30 @@ public class FawOpenService { ...@@ -45,10 +43,30 @@ public class FawOpenService {
@Resource @Resource
DwdKuaishouAuthorInfoMapper dwdKuaishouAuthorInfoMapper; DwdKuaishouAuthorInfoMapper dwdKuaishouAuthorInfoMapper;
@Resource
HongqiProjectStoreExpectedValueInfoMapper hongqiProjectStoreExpectedValueInfoMapper;
static String monthly = "monthly"; static String monthly = "monthly";
static String quarter = "quarter"; static String quarter = "quarter";
public BasePageVO<HongqiProjectStoreExpectedValueInfo> getStatisticsInfo(String storeCode, Integer expectedMonth, Integer uploadMonth, Integer pageNum, Integer pageSize) {
PageHelper.orderBy(" expected_month desc ");
IPage<HongqiProjectStoreExpectedValueInfo> page = new Page<>(pageNum, pageSize);
QueryWrapper<HongqiProjectStoreExpectedValueInfo> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(storeCode)) {
queryWrapper.eq("store_code", storeCode);
}
if (expectedMonth != null) {
queryWrapper.eq("expected_month", expectedMonth);
}
if (uploadMonth != null) {
queryWrapper.eq("upload_month", uploadMonth);
}
IPage<HongqiProjectStoreExpectedValueInfo> awemePage = hongqiProjectStoreExpectedValueInfoMapper.selectPage(page, queryWrapper);
return BasePageVO.restPage(pageNum, (int) awemePage.getSize(), (int) awemePage.getTotal(), (int) awemePage.getPages(), awemePage.getRecords());
}
public BasePageVO<HongqiAwemeIncentiveVO> awemes(Date publishDateStart, Date publishDateEnd, String type, Integer pageNum, Integer pageSize) { public BasePageVO<HongqiAwemeIncentiveVO> awemes(Date publishDateStart, Date publishDateEnd, String type, Integer pageNum, Integer pageSize) {
try { try {
TimeUnit.MILLISECONDS.sleep(500L); TimeUnit.MILLISECONDS.sleep(500L);
......
package com.afanticar.afantiopenapi.service;
import com.afanticar.afantiopenapi.model.qto.XiaoHongShuNoteDocQTO;
import com.afanticar.core.service.EsBaseService;
import org.springframework.stereotype.Service;
@Service
public class XiaoHongShuNoteDocService extends EsBaseService<XiaoHongShuNoteDocQTO> {
}
...@@ -18,6 +18,7 @@ spring: ...@@ -18,6 +18,7 @@ spring:
- data-id: dynamic-db-afanti-bi-app-vault.yml - data-id: dynamic-db-afanti-bi-app-vault.yml
- data-id: common-redis.yml - data-id: common-redis.yml
- data-id: afanti-open-api.yml - data-id: afanti-open-api.yml
- data-id: common-spark-es-vault.yml
vault: vault:
uri: https://vault.afanticar.com uri: https://vault.afanticar.com
authentication: approle authentication: approle
...@@ -46,6 +47,15 @@ spring: ...@@ -46,6 +47,15 @@ spring:
username-property: spring.datasource.dynamic.datasource.tmp.username username-property: spring.datasource.dynamic.datasource.tmp.username
password-property: spring.datasource.dynamic.datasource.tmp.password password-property: spring.datasource.dynamic.datasource.tmp.password
elasticsearch:
enabled: true
backend: ${spring.profiles.active}db
role: sparkes-role
username-property: elasticsearch.username
password-property: elasticsearch.password
mvc:
date-format: "yyyy-MM-dd"
# #
# #
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment