Commit 2bf186f5 authored by 王锦盛's avatar 王锦盛

运营管控平台基础框架

parent f6ecafa4
# operation-control-platform
以运营管控平台为顶层,构建标准物理模型、服务、应用等核心资源库,对服务、数据模型注册、变更、发布进行管控,实时监控“三区四层”架构运营情况,对模型、服务、应用异常情况自动告警,全面支撑PMS3.0数字化架构的落地与持续迭代。
\ No newline at end of file
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
</parent>
<groupId>com.pms.ocp</groupId>
<artifactId>operation-control-platform</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<spring-boot.version>2.4.2</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.github.pagehelper</groupId>-->
<!--<artifactId>pagehelper</artifactId>-->
<!--<version>5.2.0</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.16</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!--文件上传poi-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.1</version>
</dependency>
<!--EasyPoi导入导出-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>uat</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<spring.profiles.active>uat</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
</profiles>
<build>
<!-- 分环境打包 -->
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>application-*.properties</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>application-${spring.profiles.active}.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.beagle.base.StartApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.pms.ocp;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.context.annotation.Bean;
import java.util.TimeZone;
/**
* @Auther: wangjian
* @Date: 2022/2/21 15:48
* @Description:启动类
*/
@SpringBootApplication
@MapperScan(basePackages = {"com.pms.ocp.mapper"})
@ConfigurationPropertiesScan
//@EnableScheduling
public class OcpApplication {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
SpringApplication.run(OcpApplication.class, args);
}
/**
* 注册分页插件
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
return interceptor;
}
}
package com.pms.ocp.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 操作日志
*
* @author wuwanli
* @version 1.0
* @date 2021/8/16
*/
@Inherited
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface OperationLog {
/**
* 操作日志描述
*/
String desc();
/**
* 操作日志类型
*/
OperationType type();
/**
* 是否记录 设置false 则不做任何处理
*/
boolean record() default true;
}
package com.pms.ocp.common.annotation;
/**
* 操作日志枚举操作类型
*
* @author wuwanli
* @version 1.0
* @date 2021/8/16
*/
public enum OperationType {
/**
* 新增类型
*/
ADD,
/**
* 修改类型
*/
MODIFY,
/**
* 删除类型
*/
DELETE,
/**
* 导入类型
*/
IMPORT,
/**
* 导出类型
*/
EXPORT
}
package com.pms.ocp.common.aspect;
import java.util.HashMap;
import java.util.Map;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
/**
* 统一接口日志记录
*
* @author wuwanli
* @version 1.0
* @date 2021/8/6
*/
@Order(1)
@Slf4j
@Aspect
@Component
public class InterfaceLogAspect {
@Before("execution(* com.beagle.base.controller..*.*(..))")
public void before(JoinPoint joinPoint) {
// 打印接口请求参数日志
this.logInterfaceRequest(joinPoint);
}
@Around("execution(* com.beagle.base.controller..*.*(..))")
public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
long startTime = System.currentTimeMillis();
Object result = proceedingJoinPoint.proceed();
log.info("interface responseBody : " + (result != null ? JSONObject.toJSONString(result) : null));
log.info("interface time-consuming :{}", System.currentTimeMillis() - startTime);
return result;
}
/**
* 打印接口请求参数日志
*
* @param joinPoint
* 连接点
*/
private void logInterfaceRequest(JoinPoint joinPoint) {
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
String[] parameterNames = methodSignature.getParameterNames();
Map<String, Object> paramMap = new HashMap<>(10);
Object[] args = joinPoint.getArgs();
if (parameterNames.length <= args.length) {
for (int i = 0; i < parameterNames.length; i++) {
paramMap.put(parameterNames[i], args[i]);
}
}
log.info("interface url : "
+ (attributes != null ? attributes.getRequest().getRequestURL() : null));
log.info("interface className : " + joinPoint.getTarget().getClass().getName());
log.info("interface methodName : " + joinPoint.getSignature().getName());
log.info("interface requestBody : " + JSONObject.toJSONString(paramMap));
} catch (Exception exception) {
log.error("InterfaceLogAspect.before Exception", exception);
}
}
}
package com.pms.ocp.common.component;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* Bean 工具类
*
* @author wuwanli
*/
@Component
public class ApplicationContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextUtil.applicationContext = applicationContext;
}
public static <T> T getBean(Class<T> clazz) throws BeansException {
return applicationContext.getBean(clazz);
}
}
package com.pms.ocp.common.component;
import java.io.IOException;
import java.util.UUID;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.slf4j.MDC;
/**
* 日志统一增加traceId
*
* @author wuwanli
* @version 1.0
* @date 2021/8/6
*/
public class LogbackFilter implements Filter {
private static final String TRACE_ID = "traceId";
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Filter.super.init(filterConfig);
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
boolean result = this.insertMdc();
try {
filterChain.doFilter(servletRequest, servletResponse);
} finally {
if (result) {
MDC.remove(TRACE_ID);
}
}
}
private boolean insertMdc() {
try {
UUID uuid = UUID.randomUUID();
String uniqueId = uuid.toString().replace("-", "");
MDC.put(TRACE_ID, uniqueId);
return true;
} catch (Exception exception) {
return false;
}
}
@Override
public void destroy() {
Filter.super.destroy();
}
}
package com.pms.ocp.common.constants;
/**
* 业务常量
*
* @author wuwanli
* @version 1.0
* @date 2021/8/4
*/
public interface BusinessConstants {
/**
* 已删除
*/
int DELETED_FLAG = 0;
/**
* 未删除
*/
int NOT_DELETED = 1;
/**
* 是历史数据
*/
int IS_HISTORY_DATA = 1;
/**
* 不是历史数据
*/
int NOT_HISTORY_DATA = 0;
}
package com.pms.ocp.common.constants;
/**
* @author huxiuwu
* @version 1.0
* @date 2022/1/6 15:06
*/
public interface BusinessNameConstant {
String SHEET_NAME_ONE = "统建服务调用统计";
}
package com.pms.ocp.common.constants;
public enum ChooseDateType {
ONE_WEEK(1, "最近一周"),
ONE_MONTH(2, "最近一个月"),
THREE_MONTHS(3, "最近三个月");
private Integer code;
private String desc;
ChooseDateType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static ChooseDateType getChooseDateType(Integer code) {
ChooseDateType[] values = ChooseDateType.values();
for (ChooseDateType c : values) {
if (c.getCode().equals(code)) {
return c;
}
}
return null;
}
}
package com.pms.ocp.common.constants;
import lombok.Getter;
/**
* @author wuwanli
* @version 1.0
* @date 2021/8/4
*/
public enum CodeEnum {
/**
* 处理成功
*/
SUCCESS("200", "处理成功", true),
/**
* 必填参数为空
*/
REQUIRED_PARAMETER_EMPTY("0", "必填参数为空", false),
/**
* 参数类型错误
*/
PARAMETER_TYPE_ERROR("0", "Parameter type error", false),
/**
* 未登录
*/
NOT_LOGIN("401001", "用户未登录", false),
/**
* 用户名或密码错误
*/
LOGIN_FAIL("401002", "用户名或密码错误", false),
/**
* 无权限访问
*/
NO_PERMISSION("401003", "无权限访问", false),
/**
* 系统异常
*/
UNKNOWN("9999", "System abnormal", false),
/**
* 数据异常
*/
NO_DATA("555", "数据库数据异常", false),
UP_DATA_FAIL("401005", "更新失败", false),
INSERT_FAIL("401006", "插入数据失败", false);
/**
* 构造函数
*
* @param code 响应码
* @param desc 响应描述
*/
CodeEnum(String code, String desc, boolean success) {
this.code = code;
this.desc = desc;
this.success = success;
}
@Getter
private final String code;
@Getter
private final String desc;
@Getter
private final boolean success;
}
\ No newline at end of file
package com.pms.ocp.common.constants;
/**
* 业务常量
*
* @author wuwanli
* @version 1.0
* @date 2021/8/4
*/
public interface DateConstants {
String DATE_END = " 23:59:59";
String DATE_START = " 00:00:00";
}
package com.pms.ocp.common.constants;
import javax.validation.constraints.Negative;
/**
* @author admin
* @version 1.0
* @date 2021/12/11 10:50
*/
public interface NumberConstant {
Integer ZERO = 0;
Integer ONE = 1;
Integer TEN = 10;
Integer TWO = 2;
Integer THREE = 3;
Integer FOUR = 4;
Integer MINUS_THIRTY = -30;
Integer NEGATIVE_SEVEN = -7;
Integer MINUS_NINETY = -90;
}
package com.pms.ocp.common.constants;
/**
* 符号常量
*
* @author wuwanli
* @version 1.0
* @date 2021/8/4
*/
public interface SymbolConstants {
/**
* 英文分号
*/
String SEMICOLON_EN = ";";
/**
* 一个空格
*/
String BLANK = " ";
/**
* 点分割符
*/
String POINT = ".";
String XLSX_SUFFIX=".xlsx";
String XLS_SUFFIX=".xls";
}
package com.pms.ocp.common.exception;
import lombok.Getter;
/**
* @author wuwanli
* @date 2021/8/3
*/
public class BeagleException extends RuntimeException {
/**
* 错误码
*/
@Getter
protected String errorCode;
/**
* 错误信息
*/
@Getter
protected String errorMsg;
public BeagleException() {
super();
}
public BeagleException(String errorMsg) {
super(errorMsg);
this.errorMsg = errorMsg;
}
public BeagleException(String errorCode, String errorMsg) {
super(errorMsg);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public BeagleException(String errorMsg, Throwable cause) {
super(errorMsg, cause);
}
public BeagleException(String errorCode, String errorMsg, Throwable cause) {
super(errorCode, cause);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
}
package com.pms.ocp.common.exception;
import com.pms.ocp.common.utils.BeagleStringUtils;
import com.pms.ocp.model.vo.BaseResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import com.pms.ocp.common.constants.CodeEnum;
import lombok.extern.slf4j.Slf4j;
/**
* @author wuwanli
* @version 1.0
* @date 2021/8/5
*/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(value = BeagleException.class)
public BaseResponse beagleExceptionHandler(BeagleException beagleException) {
log.error("GlobalExceptionHandler.beagleExceptionHandler", beagleException);
BaseResponse baseResponse = new BaseResponse();
if (BeagleStringUtils.isBlank(beagleException.getErrorCode())) {
baseResponse.setResponseCode(CodeEnum.UNKNOWN);
} else {
baseResponse.setCode(beagleException.getErrorCode());
baseResponse.setDesc(beagleException.getErrorMsg());
}
return baseResponse;
}
@ExceptionHandler(value = Exception.class)
public BaseResponse exceptionHandler(Exception exception) {
log.error("GlobalExceptionHandler.exceptionHandler", exception);
return new BaseResponse(CodeEnum.UNKNOWN);
}
}
package com.pms.ocp.common.utils;
import org.apache.commons.lang3.StringUtils;
/**
* 字符串工具类
*
* @author wuwanli
* @version 1.0
* @date 2021/8/4
*/
public class BeagleStringUtils {
public static boolean isBlank(CharSequence cs) {
return StringUtils.isBlank(cs);
}
public static boolean isEmpty(CharSequence cs) {
return StringUtils.isEmpty(cs);
}
public static boolean isNotBlank(CharSequence cs) {
return StringUtils.isNotBlank(cs);
}
public static boolean isNotEmpty(CharSequence cs) {
return StringUtils.isNotEmpty(cs);
}
}
package com.pms.ocp.common.utils;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* @author huxiuwu
* @version 1.0
* @date 2022/1/4 20:14
*/
public class DateUtils {
private DateUtils() {
}
public static SimpleDateFormat sdf() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
/**
* 获取当天的开始时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return sdf().format(cal.getTime());
}
/**
* 获取当天的结束时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return sdf().format(cal.getTime());
}
/**
* 获取昨天的开始时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getBeginDayOfYesterday(Integer dayNum) {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.add(Calendar.DAY_OF_MONTH, dayNum);
return sdf().format(cal.getTime());
}
/**
* 获取昨天的结束时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getEndDayOfYesterday(Integer dayNum) {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.add(Calendar.DAY_OF_MONTH,dayNum);
return sdf().format(cal.getTime());
}
/**
* 获得本周一0点时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesWeekmorning() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
day_of_week = 7;
c.add(Calendar.DATE, -day_of_week + 1);
return format.format(c.getTime());
}
/**
* 获得本周日24点时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesWeeknight() {
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
day_of_week = 7;
c.add(Calendar.DATE, -day_of_week + 7);
return formatDate.format(c.getTime());
}
/**
* 根据当前日期获得最近n周的日期区间(不包含本周)
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getFromToDate(SimpleDateFormat sdf, Date date, int n, int option, int k) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
int offset = 0 == option ? 1 - dayOfWeek : 7 - dayOfWeek;
int amount = 0 == option ? offset - (n - 1 + k) * 7 : offset - k * 7;
calendar.add(Calendar.DATE, amount);
return sdf.format(calendar.getTime());
}
/**
* 获取上周的开始时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getBeginDayOfLastWeek() {
//上周日期
SimpleDateFormat sdf = sdf();
String beginDate = getFromToDate(sdf, new Date(), 1, 0, 1);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(sdf.parse(beginDate));
} catch (Exception e) {
e.printStackTrace();
}
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return sdf.format(calendar.getTime());
}
/**
* 获取上周的结束时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getEndDayOfLastWeek() {
//上周日期
SimpleDateFormat sdf = sdf();
String endDate = getFromToDate(sdf, new Date(), 1, 1, 1);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(sdf.parse(endDate));
} catch (Exception e) {
e.printStackTrace();
}
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
return sdf.format(calendar.getTime());
}
/**
* 获得本月第一天0点时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesMonthMorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return sdf().format(cal.getTime());
}
/**
* 获得本月最后一天24点时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesMonthNight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, 23);
return sdf().format(cal.getTime());
}
// 获得上月第一天0点时间
/**
* 获取昨天的开始时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesLastMonthMorning(Integer last) {
//上月日期
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, last);
int lastMonthMaxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59);
//按格式输出
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-01 00:00:00");
String gTime = sdf2.format(c.getTime()); //上月第一天
return gTime;
}
/**
* 获得上月最后一天24点时间
*
* @author huxiuwu
* @date 2022/1/4
**/
public static String getTimesLastMonthNight(Integer lastMonth) {
//上月日期
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, lastMonth);
SimpleDateFormat sdf = sdf();
int lastMonthMaxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59);
//按格式输出
String g_time = sdf.format(c.getTime());
return g_time;
}
public static Date asDate(LocalDate localDate) {
return Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
}
public static Date asDate(LocalDateTime localDateTime) {
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
public static LocalDate asLocalDate(Date date) {
return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
}
public static LocalDateTime asLocalDateTime(Date date) {
return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
}
/**
* 当前时间前后几个月
*
* @param month
* @return
*/
public static Timestamp getAssignMonthTime(Integer month) {
return Timestamp.valueOf(LocalDateTime.now().plusMonths(month));
}
/**
* 上一周
*
* @return
*/
public static Timestamp getLaskWeek() {
DateTime dateTime = DateUtil.lastWeek();
return new Timestamp(dateTime.getTime());
}
/**
* 获取月份 整数
*
* @param timestamp
* @return
*/
public static Integer getMonth(Timestamp timestamp) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timestamp.getTime());
return calendar.get(Calendar.MONTH) + 1;
}
public static Timestamp getBeginTimeOfMonth(int year, int month) {
YearMonth yearMonth = YearMonth.of(year, month);
LocalDate localDate = yearMonth.atDay(1);
LocalDateTime startOfDay = localDate.atStartOfDay();
ZonedDateTime zonedDateTime = startOfDay.atZone(ZoneId.of("Asia/Shanghai"));
Date from = Date.from(zonedDateTime.toInstant());
return new Timestamp(from.getTime());
}
public static Timestamp getEndTimeOfMonth(int year, int month) {
YearMonth yearMonth = YearMonth.of(year, month);
LocalDate endOfMonth = yearMonth.atEndOfMonth();
LocalDateTime localDateTime = endOfMonth.atTime(23, 59, 59, 999);
ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.of("Asia/Shanghai"));
Date from = Date.from(zonedDateTime.toInstant());
return new Timestamp(from.getTime());
}
public static String getLastMonth() {
LocalDate today = LocalDate.now();
today = today.minusMonths(1);
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
return formatters.format(today);
}
public static String getYearAndMonth(Integer offset) {
LocalDate today = LocalDate.now();
today = today.minusMonths(offset);
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
return formatters.format(today);
}
}
package com.pms.ocp.common.utils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
/**
* @Auther: wangjian
* @Date: 2022/1/17 10:00
* @Description:
*/
public class ExcelImportUtils {
//@描述:判断是否是2003版的excel,返回true是2003
public static boolean isExcel2003(String filePath) {
return filePath.matches("^.+\\.(?i)(xls)$");
}
//@描述:判断是否是2007版的Excel,返回true是2007
public static boolean isExcel2007(String filePath) {
return filePath.matches("^.+\\.(?i)(xlsx)$");
}
/*
@描述:验证excel文件
@param:filePath
@return
*/
public static boolean validateExcel(String filePath) {
if (filePath == null || !(isExcel2003(filePath)) || !(isExcel2007(filePath))) {
return false;
} else {
return true;
}
}
/**
* 创建标题样式
*
* @param wb
* @return
*/
public static HSSFCellStyle createTitleCellStyle(HSSFWorkbook wb) {
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直对齐
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
//背景颜色 cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
HSSFFont headerFont1 = (HSSFFont) wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("黑体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
/**
* 创建表头样式
*
* @param wb
* @return
*/
public static HSSFCellStyle createHeadCellStyle(HSSFWorkbook wb) {
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);// 设置自动换行
//背景颜色 cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
cellStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直对齐
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
HSSFFont headerFont = (HSSFFont) wb.createFont(); // 创建字体样式
headerFont.setBold(true); //字体加粗
headerFont.setFontName("黑体"); // 设置字体类型
headerFont.setFontHeightInPoints((short) 12); // 设置字体大小
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
return cellStyle;
}
/**
* 创建内容样式
*
* @param wb
* @return
*/
public static HSSFCellStyle createContentCellStyle(HSSFWorkbook wb) {
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
HSSFFont font = wb.createFont();
font.setColor((short) 8);
font.setFontHeightInPoints((short) 12);
cellStyle.setFont(font);
return cellStyle;
}
}
package com.pms.ocp.common.utils;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* @author huxiuwu
* @version 1.0
* @date 2022/1/5 21:13
*/
public class ExcelUtils {
/**
* 导出excel通用方法
*
* @param response 响应对象
* @param list 传入list
* @param fileName 文件名称
* @param sheetName sheet页名称
* @param clazz 类对象
* @return void
* @author huxiuwu
* @date 2022/1/5
**/
// public static void writeExcel(HttpServletResponse response, List<?> list, String fileName, String sheetName, Class clazz, HttpServletRequest request) {
// try {
// String characterEncoding = request.getCharacterEncoding();
// //获取需要导出的数据
// WriteCellStyle headWriteCellStyle = new WriteCellStyle();
// //设置头居中
// headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
// //内容策略
// WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
// //设置 水平居中
// contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
// HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
// response.setContentType("application/vnd.ms-excel;charset=" + characterEncoding);
// response.setCharacterEncoding(characterEncoding);
// // 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系
// String excelName = URLEncoder.encode(fileName, characterEncoding);
// response.setHeader("Content-disposition", "attachment;filename=" + excelName + SymbolConstants.XLS_SUFFIX);
// // 这里需要设置不关闭流
// EasyExcel.write(response.getOutputStream(), clazz).
// autoCloseStream(Boolean.FALSE).
// registerWriteHandler(horizontalCellStyleStrategy).
// sheet(sheetName).doWrite(list);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
/**
* Excel导出
*
* @param response response
* @param fileName 文件名
* @param list 数据List
* @param pojoClass 对象Class
*/
public static void exportExcel(HttpServletResponse response, String fileName, Collection<?> list, Class<?> pojoClass) throws IOException {
if (StringUtils.isBlank(fileName)) {
//当前日期
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
fileName = df.format(new Date());
}
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(fileName, fileName, ExcelType.XSSF), pojoClass, list);
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls");
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
}
/**
* Excel导出,先sourceList转换成List<targetClass>,再导出
*
* @param response response
* @param fileName 文件名
* @param sourceList 原数据List
* @param targetClass 目标对象Class
*/
public static void exportExcelToTarget(HttpServletResponse response, String fileName, Collection<?> sourceList, Class<?> targetClass) throws Exception {
List targetList = new ArrayList<>(sourceList.size());
for (Object source : sourceList) {
Object target = targetClass.newInstance();
BeanUtils.copyProperties(source, target);
targetList.add(target);
}
exportExcel(response, fileName, targetList, targetClass);
}
/**
* Excel导出----设置title---sheetName---要求Collection<?> list是Class<?> pojoClass类型的
*
* @param response response
* @param fileName 文件名
* @param list 数据List
* @param pojoClass 对象Class
*/
public static void exportExcel(HttpServletResponse response, String title, String sheetName, String fileName, Collection<?> list, Class<?> pojoClass) throws IOException {
if (StringUtils.isBlank(fileName)) {
//当前日期
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
fileName = df.format(new Date());
}
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(title, sheetName, ExcelType.HSSF), pojoClass, list);
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls");
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
}
}
package com.pms.ocp.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* @ClassName: JSONCopyUtil
* @Author: laizonghao
* @Description: 基于fastjson的实体复制工具类
* @Date: 2020/9/12 15:12
*/
public class JSONCopyUtil {
/**
* 对象复制
* @param o
* @param clazz
* @param <T>
* @return
*/
public static <T> T copyObject(Object o, Class<T> clazz) {
return JSON.parseObject(JSON.toJSONString(o), clazz);
}
public static <T> T copyObject(String jsonString, Class<T> clazz) {
return JSON.parseObject(jsonString, clazz);
}
/**
* List复制
* @param o
* @param clazz
* @param <T>
* @return
*/
public static <T> List<T> copyArray(Object o, Class<T> clazz) {
return JSONArray.parseArray(JSON.toJSONString(o), clazz);
}
public static <T> List<T> copyArray(String jsonString, Class<T> clazz) {
return JSONArray.parseArray(jsonString, clazz);
}
/**
* 从文本中提取数据
* @param str
* @return
*/
public static String getStringNum(String str) {
str = str.trim();
StringBuilder str2 = new StringBuilder();
if (StringUtils.isNotBlank(str)) {
for (int i = 0; i < str.length(); i++) {
//加一个分隔符判断 - 45 , 44
if ((str.charAt(i) >= 48 && str.charAt(i) <= 57) || str.charAt(i) == 44 || str.charAt(i) == 45) {
str2.append(str.charAt(i));
}
}
}
return str2.toString();
}
}
package com.pms.ocp.common.utils;
import java.util.*;
/**
* @Author: admin
* @Description:
* @Date: 2021/12/8 9:31
* @Version: V1.0
*/
public class MapUtils {
/**
* Map 排序
*
* @param map
* @return Map
*/
public static <T> Map<Date, List<T>> treeMapDesc(Map<Date, List<T>> map) {
Map<Date, List<T>> treeMapDesc = new TreeMap<>(new Comparator<Date>() {
@Override
public int compare(Date o1, Date o2) {
return o2.compareTo(o1);
}
});
for (Map.Entry<Date, List<T>> e : map.entrySet()) {
treeMapDesc.put(e.getKey(), e.getValue());
}
return treeMapDesc;
}
}
package com.pms.ocp.common.utils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @param <T>
* @author admin
*/
@Data
@ApiModel(value = "分页工具类",description = "分页工具类")
public class PageRequest<T> {
private static final long serialVersionUID = 8167917284229912157L;
@ApiModelProperty(value = "当前页码")
private int pageSize;
@ApiModelProperty(value = "每页大小")
private int pageNum;
@ApiModelProperty(value = "其他查询条件")
private T query;
}
\ No newline at end of file
package com.pms.ocp.common.utils;
import cn.hutool.core.date.DateTime;
import com.pms.ocp.common.constants.DateConstants;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @Author: admin
* @Description: date工具类
* @Date: 2021/11/25 16:34
* @Version: V1.0
*/
public class SysDateUtil {
public static String getYesterdayStr(DateTime dateTime) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.format(dateTime) + DateConstants.DATE_END;
}
public static Date getDateStr(String dateTime) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.parse(dateTime);
}
public static String getYesterdayStrShort(DateTime dateTime) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.format(dateTime);
}
}
\ No newline at end of file
package com.pms.ocp.common.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @Author: admin
* @Description:
* @Date: 2021/11/26 19:48
* @Version: V1.0
*/
@Component
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ValueUtil {
@Value("${system.company_name}")
private String companyName;
@Value("${system.company_code}")
private String companyCode;
public ValueUtil getCompany() {
return new ValueUtil(companyName, companyCode);
}
}
\ No newline at end of file
package com.pms.ocp.controller;
import com.pms.ocp.model.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* @Auther: wangjian
* @Date: 2022/2/21 16:17
* @Description:模型库管理接口
*/
@Slf4j
@RequestMapping("/model-base/v1")
@RestController
@Api(tags = "模型库管理接口")
public class ModelBaseController {
/**
* 模型分类-查询
*
* @return
*/
@ApiOperation("模型分类-查询")
@GetMapping("/model/type")
public ResponseVO getModelType() {
return ResponseVO.ok();
}
/**
* 模型分类-增加
*
* @return
*/
@ApiOperation("模型分类-增加")
@PostMapping("/model/type")
public ResponseVO createModelType() {
return ResponseVO.ok();
}
/**
* 模型分类-删除
*
* @return
*/
@ApiOperation("模型分类-删除")
@DeleteMapping("/model/type")
public ResponseVO deleteModelType() {
return ResponseVO.ok();
}
/**
* 模型分类-修改
*
* @return
*/
@ApiOperation("模型分类-修改")
@PutMapping("/model/type")
public ResponseVO updateModelType() {
return ResponseVO.ok();
}
/**
* 模型-查询
*
* @return
*/
@ApiOperation("模型-查询")
@GetMapping("/model")
public ResponseVO getModel() {
return ResponseVO.ok();
}
/**
* 模型-增加
*
* @return
*/
@ApiOperation("模型-增加")
@PostMapping("/model")
public ResponseVO createModel() {
return ResponseVO.ok();
}
/**
* 模型-删除
*
* @return
*/
@ApiOperation("模型-删除")
@DeleteMapping("/model")
public ResponseVO deleteModel() {
return ResponseVO.ok();
}
/**
* 模型-修改
*
* @return
*/
@ApiOperation("模型-修改")
@PutMapping("/model")
public ResponseVO updateModel() {
return ResponseVO.ok();
}
/**
* 模型-下发/批量下发
* TODO
*
* @return
*/
@ApiOperation("模型-下发|批量下发")
@PostMapping("/issue/model")
public ResponseVO issueModel() {
return ResponseVO.ok();
}
/**
* 模型注册-上传
*
* @return
*/
@ApiOperation("模型注册-上传")
@PostMapping("/register/model")
public ResponseVO registerModel() {
return ResponseVO.ok();
}
/**
* 模型订阅-增加
*
* @return
*/
@ApiOperation("模型订阅-增加")
@PostMapping("/model/subscribe")
public ResponseVO createModelSubscribe() {
return ResponseVO.ok();
}
/**
* 模型订阅-查询
*
* @return
*/
@ApiOperation("模型订阅-查询")
@GetMapping("/model/subscribe")
public ResponseVO getModelSubscribe() {
return ResponseVO.ok();
}
/**
* 模型事记-查询
*
* @return
*/
@ApiOperation("模型事记-查询")
@GetMapping("/model/note")
public ResponseVO getModelNote() {
return ResponseVO.ok();
}
/**
* 模型事记-增加
*
* @return
*/
@ApiOperation("模型事记-增加")
@PostMapping("/model/note")
public ResponseVO createModelNote() {
return ResponseVO.ok();
}
/**
* 模型属性-增加
*
* @return
*/
@ApiOperation("模型属性-增加")
@PostMapping("/model/property")
public ResponseVO createModelProperty() {
return ResponseVO.ok();
}
/**
* 模型属性-查询
*
* @return
*/
@ApiOperation("模型属性-查询")
@GetMapping("/model/property")
public ResponseVO getModelProperty() {
return ResponseVO.ok();
}
/**
* 模型属性-修改
*
* @return
*/
@ApiOperation("模型属性-修改")
@PutMapping("/model/property")
public ResponseVO updateModelProperty() {
return ResponseVO.ok();
}
/**
* 模型属性-删除
*
* @return
*/
@ApiOperation("模型属性-删除")
@DeleteMapping("/model/property")
public ResponseVO deleteModelProperty() {
return ResponseVO.ok();
}
/**
* 模型拓扑关系-查询
*
* @return
*/
@ApiOperation("模型拓扑关系-查询")
@GetMapping("/model/topology")
public ResponseVO getModelTopology() {
return ResponseVO.ok();
}
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型订阅数据层接口
*/
@Mapper
public interface ModelIssueMapper extends BaseMapper<Model> {
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型数据层接口
*/
@Mapper
public interface ModelMapper extends BaseMapper<Model> {
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型事记数据层接口
*/
@Mapper
public interface ModelNoteMapper extends BaseMapper<Model> {
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型属性数据层接口
*/
@Mapper
public interface ModelPropertyMapper extends BaseMapper<Model> {
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import org.apache.ibatis.annotations.Mapper;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型类型数据层接口
*/
@Mapper
public interface ModelTypeMapper extends BaseMapper<Model> {
}
package com.pms.ocp.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther: wangjian
* @Date: 2022/1/17 12:45
* @Description:应用与服务的传输参数
*/
@ApiModel(value = "应用与服务的传输参数")
@Data
public class ApiParamDTO {
@ApiModelProperty(value = "网省编码")
private String companyCode;
@ApiModelProperty(value = "应用编码")
private String tenantCode;
@ApiModelProperty(value = "服务编码")
private String apiCode;
@ApiModelProperty(value = "分组编号")
private String groupId;
@ApiModelProperty(value = "分组上级编号")
private String groupPid;
@ApiModelProperty(value = "分组等级")
private String groupLvl;
@ApiModelProperty(value = "应用名称")
private String tenantName;
@ApiModelProperty(value = "时期类型")
private String periodCategory;
}
package com.pms.ocp.model.entity;
import lombok.Data;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:26
* @Description:模型对象
*/
@Data
//@TableName("mp_user")
public class Model {
}
// model_id
// model_name
// model_code
// equip_type
// domain_type
// model_group_id
// model_group_name
// model_table
// model_relation
// Is_use
// model_promotion
// company_id
// company_name
// model_dispidx
// model_user_id
// model_user_name
// model_ctime
// model_mtime
package com.pms.ocp.model.entity;
import lombok.Data;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:40
* @Description:模型订阅对象
*/
@Data
public class ModelIssue {
}
package com.pms.ocp.model.entity;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:52
* @Description:模型事记对象
*/
public class ModelNote {
}
package com.pms.ocp.model.entity;
import lombok.Data;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:40
* @Description:模型属性对象
*/
@Data
public class ModelProperty {
}
package com.pms.ocp.model.entity;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:52
* @Description:模型类型对象
*/
public class ModelType {
}
package com.pms.ocp.model.vo;
import com.pms.ocp.common.constants.CodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
/**
* @author wuwanli
* @version 1.0
* @date 2021/8/5
*/
@Data
@ToString
@ApiModel(value = "BaseResponse返回对象", description = "BaseResponse返回对象")
public class BaseResponse implements Serializable {
private static final long serialVersionUID = -3715259891657893705L;
/**
* 返回码
*/
@ApiModelProperty(value = "返回码")
private String code;
/**
* 返回描述
*/
@ApiModelProperty(value = "返回描述")
private String desc;
@ApiModelProperty(value = "是否成功")
private boolean success;
public BaseResponse() {
super();
}
public BaseResponse(CodeEnum codeEnum) {
this.code = codeEnum.getCode();
this.desc = codeEnum.getDesc();
this.success = codeEnum.isSuccess();
}
public void setResponseCode(CodeEnum codeEnum) {
this.code = codeEnum.getCode();
this.desc = codeEnum.getDesc();
this.success = codeEnum.isSuccess();
}
}
package com.pms.ocp.model.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:56
* @Description:
*/
@Data
@NoArgsConstructor
//@AllArgsConstructor
@ApiModel(value = "中台服务运营看板_网省切换数据_服务表", description = "中台服务运营看板_网省切换数据_服务表")
public class ModelVO {
}
package com.pms.ocp.model.vo;
import com.pms.ocp.common.constants.CodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* @author wuwanli
* @version 1.0
* @date 2021/8/5
*/
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "返回对象", description = "返回对象")
public class ResponseVO<T> extends BaseResponse {
private static final long serialVersionUID = 2445069102311188334L;
/**
* 封装的返回对象
*/
@ApiModelProperty(value = "封装的返回对象")
private T data;
public ResponseVO() {
super();
}
public ResponseVO(CodeEnum codeEnum) {
this.setCode(codeEnum.getCode());
this.setDesc(codeEnum.getDesc());
this.setSuccess(codeEnum.isSuccess());
}
public static <T> ResponseVO<T> ok() {
return new ResponseVO<>(CodeEnum.SUCCESS);
}
public static <T> ResponseVO<T> ok(T data) {
ResponseVO<T> r = new ResponseVO<T>(CodeEnum.SUCCESS);
r.setData(data);
return r;
}
public static <T> ResponseVO<T> error(CodeEnum codeEnum) {
return new ResponseVO<T>(codeEnum);
}
public static <T> ResponseVO<T> error(String msg) {
ResponseVO<T> tResponseVO = new ResponseVO<>();
tResponseVO.setCode("0");
tResponseVO.setDesc(msg);
tResponseVO.setSuccess(false);
return tResponseVO;
}
}
\ No newline at end of file
package com.pms.ocp.service;
import com.pms.ocp.model.entity.ModelIssue;
import com.pms.ocp.model.entity.ModelType;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:07
* @Description:模型订阅业务层接口
*/
public interface ModelIssueService {
/**
* 创建模型订阅
*
* @param modelIssueo
* @return
*/
Integer createModelIssue(ModelIssue modelIssueo);
/**
* 删除模型订阅
*
* @param modelId
* @return
*/
Integer deleteModelIssue(String modelId);
/**
* 更新模型订阅
*
* @param modelIssueo
* @return
*/
Integer updateModelIssue(ModelIssue modelIssueo);
/**
* 获取模型订阅
*
* @param
* @return
*/
List<ModelType> getModelIssueList();
/**
* 获取模型订阅列表
*
* @param modelId
* @return
*/
ModelType getModelIssue(String modelId);
}
package com.pms.ocp.service;
import com.pms.ocp.model.entity.ModelNote;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:08
* @Description:模型事记业务层接口
*/
public interface ModelNoteService {
/**
* 创建模型事记
*
* @param modelNote
* @return
*/
Integer createModelNote(ModelNote modelNote);
/**
* 删除模型事记
*
* @param modelId
* @return
*/
Integer deleteModelNote(String modelId);
/**
* 更新模型事记
*
* @param modelNote
* @return
*/
Integer updateModelNote(ModelNote modelNote);
/**
* 获取模型事记
*
* @param
* @return
*/
List<ModelNote> getModelNoteList();
/**
* 获取模型事记列表
*
* @param modelId
* @return
*/
ModelNote getModelNote(String modelId);
}
package com.pms.ocp.service;
import com.pms.ocp.model.entity.ModelProperty;
import com.pms.ocp.model.entity.ModelType;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:03
* @Description:模型属性业务层接口
*/
public interface ModelPropertyService {
/**
* 创建模型属性
*
* @param modelProperty
* @return
*/
Integer createModelProperty(ModelProperty modelProperty);
/**
* 删除模型属性
*
* @param modelId
* @return
*/
Integer deleteModelProperty(String modelId);
/**
* 更新模型属性
*
* @param modelProperty
* @return
*/
Integer updateModelProperty(ModelProperty modelProperty);
/**
* 获取模型属性
*
* @param
* @return
*/
List<ModelProperty> getModelPropertyList();
/**
* 获取模型属性列表
*
* @param modelId
* @return
*/
ModelProperty getModelProperty(String modelId);
}
package com.pms.ocp.service;
import com.pms.ocp.model.entity.Model;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:03
* @Description:模型业务层接口
*/
public interface ModelService {
/**
* 创建模型
*
* @param model
* @return
*/
Integer createModel(Model model);
/**
* 删除模型
*
* @param modelId
* @return
*/
Integer deleteModel(String modelId);
/**
* 更新模型
*
* @param model
* @return
*/
Integer updateModel(Model model);
/**
* 获取模型
*
* @param
* @return
*/
List<Model> getModelList();
/**
* 获取模型列表
*
* @param modelId
* @return
*/
Model getModel(String modelId);
}
package com.pms.ocp.service;
import com.pms.ocp.model.entity.Model;
import com.pms.ocp.model.entity.ModelType;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:07
* @Description:模型类型业务层接口
*/
public interface ModelTypeService {
/**
* 创建模型分类
*
* @param modelType
* @return
*/
Integer createModelType(ModelType modelType);
/**
* 删除模型分类
*
* @param modelId
* @return
*/
Integer deleteModelType(String modelId);
/**
* 更新模型分类
*
* @param modelType
* @return
*/
Integer updateModelType(ModelType modelType);
/**
* 获取模型分类
*
* @param
* @return
*/
List<ModelType> getModelTypeList();
/**
* 获取模型分类列表
*
* @param modelId
* @return
*/
ModelType getModelType(String modelId);
}
package com.pms.ocp.service.impl;
import com.pms.ocp.model.entity.ModelIssue;
import com.pms.ocp.model.entity.ModelType;
import com.pms.ocp.service.ModelIssueService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:22
* @Description:模型订阅业务层实现
*/
@Service
public class ModelIssueServiceImpl implements ModelIssueService {
@Override
public Integer createModelIssue(ModelIssue modelIssueo) {
return null;
}
@Override
public Integer deleteModelIssue(String modelId) {
return null;
}
@Override
public Integer updateModelIssue(ModelIssue modelIssueo) {
return null;
}
@Override
public List<ModelType> getModelIssueList() {
return null;
}
@Override
public ModelType getModelIssue(String modelId) {
return null;
}
}
package com.pms.ocp.service.impl;
import com.pms.ocp.model.entity.ModelNote;
import com.pms.ocp.service.ModelNoteService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:21
* @Description:模型事记业务层实现
*/
@Service
public class ModelNoteServiceImpl implements ModelNoteService {
@Override
public Integer createModelNote(ModelNote modelNote) {
return null;
}
@Override
public Integer deleteModelNote(String modelId) {
return null;
}
@Override
public Integer updateModelNote(ModelNote modelNote) {
return null;
}
@Override
public List<ModelNote> getModelNoteList() {
return null;
}
@Override
public ModelNote getModelNote(String modelId) {
return null;
}
}
package com.pms.ocp.service.impl;
import com.pms.ocp.model.entity.ModelProperty;
import com.pms.ocp.service.ModelPropertyService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:21
* @Description:模型属性业务层实现
*/
@Service
public class ModelPropertyServiceImpl implements ModelPropertyService {
@Override
public Integer createModelProperty(ModelProperty modelProperty) {
return null;
}
@Override
public Integer deleteModelProperty(String modelId) {
return null;
}
@Override
public Integer updateModelProperty(ModelProperty modelProperty) {
return null;
}
@Override
public List<ModelProperty> getModelPropertyList() {
return null;
}
@Override
public ModelProperty getModelProperty(String modelId) {
return null;
}
}
package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pms.ocp.mapper.ModelMapper;
import com.pms.ocp.model.entity.Model;
import com.pms.ocp.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:21
* @Description:模型业务层实现
*/
@Service
public class ModelServiceImpl implements ModelService {
@Autowired
private ModelMapper modelMapper;
/**
* 创建模型
*
* @param model
* @return
*/
@Override
public Integer createModel(Model model) {
return modelMapper.insert(model);
}
/**
* 删除模型
*
* @param modelId
* @return
*/
@Override
public Integer deleteModel(String modelId) {
QueryWrapper<Model> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("model_id", modelId);
return modelMapper.delete(queryWrapper);
}
/**
* 更新模型
*
* @param model
* @return
*/
@Override
public Integer updateModel(Model model) {
return modelMapper.updateById(model);
}
/**
* 获取模型列表
*
* @param
* @return
*/
@Override
public List<Model> getModelList() {
return modelMapper.selectList(null);
}
/**
* 获取模型
*
* @param modelId
* @return
*/
@Override
public Model getModel(String modelId) {
QueryWrapper<Model> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("model_id", modelId);
return modelMapper.selectOne(queryWrapper);
}
}
package com.pms.ocp.service.impl;
import com.pms.ocp.model.entity.ModelType;
import com.pms.ocp.service.ModelTypeService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:21
* @Description:模型类型业务层实现
*/
@Service
public class ModelTypeServiceImpl implements ModelTypeService {
@Override
public Integer createModelType(ModelType modelType) {
return null;
}
@Override
public Integer deleteModelType(String modelId) {
return null;
}
@Override
public Integer updateModelType(ModelType modelType) {
return null;
}
@Override
public List<ModelType> getModelTypeList() {
return null;
}
@Override
public ModelType getModelType(String modelId) {
return null;
}
}
{
"groups": [
{
"name": "beagle",
"type": "com.pms.ocp.common.config.ApplicationKey",
"sourceType": "com.pms.ocp.common.config.ApplicationKey"
},
{
"name": "beagle.jwt",
"type": "com.pms.ocp.common.config.ApplicationKey$Jwt",
"sourceType": "com.pms.ocp.common.config.ApplicationKey"
},
{
"name": "spring.datasource",
"type": "com.zaxxer.hikari.HikariDataSource",
"sourceType": "com.pms.ocp.common.config.BeanConfig",
"sourceMethod": "dataSource()"
}
],
"properties": [
{
"name": "beagle.jwt.expire-time",
"type": "java.lang.String",
"sourceType": "com.pms.ocp.common.config.ApplicationKey$Jwt"
},
{
"name": "beagle.jwt.secret-key",
"type": "java.lang.String",
"sourceType": "com.pms.ocp.common.config.ApplicationKey$Jwt"
},
{
"name": "beagle.jwt.token-prefix",
"type": "java.lang.String",
"sourceType": "com.pms.ocp.common.config.ApplicationKey$Jwt"
},
{
"name": "spring.datasource.allow-pool-suspension",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.auto-commit",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.catalog",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.connection-init-sql",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.connection-test-query",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.connection-timeout",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.data-source-class-name",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.data-source-j-n-d-i",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.data-source-properties",
"type": "java.util.Properties",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.driver-class-name",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.exception-override-class-name",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.health-check-properties",
"type": "java.util.Properties",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.health-check-registry",
"type": "java.lang.Object",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.idle-timeout",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.initialization-fail-timeout",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.isolate-internal-queries",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.jdbc-url",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.leak-detection-threshold",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.login-timeout",
"type": "java.lang.Integer",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.max-lifetime",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.maximum-pool-size",
"type": "java.lang.Integer",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.metric-registry",
"type": "java.lang.Object",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.metrics-tracker-factory",
"type": "com.zaxxer.hikari.metrics.MetricsTrackerFactory",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.minimum-idle",
"type": "java.lang.Integer",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.password",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.pool-name",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.read-only",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.register-mbeans",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.scheduled-executor",
"type": "java.util.concurrent.ScheduledExecutorService",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.schema",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.transaction-isolation",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.username",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.validation-timeout",
"type": "java.lang.Long",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
}
],
"hints": []
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="./log"/>
<property name="PATTERN_FORMAT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]-%-5level-[%X{traceId}]-%F:%L- %msg%n"/>
<property name="MAX_HISTORY" value="30"/>
<property name="MAX_FILE_SIZE" value="10MB"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${PATTERN_FORMAT}</pattern>
</encoder>
</appender>
<appender name="INTERFACE_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_PATH}/interface_log_%d{yyyyMMdd}.log</FileNamePattern>
<MaxHistory>${MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${PATTERN_FORMAT}</pattern>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>${MAX_FILE_SIZE}</MaxFileSize>
</triggeringPolicy>
</appender>
<appender name="ERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_PATH}/error_log_%d{yyyyMMdd}.log</FileNamePattern>
<MaxHistory>${MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${PATTERN_FORMAT}</pattern>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>${MAX_FILE_SIZE}</MaxFileSize>
</triggeringPolicy>
</appender>
<appender name="RUN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_PATH}/service_log_%d{yyyyMMdd}.log</FileNamePattern>
<MaxHistory>${MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${PATTERN_FORMAT}</pattern>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>${MAX_FILE_SIZE}</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="org.springframework.boot.autoconfigure.logging" level="INFO"/>
<!--输出接口日志-->
<logger name="com.pms.ocp.common.aspect.InterfaceLogAspect" level="INFO" additivity="false">
<appender-ref ref="INTERFACE_LOG"/>
</logger>
<!--输出异常日志-->
<logger name="com.pms.ocp.common.exception.GlobalExceptionHandler" level="ERROR">
<appender-ref ref="ERROR_LOG"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="RUN_LOG"/>
</root>
</configuration>
\ No newline at end of file
<?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.pms.ocp.mapper.ModelMapper">
<!-- &lt;!&ndash;<select id="getPlatformServiceSortVo" resultType="com.beagle.base.model.vo.PlatformServiceSortVo">&ndash;&gt;-->
<!-- &lt;!&ndash;SELECT&ndash;&gt;-->
<!-- &lt;!&ndash;*&ndash;&gt;-->
<!-- &lt;!&ndash;FROM&ndash;&gt;-->
<!-- &lt;!&ndash;( SELECT COUNT ( api_code ) AS total, api_code AS apiCode, api_name AS apiName FROM pms_zy_api GROUP BY api_code, api_name ) T&ndash;&gt;-->
<!-- &lt;!&ndash;where T.total > 0&ndash;&gt;-->
<!-- &lt;!&ndash;ORDER BY&ndash;&gt;-->
<!-- &lt;!&ndash;total DESC&ndash;&gt;-->
<!-- &lt;!&ndash;</select>&ndash;&gt;-->
<!-- <select id="getPlatformServiceNotSortVo" resultType="com.beagle.base.model.vo.PlatformServiceSortVo">-->
<!-- SELECT COUNT ( api_code ) AS total, api_code AS apiCode, api_name AS apiName FROM pms_zy_api GROUP BY api_code, api_name-->
<!-- </select>-->
<!-- <select id="getCountCompanyCodeIsNull" resultType="int">-->
<!-- SELECT COUNT( * ) FROM pms_zy_api WHERE company_code is null-->
<!-- </select>-->
<!-- <select id="selectApiInfoList" resultType="com.beagle.base.model.dto.AcceptApiInfoDto"-->
<!-- parameterType="java.util.Map">-->
<!-- select-->
<!-- api.api_id as apiId,-->
<!-- api.api_code as api_code,-->
<!-- api.api_name as apiName,-->
<!-- api.api_url as apiUrl,-->
<!-- api.api_ctime as apiCtime,-->
<!-- gro.group_name as groupName,-->
<!-- api.company_code as companyCode,-->
<!-- api.company_name as companyName-->
<!-- from pms_zy_api api-->
<!-- left join pms_zy_api_group gro-->
<!-- on api.group_id = gro.group_id-->
<!-- <where>-->
<!-- api.company_code = #{companyCode}-->
<!-- <if test="apiName !=null and apiName != '' ">-->
<!-- and api.api_name like CONCAT('%', #{apiName}::text,'%')-->
<!-- </if>-->
<!-- <if test="groupName != null and groupName != '' ">-->
<!-- and gro.group_name = #{groupName}-->
<!-- </if>-->
<!-- <if test="isBind != null and isBind == 0">-->
<!-- and api.api_id not in-->
<!-- <foreach collection="apiIds" separator="," item="item" open="(" close=")" index="index" >-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="isBind != null and isBind == 1">-->
<!-- and api.api_id in-->
<!-- <foreach collection="apiIds" separator="," item="item" open="(" close=")" index="index" >-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </where>-->
<!-- order by api.api_ctime desc-->
<!-- </select>-->
<!-- <select id="selectPlanInvokeApiList" resultType="com.beagle.base.model.dto.PlanInvokeApiCountDTO">-->
<!-- select pc2.company_code, pc2.company_name,pc2.company_short_name, eee.tenant_code, eee.tenant_name , eee.api_plan_invoke_count from pms_company pc2-->
<!-- left join (select pc.company_code, pc.company_name, pzt.tenant_id, pzt.tenant_code, pzt.tenant_name , count(pztar.api_id) as api_plan_invoke_count-->
<!-- from pms_company pc-->
<!-- left join pms_zy_tenant pzt on pc.company_code = pzt.company_code-->
<!-- join pms_zy_tenant_api_rel pztar on pzt.tenant_id = pztar.tenant_id-->
<!-- group by pzt.tenant_id ,pc.company_code, pc.company_name,pzt.tenant_name,pzt.tenant_code) as eee on pc2.company_code = eee.company_code-->
<!-- <where>-->
<!-- <if test="tenantCode != null and tenantCode != '' ">-->
<!-- and tenant_code = #{tenantCode}-->
<!-- </if>-->
<!-- </where>-->
<!-- </select>-->
<!-- <select id="selectGroupApiQuantity" resultType="com.beagle.base.model.dto.GroupInvokeApiSituationDTO">-->
<!-- select pzag.group_id, pzag.group_name, pza.api_code, pza.api_name-->
<!-- from pms_zy_api_group pzag-->
<!-- left join pms_zy_api pza on pzag.group_id = pza.group_id-->
<!-- <where>-->
<!-- <if test="groupLvl != null and groupLvl != '' ">-->
<!-- and pzag.group_lvl = #{groupLvl}-->
<!-- </if>-->
<!-- <if test="groupNamePre != null and groupNamePre != '' ">-->
<!-- and pzag.group_name like CONCAT('%', #{groupNamePre}::text,'%')-->
<!-- </if>-->
<!-- </where>-->
<!-- </select>-->
</mapper>
\ No newline at end of file
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