viewtask 封装
parent
d790ac17ab
commit
912240c873
@ -0,0 +1,16 @@
|
|||||||
|
package com.docus.server.collect.web.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
public class BasicProperties {
|
||||||
|
@Value("${basic.pageSize}")
|
||||||
|
private Integer pageSize;
|
||||||
|
@Value("${basic.ratelimit}")
|
||||||
|
private Integer ratelimit;
|
||||||
|
@Value("${basic.ratetime}")
|
||||||
|
private Integer ratetime;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.docus.server.collect.web.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("noview.ch.newborn")
|
||||||
|
public class NoViewChNewbornProperties {
|
||||||
|
private String disdeptname;
|
||||||
|
private String syscode;
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.docus.server.collect.web.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("noview")
|
||||||
|
public class NoViewProperties {
|
||||||
|
private int hospital=0;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CollectionForJZHDto {
|
||||||
|
private List<String> jzhs;
|
||||||
|
private String syscode;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import com.docus.server.archivefile.pojo.entity.AfViewCollectionLog;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CollectionSaveDto {
|
||||||
|
private List<AfViewCollectionLog> updates = new ArrayList<>();
|
||||||
|
private List<AfViewCollectionLog> adds = new ArrayList<>();
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DaTypeDto {
|
||||||
|
private String oldtype;
|
||||||
|
private int newtype;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataFormatDto {
|
||||||
|
private List<DaTypeDto> datypes;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataSourceDto {
|
||||||
|
/**
|
||||||
|
* key, 4为视图来源
|
||||||
|
*/
|
||||||
|
private int key;
|
||||||
|
private String name;
|
||||||
|
private String url;
|
||||||
|
private String userName;
|
||||||
|
private String password;
|
||||||
|
private String driverClassName;
|
||||||
|
private String connectionTestQuery;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataSourcesDto {
|
||||||
|
|
||||||
|
private List<DataSourceDto> datasources;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataTransferJsonDto {
|
||||||
|
private DableJsonDto table;
|
||||||
|
private List<FieldJsonDto> fields;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MutliDataTransferJsonDto {
|
||||||
|
private List<DataTransferJsonDto> jsondatas;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class NoViewConfig {
|
||||||
|
/**
|
||||||
|
* 采集器代码
|
||||||
|
*/
|
||||||
|
private String syscode;
|
||||||
|
/**
|
||||||
|
* 出院科室
|
||||||
|
*/
|
||||||
|
private String deptname;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class NoViewMakeUpDto {
|
||||||
|
/**
|
||||||
|
* 补偿几天前
|
||||||
|
*/
|
||||||
|
private List<Integer> interval= Arrays.asList(3,7); ;
|
||||||
|
/**
|
||||||
|
* 采集器ids,以 , 分隔
|
||||||
|
*/
|
||||||
|
private String syscodes="1";
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto.two;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReportDownTwoDto {
|
||||||
|
@ApiModelProperty(value = "档案编号")
|
||||||
|
private String patientId;
|
||||||
|
@ApiModelProperty(value = "记账号")
|
||||||
|
private String jzh;
|
||||||
|
@ApiModelProperty(value = "档案类型")
|
||||||
|
private String recordType;
|
||||||
|
@ApiModelProperty(value = "档案时间")
|
||||||
|
private String createTime;
|
||||||
|
@ApiModelProperty(value = "患者信息")
|
||||||
|
private ReportPatientTwoDto patient =new ReportPatientTwoDto();
|
||||||
|
@ApiModelProperty(value = "住院信息")
|
||||||
|
private List<ReportHospitalTwoDto> hospitals = new ArrayList<>();
|
||||||
|
@ApiModelProperty(value = "任务信息")
|
||||||
|
private List<ReportTaskTwoDto> tasks = new ArrayList<>();
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto.two;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportHospitalTwoDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "患者id")
|
||||||
|
private String patientId;
|
||||||
|
@ApiModelProperty(value = "住院次数")
|
||||||
|
private Integer admissTimes;
|
||||||
|
@ApiModelProperty(value = "住院日期")
|
||||||
|
private String admissDate;
|
||||||
|
@ApiModelProperty(value = "出院日期")
|
||||||
|
private String disDate;
|
||||||
|
@ApiModelProperty(value = "出院科室名称")
|
||||||
|
private String disDeptName;
|
||||||
|
@ApiModelProperty(value = "卡号")
|
||||||
|
private String admissId;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto.two;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报打印 患者信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportPatientTwoDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "住院号/就诊号")
|
||||||
|
private String inpatientNo;
|
||||||
|
@ApiModelProperty(value = "患者姓名")
|
||||||
|
private String name;
|
||||||
|
@ApiModelProperty(value = "id号")
|
||||||
|
private String patientId;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.docus.server.collect.web.common.dto.two;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReportTaskTwoDto {
|
||||||
|
@ApiModelProperty(value = "采集器标识")
|
||||||
|
private String collectorId;
|
||||||
|
@ApiModelProperty(value = "任务id")
|
||||||
|
private Long taskId;
|
||||||
|
@ApiModelProperty(value = "患者id")
|
||||||
|
private String patientId;
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package com.docus.server.collect.web.domain;
|
package com.docus.server.collect.web.common.entity;
|
||||||
|
|
||||||
import com.docus.server.collect.web.enums.StateEnum;
|
|
||||||
import com.docus.server.collect.web.utils.DateSpiltUtil;
|
import com.docus.server.collect.web.utils.DateSpiltUtil;
|
||||||
import com.docus.server.collect.web.utils.PeriodTime;
|
import com.docus.server.collect.web.utils.PeriodTime;
|
||||||
|
import com.docus.server.common.enums.StateEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
@ -1,9 +1,11 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.collect.web.common.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.docus.server.collect.web.enums.CollectTypeEnum;
|
||||||
|
import com.docus.server.common.enums.StateEnum;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.docus.server.collect.web.enums;
|
||||||
|
|
||||||
|
public interface DisposeModeEnum {
|
||||||
|
public final static String mq="mq";
|
||||||
|
public final static String redis="redis";
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.docus.server.collect.web.enums;
|
||||||
|
|
||||||
|
public interface RedisKeyEnum {
|
||||||
|
public final static String QUEUEREDISKEY="docus:view:queue";
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.docus.server.collect.web.utils;
|
||||||
|
|
||||||
|
import com.docus.server.common.bean.MqQueue;
|
||||||
|
import com.docus.server.common.declare.AmQueueDeclare;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MqQueueUtils {
|
||||||
|
@Autowired
|
||||||
|
AmQueueDeclare amQueueDeclare;
|
||||||
|
|
||||||
|
public void DeclareQueue(String mqKey) {
|
||||||
|
MqQueue mqQueue = new MqQueue();
|
||||||
|
mqQueue.setName(mqKey);
|
||||||
|
mqQueue.setExclusive(false);
|
||||||
|
mqQueue.setAutoDelete(false);
|
||||||
|
mqQueue.setDurable(false);
|
||||||
|
if (!this.amQueueDeclare.isQueueExist(mqKey)) {
|
||||||
|
this.amQueueDeclare.declareQueue(mqQueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
|||||||
|
package com.docus.server.archivefile.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.docus.server.archivefile.pojo.entity.AfViewCollectionLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author linrf
|
||||||
|
* @date 2023/6/13 17:05
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AfViewCollectionLogMapper extends BaseMapper<AfViewCollectionLog> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.docus.server.archivefile.pojo.entity;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zengdl
|
||||||
|
* @website https://el-admin.vip
|
||||||
|
* @description /
|
||||||
|
* @date 2022-03-28
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("af_view_collection_log")
|
||||||
|
public class AfViewCollectionLog implements Serializable {
|
||||||
|
|
||||||
|
@TableId("id")
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("jzh")
|
||||||
|
@ApiModelProperty(value = "记帐号")
|
||||||
|
private String jzh;
|
||||||
|
|
||||||
|
@TableField("sys_code")
|
||||||
|
@ApiModelProperty(value = "采集器分类")
|
||||||
|
private String sysCode;
|
||||||
|
|
||||||
|
@TableField("file_id")
|
||||||
|
@ApiModelProperty(value = "文件id")
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
@TableField("file_modify_time")
|
||||||
|
@ApiModelProperty(value = "文件最后修改时间")
|
||||||
|
private String fileModifyTime;
|
||||||
|
|
||||||
|
@TableField("create_time")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public void copy(AfViewCollectionLog source) {
|
||||||
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.docus.server.archivefile.pojo.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zengdl
|
||||||
|
* @website https://el-admin.vip
|
||||||
|
* @description /
|
||||||
|
* @date 2022-09-02
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@TableName("af_collectsys_dictionary")
|
||||||
|
public class CollectsysDictionary implements Serializable {
|
||||||
|
|
||||||
|
@TableId("id")
|
||||||
|
@ApiModelProperty(value = "id 雪花算法")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("sys_code")
|
||||||
|
@ApiModelProperty(value = "采集来源系统编号")
|
||||||
|
private String sysCode;
|
||||||
|
|
||||||
|
@TableField("sys_name")
|
||||||
|
@ApiModelProperty(value = "采集来源系统名称")
|
||||||
|
private String sysName;
|
||||||
|
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
package com.docus.server.archivefile.service;
|
|
||||||
|
|
||||||
public interface B {
|
|
||||||
}
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.archivefile.service;
|
||||||
|
|
||||||
|
import com.docus.server.archivefile.pojo.entity.AfViewCollectionLog;
|
||||||
|
import com.docus.server.common.service.IBaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author linrf
|
||||||
|
* @date 2023/6/13 17:05
|
||||||
|
*/
|
||||||
|
public interface IAfViewCollectionLogService extends IBaseService<AfViewCollectionLog> {
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
package com.docus.server.archivefile.service.impl;
|
|
||||||
|
|
||||||
public class A {
|
|
||||||
}
|
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.docus.server.archivefile.service.impl;
|
||||||
|
|
||||||
|
import com.docus.server.archivefile.mapper.AfViewCollectionLogMapper;
|
||||||
|
import com.docus.server.archivefile.pojo.entity.AfViewCollectionLog;
|
||||||
|
import com.docus.server.archivefile.service.IAfViewCollectionLogService;
|
||||||
|
import com.docus.server.common.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author linrf
|
||||||
|
* @date 2023/6/13 17:06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AfViewCollectionLogServiceImpl extends BaseServiceImpl<AfViewCollectionLogMapper, AfViewCollectionLog> implements IAfViewCollectionLogService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.docus.server.common;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: CommonApplication
|
||||||
|
* @Package: com.amos.consumer
|
||||||
|
* @author: amos
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/6/28 0028 上午 11:50
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@SpringBootApplication(scanBasePackages = {"com.docus.server.common.thread"})
|
||||||
|
public class CommonApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CommonApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.docus.server.common.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: Result
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.bean
|
||||||
|
* @author: amos
|
||||||
|
* @Description: 结果类
|
||||||
|
* @date: 2019/6/28 0028 上午 9:51
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Result {
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* 信息
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
/**
|
||||||
|
* 数据
|
||||||
|
*/
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public Result(Integer code, String msg, Object data) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.common;
|
package com.docus.server.common.config;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.docus.server.common.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: Constants
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.constants
|
||||||
|
* @author: amos
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/6/28 0028 下午 15:59
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
/**
|
||||||
|
* 默认参数不能为空的提示信息
|
||||||
|
*/
|
||||||
|
public static final String PARAMETER_DEFAULT_NOT_NULL_EXCEPTION_MSG = "the parameter object could not be null";
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.docus.server.common.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: ExchangeProperty
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.constants
|
||||||
|
* @author: amos
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/6/28 0028 下午 15:18
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface RabbitMQProperty {
|
||||||
|
/**
|
||||||
|
* 队列的属性
|
||||||
|
*/
|
||||||
|
public interface QueueProperty {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交换机的属性
|
||||||
|
*/
|
||||||
|
public interface ExchangeProperty {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String ALTERNATE_EXCHANGE = "alternate-exchange";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.docus.server.common.declare;
|
||||||
|
|
||||||
|
import com.docus.server.common.bean.Result;
|
||||||
|
import com.docus.server.common.exception.RabbitMQExceptionUtils;
|
||||||
|
import com.docus.server.common.type.ResultEnum;
|
||||||
|
import com.docus.server.common.util.ValidateUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (C) 五月软件工作室
|
||||||
|
*
|
||||||
|
* @Package com.docus.viewtaskcollect.common.declare
|
||||||
|
* @ClassName AbstractDeclare
|
||||||
|
* @Description TODO
|
||||||
|
* @Author Amos
|
||||||
|
* @Modifier
|
||||||
|
* @Date 2019/6/29 20:28
|
||||||
|
* @Version 1.0
|
||||||
|
**/
|
||||||
|
public abstract class AbstractDeclare {
|
||||||
|
|
||||||
|
public final Log logger = LogFactory.getLog(this.getClass());
|
||||||
|
@Autowired
|
||||||
|
RabbitAdmin rabbitAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义的校验
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
public abstract void DefinedValidate(Object object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用校验
|
||||||
|
* 1. 校验字段是否是非空
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
public void validate(Object object) {
|
||||||
|
Result result = ValidateUtils.validate(object);
|
||||||
|
if (!ResultEnum.success().equals(result.getCode())) {
|
||||||
|
RabbitMQExceptionUtils.throwRabbitMQException(result.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DefinedValidate(object);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.docus.server.common.declare;
|
||||||
|
|
||||||
|
import com.docus.server.common.bean.MqExchange;
|
||||||
|
import com.docus.server.common.exception.RabbitMQException;
|
||||||
|
import com.docus.server.common.type.ExchangeTypeEnum;
|
||||||
|
import org.springframework.amqp.core.DirectExchange;
|
||||||
|
import org.springframework.amqp.core.Exchange;
|
||||||
|
import org.springframework.amqp.core.FanoutExchange;
|
||||||
|
import org.springframework.amqp.core.HeadersExchange;
|
||||||
|
import org.springframework.amqp.core.TopicExchange;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: AmExchangeDeclare
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.declare
|
||||||
|
* @author: amos
|
||||||
|
* @Description: 交换机声明
|
||||||
|
* @date: 2019/6/28 0028 下午 14:10
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AmExchangeDeclare extends AbstractDeclare {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RabbitAdmin rabbitAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向rabbitMQ服务器注册指定的交换机以及交换机的类型
|
||||||
|
*
|
||||||
|
* @param mqExchage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Exchange declareExchange(MqExchange mqExchage) {
|
||||||
|
this.logger.info("declare exchange is :" + mqExchage.toString());
|
||||||
|
|
||||||
|
Exchange exchange = null;
|
||||||
|
|
||||||
|
super.validate(mqExchage);
|
||||||
|
exchange = this.initExchange(mqExchage);
|
||||||
|
this.rabbitAdmin.declareExchange(exchange);
|
||||||
|
|
||||||
|
this.logger.info("declare exchange success");
|
||||||
|
return exchange;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从RabbitMQ服务端上删除指定的交换机
|
||||||
|
*
|
||||||
|
* @param exchangeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean deleteExchange(String exchangeName) {
|
||||||
|
this.logger.info("delete exchange is : " + exchangeName);
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(exchangeName)) {
|
||||||
|
throw new RabbitMQException("the parameter exchangeName couldn't not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.rabbitAdmin.deleteExchange(exchangeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据不同类型初始化不同类型的交换机
|
||||||
|
*
|
||||||
|
* @param mqExchage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Exchange initExchange(MqExchange mqExchage) {
|
||||||
|
ExchangeTypeEnum exchangeTypeEnum = mqExchage.getType();
|
||||||
|
switch (exchangeTypeEnum) {
|
||||||
|
case DIRECT:
|
||||||
|
return new DirectExchange(mqExchage.getName(), mqExchage.isDurable(), mqExchage.isAutoDelete(), mqExchage.getArguments());
|
||||||
|
case TOPIC:
|
||||||
|
return new TopicExchange(mqExchage.getName(), mqExchage.isDurable(), mqExchage.isAutoDelete(), mqExchage.getArguments());
|
||||||
|
case FANOUT:
|
||||||
|
return new FanoutExchange(mqExchage.getName(), mqExchage.isDurable(), mqExchage.isAutoDelete(), mqExchage.getArguments());
|
||||||
|
case HEADERS:
|
||||||
|
return new HeadersExchange(mqExchage.getName(), mqExchage.isDurable(), mqExchage.isAutoDelete(), mqExchage.getArguments());
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义校验规则
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void DefinedValidate(Object object) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
public class EnumItemView {
|
public class EnumItemView {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
import org.apache.ibatis.type.BaseTypeHandler;
|
import org.apache.ibatis.type.BaseTypeHandler;
|
||||||
import org.apache.ibatis.type.EnumTypeHandler;
|
import org.apache.ibatis.type.EnumTypeHandler;
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
public enum FlagEnum implements IIntegerEnum {
|
public enum FlagEnum implements IIntegerEnum {
|
||||||
INSERT(1, "新增"),
|
INSERT(1, "新增"),
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
import org.apache.ibatis.type.BaseTypeHandler;
|
import org.apache.ibatis.type.BaseTypeHandler;
|
||||||
import org.apache.ibatis.type.JdbcType;
|
import org.apache.ibatis.type.JdbcType;
|
@ -1,6 +1,4 @@
|
|||||||
package com.docus.server.collect.web.enums;
|
package com.docus.server.common.enums;
|
||||||
|
|
||||||
import com.docus.server.collect.web.enums.IIntegerEnum;
|
|
||||||
|
|
||||||
public enum StateEnum implements IIntegerEnum {
|
public enum StateEnum implements IIntegerEnum {
|
||||||
OK(0, "成功"),
|
OK(0, "成功"),
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.docus.server.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: BaseException
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.exception
|
||||||
|
* @author: zhuqb
|
||||||
|
* @Description: 自定义封装所有异常的基类
|
||||||
|
* <p/>
|
||||||
|
* 该异常继承RuntimeException
|
||||||
|
* @date: 2019/7/9 0009 上午 8:15
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public class BaseException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 1702524362131670363L;
|
||||||
|
/**
|
||||||
|
* 异常的返回的编码和信息
|
||||||
|
*/
|
||||||
|
protected IResult result;
|
||||||
|
/**
|
||||||
|
* 异常消息参数
|
||||||
|
*/
|
||||||
|
protected Object[] args;
|
||||||
|
|
||||||
|
public BaseException(IResult result) {
|
||||||
|
super(result.getMsg());
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(int code, String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.result = new IResult() {
|
||||||
|
@Override
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(IResult result, Object[] args, String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.result = result;
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(IResult result, Object[] args, String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
this.result = result;
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.docus.server.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: IResult
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.exception
|
||||||
|
* @author: zhuqb
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/7/9 0009 上午 8:28
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IResult {
|
||||||
|
|
||||||
|
int getCode();
|
||||||
|
|
||||||
|
String getMsg();
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.docus.server.common.exception;
|
||||||
|
|
||||||
|
|
||||||
|
import com.docus.server.common.type.ResultEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: RabbitMQException
|
||||||
|
* @Package: com.amos.producer
|
||||||
|
* @author: amos
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/6/28 0028 上午 9:23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public class RabbitMQException extends BaseException {
|
||||||
|
private static final long serialVersionUID = 284587800137211341L;
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public RabbitMQException(int code, String msg) {
|
||||||
|
super(code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RabbitMQException(String msg) {
|
||||||
|
super(ResultEnum.error(), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RabbitMQException(IResult result) {
|
||||||
|
super(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RabbitMQException(IResult result, Object[] args, String message) {
|
||||||
|
super(result, args, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RabbitMQException(IResult result, Object[] args, String message, Throwable cause) {
|
||||||
|
super(result, args, message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return this.msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.docus.server.common.exception;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright © 2018 五月工作室. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Project: rabbitmq
|
||||||
|
* @ClassName: RabbitMQExceptionAssert
|
||||||
|
* @Package: com.docus.viewtaskcollect.common.exception
|
||||||
|
* @author: zhuqb
|
||||||
|
* @Description:
|
||||||
|
* @date: 2019/7/10 0010 下午 14:52
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface RabbitMQExceptionAssert extends IResult, Assert {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default BaseException newException(Object... args) {
|
||||||
|
String msg = MessageFormat.format(this.getMsg(), args);
|
||||||
|
|
||||||
|
return new RabbitMQException(this, args, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default BaseException newException(Throwable t, Object... args) {
|
||||||
|
String msg = MessageFormat.format(this.getMsg(), args);
|
||||||
|
|
||||||
|
return new RabbitMQException(this, args, msg, t);
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue