小红书模块

master
wujingtao 2 years ago
parent 38b5c3809a
commit b59253596d

@ -0,0 +1,29 @@
package com.baiye.controller;
import com.baiye.core.base.api.Result;
import com.baiye.query.SourceOrganizeQuery;
import com.baiye.service.SourceOrganizeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* @author jt
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/xhs/source/organize")
@Api(tags = "小红书资源组管理")
public class ResourceOrganizeController {
private final SourceOrganizeService sourceOrganizeService;
@GetMapping("/query")
@ApiOperation("资源组管理")
public Result<Object> querySourceOrganize(@RequestBody SourceOrganizeQuery sourceOrganizeQuery) {
return sourceOrganizeService.querySourceOrganize(sourceOrganizeQuery);
}
}

@ -0,0 +1,63 @@
#配置数据源
spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
redis:
database: 4
host: 8.130.96.163
timeout: 5000
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://8.130.96.163:3306/db_xhs?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username: root
password: y7z7noq2
# 初始连接数
initial-size: 5
# 最小连接数
min-idle: 15
# 最大连接数
max-active: 30
# 超时时间(以秒数为单位)
remove-abandoned-timeout: 180
# 获取连接超时时间
max-wait: 3000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis: 900000
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
test-while-idle: true
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
test-on-borrow: true
# 是否在归还到池中前进行检验
test-on-return: false
# 检测连接是否有效
validation-query: select 1
# 配置监控统计
webStatFilter:
enabled: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
filter:
stat:
enabled: true
# 记录慢SQL
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
#是否开启 swagger-ui
swagger:
enabled: true

@ -0,0 +1,77 @@
server:
port: 7755
#websocket:
# port: 8100
# url: websocket
spring:
main:
allow-bean-definition-overriding: true
application:
name: cdp-tool-xhs-api
freemarker:
check-template-location: false
profiles:
active: dev
jackson:
time-zone: GMT+8
data:
redis:
repositories:
enabled: false
servlet:
multipart:
max-request-size: 200MB
max-file-size: 200MB
mybatis-plus:
mapper-locations: classpath:mapper/*Mapper.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #控制台打印sql语句
snowflake:
workerId: 9
datacenterId: 9
# 线程池配置
save:
task:
thread_pool:
corePoolSize: 2
maxPoolSize: 16
queueCapacity: 3
ThreadNamePrefix: poolExecutor-
# 文件存储路径
file:
mac:
path: ~/file/
picture: ~/sop/picture/
linux:
path: /home/eladmin/file/
picture: /home/eladmin/sop/picture/
windows:
path: H:\file\
picture: H:\file\sop\picture\
# 文件大小 /M
maxSize: 100
pictureMaxSize: 5
security:
oauth2:
client:
clientId: admin-web
clientSecret: 123456
userAuthorizationUri: http://auth-server:7070/oauth/authorize
grant-type: password
scope: server
access-token-uri: http://auth-server:7070/oauth/token
resource:
token-info-uri: http://auth-server:7070/oauth/check_token
ignore:
urls:
- /v2/api-docs
- /actuator/**
- /user/info/*
- /operlog
- /logininfor
- /oauth/check_token

@ -0,0 +1,12 @@
package com.baiye.dao;
import com.baiye.entity.Source;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author jt
*/
@Mapper
public interface SourceMapper extends BaseMapper<Source> {
}

@ -0,0 +1,12 @@
package com.baiye.dao;
import com.baiye.entity.SourceOrganize;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author jt
*/
@Mapper
public interface SourceOrganizeMapper extends BaseMapper<SourceOrganize> {
}

@ -0,0 +1,12 @@
package com.baiye.dao;
import com.baiye.entity.Template;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author jt
*/
@Mapper
public interface TemplateMapper extends BaseMapper<Template> {
}

@ -0,0 +1,12 @@
package com.baiye.dao;
import com.baiye.entity.Variable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author jt
*/
@Mapper
public interface VariableMapper extends BaseMapper<Variable> {
}

