提交 b1a419f3 authored 作者: 陈世营's avatar 陈世营

loit-api

上级 33891963
...@@ -7,9 +7,11 @@ ...@@ -7,9 +7,11 @@
<groupId>com.loit</groupId> <groupId>com.loit</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-common</artifactId> <artifactId>loit-common</artifactId>
<name>loit-common</name>
<version>1.0.2</version>
<dependencies> <dependencies>
<!--实体转换类--> <!--实体转换类-->
......
<?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">
<parent>
<artifactId>loit-service-api</artifactId>
<groupId>com.loit</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-file-api</artifactId>
<name>loit-file-api</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-common</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.loit.api.config;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Description: Feign 文件上传必须配置
* @Author: yangwenbin
* @Date: 2020/5/13 15:45
*/
@Configuration
public class MultipartSupportConfig {
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
}
package com.loit.api.service.loituser;
import com.loit.api.config.MultipartSupportConfig;
import com.loit.common.json.AjaxJson;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
/**
* @Description: 文件操作Feign声明
* @Author: yangwenbin
* @Date: 2020/5/13 13:21
*/
@FeignClient(name = "loit-file",configuration = MultipartSupportConfig.class)
public interface FileApiService {
/**
* @desc 单文件上传
*/
@PostMapping(value = "/api/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxJson fileUpload(@RequestPart(value = "file", required = true) MultipartFile file);
/**
* @desc 多文件上传
*/
@PostMapping(value = "/api/uploadFiles",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxJson fileUpload(@RequestParam(value = "file", required = true) MultipartFile[] file);
/**
* @desc 文件下载
*/
@GetMapping(value="/api/file/download",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Response downloadFile(@RequestParam("filePath")String filePath);
/**
* @desc 删除文件
*/
@GetMapping(value="/api/file/delete")
public AjaxJson deleteFile(@RequestParam("filePath")String filePath);
}
package com.loit.api.service.loituser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.loit.api.service.loituser.impl.PersonApiServiceImpl;
import com.loit.common.json.AjaxJson;
/**
* @ClassName: PersonApiService
* @Description:
* @author zhaokz
* @date 2019年11月28日 下午6:49:52
* @version V1.0
*/
@FeignClient(name = "loit-file",fallback = PersonApiServiceImpl.class)
public interface PersonApiService {
@DeleteMapping(value="/api/file/delete")
public AjaxJson photoDelete(@RequestParam("filePath") String filePath);
}
package com.loit.api.service.loituser.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.loit.api.service.loituser.PersonApiService;
import com.loit.common.json.AjaxJson;
import com.loit.common.spring.timeloit.utils.LoitStatusCode;
@Component
public class PersonApiServiceImpl implements PersonApiService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public AjaxJson photoDelete(String filePath) {
AjaxJson json = new AjaxJson();
logger.info("服务未在线。");
json.setMsg("服务未在线,请稍后重试。");
json.setSuccess(false);
json.setCode(LoitStatusCode.FAIL.statusCode);
return json;
}
}
<?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">
<parent>
<artifactId>loit-service-api</artifactId>
<groupId>com.loit</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-gateway-api</artifactId>
<name>loit-gateway-api</name>
<url>http://maven.apache.org</url>
</project>
\ No newline at end of file
package com.loit.api.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.loit.common.json.AjaxJson;
import java.util.List;
/**
* @ClassName: PersonApiService
* @Description:
* @author zhaokz
* @date 2019年11月28日 下午6:49:52
* @version V1.0
*/
@FeignClient(name = "loit-getway")
public interface OnlineUserCountApiService {
/**
* 登录,设置用户在线时间
* @return
*/
@GetMapping(value = "/online/user/save")
void saveOnline(@RequestParam(value = "userId", required = true) String userId);
/**
* 登出,删除在线用户信息
* @return
*/
@GetMapping(value = "/online/user/delete")
void deleteOnline(@RequestParam(value = "userId", required = true) String userId);
/**
* 获取在线用户数量
* @return
*/
@GetMapping(value = "/online/user/count")
AjaxJson<Long> onlineUserCount();
/**
* 获取在线用户列表
* @return
*/
@GetMapping(value = "/online/user/list")
AjaxJson<List<String>> onlineUserList();
}
<?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">
<parent>
<artifactId>loit-service-api</artifactId>
<groupId>com.loit</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-notice-api</artifactId>
<name>loit-notice-api</name>
<url>http://maven.apache.org</url>
</project>
\ No newline at end of file
package com.loit.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 消息表数据对象.
* Created by WBJ on 2020-04-23.
**/
@ApiModel(value = "Message", description = "消息表对象")
public class Message implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 消息id
*/
@ApiModelProperty(value = "消息id")
private Integer id;
/**
* 消息类型
*/
@ApiModelProperty(value = "消息类型")
private String noticeType;
/**
* 消息标题
*/
@ApiModelProperty(value = "消息标题")
private String noticeTopic;
/**
* 消息内容
*/
@ApiModelProperty(value = "消息内容")
private String noticeContent;
/**
* 消息来源
*/
@ApiModelProperty(value = "消息来源")
private String noticeSource;
/**
* 发送人
*/
@ApiModelProperty(value = "发送人")
private String sendId;
/**
* 发送人名称
*/
@ApiModelProperty(value = "发送人名称")
private String sendName;
/**
* 紧急程度(1一般,2紧急)
*/
@ApiModelProperty(value = "紧急程度(1一般,2紧急)")
private String noticeLevel;
/**
* 广播消息标记
*/
@ApiModelProperty(value = "广播消息标记")
private String allFlag;
/**
* url
*/
@ApiModelProperty(value = "url")
private String urlName;
/**
* 按钮
*/
@ApiModelProperty(value = "按钮")
private String buttonName;
/**
* 接收人list
*/
@ApiModelProperty(value = "接收人list")
private String receiveIds;
/**
* 消息ids
*/
@ApiModelProperty(value = "消息ids")
private String noticeIds;
/**
* 状态(未读0,已读1)
*/
private String noticeStatus;
/**
* 接收人
*/
private String receiveId;
/**
* 消息类型name
*/
@ApiModelProperty(value = "消息类型name")
private String noticeTypeName;
/**
* 消息来源name
*/
@ApiModelProperty(value = "消息来源name")
private String noticeSourceName;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08")
private Date createTimeStart;
@ApiModelProperty(value = "结束日期")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08")
private Date createTimeEnd;
/**
*排序字段名
*/
@ApiModelProperty(value = "排序字段名")
private String orderByName;
/**
*排序类型
*/
@ApiModelProperty(value = "排序类型 asc/desc")
private String orderBy;
@ApiModelProperty(value = "app_id")
private Integer appId;
@ApiModelProperty(value = "resource_url")
private String resourceUrl;
@ApiModelProperty(value = "menu_name")
private String menuName;
@ApiModelProperty(value = "res_context_value")
private String resContextValue;
@ApiModelProperty(value = "entrance_url")
private String entranceUrl;
@ApiModelProperty(value = "entrance_name")
private String entranceName;
@ApiModelProperty(value = "menu_context_value")
private String menuContextValue;
@ApiModelProperty(value = "children")
private List children;
@ApiModelProperty(value = "通知管理id")
private Integer noticeTypeId;
public Message() {
}
public void setId(Integer id){
this.id = id;
}
public Integer getId(){
return this.id;
}
public void setNoticeType(String noticeType){
this.noticeType = noticeType;
}
public String getNoticeType(){
return this.noticeType;
}
public void setNoticeTopic(String noticeTopic){
this.noticeTopic = noticeTopic;
}
public String getNoticeTopic(){
return this.noticeTopic;
}
public void setNoticeContent(String noticeContent){
this.noticeContent = noticeContent;
}
public String getNoticeContent(){
return this.noticeContent;
}
public void setNoticeSource(String noticeSource){
this.noticeSource = noticeSource;
}
public String getNoticeSource(){
return this.noticeSource;
}
public void setNoticeLevel(String noticeLevel){
this.noticeLevel = noticeLevel;
}
public String getNoticeLevel(){
return this.noticeLevel;
}
public void setAllFlag(String allFlag){
this.allFlag = allFlag;
}
public String getAllFlag(){
return this.allFlag;
}
public String getNoticeSourceName() {
return noticeSourceName;
}
public void setNoticeSourceName(String noticeSourceName) {
this.noticeSourceName = noticeSourceName;
}
public String getNoticeTypeName() {
return noticeTypeName;
}
public void setNoticeTypeName(String noticeTypeName) {
this.noticeTypeName = noticeTypeName;
}
public String getNoticeStatus() {
return noticeStatus;
}
public void setNoticeStatus(String noticeStatus) {
this.noticeStatus = noticeStatus;
}
public Date getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(Date createTimeStart) {
this.createTimeStart = createTimeStart;
}
public Date getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(Date createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public String getNoticeIds() {
return noticeIds;
}
public void setNoticeIds(String noticeIds) {
this.noticeIds = noticeIds;
}
public String getOrderByName() {
return orderByName;
}
public void setOrderByName(String orderByName) {
this.orderByName = orderByName;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public String getSendId() {
return sendId;
}
public String getSendName() {
return sendName;
}
public void setSendName(String sendName) {
this.sendName = sendName;
}
public void setSendId(String sendId) {
this.sendId = sendId;
}
public String getReceiveIds() {
return receiveIds;
}
public void setReceiveIds(String receiveIds) {
this.receiveIds = receiveIds;
}
public String getReceiveId() {
return receiveId;
}
public void setReceiveId(String receiveId) {
this.receiveId = receiveId;
}
public String getUrlName() {
return urlName;
}
public void setUrlName(String urlName) {
this.urlName = urlName;
}
public String getButtonName() {
return buttonName;
}
public void setButtonName(String buttonName) {
this.buttonName = buttonName;
}
public void setAppId(Integer appId){
this.appId = appId;
}
public Integer getAppId(){
return this.appId;
}
public void setResourceUrl(String resourceUrl){
this.resourceUrl = resourceUrl;
}
public String getResourceUrl(){
return this.resourceUrl;
}
public void setMenuName(String menuName){
this.menuName = menuName;
}
public String getMenuName(){
return this.menuName;
}
public void setResContextValue(String resContextValue){
this.resContextValue = resContextValue;
}
public String getResContextValue(){
return this.resContextValue;
}
public void setEntranceUrl(String entranceUrl){
this.entranceUrl = entranceUrl;
}
public String getEntranceUrl(){
return this.entranceUrl;
}
public void setEntranceName(String entranceName){
this.entranceName = entranceName;
}
public String getEntranceName(){
return this.entranceName;
}
public void setMenuContextValue(String menuContextValue){
this.menuContextValue = menuContextValue;
}
public String getMenuContextValue(){
return this.menuContextValue;
}
public List getChildren() {
return children;
}
public void setChildren(List children) {
this.children = children;
}
public Integer getNoticeTypeId() {
return noticeTypeId;
}
public void setNoticeTypeId(Integer noticeTypeId) {
this.noticeTypeId = noticeTypeId;
}
}
package com.loit.api.service;
import com.loit.api.dto.Message;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @description: NoticeApiService
* @date: 2020/4/26 14:37
* @author: wubj
* @version v1.0
*/
@FeignClient(name = "loit-notice")
public interface MessageApiService {
/**
* 消息推送
*/
@ApiOperation(value = "消息推送", notes = "消息推送")
@PostMapping("api/v1/feign/message/propel")
AjaxJson propel(@RequestBody Message message);
/**
* 标记消息为已读
*/
@ApiOperation(value = "标记消息为已读", notes = "标记消息为已读")
@PostMapping("api/v1/feign/message/updateStatus")
AjaxJson updateStatus(@RequestBody Message message);
}
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
<version>1.0.0</version> <version>1.0.0</version>
<modules> <modules>
<module>loit-portal-api</module> <module>loit-portal-api</module>
<module>loit-file-api</module>
<module>loit-notice-api</module>
<module>loit-gateway-api</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论