feat:增加op-api
This commit is contained in:
parent
d7c9100f8d
commit
84268d8a93
@ -96,6 +96,18 @@
|
||||
<artifactId>black-list-service</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>op-api</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>op-server</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
32
op/op-api/pom.xml
Normal file
32
op/op-api/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>op</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>op-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>op-api</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.framework</groupId>
|
||||
<artifactId>axzo-common-domain</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.basics</groupId>
|
||||
<artifactId>basics-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
110
op/op-api/src/main/java/cn/axzo/nanopart/api/OpApi.java
Normal file
110
op/op-api/src/main/java/cn/axzo/nanopart/api/OpApi.java
Normal file
@ -0,0 +1,110 @@
|
||||
package cn.axzo.nanopart.api;
|
||||
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.pokonyan.dao.page.IPageParam;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "nanopart", url = "http://nanopart:8080")
|
||||
public interface OpApi {
|
||||
|
||||
@PostMapping("/api/op-message-config/page")
|
||||
ApiPageResult<OpMessageConfigResp> page(@RequestBody PageOpMessageConfigReq req);
|
||||
|
||||
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class ListOpMessageConfigReq {
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private Date planStartTimeLE;
|
||||
|
||||
private String status;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class PageOpMessageConfigReq extends ListOpMessageConfigReq implements IPageParam {
|
||||
Integer pageNumber;
|
||||
|
||||
Integer pageSize;
|
||||
|
||||
/**
|
||||
* 排序:使用示例,createTime__DESC
|
||||
*/
|
||||
List<String> sort;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
class OpMessageConfigResp {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* im-center服务im_message_task的id
|
||||
*/
|
||||
private Long imMessageTaskId;
|
||||
|
||||
/**
|
||||
* 消息名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 发送者的三方平台账号id
|
||||
*/
|
||||
private String sendImAccount;
|
||||
|
||||
/**
|
||||
* 消息接收配置
|
||||
*/
|
||||
private JSONObject receiveData;
|
||||
|
||||
private String status;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private String contentType;
|
||||
|
||||
@TableField(value = "cover_img")
|
||||
private String coverImg;
|
||||
|
||||
private JSONObject jumpData;
|
||||
|
||||
private JSONObject pushData;
|
||||
|
||||
private JSONObject ext;
|
||||
|
||||
private Date planStartTime;
|
||||
|
||||
private Date startedTime;
|
||||
|
||||
private Date finishedTime;
|
||||
|
||||
private Integer isDelete;
|
||||
|
||||
private Date createAt;
|
||||
|
||||
private Date updateAt;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.nanopart.api.config;
|
||||
|
||||
import cn.axzo.nanopart.api.constant.NanopartConstant;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients(NanopartConstant.BASIC_FEIGN_PACKAGE)
|
||||
public class NanopartApiAutoConfiguration {
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package cn.axzo.nanopart.api.constant;
|
||||
|
||||
/**
|
||||
* @author: chenwenjian
|
||||
* @date: 2023/8/14 9:38
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class NanopartConstant {
|
||||
|
||||
public static final String BASIC_FEIGN_PACKAGE = "cn.axzo.nanopart.api";
|
||||
}
|
||||
2
op/op-api/src/main/resources/META-INF/spring.factories
Normal file
2
op/op-api/src/main/resources/META-INF/spring.factories
Normal file
@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
cn.axzo.nanopart.api.config.NanopartApiAutoConfiguration
|
||||
45
op/op-server/pom.xml
Normal file
45
op/op-server/pom.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>op</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>op-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>op-server</name>
|
||||
|
||||
<dependencies>
|
||||
<!--mybatis-plus-->
|
||||
<dependency>
|
||||
<groupId>cn.axzo.framework</groupId>
|
||||
<artifactId>axzo-mybatisplus-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.basics</groupId>
|
||||
<artifactId>basics-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>op-api</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.pokonyan</groupId>
|
||||
<artifactId>pokonyan</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,33 @@
|
||||
package cn.axzo.op.controller;
|
||||
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.nanopart.api.OpApi;
|
||||
import cn.axzo.op.domain.OpMessageConfig;
|
||||
import cn.axzo.op.service.OpMessageConfigService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class OpMessageConfigController implements OpApi {
|
||||
|
||||
@Autowired
|
||||
private OpMessageConfigService opMessageConfigService;
|
||||
|
||||
@Override
|
||||
public ApiPageResult<OpMessageConfigResp> page(PageOpMessageConfigReq param) {
|
||||
OpMessageConfigService.PageOpMessageConfigParam pageOpMessageConfigParam = OpMessageConfigService.PageOpMessageConfigParam.builder().build();
|
||||
BeanUtils.copyProperties(param, pageOpMessageConfigParam);
|
||||
|
||||
Page<OpMessageConfig> page = opMessageConfigService.page(pageOpMessageConfigParam);
|
||||
|
||||
return ApiPageResult.ok(page.convert(record -> {
|
||||
OpMessageConfigResp opMessageConfigResp = OpMessageConfigResp.builder().build();
|
||||
BeanUtils.copyProperties(record, opMessageConfigResp);
|
||||
return opMessageConfigResp;
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
package cn.axzo.op.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "`op_message_config`", autoResultMap = true)
|
||||
public class OpMessageConfig {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* im-center服务im_message_task的id
|
||||
*/
|
||||
@TableField(value = "im_message_task_id")
|
||||
private Long imMessageTaskId;
|
||||
|
||||
/**
|
||||
* 消息名字
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 发送者的三方平台账号id
|
||||
*/
|
||||
@TableField(value = "send_im_account")
|
||||
private String sendImAccount;
|
||||
|
||||
/**
|
||||
* 消息接收配置
|
||||
*/
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject receiveData;
|
||||
|
||||
private Status status;
|
||||
|
||||
@TableField(value = "title")
|
||||
private String title;
|
||||
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
@TableField(value = "content_type")
|
||||
private String contentType;
|
||||
|
||||
@TableField(value = "cover_img")
|
||||
private String coverImg;
|
||||
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject jumpData;
|
||||
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject pushData;
|
||||
|
||||
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||
private JSONObject ext;
|
||||
|
||||
@TableField
|
||||
private Date planStartTime;
|
||||
|
||||
@TableField
|
||||
private Date startedTime;
|
||||
|
||||
@TableField
|
||||
private Date finishedTime;
|
||||
|
||||
@TableField
|
||||
private Integer isDelete;
|
||||
|
||||
@TableField
|
||||
private Date createAt;
|
||||
|
||||
@TableField
|
||||
private Date updateAt;
|
||||
|
||||
public enum Status {
|
||||
DRAFT,
|
||||
PENDING,
|
||||
RUNNING,
|
||||
COMPLETED,
|
||||
;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.op.mapper;
|
||||
|
||||
import cn.axzo.op.domain.OpMessageConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface OpMessageConfigMapper extends BaseMapper<OpMessageConfig> {
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package cn.axzo.op.service;
|
||||
|
||||
import cn.axzo.nanopart.api.OpApi;
|
||||
import cn.axzo.op.domain.OpMessageConfig;
|
||||
import cn.axzo.pokonyan.dao.page.IPageParam;
|
||||
import cn.axzo.pokonyan.dao.wrapper.CriteriaField;
|
||||
import cn.axzo.pokonyan.dao.wrapper.Operator;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface OpMessageConfigService extends IService<OpMessageConfig> {
|
||||
|
||||
Page<OpMessageConfig> page(PageOpMessageConfigParam param);
|
||||
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class ListOpMessageConfigParam {
|
||||
|
||||
@CriteriaField(field = "id", operator = Operator.IN)
|
||||
private List<Long> ids;
|
||||
|
||||
@CriteriaField(field = "planStartTime", operator = Operator.LE)
|
||||
private Date planStartTimeLE;
|
||||
|
||||
@CriteriaField(field = "status", operator = Operator.EQ)
|
||||
private OpMessageConfig.Status status;
|
||||
}
|
||||
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class PageOpMessageConfigParam extends ListOpMessageConfigParam implements IPageParam {
|
||||
@CriteriaField(ignore = true)
|
||||
Integer pageNumber;
|
||||
|
||||
@CriteriaField(ignore = true)
|
||||
Integer pageSize;
|
||||
|
||||
/**
|
||||
* 排序:使用示例,createTime__DESC
|
||||
*/
|
||||
@CriteriaField(ignore = true)
|
||||
List<String> sort;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.axzo.op.service.impl;
|
||||
|
||||
import cn.axzo.op.domain.OpMessageConfig;
|
||||
import cn.axzo.op.mapper.OpMessageConfigMapper;
|
||||
import cn.axzo.op.service.OpMessageConfigService;
|
||||
import cn.axzo.pokonyan.dao.converter.PageConverter;
|
||||
import cn.axzo.pokonyan.dao.mysql.QueryWrapperHelper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OpMessageConfigServiceImpl extends ServiceImpl<OpMessageConfigMapper, OpMessageConfig>
|
||||
implements OpMessageConfigService {
|
||||
|
||||
@Override
|
||||
public Page<OpMessageConfig> page(PageOpMessageConfigParam param) {
|
||||
QueryWrapper<OpMessageConfig> wrapper = QueryWrapperHelper.fromBean(param, OpMessageConfig.class);
|
||||
wrapper.eq("is_delete", 0);
|
||||
|
||||
return this.page(PageConverter.convertToMybatis(param, OpMessageConfig.class), wrapper);
|
||||
}
|
||||
}
|
||||
25
op/op-server/src/test/resources/mysql/schema.sql
Normal file
25
op/op-server/src/test/resources/mysql/schema.sql
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS op_message_config
|
||||
(
|
||||
id bigint auto_increment comment '主键',
|
||||
im_message_task_id bigint null comment 'im-center服务im_message_task的id',
|
||||
`name` varchar(50) not null comment '消息名字',
|
||||
send_im_account varchar(100) not null comment '发送者的三方平台账号id',
|
||||
receive_data json not null comment '消息接收配置',
|
||||
status varchar(32) not null default 'DRAFT' comment '消息状态:DRAFT、PENDING、RUNNING、COMPLETED',
|
||||
title varchar(128) not null default '' comment '消息标题',
|
||||
content varchar(512) not null default '' comment '消息内容',
|
||||
content_type varchar(32) not null comment '消息形式:IMAGE_TEXT_SAMPLE',
|
||||
cover_img varchar(512) not null default '' comment '消息封面大图',
|
||||
jump_data json comment '跳转配置',
|
||||
push_data json comment 'push配置',
|
||||
ext varchar(1024) not null default '{}' COMMENT '其它额外信息',
|
||||
plan_start_time DATETIME(3) not null comment '任务计划开始时间,时间大于改时间会对未完成的任务进行执行操作',
|
||||
started_time DATETIME(3) null comment '实际开始时间',
|
||||
finished_time DATETIME(3) null comment '实际完成时间',
|
||||
is_delete tinyint default 0 not null comment '未删除0,删除1',
|
||||
create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
update_at datetime default CURRENT_TIMESTAMP not null comment '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8 comment '运营消息配置';
|
||||
25
op/pom.xml
Normal file
25
op/pom.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>nanopart</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>op</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>op</name>
|
||||
|
||||
<modules>
|
||||
<module>op-api</module>
|
||||
<module>op-server</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
Loading…
Reference in New Issue
Block a user