@ -0,0 +1,43 @@
package com.baiye.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author jt
*/
@Data
@TableName("tb_source")
@ApiOperation("资源 素材包")
public class Source implements Serializable {
private static final long serialVersionUID = -7281246000750520229L;
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "ID", hidden = true)
private Long id;
@ApiModelProperty(value = "素材包名称")
private String sourceName;
@ApiModelProperty(value = "类型 1-图片 2-文字 3-文字模板")
private Integer sourceType;
@ApiModelProperty(value = "素材包描述")
private String sourceRemark;
@ApiModelProperty(value = "素材组id")
private String organizeId;
@ApiModelProperty(value = "创建人")
private Long createBy;
@ApiModelProperty(value = "创建时间")
private Date creatTime;
}

@ -0,0 +1,36 @@
package com.baiye.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author jt
*/
@Data
@TableName("tb_source_organize")
@ApiOperation("资源 素材包 组")
public class SourceOrganize implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "ID", hidden = true)
private Long id;
@ApiModelProperty(value = "组名称")
private String organizeName;
@ApiModelProperty(value = "组描述")
private String organizeRemark;
@ApiModelProperty(value = "素材组id")
private String organizeId;
@ApiModelProperty(value = "创建时间")
private Date creatTime;
}

@ -0,0 +1,30 @@
package com.baiye.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
/**
* @author jt
*/
@Data
@TableName("tb_template")
@ApiOperation("模板")
public class Template implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "ID", hidden = true)
private Long id;
@ApiModelProperty(value = "素材包id")
private String sourceId;
@ApiModelProperty(value = "模板内容")
private String templateContent;
}

@ -0,0 +1,29 @@
package com.baiye.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
/**
* @author jt
*/
@Data
@TableName("tb_variable")
@ApiOperation("变量库")
public class Variable implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "ID", hidden = true)
private Long id;
@ApiModelProperty(value = "变量序号")
private Integer number;
@ApiModelProperty(value = "模板id")
private String templateId;
}

@ -0,0 +1,29 @@
package com.baiye.query;
import com.baiye.annotation.Query;
import com.baiye.annotation.type.SelectType;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author jt
*/
@Data
public class SourceOrganizeQuery {
/**
* id
*/
@TableId(type = IdType.INPUT)
@ApiModelProperty(value = "资源组id")
private Long id;
/**
*
*/
@Query(type = SelectType.INNER_LIKE)
@ApiModelProperty(value = "组名称")
private String organizeName;
}

@ -0,0 +1,33 @@
package com.baiye.config;
import com.alibaba.alicloud.context.AliCloudProperties;
import com.alibaba.alicloud.context.oss.OssProperties;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
/**
* @author Enzo
* @date : 2022/8/15
*/
@Configuration
@RequiredArgsConstructor
public class OssConfig {
private final OssProperties ossProperties;
private final AliCloudProperties aliCloudProperties;
@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public OSS ossClient() {
return new OSSClientBuilder().build
(ossProperties.getEndpoint(),
aliCloudProperties.getAccessKey(),
aliCloudProperties.getSecretKey());
}
}

@ -0,0 +1,17 @@
package com.baiye.service;
import com.baiye.core.base.api.Result;
import com.baiye.query.SourceOrganizeQuery;
/**
* @author jt
*/
public interface SourceOrganizeService {
/**
*
*
* @param sourceOrganizeQuery
* @return
*/
Result<Object> querySourceOrganize(SourceOrganizeQuery sourceOrganizeQuery);
}

@ -0,0 +1,29 @@
package com.baiye.service.impl;
import com.baiye.core.base.api.Result;
import com.baiye.dao.SourceOrganizeMapper;
import com.baiye.entity.SourceOrganize;
import com.baiye.query.SourceOrganizeQuery;
import com.baiye.service.SourceOrganizeService;
import com.baiye.util.QueryHelpUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author jt
*/
@Service
@RequiredArgsConstructor
public class SourceOrganizeServiceImpl implements SourceOrganizeService {
private final SourceOrganizeMapper sourceOrganizeMapper;
@Override
public Result<Object> querySourceOrganize(SourceOrganizeQuery sourceOrganizeQuery) {
QueryWrapper<SourceOrganize> queryWrapper = QueryHelpUtils.getWrapper(sourceOrganizeQuery, SourceOrganize.class);
List<SourceOrganize> sourceOrganizes = sourceOrganizeMapper.selectList(queryWrapper);
return Result.data(sourceOrganizes);
}
}

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.baiye.dao.SourceMapper">
</mapper>
Loading…
Cancel
Save