haungxing
1 year ago
68 changed files with 1673 additions and 257 deletions
@ -0,0 +1,26 @@
|
||||
package com.hnac.hzims.ticket.standardTicket.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class CensParamVo { |
||||
|
||||
@ApiModelProperty("机构Id") |
||||
private Long deptId; |
||||
|
||||
@ApiModelProperty("开始时间 : yyyy-MM-dd HH:mm:ss") |
||||
private String startTime; |
||||
|
||||
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss") |
||||
private String endTime; |
||||
|
||||
@ApiModelProperty("状态 : 0-全部 1-完成") |
||||
private Integer state; |
||||
|
||||
@ApiModelProperty("结束") |
||||
private String flowTaskName; |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.ticket.standardTicket.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class CensVo { |
||||
|
||||
@ApiModelProperty("机构ID") |
||||
private Long deptId; |
||||
|
||||
@ApiModelProperty("机构名称") |
||||
private String deptName; |
||||
|
||||
@ApiModelProperty("月份") |
||||
private Integer mon; |
||||
|
||||
@ApiModelProperty("工作票数量") |
||||
private Long workCount; |
||||
|
||||
@ApiModelProperty("操作票数量") |
||||
private Long operateCount; |
||||
|
||||
@ApiModelProperty("工作任务数量") |
||||
private Long workTaskCount; |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.ticket.standardTicket.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class CensYearParamVo { |
||||
|
||||
@ApiModelProperty("机构Id") |
||||
private Long deptId; |
||||
|
||||
@ApiModelProperty("年度 : yyyy") |
||||
private String year; |
||||
|
||||
@ApiModelProperty("状态 : 0-全部 1-完成") |
||||
private Integer state; |
||||
|
||||
@ApiModelProperty("流程描述") |
||||
private String flowTaskName; |
||||
|
||||
@ApiModelProperty("开始时间 : yyyy-MM-dd HH:mm:ss") |
||||
private String startTime; |
||||
|
||||
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss") |
||||
private String endTime; |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.hzims.ticket.standardTicket.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class CensYearVo { |
||||
|
||||
@ApiModelProperty("机构ID") |
||||
private Long deptId; |
||||
|
||||
@ApiModelProperty("机构名称") |
||||
private String deptName; |
||||
|
||||
@ApiModelProperty("统计数量") |
||||
private List<CensVo> censs; |
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.hnac.hzims.alarm.ws.alart; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hnac.hzims.alarm.show.service.AlarmService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.socket.CloseStatus; |
||||
import org.springframework.web.socket.TextMessage; |
||||
import org.springframework.web.socket.WebSocketSession; |
||||
import org.springframework.web.socket.handler.TextWebSocketHandler; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
public class AlarmHandler extends TextWebSocketHandler { |
||||
|
||||
@Autowired |
||||
private AlarmService alarmService; |
||||
|
||||
@Override |
||||
public void afterConnectionEstablished(WebSocketSession session) { |
||||
String[] split = session.getUri().toString().split("/"); |
||||
String uid = split[split.length - 1]; |
||||
AlarmSessionManager.add(uid, session); |
||||
session.getAttributes().put("userId", uid); |
||||
log.info("sessionId: " + session.getId()); |
||||
log.info("session connection successful!"); |
||||
AlarmSocketPool.pool.put(session.getId(), this); |
||||
} |
||||
|
||||
@Override |
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { |
||||
AlarmSessionManager.removeAndClose(session.getId()); |
||||
AlarmSocketPool.pool.remove(session.getId()); |
||||
log.info("sessionId: " + session.getId()); |
||||
log.info("uri: " + session.getUri()); |
||||
log.info("session closed successful!"); |
||||
} |
||||
|
||||
@Override |
||||
public void handleTransportError(WebSocketSession session, Throwable exception) { |
||||
AlarmSessionManager.removeAndClose(session.getId()); |
||||
AlarmSocketPool.pool.remove(session.getId()); |
||||
} |
||||
|
||||
@Override |
||||
protected void handleTextMessage(WebSocketSession session, TextMessage textMessage) throws IOException { |
||||
String userId = (String) session.getAttributes().get("userId"); |
||||
String message = textMessage.getPayload(); |
||||
if(StringUtil.isBlank(message)){ |
||||
return; |
||||
} |
||||
List<Long> depts = JSONObject.parseArray(message,Long.class); |
||||
if(CollectionUtil.isEmpty(depts)){ |
||||
return; |
||||
} |
||||
TextMessage sendMessage = alarmService.majorAlarm(depts); |
||||
if(ObjectUtil.isEmpty(sendMessage)){ |
||||
return; |
||||
} |
||||
session.sendMessage(sendMessage); |
||||
} |
||||
} |
@ -0,0 +1,63 @@
|
||||
package com.hnac.hzims.alarm.ws.alart; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.web.socket.WebSocketSession; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
public class AlarmSessionManager { |
||||
/** |
||||
* ws会话池 |
||||
*/ |
||||
public static ConcurrentHashMap<String, WebSocketSession> SESSION_POOL = new ConcurrentHashMap<>(); |
||||
|
||||
/** |
||||
* 添加会话 |
||||
* |
||||
* @param uid 标记 |
||||
* @param session 会话对象 |
||||
*/ |
||||
public static void add(String uid, WebSocketSession session) { |
||||
if (SESSION_POOL.containsKey(uid)) { |
||||
AlarmSessionManager.removeAndClose(uid); |
||||
} |
||||
SESSION_POOL.put(uid, session); |
||||
log.info("添加 WebSocketSession 会话成功,uid=" + uid); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取 ws 会话 |
||||
* |
||||
* @param uid |
||||
*/ |
||||
public static WebSocketSession get(String uid) { |
||||
return SESSION_POOL.get(uid); |
||||
} |
||||
|
||||
/** |
||||
* 移除 ws 会话并关闭会话 |
||||
* |
||||
* @param uid |
||||
*/ |
||||
public static void removeAndClose(String uid) { |
||||
WebSocketSession session = SESSION_POOL.get(uid); |
||||
if (session != null) { |
||||
try { |
||||
//关闭连接
|
||||
session.close(); |
||||
} catch (IOException ex) { |
||||
throw new RuntimeException("关闭ws会话失败!", ex); |
||||
} |
||||
} |
||||
|
||||
SESSION_POOL.remove(uid); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.hnac.hzims.alarm.ws.alart; |
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.socket.WebSocketHandler; |
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket; |
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer; |
||||
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; |
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Configuration |
||||
@EnableWebSocket |
||||
public class AlarmSocketConfig implements WebSocketConfigurer{ |
||||
@Override |
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { |
||||
// 集中监控弹框处理器
|
||||
registry.addHandler(monitorHandler(), "/alarm/alart/{uid}").setAllowedOrigins("*"); |
||||
} |
||||
|
||||
@Bean |
||||
public WebSocketHandler monitorHandler() { |
||||
return new AlarmHandler(); |
||||
} |
||||
|
||||
@Bean |
||||
public ServerEndpointExporter serverEndpointExporter() { |
||||
return new ServerEndpointExporter(); |
||||
} |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.hzims.alarm.ws.alart; |
||||
|
||||
import java.util.Map; |
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public class AlarmSocketPool { |
||||
|
||||
public static Map<String, AlarmHandler> pool = new ConcurrentHashMap<>(); |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.hnac.hzims.scheduled.scheduled; |
||||
|
||||
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; |
||||
import com.xxl.job.core.biz.model.ReturnT; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.DateUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* 告警定时任务 |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
public class AlarmScheduledTask { |
||||
|
||||
@Autowired |
||||
private AlarmQueryService service; |
||||
|
||||
/** |
||||
* 开停机告警 |
||||
* @return ReturnT<String> |
||||
*/ |
||||
//@XxlJob(START_STOP_ALARM)
|
||||
@Scheduled(cron = "0/40 * * * * ? ") |
||||
public ReturnT<String> startStopAlarm() { |
||||
String param = ""; |
||||
if (Func.isBlank(param)) { |
||||
param = DateUtil.format(new Date(), "yyyy-MM"); |
||||
} |
||||
service.startStopAlarm(param); |
||||
return new ReturnT<>("SUCCESS"); |
||||
} |
||||
} |
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration scan="true" scanPeriod="60 seconds"> |
||||
<!-- 自定义参数监听 --> |
||||
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/> |
||||
|
||||
<!-- 彩色日志依赖的渲染类 --> |
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
||||
<conversionRule conversionWord="wex" |
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
||||
<conversionRule conversionWord="wEx" |
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
||||
<!-- 彩色日志格式 --> |
||||
<property name="CONSOLE_LOG_PATTERN" |
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
<!-- 控制台输出 --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> |
||||
<property name="log.pattern" |
||||
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/> |
||||
|
||||
<!-- 生成日志文件 --> |
||||
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/info.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!-- 日志文件输出的文件名 --> |
||||
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!--设置保存10天 一天24个文件,一小时生成一个--> |
||||
<MaxHistory>240</MaxHistory> |
||||
<!--给定日志文件大小,超过指定的大小就新建一个日志文件--> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 --> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!-- 打印日志级别 --> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>INFO</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 生成日志文件 --> |
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/error.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!-- 日志文件输出的文件名 --> |
||||
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!--设置保存15天 一天24个文件,一小时生成一个--> |
||||
<MaxHistory>360</MaxHistory> |
||||
<!--给定日志文件大小,超过指定的大小就新建一个日志文件--> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 --> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!-- 打印日志级别 --> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>ERROR</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 日志输出级别 --> |
||||
<root level="ERROR"> |
||||
<appender-ref ref="STDOUT"/> |
||||
<!--<appender-ref ref="INFO"/>--> |
||||
<appender-ref ref="ERROR"/> |
||||
</root> |
||||
|
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
|
||||
|
||||
<!-- MyBatis log configure --> |
||||
<logger name="com.apache.ibatis" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="java.sql.Connection" level="ERROR"/> |
||||
<logger name="java.sql.Statement" level="ERROR"/> |
||||
<logger name="java.sql.PreparedStatement" level="ERROR"/> |
||||
|
||||
<!-- 减少部分debug日志 --> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
<logger name="org.apache.shiro" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="org.springframework" level="ERROR"/> |
||||
<logger name="org.springframework.context" level="ERROR"/> |
||||
<logger name="org.springframework.beans" level="ERROR"/> |
||||
<logger name="com.baomidou.mybatisplus" level="ERROR"/> |
||||
<logger name="org.apache.ibatis.io" level="ERROR"/> |
||||
<logger name="org.apache.velocity" level="ERROR"/> |
||||
<logger name="org.eclipse.jetty" level="ERROR"/> |
||||
<logger name="io.undertow" level="ERROR"/> |
||||
<logger name="org.xnio.nio" level="ERROR"/> |
||||
<logger name="org.thymeleaf" level="ERROR"/> |
||||
<logger name="springfox.documentation" level="ERROR"/> |
||||
<logger name="org.hibernate.validator" level="ERROR"/> |
||||
<logger name="com.netflix.loadbalancer" level="ERROR"/> |
||||
<logger name="com.netflix.hystrix" level="ERROR"/> |
||||
<logger name="com.netflix.zuul" level="ERROR"/> |
||||
<logger name="de.codecentric" level="ERROR"/> |
||||
<!-- cache ERROR --> |
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="org.springframework.cache" level="ERROR"/> |
||||
<!-- cloud --> |
||||
<logger name="org.apache.http" level="ERROR"/> |
||||
<logger name="com.netflix.discovery" level="ERROR"/> |
||||
<logger name="com.netflix.eureka" level="ERROR"/> |
||||
<!-- 业务日志 --> |
||||
<Logger name="org.springblade" level="ERROR"/> |
||||
<Logger name="org.springblade.core.version" level="ERROR"/> |
||||
|
||||
<!-- 减少nacos日志 --> |
||||
<logger name="com.alibaba.nacos" level="ERROR"/> |
||||
|
||||
</configuration> |
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration scan="true" scanPeriod="60 seconds"> |
||||
<!-- 自定义参数监听 --> |
||||
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/> |
||||
|
||||
<!-- 彩色日志依赖的渲染类 --> |
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
||||
<conversionRule conversionWord="wex" |
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
||||
<conversionRule conversionWord="wEx" |
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
||||
<!-- 彩色日志格式 --> |
||||
<property name="CONSOLE_LOG_PATTERN" |
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
<!-- 控制台输出 --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> |
||||
<property name="log.pattern" |
||||
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/> |
||||
|
||||
<!-- 生成日志文件 --> |
||||
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/info.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!-- 日志文件输出的文件名 --> |
||||
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!--设置保存10天 一天24个文件,一小时生成一个--> |
||||
<MaxHistory>240</MaxHistory> |
||||
<!--给定日志文件大小,超过指定的大小就新建一个日志文件--> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 --> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!-- 打印日志级别 --> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>INFO</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 生成日志文件 --> |
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/error.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!-- 日志文件输出的文件名 --> |
||||
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!--设置保存15天 一天24个文件,一小时生成一个--> |
||||
<MaxHistory>360</MaxHistory> |
||||
<!--给定日志文件大小,超过指定的大小就新建一个日志文件--> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 --> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!-- 打印日志级别 --> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>ERROR</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 日志输出级别 --> |
||||
<root level="ERROR"> |
||||
<appender-ref ref="STDOUT"/> |
||||
<!--<appender-ref ref="INFO"/>--> |
||||
<appender-ref ref="ERROR"/> |
||||
</root> |
||||
|
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
|
||||
|
||||
<!-- MyBatis log configure --> |
||||
<logger name="com.apache.ibatis" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="java.sql.Connection" level="ERROR"/> |
||||
<logger name="java.sql.Statement" level="ERROR"/> |
||||
<logger name="java.sql.PreparedStatement" level="ERROR"/> |
||||
|
||||
<!-- 减少部分debug日志 --> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
<logger name="org.apache.shiro" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="org.springframework" level="ERROR"/> |
||||
<logger name="org.springframework.context" level="ERROR"/> |
||||
<logger name="org.springframework.beans" level="ERROR"/> |
||||
<logger name="com.baomidou.mybatisplus" level="ERROR"/> |
||||
<logger name="org.apache.ibatis.io" level="ERROR"/> |
||||
<logger name="org.apache.velocity" level="ERROR"/> |
||||
<logger name="org.eclipse.jetty" level="ERROR"/> |
||||
<logger name="io.undertow" level="ERROR"/> |
||||
<logger name="org.xnio.nio" level="ERROR"/> |
||||
<logger name="org.thymeleaf" level="ERROR"/> |
||||
<logger name="springfox.documentation" level="ERROR"/> |
||||
<logger name="org.hibernate.validator" level="ERROR"/> |
||||
<logger name="com.netflix.loadbalancer" level="ERROR"/> |
||||
<logger name="com.netflix.hystrix" level="ERROR"/> |
||||
<logger name="com.netflix.zuul" level="ERROR"/> |
||||
<logger name="de.codecentric" level="ERROR"/> |
||||
<!-- cache INFO --> |
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="org.springframework.cache" level="ERROR"/> |
||||
<!-- cloud --> |
||||
<logger name="org.apache.http" level="ERROR"/> |
||||
<logger name="com.netflix.discovery" level="ERROR"/> |
||||
<logger name="com.netflix.eureka" level="ERROR"/> |
||||
<!-- 业务日志 --> |
||||
<Logger name="org.springblade" level="ERROR"/> |
||||
<Logger name="org.springblade.core.version" level="ERROR"/> |
||||
|
||||
<!-- 减少nacos日志 --> |
||||
<logger name="com.alibaba.nacos" level="ERROR"/> |
||||
|
||||
</configuration> |
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration scan="true" scanPeriod="60 seconds"> |
||||
<!-- 自定义参数监听 --> |
||||
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/> |
||||
|
||||
<!-- 彩色日志依赖的渲染类 --> |
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
||||
<conversionRule conversionWord="wex" |
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
||||
<conversionRule conversionWord="wEx" |
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
||||
<!-- 彩色日志格式 --> |
||||
<property name="CONSOLE_LOG_PATTERN" |
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
<!-- 控制台输出 --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 --> |
||||
<property name="log.pattern" |
||||
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/> |
||||
|
||||
<!-- 生成日志文件 |
||||
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/info.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!– 日志文件输出的文件名 –> |
||||
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!–设置保存10天 一天24个文件,一小时生成一个–> |
||||
<MaxHistory>240</MaxHistory> |
||||
<!–给定日志文件大小,超过指定的大小就新建一个日志文件–> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!– 总日志大小 –> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!– 打印日志级别 –> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>INFO</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender>--> |
||||
|
||||
<!-- 生成日志文件 --> |
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>log/error.log</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
<!-- 日志文件输出的文件名 --> |
||||
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||
<!--设置保存15天 一天24个文件,一小时生成一个--> |
||||
<MaxHistory>360</MaxHistory> |
||||
<!--给定日志文件大小,超过指定的大小就新建一个日志文件--> |
||||
<maxFileSize>20MB</maxFileSize> |
||||
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 --> |
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
||||
</rollingPolicy> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${log.pattern}</pattern> |
||||
</encoder> |
||||
<!-- 打印日志级别 --> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>ERROR</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
</appender> |
||||
|
||||
<!-- 日志输出级别 --> |
||||
<root level="ERROR"> |
||||
<appender-ref ref="STDOUT"/> |
||||
<!--<appender-ref ref="INFO"/>--> |
||||
<appender-ref ref="ERROR"/> |
||||
</root> |
||||
|
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
|
||||
|
||||
<!-- MyBatis log configure --> |
||||
<logger name="com.apache.ibatis" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="java.sql.Connection" level="ERROR"/> |
||||
<logger name="java.sql.Statement" level="ERROR"/> |
||||
<logger name="java.sql.PreparedStatement" level="ERROR"/> |
||||
|
||||
<!-- 减少部分debug日志 --> |
||||
<logger name="druid.sql" level="ERROR"/> |
||||
<logger name="org.apache.shiro" level="ERROR"/> |
||||
<logger name="org.mybatis.spring" level="ERROR"/> |
||||
<logger name="org.springframework" level="ERROR"/> |
||||
<logger name="org.springframework.context" level="ERROR"/> |
||||
<logger name="org.springframework.beans" level="ERROR"/> |
||||
<logger name="com.baomidou.mybatisplus" level="ERROR"/> |
||||
<logger name="org.apache.ibatis.io" level="ERROR"/> |
||||
<logger name="org.apache.velocity" level="ERROR"/> |
||||
<logger name="org.eclipse.jetty" level="ERROR"/> |
||||
<logger name="io.undertow" level="ERROR"/> |
||||
<logger name="org.xnio.nio" level="ERROR"/> |
||||
<logger name="org.thymeleaf" level="ERROR"/> |
||||
<logger name="springfox.documentation" level="ERROR"/> |
||||
<logger name="org.hibernate.validator" level="ERROR"/> |
||||
<logger name="com.netflix.loadbalancer" level="ERROR"/> |
||||
<logger name="com.netflix.hystrix" level="ERROR"/> |
||||
<logger name="com.netflix.zuul" level="ERROR"/> |
||||
<logger name="de.codecentric" level="ERROR"/> |
||||
<!-- cache INFO --> |
||||
<logger name="net.sf.ehcache" level="ERROR"/> |
||||
<logger name="org.springframework.cache" level="ERROR"/> |
||||
<!-- cloud --> |
||||
<logger name="org.apache.http" level="ERROR"/> |
||||
<logger name="com.netflix.discovery" level="ERROR"/> |
||||
<logger name="com.netflix.eureka" level="ERROR"/> |
||||
<!-- 业务日志 --> |
||||
<Logger name="org.springblade" level="ERROR"/> |
||||
<Logger name="org.springblade.core.version" level="ERROR"/> |
||||
|
||||
<!-- 减少nacos日志 --> |
||||
<logger name="com.alibaba.nacos" level="ERROR"/> |
||||
|
||||
</configuration> |
Binary file not shown.
@ -0,0 +1,41 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo; |
||||
import com.hnac.hzims.ticket.twoTicket.service.CensService; |
||||
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
@RequestMapping("/bill") |
||||
public class CensController { |
||||
|
||||
private final CensService censService; |
||||
|
||||
@PostMapping("/cens") |
||||
@ApiOperation("两票统计") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<List<CensVo>> cens(@RequestBody CensParamVo param) { |
||||
return R.data(censService.cens(param)); |
||||
} |
||||
|
||||
@PostMapping("/censYear") |
||||
@ApiOperation("两票统计") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<List<CensYearVo>> censYear(@RequestBody CensYearParamVo param) { |
||||
return R.data(censService.censYear(param)); |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.service; |
||||
|
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface CensService { |
||||
|
||||
List<CensVo> cens(CensParamVo param); |
||||
|
||||
List<CensYearVo> censYear(CensYearParamVo param); |
||||
} |
@ -0,0 +1,180 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
||||
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; |
||||
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo; |
||||
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo; |
||||
import com.hnac.hzims.ticket.twoTicket.service.CensService; |
||||
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
||||
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.DateUtil; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.system.entity.Dept; |
||||
import org.springblade.system.feign.ISysClient; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
@Service |
||||
@RequiredArgsConstructor |
||||
public class CensServiceImpl implements CensService { |
||||
|
||||
private final IStandardTicketInfoService operateTicketService; |
||||
|
||||
private final IWorkTicketInfoService workTicketInfoService; |
||||
|
||||
private final ISysClient sysClient; |
||||
|
||||
@Override |
||||
public List<CensVo> cens(CensParamVo param) { |
||||
if(StringUtil.isEmpty(param.getStartTime())){ |
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(new Date()); |
||||
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH)); |
||||
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
||||
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
||||
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
||||
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME)); |
||||
} |
||||
if(StringUtil.isEmpty(param.getEndTime())){ |
||||
param.setStartTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); |
||||
} |
||||
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){ |
||||
param.setFlowTaskName("结束"); |
||||
} |
||||
|
||||
// 获取权限区域机构
|
||||
List<Dept> depts = this.authArea(); |
||||
if(CollectionUtil.isEmpty(depts)){ |
||||
return new ArrayList<>(); |
||||
} |
||||
// 操作票查询
|
||||
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery() |
||||
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime()) |
||||
.in(StandardTicketInfoEntity::getCreateDept,depts); |
||||
if(!StringUtil.isEmpty(param.getFlowTaskName())){ |
||||
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName()); |
||||
} |
||||
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper); |
||||
// 工作票查询
|
||||
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery() |
||||
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime()) |
||||
.in(StandardTicketInfoEntity::getCreateDept,depts); |
||||
if(!StringUtil.isEmpty(param.getFlowTaskName())){ |
||||
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName()); |
||||
} |
||||
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper); |
||||
// 工作任务单
|
||||
return depts.stream().map(dept->{ |
||||
CensVo cens = new CensVo(); |
||||
cens.setDeptId(dept.getId()); |
||||
cens.setDeptName(dept.getDeptName()); |
||||
if(CollectionUtil.isEmpty(operates)){ |
||||
cens.setOperateCount(0L); |
||||
}else{ |
||||
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId())).count()); |
||||
} |
||||
if(CollectionUtil.isEmpty(works)){ |
||||
cens.setWorkCount(0L); |
||||
}else{ |
||||
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId())).count()); |
||||
} |
||||
cens.setWorkTaskCount((long)new Random().nextInt(10)); |
||||
return cens; |
||||
}).collect(Collectors.toList()); |
||||
} |
||||
|
||||
/** |
||||
* 获取权限区域机构 |
||||
* @return |
||||
*/ |
||||
private List<Dept> authArea() { |
||||
R<List<Dept>> resut = sysClient.getDeptByCurrentUser(); |
||||
if(!resut.isSuccess() || CollectionUtil.isEmpty(resut.getData())){ |
||||
return new ArrayList<>(); |
||||
} |
||||
return resut.getData().stream().filter(dept->dept.getDeptCategory().equals(HomePageConstant.AREA)).collect(Collectors.toList()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public List<CensYearVo> censYear(CensYearParamVo param) { |
||||
if(StringUtil.isEmpty(param.getYear())){ |
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH)); |
||||
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH)); |
||||
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
||||
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
||||
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
||||
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME)); |
||||
param.setEndTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); |
||||
}else{ |
||||
param.setStartTime(param.getYear() + "-01-01 00:00:00"); |
||||
param.setEndTime(param.getYear() + "-12-31 23:59:59"); |
||||
} |
||||
|
||||
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){ |
||||
param.setFlowTaskName("结束"); |
||||
} |
||||
|
||||
// 获取权限区域机构
|
||||
List<Dept> depts = this.authArea(); |
||||
if(CollectionUtil.isEmpty(depts)){ |
||||
return new ArrayList<>(); |
||||
} |
||||
|
||||
// 操作票查询
|
||||
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery() |
||||
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime()) |
||||
.in(StandardTicketInfoEntity::getCreateDept,depts); |
||||
if(!StringUtil.isEmpty(param.getFlowTaskName())){ |
||||
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName()); |
||||
} |
||||
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper); |
||||
// 工作票查询
|
||||
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery() |
||||
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime()) |
||||
.in(StandardTicketInfoEntity::getCreateDept,depts); |
||||
if(!StringUtil.isEmpty(param.getFlowTaskName())){ |
||||
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName()); |
||||
} |
||||
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper); |
||||
return depts.stream().map(dept -> { |
||||
CensYearVo censYear = new CensYearVo(); |
||||
censYear.setDeptId(dept.getId()); |
||||
censYear.setDeptName(dept.getDeptName()); |
||||
for(int mon = 1 ; mon <= 12 ;mon++){ |
||||
String strMon = param.getYear() + "-" + (mon > 9 ? mon : "0" + mon); |
||||
CensVo cens = new CensVo(); |
||||
cens.setMon(mon); |
||||
if(CollectionUtil.isEmpty(operates)){ |
||||
cens.setOperateCount(0L); |
||||
}else{ |
||||
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId()) && DateUtil.format(operate.getCreateTime(),"yyyy-MM").equals(strMon)).count()); |
||||
} |
||||
if(CollectionUtil.isEmpty(works)){ |
||||
cens.setWorkCount(0L); |
||||
}else{ |
||||
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId()) && DateUtil.format(work.getCreateTime(),"yyyy-MM").equals(strMon)).count()); |
||||
} |
||||
cens.setWorkTaskCount((long)new Random().nextInt(10)); |
||||
} |
||||
return censYear; |
||||
}).collect(Collectors.toList()); |
||||
} |
||||
} |
Loading…
Reference in new issue