parent
3b8afb310c
commit
4932096ba3
@ -0,0 +1,77 @@
|
||||
package com.renchao;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* @author ren_chao
|
||||
*/
|
||||
public class Demo02 {
|
||||
public static void main(String[] args) throws IOException {
|
||||
String root = "./abc/dd/";
|
||||
String file = "tt.txt";
|
||||
|
||||
Path path = Paths.get(root, file);
|
||||
System.out.println(path.toString());
|
||||
|
||||
|
||||
// setParent(Demo02.class.getClassLoader());
|
||||
//
|
||||
//
|
||||
// URL resource = Demo02.class.getClassLoader().getResource("crypto.yml");
|
||||
//
|
||||
//
|
||||
// try(InputStream inputStream = resource.openStream();
|
||||
// BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
|
||||
// String line;
|
||||
// while ((line = br.readLine()) != null) {
|
||||
// System.out.println(line);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// System.out.println(resource);
|
||||
}
|
||||
|
||||
|
||||
private static void setParent(ClassLoader classLoader) {
|
||||
|
||||
try {
|
||||
Field parent = ClassLoader.class.getDeclaredField("parent");
|
||||
parent.setAccessible(true);
|
||||
CustomClassLoader loader = new CustomClassLoader(classLoader.getParent());
|
||||
parent.set(classLoader,loader);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class CustomClassLoader extends ClassLoader {
|
||||
|
||||
public CustomClassLoader(ClassLoader parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String name) {
|
||||
try {
|
||||
if ("crypto.yml".equals(name)) {
|
||||
return new URL("file:C:/Users/RENCHAO/Desktop/temp-sss/bb/" + name);
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return super.getResource(name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDbzCCAxagAwIBAgIQWKQdbIzXXGI0HyTMVQqaSDAKBggqgRzPVQGDdTCBhzEL
|
||||
MAkGA1UEBhMCQ04xMzAxBgNVBAoMKuW4guWkp+aVsOaNruS4reW/gy3nm5HnrqHp
|
||||
k74uY20tMzl1cWhoazloMzELMAkGA1UECwwCY2ExNjA0BgNVBAMMLWNhLuW4guWk
|
||||
p+aVsOaNruS4reW/gy3nm5HnrqHpk74uY20tMzl1cWhoazloMzAeFw0yNDA0MDMw
|
||||
NTIxNTRaFw0yOTA0MDIwNTIxNTRaMIHCMQswCQYDVQQGEwJDTjEPMA0GA1UECAwG
|
||||
5LiK5rW3MQ8wDQYDVQQHDAbkuIrmtbcxMzAxBgNVBAoMKuW4guWkp+aVsOaNruS4
|
||||
reW/gy3nm5HnrqHpk74uY20tMzl1cWhoazloMzEOMAwGA1UECxMFYWRtaW4xTDBK
|
||||
BgNVBAMMQ+Wkp+aVsOaNruS4reW/g+euoeeQhuWRmC3luILlpKfmlbDmja7kuK3l
|
||||
v4Mt55uR566h6ZO+LmNtLTM5dXFoaGs5aDMwWTATBgcqhkjOPQIBBggqgRzPVQGC
|
||||
LQNCAARRDwc9DKv7hy24Zn6tdnaK7vJjFSHK7Y/OZW6jx8RoE5E/AzcxtmBYtHMr
|
||||
B10cuTs/aEnqtI7sIO5bnkLFzEx0o4IBJTCCASEwHQYDVR0OBBYEFAVn3B0+DHsp
|
||||
6b4mPtaqOjbzNZk9MA4GA1UdDwEB/wQEAwIDODAJBgNVHRMEAjAAMB8GA1UdIwQY
|
||||
MBaAFJSwbf0W4Y1mITjqfSm22chUqkK0MEEGCCsGAQUFBwEBBDUwMzAxBggrBgEF
|
||||
BQcwAYYlaHR0cDovL29zY3AxLmJsb2NrY2hhaW4uc2guY2Vnbi5jbi92MTA+BgNV
|
||||
HR8ENzA1MDOgMaAvhi1odHRwOi8vbGRhcDEuYmxvY2tjaGFpbi5zaC5jZWduLmNu
|
||||
L3YxL2FsbC5jcmwwQQYDVR0gBDowODA2BggqgRyG7zqBFTAqMCgGCCsGAQUFBwIB
|
||||
FhxodHRwOi8vd3d3LnNoZWNhLmNvbS9wb2xpY3kvMAoGCCqBHM9VAYN1A0cAMEQC
|
||||
ID2SIp0MsD7ImramHmazo6gjQdLxq5hUILVsFRUMz8+pAiAHCdZ6OwASFamka0Bn
|
||||
rdfj97z29ERgrsJ6gSnL2D9Meg==
|
||||
-----END CERTIFICATE-----
|
@ -0,0 +1,6 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQg2e6nVOJwcfqXZO20
|
||||
OK+4SAbLlIqoivBGTGHUuge9FaagCgYIKoEcz1UBgi2hRANCAARRDwc9DKv7hy24
|
||||
Zn6tdnaK7vJjFSHK7Y/OZW6jx8RoE5E/AzcxtmBYtHMrB10cuTs/aEnqtI7sIO5b
|
||||
nkLFzEx0
|
||||
-----END PRIVATE KEY-----
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
package com.jiuyv.sptcc.carbon.dataprocess.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author ren_chao
|
||||
*/
|
||||
public class ReqChainResultDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String txId;
|
||||
|
||||
public String getTxId() {
|
||||
return txId;
|
||||
}
|
||||
|
||||
public void setTxId(String txId) {
|
||||
this.txId = txId;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.jiuyv.sptcc.carbon.dataprocess.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author ren_chao
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "carbon-data-process")
|
||||
public class DataProcessProperties {
|
||||
/**
|
||||
* 是否开启上链
|
||||
*/
|
||||
private boolean enableUpChain = true;
|
||||
|
||||
public boolean getEnableUpChain() {
|
||||
return enableUpChain;
|
||||
}
|
||||
|
||||
public void setEnableUpChain(boolean enableUpChain) {
|
||||
this.enableUpChain = enableUpChain;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.jiuyv.sptcc.carbon.dataprocess.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ren_chao
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sms")
|
||||
public class SmsProperties {
|
||||
private boolean enable = false;
|
||||
private String sendUrl;
|
||||
private List<String> phoneList;
|
||||
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getSendUrl() {
|
||||
return sendUrl;
|
||||
}
|
||||
|
||||
public void setSendUrl(String sendUrl) {
|
||||
this.sendUrl = sendUrl;
|
||||
}
|
||||
|
||||
public List<String> getPhoneList() {
|
||||
return phoneList;
|
||||
}
|
||||
|
||||
public void setPhoneList(List<String> phoneList) {
|
||||
this.phoneList = phoneList;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.jiuyv.sptcc.carbon.dataprocess.feign;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 短信发送
|
||||
*
|
||||
* @author ren_chao
|
||||
*/
|
||||
@FeignClient(url = "${sms.sendUrl}", name = "msgSendFeign")
|
||||
public interface SmsSendFeign {
|
||||
@GetMapping
|
||||
String send(@RequestParam("phoneNo") String phoneNo, @RequestParam("sms") String sms, @RequestParam("code") String code);
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
<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>com.jiuyv.sptcc.agile</groupId>
|
||||
<artifactId>agile-datacenter</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>agile-datacenter-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jiuyv.sptcc.agile</groupId>
|
||||
<artifactId>agile-common</artifactId>
|
||||
<version>${agile-common.version}</version>
|
||||
</dependency>
|
||||
<!-- SpringWeb模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-report</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,31 @@
|
||||
package com.jiuyv.sptccc.agile.api.fegin;
|
||||
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.*;
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.R;
|
||||
import feign.Response;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 线路客流统计相关接口
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public interface SjztLinePassengerFeginApi{
|
||||
|
||||
/** 查询 t+1线路客流 */
|
||||
@PostMapping(value="/sjzt/querySjztLinePassengerNonrtime")
|
||||
public Response querySjztLinePassengerNonrtime(@RequestBody ReqSjztLinePassengerNonrtimeQueryDTO reqInfo) throws Exception;
|
||||
|
||||
/** 查询 实时线路客流*/
|
||||
@PostMapping(value="/sjzt/querySjztLinePassengerRealtime")
|
||||
public R<List<ResSjztLinePassengerRealtimeQueryDTO>> querySjztLinePassengerRealtime(@RequestBody ReqSjztLinePassengerRealtimeQueryDTO reqInfo) throws Exception;
|
||||
|
||||
/** 查询 实时线路累计客流 */
|
||||
@PostMapping(value="/sjzt/querySjztLinePassengerTotal")
|
||||
public R<List<ResSjztLinePassengerTotalQueryDTO>> querySjztLinePassengerTotal(@RequestBody ReqSjztLinePassengerTotalQueryDTO reqInfo) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* t+1线路客流_查询请求体
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public class ReqSjztLinePassengerNonrtimeQueryDTO implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 日期|yyyy-MM-dd
|
||||
*/
|
||||
@NotNull(message="日期不能为空")
|
||||
private String txnDate;
|
||||
|
||||
/**
|
||||
* Get日期
|
||||
*/
|
||||
public String getTxnDate(){
|
||||
return txnDate;
|
||||
}
|
||||
/**
|
||||
* Set日期
|
||||
*/
|
||||
public void setTxnDate(String txnDate){
|
||||
this.txnDate = txnDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* 实时线路客流_查询请求体
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public class ReqSjztLinePassengerRealtimeQueryDTO implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 日期|yyyy-MM-dd
|
||||
*/
|
||||
private String txnDate;
|
||||
|
||||
/**
|
||||
* 时间段|Y
|
||||
*/
|
||||
@NotNull(message="时间段不能为空")
|
||||
private Integer timeCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get日期
|
||||
*/
|
||||
public String getTxnDate(){
|
||||
return txnDate;
|
||||
}
|
||||
/**
|
||||
* Set日期
|
||||
*/
|
||||
public void setTxnDate(String txnDate){
|
||||
this.txnDate = txnDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get时间段
|
||||
*/
|
||||
public Integer getTimeCode(){
|
||||
return timeCode;
|
||||
}
|
||||
/**
|
||||
* Set时间段
|
||||
*/
|
||||
public void setTimeCode(Integer timeCode){
|
||||
this.timeCode = timeCode;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* 实时线路累计客流_查询请求体
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public class ReqSjztLinePassengerTotalQueryDTO implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 日期|yyyy-MM-dd
|
||||
*/
|
||||
private String txnDate;
|
||||
|
||||
/**
|
||||
* 时间段|Y
|
||||
*/
|
||||
@NotNull(message="时间段不能为空")
|
||||
private Integer timeCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get日期
|
||||
*/
|
||||
public String getTxnDate(){
|
||||
return txnDate;
|
||||
}
|
||||
/**
|
||||
* Set日期
|
||||
*/
|
||||
public void setTxnDate(String txnDate){
|
||||
this.txnDate = txnDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get时间段
|
||||
*/
|
||||
public Integer getTimeCode(){
|
||||
return timeCode;
|
||||
}
|
||||
/**
|
||||
* Set时间段
|
||||
*/
|
||||
public void setTimeCode(Integer timeCode){
|
||||
this.timeCode = timeCode;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.jiuyv.sptccc.agile.api.fegin.fallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import com.jiuyv.sptccc.agile.api.fegin.SjztLinePassengerFeginApi;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerNonrtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ResSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ResSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.R;
|
||||
|
||||
import feign.Response;
|
||||
|
||||
|
||||
/**
|
||||
* 线路客流统计相关接口
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public class SjztLinePassengerFallback implements FallbackFactory<SjztLinePassengerFeginApi> {
|
||||
@Override
|
||||
public SjztLinePassengerFeginApi create(Throwable throwable)
|
||||
{
|
||||
return new SjztLinePassengerFeginApi()
|
||||
{
|
||||
@Override
|
||||
public Response querySjztLinePassengerNonrtime(
|
||||
ReqSjztLinePassengerNonrtimeQueryDTO reqInfo) throws Exception {
|
||||
return Response.builder().body("error".getBytes()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<ResSjztLinePassengerRealtimeQueryDTO>> querySjztLinePassengerRealtime(
|
||||
ReqSjztLinePassengerRealtimeQueryDTO reqInfo) throws Exception {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<ResSjztLinePassengerTotalQueryDTO>> querySjztLinePassengerTotal(
|
||||
ReqSjztLinePassengerTotalQueryDTO reqInfo) throws Exception {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.jiuyv.sptccc.agile;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration;
|
||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@EnableFeignClients
|
||||
@EnableEurekaClient
|
||||
@EnableScheduling
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(exclude = {GroovyTemplateAutoConfiguration.class})
|
||||
@ImportResource({ "classpath:spring/applicationContext.xml" })//事务控制
|
||||
public class DataCenterServiceApplication {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DataCenterServiceApplication.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataCenterServiceApplication.class, args);
|
||||
LOGGER.info("(♥◠‿◠)ノ゙ 模块启动成功゙ \n"+
|
||||
" ___ ___ ___ \n"+
|
||||
" |\\ \\ |\\ \\ / /| \n"+
|
||||
" \\ \\ \\ \\ \\ \\/ / / \n"+
|
||||
" __ \\ \\ \\ \\ \\ / / \n"+
|
||||
" |\\ \\\\_\\ \\ \\/ / / \n"+
|
||||
" \\ \\________\\ __/ / / \n"+
|
||||
" \\|________| |\\___/ / \n"+
|
||||
" \\|___|/ \n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.jiuyv.sptccc.agile;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class DataCenterServiceServletInitializer extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(DataCenterServiceApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.jiuyv.sptccc.agile.business.common.constant;
|
||||
|
||||
/**
|
||||
* 数据同步相关常量
|
||||
*/
|
||||
public class SyncDatacenterConstants
|
||||
{
|
||||
private SyncDatacenterConstants() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
/** 日期转换用 */
|
||||
public static final String FORMAT_DATETIME ="yyyy-MM-dd HH:mm:ss";
|
||||
public static final String FORMAT_DATEDAY ="yyyy-MM-dd";
|
||||
public static final String FORMAT_DATETIME_SIMPLE ="yyyyMMddHHmmss";
|
||||
public static final String FORMAT_DATEDAY_SIMPLE ="yyyyMMdd";
|
||||
|
||||
/** 文件名后缀 */
|
||||
public static final String FILEEXT_CSV =".csv";
|
||||
public static final String FILEEXT_ZIP =".zip";
|
||||
|
||||
/** 文件名 */
|
||||
public static final String FILENAME_LINE_PASSENGER_NONRTIME ="line_passenger_nonrtime_";
|
||||
public static final String FILENAME_LINE_PASSENGER_NONRTIME_W ="line_passenger_nonrtime_%s.zip";
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.jiuyv.sptccc.agile.business.controller;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerNonrtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ResSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ResSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.business.common.constant.SyncDatacenterConstants;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerRealtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerTotal;
|
||||
import com.jiuyv.sptccc.agile.business.service.ISjztLinePassengerService;
|
||||
import com.jiuyv.sptccc.agile.common.annotation.LogIgnore;
|
||||
import com.jiuyv.sptccc.agile.common.constant.Constants;
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.R;
|
||||
import com.jiuyv.sptccc.agile.common.utils.ServletUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 线路客流统计相关接口
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sjzt")
|
||||
public class SjztLinePassengerController {
|
||||
@Autowired
|
||||
private ISjztLinePassengerService sjztLinePassengerService;
|
||||
|
||||
@LogIgnore
|
||||
@PostMapping("/querySjztLinePassengerNonrtime")
|
||||
public void querySjztLinePassengerNonrtime(HttpServletResponse response,@RequestBody ReqSjztLinePassengerNonrtimeQueryDTO reqInfo) throws Exception {
|
||||
//先去sftp服务器检索是否已有文件
|
||||
|
||||
String fileName = ServletUtils.urlEncode(String.format(SyncDatacenterConstants.FILENAME_LINE_PASSENGER_NONRTIME_W
|
||||
,reqInfo.getTxnDate().replace("-", "")));
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + fileName);
|
||||
Path path = sjztLinePassengerService.querySjztLinePassengerNonrtime(reqInfo);
|
||||
File file = path.toFile();
|
||||
if(file != null) {
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) {
|
||||
response.setContentLength(inputStream.available());
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
outputStream.flush();
|
||||
} finally {
|
||||
//上传到sftp并删除文件
|
||||
file.deleteOnExit();
|
||||
}
|
||||
}else {
|
||||
response.sendError(HttpStatus.NOT_FOUND.value(), "File not found");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/querySjztLinePassengerRealtime")
|
||||
public R<List<ResSjztLinePassengerRealtimeQueryDTO>> querySjztLinePassengerRealtime(@RequestBody ReqSjztLinePassengerRealtimeQueryDTO reqInfo) throws Exception {
|
||||
List<TblSjztLinePassengerRealtime> list = sjztLinePassengerService.querySjztLinePassengerNonrtime(reqInfo);
|
||||
List<ResSjztLinePassengerRealtimeQueryDTO> data = new ArrayList<>();
|
||||
for(TblSjztLinePassengerRealtime x:list) {
|
||||
ResSjztLinePassengerRealtimeQueryDTO vo = new ResSjztLinePassengerRealtimeQueryDTO();
|
||||
vo.setTxnDate(DateFormatUtils.format(x.getTxnDate(), Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
vo.setSettleCenterCode(x.getSettleCenterCode());
|
||||
vo.setTimeCode(x.getTimeCode());
|
||||
vo.setInLineCode(x.getInLineCode());
|
||||
vo.setTotalCnt(x.getTotalCnt());
|
||||
vo.setOutTxnCnt(x.getOutTxnCnt());
|
||||
vo.setInStationCnt(x.getInStationCnt());
|
||||
vo.setJtkInStationCnt(x.getJtkInStationCnt());
|
||||
// vo.setJtkBusTransferCnt(x.getJtkBusTransferCnt());
|
||||
// vo.setJtkMetroTransferCnt(x.getJtkMetroTransferCnt());
|
||||
vo.setEwmInStationCnt(x.getEwmInStationCnt());
|
||||
// vo.setQrBusTransferCnt(x.getQrBusTransferCnt());
|
||||
// vo.setQrMetroTransferCnt(x.getQrMetroTransferCnt());
|
||||
data.add(vo);
|
||||
}
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
@PostMapping("/querySjztLinePassengerTotal")
|
||||
public R<List<ResSjztLinePassengerTotalQueryDTO>> querySjztLinePassengerTotal(@RequestBody ReqSjztLinePassengerTotalQueryDTO reqInfo)throws Exception {
|
||||
List<TblSjztLinePassengerTotal> list = sjztLinePassengerService.querySjztLinePassengerNonrtime(reqInfo);
|
||||
List<ResSjztLinePassengerTotalQueryDTO> data = new ArrayList<>();
|
||||
for(TblSjztLinePassengerTotal x:list) {
|
||||
ResSjztLinePassengerTotalQueryDTO vo = new ResSjztLinePassengerTotalQueryDTO();
|
||||
vo.setTxnDate(DateFormatUtils.format(x.getTxnDate(), Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
vo.setSettleCenterCode(x.getSettleCenterCode());
|
||||
vo.setTimeCode(x.getTimeCode());
|
||||
vo.setInLineCode(x.getInLineCode());
|
||||
vo.setTotalCnt(x.getTotalCnt());
|
||||
vo.setOutTxnCnt(x.getOutTxnCnt());
|
||||
vo.setInStationCnt(x.getInStationCnt());
|
||||
vo.setJtkInStationCnt(x.getJtkInStationCnt());
|
||||
vo.setJtkBusTransferCnt(x.getJtkBusTransferCnt());
|
||||
vo.setJtkMetroTransferCnt(x.getJtkMetroTransferCnt());
|
||||
vo.setEwmInStationCnt(x.getEwmInStationCnt());
|
||||
vo.setQrBusTransferCnt(x.getQrBusTransferCnt());
|
||||
vo.setQrMetroTransferCnt(x.getQrMetroTransferCnt());
|
||||
data.add(vo);
|
||||
}
|
||||
return R.ok(data);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.jiuyv.sptccc.agile.business.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.cursor.Cursor;
|
||||
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerNonrtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerNonrtimeVO;
|
||||
|
||||
|
||||
/**
|
||||
* t+1线路客流
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface TblSjztLinePassengerNonrtimeMapper{
|
||||
|
||||
/** 查询集合 */
|
||||
@Options(fetchSize = 5000)
|
||||
Cursor<TblSjztLinePassengerNonrtime> selectList(TblSjztLinePassengerNonrtimeVO paramMap);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.jiuyv.sptccc.agile.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerRealtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerRealtimeVO;
|
||||
|
||||
|
||||
/**
|
||||
* 实时线路客流
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface TblSjztLinePassengerRealtimeMapper{
|
||||
|
||||
/** 查询集合 */
|
||||
List<TblSjztLinePassengerRealtime> selectList(TblSjztLinePassengerRealtimeVO paramMap);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.jiuyv.sptccc.agile.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerTotal;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerTotalVO;
|
||||
|
||||
|
||||
/**
|
||||
* 实时线路累计客流
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface TblSjztLinePassengerTotalMapper{
|
||||
|
||||
/** 查询集合 */
|
||||
List<TblSjztLinePassengerTotal> selectList(TblSjztLinePassengerTotalVO paramMap);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.jiuyv.sptccc.agile.business.service;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerNonrtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerRealtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerTotal;
|
||||
|
||||
/**
|
||||
* 线路客流统计相关接口
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
public interface ISjztLinePassengerService {
|
||||
|
||||
/** 查询T+1实时客流 */
|
||||
Path querySjztLinePassengerNonrtime(ReqSjztLinePassengerNonrtimeQueryDTO reqInfo) throws Exception;
|
||||
/** 查询实时客流 */
|
||||
List<TblSjztLinePassengerRealtime> querySjztLinePassengerNonrtime(ReqSjztLinePassengerRealtimeQueryDTO reqInfo)throws Exception;
|
||||
/** 查询实时客流 */
|
||||
List<TblSjztLinePassengerTotal> querySjztLinePassengerNonrtime(ReqSjztLinePassengerTotalQueryDTO reqInfo) throws Exception;;
|
||||
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.jiuyv.sptccc.agile.business.service.impl;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.apache.ibatis.cursor.Cursor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerNonrtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerRealtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ReqSjztLinePassengerTotalQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.api.fegin.dto.linepassenger.ResSjztLinePassengerNonrtimeQueryDTO;
|
||||
import com.jiuyv.sptccc.agile.business.common.constant.SyncDatacenterConstants;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerNonrtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerRealtime;
|
||||
import com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerTotal;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerNonrtimeVO;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerRealtimeVO;
|
||||
import com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerTotalVO;
|
||||
import com.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerNonrtimeMapper;
|
||||
import com.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerRealtimeMapper;
|
||||
import com.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerTotalMapper;
|
||||
import com.jiuyv.sptccc.agile.business.service.ISjztLinePassengerService;
|
||||
import com.jiuyv.sptccc.agile.common.constant.Constants;
|
||||
import com.jiuyv.sptccc.agile.common.core.BaseManagerUtils;
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.BaseTime;
|
||||
|
||||
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* t+1线路客流
|
||||
* @author zhoul
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Service("sjztLinePassengerService")
|
||||
public class SjztLinePassengerServiceImpl implements ISjztLinePassengerService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SjztLinePassengerServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private TblSjztLinePassengerNonrtimeMapper tblSjztLinePassengerNonrtimeMapper;
|
||||
@Autowired
|
||||
private TblSjztLinePassengerRealtimeMapper tblSjztLinePassengerRealtimeMapper;
|
||||
@Autowired
|
||||
private TblSjztLinePassengerTotalMapper tblSjztLinePassengerTotalMapper;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Path querySjztLinePassengerNonrtime(ReqSjztLinePassengerNonrtimeQueryDTO reqInfo) throws Exception {
|
||||
Path tempTxtFile = Files.createTempFile(SyncDatacenterConstants.FILENAME_LINE_PASSENGER_NONRTIME, SyncDatacenterConstants.FILEEXT_CSV);
|
||||
|
||||
TblSjztLinePassengerNonrtimeVO param = new TblSjztLinePassengerNonrtimeVO();
|
||||
param.setTxnDate(DateUtils.parseDate(reqInfo.getTxnDate(), Constants.FORMAT_DATEDAY.length()==reqInfo.getTxnDate().length()
|
||||
?Constants.FORMAT_DATEDAY: Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
|
||||
boolean flag = false;
|
||||
try (Cursor<TblSjztLinePassengerNonrtime> stream = tblSjztLinePassengerNonrtimeMapper.selectList(param);
|
||||
BufferedWriter writer = Files.newBufferedWriter(tempTxtFile, StandardOpenOption.WRITE)) {
|
||||
//表头
|
||||
ResSjztLinePassengerNonrtimeQueryDTO vo = new ResSjztLinePassengerNonrtimeQueryDTO();
|
||||
writer.write(vo.toFileTitle(","));
|
||||
|
||||
Iterator<TblSjztLinePassengerNonrtime> data = stream.iterator();
|
||||
List<TblSjztLinePassengerNonrtime> lists;
|
||||
while(!(lists=readLines(data, 20000)).isEmpty()) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for(TblSjztLinePassengerNonrtime x:lists) {
|
||||
vo = new ResSjztLinePassengerNonrtimeQueryDTO();
|
||||
vo.setTxnDate(DateFormatUtils.format(x.getTxnDate(), Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
vo.setSettleCenterCode(x.getSettleCenterCode());
|
||||
vo.setTimeCode(x.getTimeCode());
|
||||
vo.setInLineCode(x.getInLineCode());
|
||||
vo.setTotalCnt(x.getTotalCnt());
|
||||
vo.setOutTxnCnt(x.getOutTxnCnt());
|
||||
vo.setInStationCnt(x.getInStationCnt());
|
||||
vo.setJtkInStationCnt(x.getJtkInStationCnt());
|
||||
vo.setJtkBusTransferCnt(x.getJtkBusTransferCnt());
|
||||
vo.setJtkMetroTransferCnt(x.getJtkMetroTransferCnt());
|
||||
vo.setEwmInStationCnt(x.getEwmInStationCnt());
|
||||
vo.setQrBusTransferCnt(x.getQrBusTransferCnt());
|
||||
vo.setQrMetroTransferCnt(x.getQrMetroTransferCnt());
|
||||
str.append(vo.toFileString(","));
|
||||
}
|
||||
writer.write(str.toString());
|
||||
}
|
||||
flag = stream.isConsumed();
|
||||
}catch (Exception e) {
|
||||
LOGGER.info("querySjztLinePassengerNonrtime read error>>",e);
|
||||
flag = false;
|
||||
Files.deleteIfExists(tempTxtFile);//删除临时文件
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
Path tempZipFile = Files.createTempFile(SyncDatacenterConstants.FILENAME_LINE_PASSENGER_NONRTIME, SyncDatacenterConstants.FILEEXT_ZIP);
|
||||
try (FileOutputStream fos = new FileOutputStream(tempZipFile.toFile());
|
||||
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||
FileInputStream fis = new FileInputStream(tempTxtFile.toFile())) {
|
||||
|
||||
ZipEntry zipEntry = new ZipEntry(tempTxtFile.getFileName().toString());
|
||||
zos.putNextEntry(zipEntry);
|
||||
byte[] buffer = new byte[4096];
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
zos.closeEntry();
|
||||
}catch (Exception e) {
|
||||
LOGGER.info("querySjztLinePassengerNonrtime zip error>>",e);
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
Files.deleteIfExists(tempTxtFile);//删除临时文件
|
||||
}
|
||||
return tempZipFile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
private List<TblSjztLinePassengerNonrtime> readLines(Iterator<TblSjztLinePassengerNonrtime> data,int number) throws Exception {
|
||||
List<TblSjztLinePassengerNonrtime> list = new ArrayList<>();
|
||||
while(data.hasNext()) {
|
||||
list.add(data.next());
|
||||
if(list.size()>=number) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TblSjztLinePassengerRealtime> querySjztLinePassengerNonrtime(
|
||||
ReqSjztLinePassengerRealtimeQueryDTO reqInfo) throws Exception {
|
||||
TblSjztLinePassengerRealtimeVO param = new TblSjztLinePassengerRealtimeVO();
|
||||
if(StringUtils.isNotBlank(reqInfo.getTxnDate())) {
|
||||
param.setTxnDate(DateUtils.parseDate(reqInfo.getTxnDate(), Constants.FORMAT_DATEDAY.length()==reqInfo.getTxnDate().length()
|
||||
?Constants.FORMAT_DATEDAY: Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
}else {//默认当天
|
||||
BaseTime timeVO = BaseManagerUtils.getSystemTime();
|
||||
param.setTxnDate(DateUtils.parseDate(timeVO.getDateDay(), Constants.FORMAT_DATEDAY));
|
||||
}
|
||||
param.setTimeCode(reqInfo.getTimeCode());
|
||||
return tblSjztLinePassengerRealtimeMapper.selectList(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblSjztLinePassengerTotal> querySjztLinePassengerNonrtime(
|
||||
ReqSjztLinePassengerTotalQueryDTO reqInfo) throws Exception {
|
||||
TblSjztLinePassengerTotalVO param = new TblSjztLinePassengerTotalVO();
|
||||
if(StringUtils.isNotBlank(reqInfo.getTxnDate())) {
|
||||
param.setTxnDate(DateUtils.parseDate(reqInfo.getTxnDate(), Constants.FORMAT_DATEDAY.length()==reqInfo.getTxnDate().length()
|
||||
?Constants.FORMAT_DATEDAY: Constants.FORMAT_DATEDAY_SIMPLE));
|
||||
}else {//默认当天
|
||||
BaseTime timeVO = BaseManagerUtils.getSystemTime();
|
||||
param.setTxnDate(DateUtils.parseDate(timeVO.getDateDay(), Constants.FORMAT_DATEDAY));
|
||||
}
|
||||
param.setTimeCode(reqInfo.getTimeCode());
|
||||
return tblSjztLinePassengerTotalMapper.selectList(param);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.jiuyv.sptccc.agile.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* 方法不需要输出日志时使用
|
||||
* @author zhouliang
|
||||
*
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface LogIgnore {
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.jiuyv.sptccc.agile.common.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 读取项目相关配置
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "console")
|
||||
public class ConsoleConfig {
|
||||
/** 项目名称 */
|
||||
private String name;
|
||||
|
||||
/** 版本 */
|
||||
private String version;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.jiuyv.sptccc.agile.common.constant;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
/** 一个固定的密钥,用于配置文件内容加密/解密 */
|
||||
public static final String SM4_SECERT_KEY = "a14751855ccb428d982c33dfa3535a57";
|
||||
|
||||
/** 日期格式 */
|
||||
public static final String FORMAT_DATEDAY = "yyyy-MM-dd";
|
||||
public static final String FORMAT_DATEDAY_SIMPLE ="yyyyMMdd";
|
||||
|
||||
/** 默认时区 */
|
||||
public static final String DEFAULT_TIMEZONE = "+08:00";
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.jiuyv.sptccc.agile.common.core.domain;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 时间对象
|
||||
* @author zhouliang
|
||||
*
|
||||
*/
|
||||
public class BaseTime implements java.io.Serializable {
|
||||
|
||||
/** default Serial Version UID*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 当前时区 */
|
||||
private String timeZone ="+08:00";
|
||||
|
||||
/** 当前时区 YYYY-MM-DD */
|
||||
private String dateDay;
|
||||
|
||||
/** 当前时区 YYYY-MM-DD HH:MM:SS */
|
||||
private String dateTime;
|
||||
|
||||
/** 当前时区日期 */
|
||||
private Date date;
|
||||
|
||||
/** UTC-0 带时区时间 */
|
||||
private Instant utcTime;
|
||||
|
||||
/** UTC-0 带时区时间 */
|
||||
private String utcTimeStr;
|
||||
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public void setTimeZone(String timeZone) {
|
||||
this.timeZone = timeZone;
|
||||
}
|
||||
|
||||
public String getDateDay() {
|
||||
return dateDay;
|
||||
}
|
||||
|
||||
public void setDateDay(String dateDay) {
|
||||
this.dateDay = dateDay;
|
||||
}
|
||||
|
||||
public String getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(String dataTime) {
|
||||
this.dateTime = dataTime;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Instant getUtcTime() {
|
||||
return utcTime;
|
||||
}
|
||||
|
||||
public void setUtcTime(Instant utcTime) {
|
||||
this.utcTime = utcTime;
|
||||
}
|
||||
|
||||
public String getUtcTimeStr() {
|
||||
return utcTimeStr;
|
||||
}
|
||||
|
||||
public void setUtcTimeStr(String utcTimeStr) {
|
||||
this.utcTimeStr = utcTimeStr;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.jiuyv.sptccc.agile.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public enum HttpMethod
|
||||
{
|
||||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
||||
|
||||
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
||||
|
||||
static
|
||||
{
|
||||
for (HttpMethod httpMethod : values())
|
||||
{
|
||||
mappings.put(httpMethod.name(), httpMethod);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HttpMethod resolve(@Nullable String method)
|
||||
{
|
||||
return (method != null ? mappings.get(method) : null);
|
||||
}
|
||||
|
||||
public boolean matches(String method)
|
||||
{
|
||||
return (this == resolve(method));
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.jiuyv.sptccc.agile.common.enums;
|
||||
|
||||
/**
|
||||
* 字段代码通用枚举接口
|
||||
* 便于统一方式处理
|
||||
* @author zhouliang
|
||||
*
|
||||
*/
|
||||
public interface IDictEnum {
|
||||
|
||||
public String getCode();
|
||||
|
||||
public String getMsg();
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.jiuyv.sptccc.agile.common.exception;
|
||||
|
||||
/**
|
||||
* 工具类异常
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class UtilException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 8247610319171014183L;
|
||||
|
||||
public UtilException(Throwable e)
|
||||
{
|
||||
super(e.getMessage(), e);
|
||||
}
|
||||
|
||||
public UtilException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UtilException(String message, Throwable throwable)
|
||||
{
|
||||
super(message, throwable);
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.jiuyv.sptccc.agile.common.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhouliang
|
||||
*
|
||||
*/
|
||||
public abstract class JsonUtil {
|
||||
|
||||
/**
|
||||
* The Constant LOGGER.
|
||||
*/
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
|
||||
|
||||
private JsonUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* The object mapper.
|
||||
*/
|
||||
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
static {
|
||||
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
objectMapper.setSerializationInclusion(Include.NON_NULL);
|
||||
objectMapper.configure(Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
|
||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);//允许单引号
|
||||
}
|
||||
public static ObjectMapper JsonMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转为json字符串
|
||||
*
|
||||
* @param object the object
|
||||
* @return the string
|
||||
*/
|
||||
public static String toJSONString(Object object) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(object);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("convert failed", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jiuyv.sptccc.agile.common.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
import com.jiuyv.sptccc.agile.common.utils.spring.SpringUtils;
|
||||
|
||||
/**
|
||||
* 获取i18n资源文件
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class MessageUtils
|
||||
{
|
||||
/**
|
||||
* 根据消息键和参数 获取消息 委托给spring messageSource
|
||||
*
|
||||
* @param code 消息键
|
||||
* @param args 参数
|
||||
* @return 获取国际化翻译值
|
||||
*/
|
||||
public static String message(String code, Object... args)
|
||||
{
|
||||
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
|
||||
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.jiuyv.sptccc.agile.common.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import com.jiuyv.sptccc.agile.common.constant.Constants;
|
||||
|
||||
/**
|
||||
* 客户端工具类
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class ServletUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取request
|
||||
*/
|
||||
public static HttpServletRequest getRequest()
|
||||
{
|
||||
ServletRequestAttributes requestAttributes = getRequestAttributes();
|
||||
if(null != requestAttributes) {
|
||||
return requestAttributes.getRequest();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static ServletRequestAttributes getRequestAttributes()
|
||||
{
|
||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||
if(null != attributes) {
|
||||
return (ServletRequestAttributes) attributes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 内容编码
|
||||
*
|
||||
* @param str 内容
|
||||
* @return 编码后的内容
|
||||
*/
|
||||
public static String urlEncode(String str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return URLEncoder.encode(str, StandardCharsets.UTF_8.name());
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.jiuyv.sptccc.agile.common.utils.spring;
|
||||
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jiuyv.sptccc.agile.common.utils.StriUtils;
|
||||
|
||||
/**
|
||||
* spring工具类 方便在非spring管理环境中获取bean
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Component
|
||||
public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware {
|
||||
/** Spring应用上下文环境 */
|
||||
private static ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
setBeanFactory(beanFactory);
|
||||
}
|
||||
|
||||
public static void setBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
||||
SpringUtils.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
setContext(applicationContext);
|
||||
}
|
||||
|
||||
public static void setContext(ApplicationContext applicationContext) {
|
||||
SpringUtils.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对象
|
||||
*
|
||||
* @param name
|
||||
* @return Object 一个以所给名字注册的bean的实例
|
||||
* @throws org.springframework.beans.BeansException
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getBean(String name) throws BeansException {
|
||||
return (T) beanFactory.getBean(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型为requiredType的对象
|
||||
*
|
||||
* @param clz
|
||||
* @return
|
||||
* @throws org.springframework.beans.BeansException
|
||||
*
|
||||
*/
|
||||
public static <T> T getBean(Class<T> clz) throws BeansException {
|
||||
T result = (T) beanFactory.getBean(clz);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.jiuyv.sptccc.agile.framework.config;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class ActuatorSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
Environment env;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity security) throws Exception {
|
||||
|
||||
|
||||
String actuatorPath = env.getProperty("management.endpoints.web.base-path");
|
||||
if(StringUtils.isBlank(actuatorPath)) {
|
||||
actuatorPath = "/actuator";
|
||||
}
|
||||
//优化一下根路径
|
||||
String servletPath = env.getProperty("server.servlet.context-path");
|
||||
if(StringUtils.isNotBlank(servletPath)) {
|
||||
if(servletPath.endsWith("/")) {
|
||||
servletPath=servletPath.substring(0,servletPath.length()-1);
|
||||
}
|
||||
servletPath=servletPath.replaceAll("[^/]+", "**");
|
||||
}else {
|
||||
servletPath="";
|
||||
}
|
||||
security.csrf().disable();
|
||||
security.requestMatcher(new AntPathRequestMatcher(servletPath+actuatorPath+"/**"))
|
||||
.authorizeRequests()
|
||||
.antMatchers(servletPath+actuatorPath+"/shutdown","/**"+servletPath+actuatorPath+"/serviceregistry","/**"+servletPath+actuatorPath+"/refresh")
|
||||
.access("hasIpAddress(\"127.0.0.1\")")
|
||||
.antMatchers(servletPath+actuatorPath+"/**").authenticated()
|
||||
.and().httpBasic();
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.jiuyv.sptccc.agile.framework.config;
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
* 程序注解配置
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Configuration
|
||||
// 表示通过aop框架暴露该代理对象,AopContext能够访问
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
// 指定要扫描的Mapper类的包的路径
|
||||
@MapperScan("com.jiuyv.sptccc.agile.**.mapper")
|
||||
public class ApplicationConfig
|
||||
{
|
||||
/**
|
||||
* 时区配置
|
||||
*/
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
|
||||
{
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package com.jiuyv.sptccc.agile.framework.config;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jcraft.jsch.Session;
|
||||
import com.jiuyv.sptccc.agile.common.constant.Constants;
|
||||
import com.jiuyv.sptccc.agile.common.utils.sm4.Sm4Util;
|
||||
|
||||
/**
|
||||
* sftp配置类
|
||||
* @author zhouliang
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "filesftp")
|
||||
public class SftpConfigProperties implements java.io.Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主机ip
|
||||
*/
|
||||
private String host;
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
private int port=22;
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* location
|
||||
*/
|
||||
private int location;
|
||||
|
||||
/** 全局上传主路径 */
|
||||
private String uploadPath;
|
||||
|
||||
/** 连接池配置*/
|
||||
private transient GenericObjectPoolConfig<Session> poolConfig;
|
||||
|
||||
/**
|
||||
* @return the host
|
||||
*/
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param host the host to set
|
||||
*/
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param port the port to set
|
||||
*/
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the username
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param username the username to set
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword() {
|
||||
try {
|
||||
return Sm4Util.decryptEcb(Constants.SM4_SECERT_KEY, password);
|
||||
}catch (Exception e) {
|
||||
// 兼容写法,不加密也可以
|
||||
}
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param password the password to set
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public int getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location the location to set
|
||||
*/
|
||||
public void setLocation(int location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getUploadPath() {
|
||||
return uploadPath;
|
||||
}
|
||||
|
||||
public void setUploadPath(String uploadPath) {
|
||||
this.uploadPath = uploadPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the poolConfig
|
||||
*/
|
||||
public GenericObjectPoolConfig<Session> getPoolConfig() {
|
||||
return poolConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param poolConfig the poolConfig to set
|
||||
*/
|
||||
public void setPoolConfig(GenericObjectPoolConfig<Session> poolConfig) {
|
||||
this.poolConfig = poolConfig;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.jiuyv.sptccc.agile.framework.web.exception;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.R;
|
||||
import com.jiuyv.sptccc.agile.common.utils.JsonUtil;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(BindException.class)
|
||||
public R<Object> handleBindException(BindException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
String message = e.getAllErrors().get(0).getDefaultMessage();
|
||||
return R.fail(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
log.error("数据校验出现问题{},异常类型:{}", e.getMessage(), e.getClass());
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
bindingResult.getFieldErrors().forEach((fieldError) -> {
|
||||
errorMap.put(fieldError.getField(), fieldError.getDefaultMessage());
|
||||
});
|
||||
return R.fail(JsonUtil.toJSONString(errorMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R<Object> handleException(Exception e, HttpServletRequest request, HttpServletResponse response) {
|
||||
response.setStatus(301);
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.jiuyv.sptccc.agile.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.jiuyv.sptccc.agile.common.core.domain.BaseTime;
|
||||
|
||||
@Mapper
|
||||
public interface ISysTimeBaseMapper {
|
||||
|
||||
/**
|
||||
* 获取系统当前时间-yyyyMMddHHmmss
|
||||
* @return
|
||||
*/
|
||||
BaseTime selectSysCurrentTime();
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
Application Version: ${console.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
@ -0,0 +1,43 @@
|
||||
console:
|
||||
version: 1.0
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
application:
|
||||
name : datacenter-service
|
||||
profiles:
|
||||
#部署时带上自身名字sms-service-dev
|
||||
active: dev
|
||||
cloud:
|
||||
config:
|
||||
#本地可以置为关闭false
|
||||
enabled: false
|
||||
discovery:
|
||||
service-id: config-service #使用服务名
|
||||
enabled: false
|
||||
name: ${spring.application.name}
|
||||
profile: ${spring.profiles.active}
|
||||
fail-fast: true
|
||||
security:
|
||||
user:
|
||||
name: sptcc
|
||||
password: 123456
|
||||
|
||||
# 配置eureka客户端信息
|
||||
eureka:
|
||||
instance:
|
||||
appname: ${spring.application.name}
|
||||
lease-expiration-duration-in-seconds: 30
|
||||
lease-renewal-interval-in-seconds: 10
|
||||
prefer-ip-address: true
|
||||
instance-id: ${spring.cloud.client.ip-address}:${server.port}
|
||||
metadata-map:
|
||||
user.name: ${spring.security.user.name}
|
||||
user.password: ${spring.security.user.password}
|
||||
client:
|
||||
enabled: true
|
||||
registry-fetch-interval-seconds: 1
|
||||
register-with-eureka: true
|
||||
fetch-registry: true
|
||||
service-url:
|
||||
defaultZone: http://172.16.12.109:8761/eureka/
|
@ -0,0 +1,3 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!-- LOG目录 -->
|
||||
<property name="LOG_HOME" value="logs"/>
|
||||
|
||||
<!-- JSON_LOG目录 -->
|
||||
<property name="JSON_LOG_HOME" value="logs/jsonlog"/>
|
||||
|
||||
<!-- spring.application.name 作为参数 -->
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<target>System.out</target>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按天压缩日志 -->
|
||||
<appender name="ZIP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/${APP_NAME}.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}.log.%d{yyyy-MM-dd}.%i.log.zip</FileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!-- or whenever the file size reaches 100MB -->
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 不压缩日志,保留7天 -->
|
||||
<appender name="DEFAULT_INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!-- or whenever the file size reaches 100MB -->
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- LOGSTASH,输出seuleth项,保留7天 -->
|
||||
<appender name="LOGSTASH" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${JSON_LOG_HOME}/${APP_NAME}.json.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!-- or whenever the file size reaches 100MB -->
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<pattern>
|
||||
<pattern>
|
||||
{
|
||||
"timestamp": "%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"severity": "%level",
|
||||
"service": "${APP_NAME:-}",
|
||||
"trace": "%X{X-B3-TraceId:-}",
|
||||
"span": "%X{X-B3-SpanId:-}",
|
||||
"parent": "%X{X-B3-ParentSpanId:-}",
|
||||
"exportable": "%X{X-Span-Export:-}",
|
||||
"pid": "${PID:-}",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"rest": "%message"
|
||||
}
|
||||
</pattern>
|
||||
</pattern>
|
||||
</providers>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按天压缩Json日志 -->
|
||||
<appender name="JSON_ZIP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${JSON_LOG_HOME}/${APP_NAME}.json.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${JSON_LOG_HOME}/${APP_NAME}.log.%d{yyyy-MM-dd}.%i.json.log.zip</FileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!-- or whenever the file size reaches 100MB -->
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<pattern>
|
||||
<pattern>
|
||||
{
|
||||
"timestamp": "%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"severity": "%level",
|
||||
"service": "${APP_NAME:-}",
|
||||
"trace": "%X{X-B3-TraceId:-}",
|
||||
"span": "%X{X-B3-SpanId:-}",
|
||||
"parent": "%X{X-B3-ParentSpanId:-}",
|
||||
"exportable": "%X{X-Span-Export:-}",
|
||||
"pid": "${PID:-}",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"rest": "%message"
|
||||
}
|
||||
</pattern>
|
||||
</pattern>
|
||||
</providers>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<target>System.err</target>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="com.jiuyv.sptccc.agile.thirdparty.dao" level="debug"/>
|
||||
|
||||
<root>
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ZIP_FILE"/>
|
||||
<appender-ref ref="DEFAULT_INFO_FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
<appender-ref ref="JSON_ZIP_FILE"/>
|
||||
</root>
|
||||
</configuration>
|
@ -0,0 +1,20 @@
|
||||
<?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" >
|
||||
<!-- t+1线路客流 -->
|
||||
<mapper namespace="com.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerNonrtimeMapper">
|
||||
<sql id="_select">
|
||||
a.txn_date, a.settle_center_code, a.time_code, a.in_line_code, a.total_cnt, a.out_txn_cnt,
|
||||
a.in_station_cnt, a.jtk_in_station_cnt, a.jtk_bus_transfer_cnt,
|
||||
a.jtk_metro_transfer_cnt, a.ewm_in_station_cnt, a.qr_bus_transfer_cnt,
|
||||
a.qr_metro_transfer_cnt
|
||||
</sql>
|
||||
<select id="selectList" resultType="com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerNonrtime" parameterType="com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerNonrtimeVO">
|
||||
select
|
||||
<include refid="_select"/>
|
||||
from tbl_sjzt_line_passenger_nonrtime a
|
||||
<where>
|
||||
and a.txn_date = #{txnDate}
|
||||
<if test="timeCode != null">and a.time_code = #{timeCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
<?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.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerRealtimeMapper">
|
||||
<sql id="_select">
|
||||
a.txn_date, a.settle_center_code, a.time_code, a.in_line_code, a.total_cnt, a.out_txn_cnt,
|
||||
a.in_station_cnt, a.jtk_in_station_cnt, a.jtk_bus_transfer_cnt,
|
||||
a.jtk_metro_transfer_cnt, a.ewm_in_station_cnt, a.qr_bus_transfer_cnt,
|
||||
a.qr_metro_transfer_cnt
|
||||
</sql>
|
||||
|
||||
<!-- 查询集合 -->
|
||||
<select id="selectList" resultType="com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerRealtime" parameterType="com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerRealtimeVO">
|
||||
select
|
||||
<include refid="_select"/>
|
||||
from tbl_sjzt_line_passenger_realtime a
|
||||
<where>
|
||||
and a.txn_date = #{txnDate}
|
||||
and a.time_code = #{timeCode}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
<?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.jiuyv.sptccc.agile.business.mapper.TblSjztLinePassengerTotalMapper">
|
||||
<sql id="_select">
|
||||
a.txn_date, a.settle_center_code, a.time_code, a.in_line_code, a.total_cnt, a.out_txn_cnt,
|
||||
a.in_station_cnt, a.jtk_in_station_cnt, a.jtk_bus_transfer_cnt,
|
||||
a.jtk_metro_transfer_cnt, a.ewm_in_station_cnt, a.qr_bus_transfer_cnt,
|
||||
a.qr_metro_transfer_cnt
|
||||
</sql>
|
||||
|
||||
<!-- 查询集合 -->
|
||||
<select id="selectList" resultType="com.jiuyv.sptccc.agile.business.entity.TblSjztLinePassengerTotal" parameterType="com.jiuyv.sptccc.agile.business.entity.vo.TblSjztLinePassengerTotalVO">
|
||||
select
|
||||
<include refid="_select"/>
|
||||
from tbl_sjzt_line_passenger_total a
|
||||
<where>
|
||||
and a.txn_date = #{txnDate}
|
||||
and a.time_code = #{timeCode}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,11 @@
|
||||
<?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.jiuyv.sptccc.agile.system.mapper.ISysTimeBaseMapper">
|
||||
|
||||
<select id="selectSysCurrentTime" resultType="com.jiuyv.sptccc.agile.common.core.domain.BaseTime">
|
||||
SELECT now() AS utcTime
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue