master
RENCHAO 2 months ago
parent 2538677c9b
commit 2a1b06aedf

@ -65,7 +65,7 @@ public class RSATest {
RSA rsa = new RSA(privateKey,null);
String str = "url=/checkInInfo/reviewResult&token=5bce7d71-d60b-4858-a852-15380eba6c84&timestamp=1681440129945";
String str = "url=/checkInInfo/reviewResult&customerArea=2220&token=2bce7d71-d60b-4858-a852-15380eba6c84&timestamp=" + System.currentTimeMillis();
String base64 = rsa.encryptBase64(str, KeyType.PrivateKey);
System.out.println(base64);
@ -74,7 +74,7 @@ public class RSATest {
RSA rsa2 = new RSA(null, publicKey);
try {
System.out.println(rsa2.decryptStr(base64 + "ss", KeyType.PublicKey));
System.out.println(rsa2.decryptStr(base64, KeyType.PublicKey));
} catch (CryptoException e) {
System.out.println("发生异常===================" + e);
}

@ -7,7 +7,6 @@ import cn.dreamdt.audit.main.DataAudit;
import cn.dreamdt.audit.maker.chain.ChainConsumer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.netty.handler.ssl.OpenSsl;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
@ -34,24 +33,22 @@ public class Demo01 {
dataAudit.subscribeChain(null,null,null);
// 数据上链 测试数据
JSONObject bizData = new JSONObject();
bizData.put("behaviorId", "20240701798445635972400");
bizData.put("platformCid", "did:unitrust:6r5eR9TPcSNRCGYjfEsDxbXjm9Cm");
bizData.put("ccid", "did:unitrust:7CXMdXzSmNrGk3mWPe9jpsHg2HmU");
bizData.put("sceneCode", "77");
bizData.put("startTime", "2024-07-05 16:43:52");
// bizData.put("endTime", "2024-07-05 16:43:52");
// bizData.put("endTime", "");
bizData.put("tripDistance", "5544.000");
bizData.put("hashData", "5f89452b52a9df1fe0060c8ac3de5b6ffea3e6855cf307db31ac0359d67d7888");
bizData.put("state", 1);
JSONObject bizData = buildTestJsonObject("20240701798445635972402");
//调用合约
MessageBean messageBean = dataAudit.invoke("CAMC", "saveAssetData", bizData,"00570000000000000000121");
MessageBean messageBean = dataAudit.invoke("CAMC", "saveAssetData", bizData,bizData.get("behaviorId").toString());
System.out.println("=============异步json============\n");
System.out.println(JSON.toJSONString(messageBean));
System.out.println("\n=========================");
bizData = buildTestJsonObject("20240701798445635972403");
messageBean = dataAudit.invoke(null, "CAMC", "saveAssetData", bizData, bizData.get("behaviorId").toString(), "", 10000L, 10000L);
System.out.println("=============json============\n");
System.out.println("=============同步json============\n");
System.out.println(JSON.toJSONString(messageBean));
System.out.println("\n=========================");
Map<String, String> map = new HashMap<>();
map.put("behaviorId", "20240701798445635972400"); // 失败的
// map.put("behaviorId", "00571000000000000000126"); // 成功d
@ -107,6 +104,21 @@ public class Demo01 {
}
private static JSONObject buildTestJsonObject(String behaviorId) {
JSONObject bizData = new JSONObject();
bizData.put("behaviorId", behaviorId);
bizData.put("platformCid", "did:unitrust:6r5eR9TPcSNRCGYjfEsDxbXjm9Cm");
bizData.put("ccid", "did:unitrust:7CXMdXzSmNrGk3mWPe9jpsHg2HmU");
bizData.put("sceneCode", "77");
bizData.put("startTime", "2024-07-05 16:43:52");
// bizData.put("endTime", "2024-07-05 16:43:52");
// bizData.put("endTime", "");
bizData.put("tripDistance", "5544.000");
bizData.put("hashData", "5f89452b52a9df1fe0060c8ac3de5b6ffea3e6855cf307db31ac0359d67d7888");
bizData.put("state", 1);
return bizData;
}
private static void setParent(ClassLoader classLoader) {

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.4</version>
</parent>
<groupId>com.renchao</groupId>
<artifactId>decompile</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- ProGuard混淆插件-->
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.6.1</version>
<!-- <executions>-->
<!-- <execution>-->
<!-- &lt;!&ndash; 混淆时刻,这里是打包的时候混淆&ndash;&gt;-->
<!-- <phase>package</phase>-->
<!-- &lt;!&ndash; <phase>compile</phase>&ndash;&gt;-->
<!-- <goals>-->
<!-- &lt;!&ndash; 使用插件的什么功能,当然是混淆&ndash;&gt;-->
<!-- <goal>proguard</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- &lt;!&ndash; 是否将生成的PG文件安装部署&ndash;&gt;-->
<!-- <attach>true</attach>-->
<!-- &lt;!&ndash; 是否混淆&ndash;&gt;-->
<!-- <obfuscate>true</obfuscate>-->
<!-- &lt;!&ndash; 指定生成文件分类 &ndash;&gt;-->
<!-- <attachArtifactClassifier>pg</attachArtifactClassifier>-->
<!-- <options>-->
<!-- &lt;!&ndash; JDK目标版本1.8&ndash;&gt;-->
<!-- <option>-target 1.8</option>-->
<!-- &lt;!&ndash; 不做收缩(删除注释、未被引用代码)&ndash;&gt;-->
<!-- <option>-dontshrink</option>-->
<!-- &lt;!&ndash; 不做优化(变更代码实现逻辑)&ndash;&gt;-->
<!-- <option>-dontoptimize</option>-->
<!-- &lt;!&ndash; 不路过非公用类文件及成员&ndash;&gt;-->
<!-- <option>-dontskipnonpubliclibraryclasses</option>-->
<!-- <option>-dontskipnonpubliclibraryclassmembers</option>-->
<!-- &lt;!&ndash;不用大小写混合类名机制&ndash;&gt;-->
<!-- <option>-dontusemixedcaseclassnames</option>-->
<!-- &lt;!&ndash; 优化时允许访问并修改有修饰符的类和类的成员 &ndash;&gt;-->
<!-- <option>-allowaccessmodification</option>-->
<!-- &lt;!&ndash; 确定统一的混淆类的成员名称来增加混淆&ndash;&gt;-->
<!-- <option>-useuniqueclassmembernames</option>-->
<!-- &lt;!&ndash; 不混淆所有包名&ndash;&gt;-->
<!-- &lt;!&ndash;<option>-keeppackagenames</option>&ndash;&gt;-->
<!-- &lt;!&ndash; 需要保持的属性:异常,注解等&ndash;&gt;-->
<!-- <option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod</option>-->
<!-- &lt;!&ndash; 不混淆所有的set/get方法 &ndash;&gt;-->
<!-- &lt;!&ndash; <option>-keepclassmembers public class * {void set*(***);*** get*();}</option>&ndash;&gt;-->
<!-- &lt;!&ndash; 不混淆包下的所有类名,且类中的方法也不混淆&ndash;&gt;-->
<!-- <option>-keep class com.proguard.ProguardDemo { &lt;methods&gt;; }</option>-->
<!-- <option>-keep class com.xxx.xxx.framework.** { *; }</option>-->
<!-- &lt;!&ndash; <option>-keep class com.xxx.xxx.xxx.controller.** { <methods>; }</option>&ndash;&gt;-->
<!-- &lt;!&ndash; <option>-keep class com.xxx.xxx.xxx.dao.** { <methods>; }</option>&ndash;&gt;-->
<!-- &lt;!&ndash; <option>-keep class com.xxx.xxx.xxx.exception { <methods>; }</option>&ndash;&gt;-->
<!-- &lt;!&ndash; <option>-keep class com.xxx.xxx.xxx.model.** { <methods>; }</option>&ndash;&gt;-->
<!-- </options>-->
<!-- &lt;!&ndash;class 混淆后输出的jar包&ndash;&gt;-->
<!-- <outjar>classes-autotest.jar</outjar>-->
<!-- &lt;!&ndash; 添加依赖这里你可以按你的需要修改这里测试只需要一个JRE的Runtime包就行了 &ndash;&gt;-->
<!-- <libs>-->
<!-- <lib>${java.home}/lib/rt.jar</lib>-->
<!-- </libs>-->
<!-- &lt;!&ndash; 对什么东西进行加载这里仅有classes成功毕竟你也不可能对配置文件及JSP混淆吧&ndash;&gt;-->
<!-- <injar>classes</injar>-->
<!-- &lt;!&ndash; 输出目录&ndash;&gt;-->
<!-- <outputDirectory>${project.build.directory}</outputDirectory>-->
<!-- </configuration>-->
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,28 @@
package com.renchao;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created on: 2024-09-13
*
* @author ren_chao
*/
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
@RestController
static class MyController {
@GetMapping("/test")
public String test() {
return "OK.......";
}
}
}

@ -3,7 +3,7 @@
<parent>
<groupId>com.jiuyv</groupId>
<artifactId>carcheck-console</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -186,11 +186,6 @@
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- redis 缓存操作 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
@ -250,6 +245,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
</dependencies>
<build>

@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
@ -15,6 +16,7 @@ import org.springframework.web.client.RestTemplate;
* @author admin
*/
@EnableScheduling
@EnableCaching
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class CarcheckApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(CarcheckApplication.class);

@ -1,38 +0,0 @@
package com.jiuyv.business.app.config;
/**
* @author he_jiebing@jiuyv.com
* @create 2023-08-25 16:39
*/
import com.google.common.cache.CacheBuilder;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
@Configuration
@EnableCaching
public class CacheConfig {
@Bean
public CacheManager cacheManager() {
ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager() {
@Override
protected org.springframework.cache.Cache createConcurrentMapCache(String name) {
return new ConcurrentMapCache(name,
CacheBuilder.newBuilder()
.expireAfterWrite(1, TimeUnit.DAYS) // Set cache expiration time
.build().asMap(),
false);
}
};
return cacheManager;
}
}

@ -31,7 +31,6 @@ import com.jiuyv.business.domain.TblCarInspectDetailHisInfo;
import com.jiuyv.business.domain.TblCarInspectDetailInfo;
import com.jiuyv.business.domain.TblCarInspectHisInfo;
import com.jiuyv.business.domain.TblCarInspectInfo;
import com.jiuyv.business.domain.TblCarOrderFormalDetailHisInfo;
import com.jiuyv.business.domain.TblCarOrderFormalDetailInfo;
import com.jiuyv.business.domain.TblCarOrderFormalHisInfo;
import com.jiuyv.business.domain.TblCarOrderFormalInfo;
@ -44,7 +43,6 @@ import com.jiuyv.business.mapper.TblCarInspectDetailHisInfoMapper;
import com.jiuyv.business.mapper.TblCarInspectDetailInfoMapper;
import com.jiuyv.business.mapper.TblCarInspectHisInfoMapper;
import com.jiuyv.business.mapper.TblCarInspectInfoMapper;
import com.jiuyv.business.mapper.TblCarOrderFormalDetailHisInfoMapper;
import com.jiuyv.business.mapper.TblCarOrderFormalDetailInfoMapper;
import com.jiuyv.business.mapper.TblCarOrderFormalHisInfoMapper;
import com.jiuyv.business.mapper.TblCarOrderFormalInfoMapper;
@ -55,6 +53,7 @@ import com.jiuyv.business.mapper.TblInspectSiteInfoMapper;
import com.jiuyv.business.mapper.TblNgPartInfoMapper;
import com.jiuyv.business.mapper.TblPollutantInfoMapper;
import com.jiuyv.business.service.CarOrderFormalDetailHisInfoService;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.exception.ServiceException;
import com.jiuyv.common.utils.CarcheckDateUtils;
import com.jiuyv.common.utils.JsonUtil;
@ -66,7 +65,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -129,7 +127,7 @@ public class InspectServiceImpl implements IInspectService {
private TblFileInfoMapper fileInfoMapper;
@Autowired
private StringRedisTemplate redisTemplate;
private LocalCache localCache;
@Value("${carcheck.app.fileViewUrl}")
private String fileViewUrl;
@ -309,7 +307,7 @@ public class InspectServiceImpl implements IInspectService {
String checkType = req.getCheckType();
// 先查询缓存有没有
String ngPartKey = Constants.NG_PART_CACHE_PREFIX + checkType;
String ngPartRedisJson = redisTemplate.opsForValue().get(ngPartKey);
String ngPartRedisJson = localCache.getCacheObject(ngPartKey, String.class);
List<ResNgPartVO> partList = new ArrayList<>();
if (StringUtils.isBlank(ngPartRedisJson)) {
TblNgPartInfo condition = new TblNgPartInfo();
@ -332,13 +330,13 @@ public class InspectServiceImpl implements IInspectService {
return resNgPartVO;
}).collect(Collectors.toList());
partList.addAll(collect);
redisTemplate.opsForValue().set(ngPartKey, JsonUtil.toJSONString(partList));
localCache.setCacheObject(ngPartKey, JsonUtil.toJSONString(partList));
} else {
List<ResNgPartVO> resNgPartVOS = JsonUtil.json2List(ngPartRedisJson, ResNgPartVO.class);
partList.addAll(resNgPartVOS);
}
String pollutantKey = Constants.POLLUTANT_CACHE_PREFIX;
String pollutantRedisJson = redisTemplate.opsForValue().get(pollutantKey);
String pollutantRedisJson = localCache.getCacheObject(pollutantKey, String.class);
List<ResPollutantVO> pollutantList = null;
if (StringUtils.isBlank(pollutantRedisJson)) {
TblPollutantInfo cond = new TblPollutantInfo();
@ -354,7 +352,7 @@ public class InspectServiceImpl implements IInspectService {
res.setHandFill(item.getHandFill());
return res;
}).collect(Collectors.toList());
redisTemplate.opsForValue().set(pollutantKey, JsonUtil.toJSONString(pollutantList));
localCache.setCacheObject(pollutantKey, JsonUtil.toJSONString(pollutantList));
} else {
pollutantList = JsonUtil.json2List(pollutantRedisJson, ResPollutantVO.class);
}

@ -13,10 +13,12 @@ import com.jiuyv.common.core.controller.BaseController;
import com.jiuyv.common.core.domain.AjaxResult;
import com.jiuyv.common.core.page.TableDataInfo;
import com.jiuyv.common.enums.BusinessType;
import com.jiuyv.common.exception.ServiceException;
import com.jiuyv.common.utils.CarcheckDateUtils;
import com.jiuyv.common.utils.file.FileUtils;
import com.jiuyv.common.utils.poi.ExcelUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,23 +37,24 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.CRC32;
import java.util.zip.CheckedInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@ -151,9 +154,9 @@ public class InspectDetailInfoController extends BaseController {
e.printStackTrace();
}
}
@Anonymous
@PreAuthorize("@ss.hasPermi('business:inspectDetail:exportImages')")
@GetMapping("/download/zipImages")
public void downloadImagesAsZip(HttpServletResponse response, TblCarInspectDetailInfo tblCarInspectDetailInfo) {
public AjaxResult downloadImagesAsZip(TblCarInspectDetailInfo tblCarInspectDetailInfo) {
long start = System.currentTimeMillis();
try {
// Create a ZIP with local images and save it to a temporary directory
@ -195,7 +198,7 @@ public class InspectDetailInfoController extends BaseController {
// 找到需要替换的部分的索引(倒数第三个部分)
int indexToReplace = parts.length - 4;
if (indexToReplace >= 0 && indexToReplace < parts.length) {
if (indexToReplace >= 0) {
// 替换指定索引的部分为动态值
parts[indexToReplace] = inspectTimePath;
@ -206,19 +209,12 @@ public class InspectDetailInfoController extends BaseController {
}
ZipEntry zipEntry = new ZipEntry(zipEntryName);
zipOutputStream.putNextEntry(zipEntry);
// 使用NIO和缓冲区读取文件
try (FileChannel fileChannel = FileChannel.open(imagePath, StandardOpenOption.READ)) {
ByteBuffer buffer = ByteBuffer.allocate(8192); // 8KB缓冲区
int bytesRead;
while ((bytesRead = fileChannel.read(buffer)) != -1) {
buffer.flip(); // 切换到读模式
zipOutputStream.write(buffer.array(), 0, bytesRead);
buffer.clear(); // 清空缓冲区
}
}
zipOutputStream.flush();
zipOutputStream.closeEntry();
zipEntry.setMethod(ZipEntry.STORED);
File file = imagePath.toFile();
zipEntry.setSize(file.length());
zipEntry.setCrc(calcChecksum(file));
writeZipOutputStream(zipOutputStream, imagePath, zipEntry);
} catch (IOException e) {
// 处理异常
e.printStackTrace();
@ -228,37 +224,31 @@ public class InspectDetailInfoController extends BaseController {
LOGGER.info(">>>>>>>>>>>>>>生成完临时zip包");
LOGGER.info("生成完临时zip包完毕耗时时间: {}秒", ((System.currentTimeMillis() - start) / 1000.0));
return AjaxResult.success("压缩完成", zipFile.getName());
} catch (IOException e) {
LOGGER.error("压缩失败", e);
throw new ServiceException("压缩失败");
}
}
// Generate the ZIP file name based on the current date
String zipFileName = generateZipFileName() + ".zip";
// Set response headers for the file download
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + zipFileName);
@Anonymous
@GetMapping("/download/{fileName}")
public void downloadZipFile(@PathVariable("fileName") String fileName, HttpServletResponse response) {
File zipFile = Paths.get(tempImgDir, fileName).toFile();
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + generateZipFileName() + ".zip");
response.setContentType("application/zip");
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(zipFile.length()));
// Calculate the size of the ZIP file
long zipFileSize = zipFile.length();
// Set the Content-Length header in the response
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(zipFileSize));
try (
OutputStream sos = response.getOutputStream()
) {
Path zipFilePath = zipFile.toPath();
Files.copy(zipFilePath, sos);
try (FileInputStream inputStream = new FileInputStream(zipFile);
ServletOutputStream outputStream = response.getOutputStream()) {
IOUtils.copy(inputStream, outputStream);
} catch (IOException e) {
// 处理异常
e.printStackTrace();
}
long end = System.currentTimeMillis();
LOGGER.info("下载图片耗时时间: {}秒", ((end - start) / 1000.0));
} catch (IOException e) {
// Handle IO exception
e.printStackTrace();
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
LOGGER.error("文件下载中断。。。", e);
}
}
@Anonymous
@GetMapping("/download/zipImages2")
public void downloadImagesAsZip2(HttpServletResponse response, TblCarInspectDetailInfo tblCarInspectDetailInfo) {
@ -289,18 +279,7 @@ public class InspectDetailInfoController extends BaseController {
// 将相对路径转换为字符串并用正斜杠作为分隔符
String zipEntryName = relativePath.toString().replace(File.separator, "/");
ZipEntry zipEntry = new ZipEntry(zipEntryName);
zipOutputStream.putNextEntry(zipEntry);
// 使用NIO和缓冲区读取文件
try (FileChannel fileChannel = FileChannel.open(imagePath, StandardOpenOption.READ)) {
ByteBuffer buffer = ByteBuffer.allocate(8192); // 8KB缓冲区
int bytesRead;
while ((bytesRead = fileChannel.read(buffer)) != -1) {
buffer.flip(); // 切换到读模式
zipOutputStream.write(buffer.array(), 0, bytesRead);
buffer.clear(); // 清空缓冲区
}
}
zipOutputStream.closeEntry();
writeZipOutputStream(zipOutputStream, imagePath, zipEntry);
} catch (IOException e) {
// 处理异常
e.printStackTrace();
@ -385,4 +364,30 @@ public class InspectDetailInfoController extends BaseController {
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tblCarInspectDetailInfoService.deleteTblCarInspectDetailInfoByIds(ids));
}
private synchronized void writeZipOutputStream(ZipOutputStream zipOutputStream, Path imagePath, ZipEntry zipEntry) throws IOException {
try (FileInputStream inputStream = new FileInputStream(imagePath.toFile())) {
zipOutputStream.putNextEntry(zipEntry);
IOUtils.copy(inputStream, zipOutputStream);
} finally {
zipOutputStream.flush();
zipOutputStream.closeEntry();
}
}
/**
*
*
*/
@SuppressWarnings("all")
private long calcChecksum(File file) throws IOException {
try (FileInputStream fis = new FileInputStream(file);
CheckedInputStream cis = new CheckedInputStream(fis, new CRC32())) {
byte[] buffer = new byte[2048];
while (cis.read(buffer) >= 0) {}
return cis.getChecksum().getValue();
}
}
}

@ -75,7 +75,6 @@ public interface TblCarInspectDetailInfoMapper {
List<ResExportSumDetailVO> selectExportSumInfoV2(ReqExportSumInfoVO cond);
List<ResQueryInspectDetailVO> queryInspectDetailList(TblCarInspectDetailInfo detailCond);
TblCarInspectDetailInfo selectTblCarInspectDetailInfoById2(String id);

@ -20,6 +20,12 @@ public class ResExportInspectDetailVO implements Serializable {
@Excel(name = "车架号 VIN No.")
private String carVin;
/**
*
*/
@Excel(name = "车型")
private String carModel;
/**
*
*/
@ -214,4 +220,12 @@ public class ResExportInspectDetailVO implements Serializable {
public void setInspectUserName(String inspectUserName) {
this.inspectUserName = inspectUserName;
}
public String getCarModel() {
return carModel;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
}

@ -11,6 +11,7 @@ public class ResExportSumDetailVO implements Serializable {
private String seq;
private String carVin;
private String carModel;
private String inspectPartFirstName;
@ -199,4 +200,12 @@ public class ResExportSumDetailVO implements Serializable {
public void setInspectUserName(String inspectUserName) {
this.inspectUserName = inspectUserName;
}
public String getCarModel() {
return carModel;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
}

@ -94,6 +94,11 @@ public class ResQueryInspectDetailPage implements Serializable {
*/
private String inspectUserName;
/**
*
*/
private String carModel;
private List<String> imgs;
private String partComment;
@ -260,4 +265,12 @@ public class ResQueryInspectDetailPage implements Serializable {
public void setInspectTime(Date inspectTime) {
this.inspectTime = inspectTime;
}
public String getCarModel() {
return carModel;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
}

@ -0,0 +1,97 @@
package com.jiuyv.common.core.cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.Cache;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* Caffeine
*
**/
@Component
public class LocalCache {
private final CaffeineCacheManager cacheManager;
public LocalCache(CaffeineCacheManager caffeineCacheManager) {
for (Names n : Names.values()) {
caffeineCacheManager.registerCustomCache(n.name(),
Caffeine.newBuilder().expireAfterWrite(n.value, TimeUnit.SECONDS).build());
}
this.cacheManager = caffeineCacheManager;
}
/**
* IntegerString
*
*/
public void setCacheObject(Object key, Object value) {
getCache(Names.CACHE_DEFAULT).put(key, value);
}
/**
* IntegerString
*
*/
public void setCacheObject(Object key, Object value, Names cacheName) {
getCache(cacheName).put(key, value);
}
/**
*
*
*/
public <T> T getCacheObject(String key, Class<T> type) {
return getCache(Names.CACHE_DEFAULT).get(key, type);
}
/**
*
*
*/
public <T> T getCacheObject(String key, Class<T> type, Names cacheName) {
return getCache(cacheName).get(key, type);
}
/**
*
*
*/
public void deleteObject(String key,Names cacheName) {
getCache(cacheName).evict(key);
}
/**
*
*
*/
public void clear(Names cacheName) {
getCache(cacheName).clear();
}
/**
*
*
*/
private Cache getCache(Names cacheName) {
return cacheManager.getCache(cacheName.name());
}
public enum Names {
CACHE_5S(5),
CACHE_30DAY(2592000),
CACHE_CAPTCHA(120), // 验证码
CACHE_DEFAULT(CACHE_30DAY.value), // 默认
CACHE_DICT(CACHE_30DAY.value), // 字典
CACHE_CONFIG(CACHE_30DAY.value); // 参数配置
private final long value;
Names(long value) {
this.value = value;
}
}
}

@ -1,221 +0,0 @@
package com.jiuyv.common.core.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* spring redis
*
* @author admin
**/
@SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component
public class RedisCache {
@Autowired
public RedisTemplate redisTemplate;
/**
* IntegerString
*
* @param key
* @param value
*/
public <T> void setCacheObject(final String key, final T value)
{
redisTemplate.opsForValue().set(key, value);
}
/**
* IntegerString
*
* @param key
* @param value
* @param timeout
* @param timeUnit
*/
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
{
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
/**
*
*
* @param key
* @return
*/
public <T> T getCacheObject(final String key)
{
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
*
*
* @param key
*/
public Boolean deleteObject(final String key)
{
return redisTemplate.delete(key);
}
/**
*
*
* @param collection
* @return
*/
public Long deleteObject(final Collection collection)
{
return redisTemplate.delete(collection);
}
/**
* List
*
* @param key
* @param dataList List
* @return
*/
public <T> long setCacheList(final String key, final List<T> dataList)
{
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
/**
* list
*
* @param key
* @return
*/
public <T> List<T> getCacheList(final String key)
{
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* Set
*
* @param key
* @param dataSet
* @return
*/
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
{
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext())
{
setOperation.add(it.next());
}
return setOperation;
}
/**
* set
*
* @param key
* @return
*/
public <T> Set<T> getCacheSet(final String key)
{
return redisTemplate.opsForSet().members(key);
}
/**
* Map
*
* @param key
* @param dataMap
*/
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
{
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
}
/**
* Map
*
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(final String key)
{
return redisTemplate.opsForHash().entries(key);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @param value
*/
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
{
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @return Hash
*/
public <T> T getCacheMapValue(final String key, final String hKey)
{
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
/**
* Hash
*
* @param key
* @param hKey
*/
public void delCacheMapValue(final String key, final String hKey)
{
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.delete(key, hKey);
}
/**
* Hash
*
* @param key Redis
* @param hKeys Hash
* @return Hash
*/
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
{
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
/**
*
*
* @param pattern
* @return
*/
public Collection<String> keys(final String pattern)
{
return redisTemplate.keys(pattern);
}
}

@ -1,12 +1,10 @@
package com.jiuyv.common.utils;
import com.alibaba.fastjson2.JSONArray;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.core.domain.entity.SysDictData;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.utils.spring.SpringUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -31,7 +29,7 @@ public final class DictUtils {
*/
public static void setDictCache(String key, List<SysDictData> dictDatas)
{
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
SpringUtils.getBean(LocalCache.class).setCacheObject(getCacheKey(key), dictDatas, LocalCache.Names.CACHE_DICT);
}
/**
@ -40,14 +38,12 @@ public final class DictUtils {
* @param key
* @return dictDatas
*/
@SuppressWarnings("unchecked")
public static List<SysDictData> getDictCache(String key)
{
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (CarcheckStringUtils.isNotNull(arrayCache))
{
return arrayCache.toList(SysDictData.class);
}
return Collections.emptyList();
Object object = SpringUtils.getBean(LocalCache.class)
.getCacheObject(getCacheKey(key), Object.class, LocalCache.Names.CACHE_DICT);
return object == null ? Collections.emptyList() : (List<SysDictData>) object;
}
/**
@ -164,7 +160,7 @@ public final class DictUtils {
*/
public static void removeDictCache(String key)
{
SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
SpringUtils.getBean(LocalCache.class).deleteObject(getCacheKey(key), LocalCache.Names.CACHE_DICT);
}
/**
@ -172,8 +168,7 @@ public final class DictUtils {
*/
public static void clearDictCache()
{
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
SpringUtils.getBean(LocalCache.class).clear(LocalCache.Names.CACHE_DICT);
}
/**

@ -1,82 +0,0 @@
package com.jiuyv.framework.aspectj;
import com.jiuyv.common.annotation.RateLimiter;
import com.jiuyv.common.enums.LimitType;
import com.jiuyv.common.exception.ServiceException;
import com.jiuyv.common.utils.ServletUtils;
import com.jiuyv.common.utils.ip.IpUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
/**
*
*
* @author admin
*/
@Aspect
@Component
public class RateLimiterAspect
{
private static final Logger LOGGER = LoggerFactory.getLogger(RateLimiterAspect.class);
private final RedisTemplate<Object, Object> redisTemplate;
private final RedisScript<Long> limitScript;
@Autowired
public RateLimiterAspect(RedisTemplate<Object, Object> redisTemplate, RedisScript<Long> limitScript) {
this.redisTemplate = redisTemplate;
this.limitScript = limitScript;
}
@Before("@annotation(rateLimiter)")
public void doBefore(JoinPoint point, RateLimiter rateLimiter)
{
String key = rateLimiter.key();
int time = rateLimiter.time();
int count = rateLimiter.count();
String combineKey = getCombineKey(rateLimiter, point);
List<Object> keys = Collections.singletonList(combineKey);
try
{
Long number = redisTemplate.execute(limitScript, keys, count, time);
if (number == null || number.intValue() > count)
{
throw new ServiceException("访问过于频繁,请稍候再试");
}
LOGGER.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), key);
}
catch (ServiceException e)
{
LOGGER.error(e.getMessage(), e);
throw e;
}
}
public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
{
StringBuilder stringBuffer = new StringBuilder(rateLimiter.key());
if (rateLimiter.limitType() == LimitType.IP)
{
stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())).append("-");
}
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
Class<?> targetClass = method.getDeclaringClass();
stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
return stringBuffer.toString();
}
}

@ -1,49 +0,0 @@
package com.jiuyv.framework.config;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;
import java.nio.charset.Charset;
/**
* Redis使FastJson
*
* @author admin
*/
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
{
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
private Class<T> clazz;
public FastJson2JsonRedisSerializer(Class<T> clazz)
{
super();
this.clazz = clazz;
}
@Override
public byte[] serialize(T t) throws SerializationException
{
if (t == null)
{
return new byte[0];
}
return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET);
}
@Override
public T deserialize(byte[] bytes) throws SerializationException
{
if (bytes == null || bytes.length <= 0)
{
return null;
}
String str = new String(bytes, DEFAULT_CHARSET);
return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType);
}
}

@ -1,98 +0,0 @@
package com.jiuyv.framework.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.nio.charset.StandardCharsets;
/**
* redis
*
* @author admin
*/
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
@Value("${carcheck.redisPrefix}")
private String redisPrefix;
class RedisKeySerializer extends StringRedisSerializer {
@Override
public byte[] serialize(String s) {
if (s == null) {
return null;
}
// 这里加上你需要加上的key前缀
String realKey = redisPrefix + s;
return super.serialize(realKey);
}
@Override
public String deserialize(byte[] bytes) {
if (bytes == null) {
return null;
}
String s = new String(bytes, StandardCharsets.UTF_8);
int index = s.indexOf(redisPrefix);
if (index != -1) {
return s.substring(index + 2);
}
return s;
}
}
@Bean
@SuppressWarnings(value = {"unchecked", "rawtypes"})
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
// 使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(serializer);
// Hash的key也采用StringRedisSerializer的序列化方式
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(serializer);
template.afterPropertiesSet();
return template;
}
@Bean
public DefaultRedisScript<Long> limitScript()
{
DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
redisScript.setScriptText(limitScriptText());
redisScript.setResultType(Long.class);
return redisScript;
}
/**
*
*/
private String limitScriptText()
{
return "local key = KEYS[1]\n" +
"local count = tonumber(ARGV[1])\n" +
"local time = tonumber(ARGV[2])\n" +
"local current = redis.call('get', key);\n" +
"if current and tonumber(current) > count then\n" +
" return tonumber(current);\n" +
"end\n" +
"current = redis.call('incr', key)\n" +
"if tonumber(current) == 1 then\n" +
" redis.call('expire', key, time)\n" +
"end\n" +
"return tonumber(current);";
}
}

@ -3,7 +3,7 @@ package com.jiuyv.framework.interceptor.impl;
import com.alibaba.fastjson2.JSON;
import com.jiuyv.common.annotation.RepeatSubmit;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.filter.RepeatedlyRequestWrapper;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.common.utils.http.HttpHelper;
@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* url
@ -35,7 +34,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
private String header;
@Autowired
private RedisCache redisCache;
private LocalCache localCache;
@SuppressWarnings("unchecked")
@Override
@ -66,7 +65,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
// 唯一标识指定key + url + 消息头)
String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey;
Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
Object sessionObj = localCache.getCacheObject(cacheRepeatKey, Object.class, LocalCache.Names.CACHE_5S);
if (sessionObj != null)
{
Map<String, Object> sessionMap = (Map<String, Object>) sessionObj;
@ -81,7 +80,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
}
Map<String, Object> cacheMap = new HashMap<String, Object>();
cacheMap.put(url, nowDataMap);
redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS);
localCache.setCacheObject(cacheRepeatKey, cacheMap, LocalCache.Names.CACHE_5S);
return false;
}

@ -6,7 +6,7 @@ import com.jiuyv.common.constant.Constants;
import com.jiuyv.common.core.domain.AjaxResult;
import com.jiuyv.common.core.domain.model.LoginBody;
import com.jiuyv.common.core.domain.model.LoginUser;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.exception.LoginFailureException;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.common.utils.MessageUtils;
@ -39,18 +39,18 @@ public class LoginFilter extends UsernamePasswordAuthenticationFilter {
private final ISysConfigService configService;
private final RedisCache redisCache;
private final LocalCache localCache;
private final UserDetailsService userDetailsService;
@Lazy // 延迟加载,不然启动时会形成循环依赖
public LoginFilter(AuthenticationManager authenticationManager,
ISysSecretService sysSecretService, ISysConfigService configService, RedisCache redisCache,
ISysSecretService sysSecretService, ISysConfigService configService, LocalCache localCache,
ISysUserService userService, UserDetailsService userDetailsService) {
super(authenticationManager);
this.sysSecretService = sysSecretService;
this.configService = configService;
this.redisCache = redisCache;
this.localCache = localCache;
this.userDetailsService = userDetailsService;
super.setAuthenticationSuccessHandler((HttpServletRequest req, HttpServletResponse resp, Authentication auth) -> {
LoginUser loginUser = (LoginUser) auth.getPrincipal();
@ -103,8 +103,8 @@ public class LoginFilter extends UsernamePasswordAuthenticationFilter {
*/
private void validateCaptcha(String username, String code, String uuid) {
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + CarcheckStringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
String captcha = localCache.getCacheObject(verifyKey, String.class, LocalCache.Names.CACHE_CAPTCHA);
localCache.deleteObject(verifyKey, LocalCache.Names.CACHE_CAPTCHA);
if (captcha == null) {
String message = MessageUtils.message("user.jcaptcha.expire");
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, message));

@ -5,7 +5,7 @@ import com.jiuyv.common.constant.Constants;
import com.jiuyv.common.constant.UserConstants;
import com.jiuyv.common.core.domain.entity.SysUser;
import com.jiuyv.common.core.domain.model.RegisterBody;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.exception.user.CaptchaException;
import com.jiuyv.common.exception.user.CaptchaExpireException;
import com.jiuyv.common.utils.CarcheckStringUtils;
@ -33,7 +33,7 @@ public class SysRegisterService
private ISysConfigService configService;
@Autowired
private RedisCache redisCache;
private LocalCache localCache;
/**
*
@ -102,8 +102,8 @@ public class SysRegisterService
public void validateCaptcha(String username, String code, String uuid)
{
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + CarcheckStringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
String captcha = localCache.getCacheObject(verifyKey,String.class, LocalCache.Names.CACHE_CAPTCHA);
localCache.deleteObject(verifyKey, LocalCache.Names.CACHE_CAPTCHA);
if (captcha == null)
{
throw new CaptchaExpireException();

@ -1,231 +0,0 @@
package com.jiuyv.framework.web.service;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.constant.Constants;
import com.jiuyv.common.core.domain.model.LoginUser;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.common.utils.ServletUtils;
import com.jiuyv.common.utils.ip.AddressUtils;
import com.jiuyv.common.utils.ip.IpUtils;
import com.jiuyv.common.utils.uuid.IdUtils;
import eu.bitwalker.useragentutils.UserAgent;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* token
*
* @author admin
*/
@Component
public class TokenService
{
private static final Logger LOGGER = LoggerFactory.getLogger(TokenService.class);
// 令牌自定义标识
@Value("${token.header}")
private String header;
// 令牌秘钥
@Value("${token.secret}")
private String secret;
// 令牌有效期默认30分钟
@Value("${token.expireTime}")
private int expireTime;
protected static final long MILLIS_SECOND = 1000;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
@Autowired
private RedisCache redisCache;
/**
*
*
* @return
*/
public LoginUser getLoginUser(HttpServletRequest request)
{
// 获取请求携带的令牌
String token = getToken(request);
if (CarcheckStringUtils.isNotEmpty(token))
{
try
{
Claims claims = parseToken(token);
// 解析对应的权限以及用户信息
String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
return redisCache.getCacheObject(userKey);
}
catch (ClassCastException e)
{
LOGGER.error(e.getMessage(), e);
}
}
return null;
}
/**
*
*/
public void setLoginUser(LoginUser loginUser)
{
if (CarcheckStringUtils.isNotNull(loginUser) && CarcheckStringUtils.isNotEmpty(loginUser.getToken()))
{
refreshToken(loginUser);
}
}
/**
*
*/
public void delLoginUser(String token)
{
if (CarcheckStringUtils.isNotEmpty(token))
{
String userKey = getTokenKey(token);
redisCache.deleteObject(userKey);
}
}
/**
*
*
* @param loginUser
* @return
*/
public String createToken(LoginUser loginUser)
{
loginUser.getUser().setPassword(null);
String token = IdUtils.fastUUID();
loginUser.setToken(token);
setUserAgent(loginUser);
refreshToken(loginUser);
Map<String, Object> claims = new HashMap<>();
claims.put(Constants.LOGIN_USER_KEY, token);
return createToken(claims);
}
/**
* 20
*
* @param loginUser
* @return
*/
public void verifyToken(LoginUser loginUser)
{
long expiresTime = loginUser.getExpireTime();
long currentTime = System.currentTimeMillis();
if (expiresTime - currentTime <= MILLIS_MINUTE_TEN)
{
refreshToken(loginUser);
}
}
/**
*
*
* @param loginUser
*/
public void refreshToken(LoginUser loginUser)
{
loginUser.setLoginTime(System.currentTimeMillis());
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
// 根据uuid将loginUser缓存
String userKey = getTokenKey(loginUser.getToken());
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
}
/**
*
*
* @param loginUser
*/
public void setUserAgent(LoginUser loginUser)
{
UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
loginUser.setIpaddr(ip);
loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip));
loginUser.setBrowser(userAgent.getBrowser().getName());
loginUser.setOs(userAgent.getOperatingSystem().getName());
}
/**
*
*
* @param claims
* @return
*/
private String createToken(Map<String, Object> claims)
{
String token = Jwts.builder()
.setClaims(claims)
.signWith(SignatureAlgorithm.HS512, secret).compact();
return token;
}
/**
*
*
* @param token
* @return
*/
private Claims parseToken(String token)
{
return Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token)
.getBody();
}
/**
*
*
* @param token
* @return
*/
public String getUsernameFromToken(String token)
{
Claims claims = parseToken(token);
return claims.getSubject();
}
/**
* token
*
* @param request
* @return token
*/
private String getToken(HttpServletRequest request)
{
String token = request.getHeader(header);
if (CarcheckStringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
{
token = token.replace(Constants.TOKEN_PREFIX, "");
}
return token;
}
private String getTokenKey(String uuid)
{
return CacheConstants.LOGIN_TOKEN_KEY + uuid;
}
}

@ -1,48 +0,0 @@
package com.jiuyv.system.service;
import com.jiuyv.common.core.domain.model.LoginUser;
import com.jiuyv.system.domain.SysUserOnline;
/**
* 线
*
* @author admin
*/
public interface ISysUserOnlineService
{
/**
*
*
* @param ipaddr
* @param user
* @return 线
*/
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user);
/**
*
*
* @param userName
* @param user
* @return 线
*/
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user);
/**
* /
*
* @param ipaddr
* @param userName
* @param user
* @return 线
*/
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user);
/**
* 线
*
* @param user
* @return 线
*/
public SysUserOnline loginUserToUserOnline(LoginUser user);
}

@ -3,7 +3,7 @@ package com.jiuyv.system.service.impl;
import com.jiuyv.common.annotation.DataSource;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.constant.UserConstants;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.core.text.Convert;
import com.jiuyv.common.enums.DataSourceType;
import com.jiuyv.common.exception.ServiceException;
@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Collection;
import java.util.List;
/**
@ -28,12 +27,12 @@ public class SysConfigServiceImpl implements ISysConfigService
{
private final SysConfigMapper configMapper;
private final RedisCache redisCache;
private final LocalCache localCache;
@Autowired
public SysConfigServiceImpl(SysConfigMapper configMapper, RedisCache redisCache) {
public SysConfigServiceImpl(SysConfigMapper configMapper, LocalCache localCache) {
this.configMapper = configMapper;
this.redisCache = redisCache;
this.localCache = localCache;
}
/**
@ -69,7 +68,7 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override
public String selectConfigByKey(String configKey)
{
String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey)));
String configValue = Convert.toStr(localCache.getCacheObject(getCacheKey(configKey), Object.class, LocalCache.Names.CACHE_CONFIG));
if (CarcheckStringUtils.isNotEmpty(configValue))
{
return configValue;
@ -79,7 +78,7 @@ public class SysConfigServiceImpl implements ISysConfigService
SysConfig retConfig = configMapper.selectConfig(config);
if (CarcheckStringUtils.isNotNull(retConfig))
{
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
localCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue(), LocalCache.Names.CACHE_CONFIG);
return retConfig.getConfigValue();
}
return CarcheckStringUtils.EMPTY;
@ -125,7 +124,7 @@ public class SysConfigServiceImpl implements ISysConfigService
int row = configMapper.insertConfig(config);
if (row > 0)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
localCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue(), LocalCache.Names.CACHE_CONFIG);
}
return row;
}
@ -142,7 +141,7 @@ public class SysConfigServiceImpl implements ISysConfigService
int row = configMapper.updateConfig(config);
if (row > 0)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
localCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue(), LocalCache.Names.CACHE_CONFIG);
}
return row;
}
@ -163,7 +162,7 @@ public class SysConfigServiceImpl implements ISysConfigService
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
configMapper.deleteConfigById(configId);
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
localCache.deleteObject(getCacheKey(config.getConfigKey()), LocalCache.Names.CACHE_CONFIG);
}
}
@ -176,7 +175,7 @@ public class SysConfigServiceImpl implements ISysConfigService
List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
for (SysConfig config : configsList)
{
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
localCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue(), LocalCache.Names.CACHE_CONFIG);
}
}
@ -186,8 +185,7 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override
public void clearConfigCache()
{
Collection<String> keys = redisCache.keys(CacheConstants.SYS_CONFIG_KEY + "*");
redisCache.deleteObject(keys);
localCache.clear(LocalCache.Names.CACHE_CONFIG);
}
/**

@ -1,96 +0,0 @@
package com.jiuyv.system.service.impl;
import com.jiuyv.common.core.domain.model.LoginUser;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.system.domain.SysUserOnline;
import com.jiuyv.system.service.ISysUserOnlineService;
import org.springframework.stereotype.Service;
/**
* 线
*
* @author admin
*/
@Service
public class SysUserOnlineServiceImpl implements ISysUserOnlineService
{
/**
*
*
* @param ipaddr
* @param user
* @return 线
*/
@Override
public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user)
{
if (CarcheckStringUtils.equals(ipaddr, user.getIpaddr()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
*
*
* @param userName
* @param user
* @return 线
*/
@Override
public SysUserOnline selectOnlineByUserName(String userName, LoginUser user)
{
if (CarcheckStringUtils.equals(userName, user.getUsername()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
* /
*
* @param ipaddr
* @param userName
* @param user
* @return 线
*/
@Override
public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user)
{
if (CarcheckStringUtils.equals(ipaddr, user.getIpaddr()) && CarcheckStringUtils.equals(userName, user.getUsername()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
* 线
*
* @param user
* @return 线
*/
@Override
public SysUserOnline loginUserToUserOnline(LoginUser user)
{
if (CarcheckStringUtils.isNull(user) || CarcheckStringUtils.isNull(user.getUser()))
{
return null;
}
SysUserOnline sysUserOnline = new SysUserOnline();
sysUserOnline.setTokenId(user.getToken());
sysUserOnline.setUserName(user.getUsername());
sysUserOnline.setIpaddr(user.getIpaddr());
sysUserOnline.setLoginLocation(user.getLoginLocation());
sysUserOnline.setBrowser(user.getBrowser());
sysUserOnline.setOs(user.getOs());
sysUserOnline.setLoginTime(user.getLoginTime());
if (CarcheckStringUtils.isNotNull(user.getUser().getDept()))
{
sysUserOnline.setDeptName(user.getUser().getDept().getDeptName());
}
return sysUserOnline;
}
}

@ -4,9 +4,8 @@ import com.google.code.kaptcha.Producer;
import com.jiuyv.common.annotation.Anonymous;
import com.jiuyv.common.config.CarcheckConfig;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.constant.Constants;
import com.jiuyv.common.core.domain.AjaxResult;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.core.cache.LocalCache;
import com.jiuyv.common.utils.sign.Base64;
import com.jiuyv.common.utils.uuid.IdUtils;
import com.jiuyv.system.service.ISysConfigService;
@ -21,7 +20,6 @@ import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
*
@ -39,7 +37,7 @@ public class CaptchaController
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
private LocalCache localCache;
@Autowired
private ISysConfigService configService;
@ -77,7 +75,7 @@ public class CaptchaController
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
localCache.setCacheObject(verifyKey, code, LocalCache.Names.CACHE_CAPTCHA);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try

@ -1,130 +0,0 @@
package com.jiuyv.web.controller.monitor;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.core.domain.AjaxResult;
import com.jiuyv.common.exception.ServiceException;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.system.domain.SysCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
/**
*
*
* @author admin
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
private final RedisTemplate<String, String> redisTemplate;
@Autowired
public CacheController(RedisTemplate<String, String> redisTemplate) {
this.redisTemplate = redisTemplate;
}
private final static List<SysCache> caches = new ArrayList<SysCache>();
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
if (commandStats == null) {
throw new ServiceException("系统异常");
}
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach((String key) -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", CarcheckStringUtils.removeStart(key, "cmdstat_"));
data.put("value", CarcheckStringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public AjaxResult cache()
{
return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKyes = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(cacheKyes);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
assert cacheKeys != null;
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
assert cacheKeys != null;
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
}

@ -1,93 +0,0 @@
package com.jiuyv.web.controller.monitor;
import com.jiuyv.common.annotation.Log;
import com.jiuyv.common.constant.CacheConstants;
import com.jiuyv.common.core.controller.BaseController;
import com.jiuyv.common.core.domain.AjaxResult;
import com.jiuyv.common.core.domain.model.LoginUser;
import com.jiuyv.common.core.page.TableDataInfo;
import com.jiuyv.common.core.redis.RedisCache;
import com.jiuyv.common.enums.BusinessType;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.system.domain.SysUserOnline;
import com.jiuyv.system.service.ISysUserOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* 线
*
* @author admin
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (CarcheckStringUtils.isNotEmpty(ipaddr) && CarcheckStringUtils.isNotEmpty(userName))
{
if (CarcheckStringUtils.equals(ipaddr, user.getIpaddr()) && CarcheckStringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
}
else if (CarcheckStringUtils.isNotEmpty(ipaddr))
{
if (CarcheckStringUtils.equals(ipaddr, user.getIpaddr()))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
}
else if (CarcheckStringUtils.isNotEmpty(userName) && CarcheckStringUtils.isNotNull(user.getUser()))
{
if (CarcheckStringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 退
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}

@ -12,7 +12,6 @@ import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.common.utils.SecurityUtils;
import com.jiuyv.common.utils.file.FileUploadUtils;
import com.jiuyv.common.utils.file.MimeTypeUtils;
import com.jiuyv.framework.web.service.TokenService;
import com.jiuyv.system.service.ISysSecretService;
import com.jiuyv.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,9 +35,6 @@ public class SysProfileController extends BaseController {
@Autowired
private ISysUserService userService;
@Autowired
private TokenService tokenService;
@Autowired
private ISysSecretService sysSecretService;
@ -80,7 +76,6 @@ public class SysProfileController extends BaseController {
sysUser.setPhonenumber(user.getPhonenumber());
sysUser.setEmail(user.getEmail());
sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改个人信息异常,请联系管理员");
@ -108,7 +103,6 @@ public class SysProfileController extends BaseController {
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
// 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改密码异常,请联系管理员");
@ -128,7 +122,6 @@ public class SysProfileController extends BaseController {
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}

@ -12,7 +12,6 @@ import com.jiuyv.common.enums.BusinessType;
import com.jiuyv.common.utils.CarcheckStringUtils;
import com.jiuyv.common.utils.poi.ExcelUtil;
import com.jiuyv.framework.web.service.SysPermissionService;
import com.jiuyv.framework.web.service.TokenService;
import com.jiuyv.system.domain.SysUserRole;
import com.jiuyv.system.service.ISysRoleService;
import com.jiuyv.system.service.ISysUserService;
@ -42,17 +41,14 @@ public class SysRoleController extends BaseController
{
private final ISysRoleService roleService;
private final TokenService tokenService;
private final SysPermissionService permissionService;
private final ISysUserService userService;
@Autowired
public SysRoleController(ISysRoleService roleService, TokenService tokenService,
public SysRoleController(ISysRoleService roleService,
SysPermissionService permissionService, ISysUserService userService) {
this.roleService = roleService;
this.tokenService = tokenService;
this.permissionService = permissionService;
this.userService = userService;
}
@ -136,7 +132,6 @@ public class SysRoleController extends BaseController
{
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser);
}
return AjaxResult.success();
}

@ -72,6 +72,10 @@ spring:
messages:
# 国际化资源文件路径
basename: i18n/messages
# 缓存配置
cache:
type: caffeine
caffeine.spec: maximumSize=2000,expireAfterWrite=1h
# 文件上传
servlet:
multipart:
@ -86,29 +90,6 @@ spring:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 172.16.12.81
# host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource: #数据源配置
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
@ -161,7 +142,7 @@ carcheck:
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/carcheck/uploadPathLinux配置 /home/carcheck/uploadPath
profile: C:/Users/RENCHAO/carcheck/uploadPath
profile: C:/carcheck/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证

@ -67,7 +67,8 @@
t7.site_name AS inspectSiteName,
t8.realname AS inspectUserName,
t9.company_name AS companyName,
t10.dept_name AS inspectOrgName
t10.dept_name AS inspectOrgName,
t11.car_model as carModel
FROM tbl_car_inspect_detail_info t1
LEFT JOIN tbl_ng_part_info t2 ON t1.inspect_part_first = t2.id
AND t2.ng_part_type = '00' and t2.status = '00' and t2.data_status = '00'
@ -83,6 +84,7 @@
LEFT JOIN tbl_inspector_info t8 ON t1.inspect_user_id = t8.id
LEFT JOIN tbl_company_info t9 ON t1.company_id = t9.id
LEFT JOIN sys_dept t10 ON t1.inspect_org_id = t10.dept_id
lEFT JOIN tbl_car_inspect_info t11 ON t1.main_id = t11.id
</sql>
<select id="selectTblCarInspectDetailInfoList" parameterType="TblCarInspectDetailInfo"
@ -208,7 +210,6 @@
AND t6.pollutant_type = '02' and t6.status = '00' and t6.data_status = '00'
LEFT JOIN tbl_inspect_site_info t7 ON t1.inspect_site = t7.id
LEFT JOIN tbl_inspector_info t8 ON t1.inspect_user_id = t8.id
left join tbl_company_info t9 on t1.company_id = t9.id
<where>
<if test="inspectOrgId != null and inspectOrgId != ''">and t1.inspect_org_id = #{inspectOrgId}</if>
<if test="orderId != null and orderId != ''">and t1.order_id like concat('%', #{orderId}, '%')</if>
@ -249,7 +250,8 @@
t6.pollutant_en_name as pollutantDetailDescEnName,
t7.site_name AS inspectSiteName,
( CASE WHEN t1.clean_flag = '00' THEN 'Y' WHEN t1.clean_flag = '01' THEN 'N' END ) AS cleanFlagName,
t8.realname AS inspectUserName
t8.realname AS inspectUserName,
t10.car_model as carModel
FROM
tbl_car_inspect_detail_info t1
LEFT JOIN tbl_ng_part_info t2 ON t1.inspect_part_first = t2.id
@ -264,7 +266,7 @@
AND t6.pollutant_type = '02' and t6.status = '00' and t6.data_status = '00'
LEFT JOIN tbl_inspect_site_info t7 ON t1.inspect_site = t7.id
LEFT JOIN tbl_inspector_info t8 ON t1.inspect_user_id = t8.id
left join tbl_company_info t9 on t1.company_id = t9.id
lEFT JOIN tbl_car_inspect_info t10 ON t1.main_id = t10.id
<where>
<if test="inspectOrgId != null and inspectOrgId != ''">and t1.inspect_org_id = #{inspectOrgId}</if>
<if test="orderId != null and orderId != ''">and t1.order_id like concat('%', #{orderId}, '%')</if>
@ -341,7 +343,6 @@
AND t6.pollutant_type = '02' and t6.status = '00' and t6.data_status = '00'
LEFT JOIN tbl_inspect_site_info t7 ON t1.inspect_site = t7.id
LEFT JOIN tbl_inspector_info t8 ON t1.inspect_user_id = t8.id
left join tbl_company_info t9 on t1.company_id = t9.id
<where>
<if test="inspectOrgId != null and inspectOrgId != ''">and t1.inspect_org_id = #{inspectOrgId}</if>
<if test="orderId != null and orderId != ''">and t1.order_id like concat('%', #{orderId}, '%')</if>
@ -378,7 +379,8 @@
t6.pollutant_en_name as pollutantDetailDescEnName,
t7.site_name AS inspectSiteName,
( CASE WHEN t1.clean_flag = '00' THEN 'Y' WHEN t1.clean_flag = '01' THEN 'N' END ) AS cleanFlagName,
t8.realname AS inspectUserName
t8.realname AS inspectUserName,
t9.car_model as carModel
FROM
tbl_car_inspect_detail_info t1
LEFT JOIN tbl_ng_part_info t2 ON t1.inspect_part_first = t2.id
@ -393,7 +395,7 @@
AND t6.pollutant_type = '02' and t6.status = '00' and t6.data_status = '00'
LEFT JOIN tbl_inspect_site_info t7 ON t1.inspect_site = t7.id
LEFT JOIN tbl_inspector_info t8 ON t1.inspect_user_id = t8.id
left join tbl_company_info t9 on t1.company_id = t9.id
lEFT JOIN tbl_car_inspect_info t9 ON t1.main_id = t9.id
<where>
<if test="inspectOrgId != null and inspectOrgId != ''">and t1.inspect_org_id = #{inspectOrgId}</if>
<if test="orderId != null and orderId != ''">and t1.order_id like concat('%', #{orderId}, '%')</if>

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.el-descriptions-item__label:not(.is-bordered-label){text-align:right;width:110px;display:inline-block}.imglist[data-v-2cb805f7]{overflow:hidden;padding:0;margin:0}.imglist li[data-v-2cb805f7]{float:left;margin:5px;width:100px;height:100px;overflow:hidden}.imglist li img[data-v-2cb805f7]{width:100%;display:block}

@ -1 +0,0 @@
.el-descriptions-item__label:not(.is-bordered-label){text-align:right;width:110px;display:inline-block}.imglist[data-v-5d6437b8]{overflow:hidden;padding:0;margin:0}.imglist li[data-v-5d6437b8]{float:left;margin:5px;width:100px;height:100px;overflow:hidden}.imglist li img[data-v-5d6437b8]{width:100%;display:block}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4,7 +4,7 @@
<parent>
<groupId>com.jiuyv</groupId>
<artifactId>carcheck-console</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.5-SNAPSHOT</version>
</parent>
<artifactId>carcheck-ui</artifactId>
<name>carcheck-ui</name>

@ -88,20 +88,6 @@
"redirect": null,
"meta": null
},
"ONLINE_USER_QUERY":{
"id":"ONLINE_USER_QUERY",
"_parentId":"ONLINE_USER",
"label":"在线查询",
"sort":1,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"monitor:online:query",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_INSPECT_DETAIL_INDEX": {
"id": "CAR_INSPECT_DETAIL_INDEX",
"_parentId": "CAR_CHECK",
@ -229,20 +215,6 @@
"redirect": null,
"meta": null
},
"FORM_BUILD_IMPORT":{
"id":"FORM_BUILD_IMPORT",
"_parentId":"FORM_BUILD",
"label":"导入代码",
"sort":2,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"tool:gen:import",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_INSPECT_UPDATE": {
"id": "CAR_INSPECT_UPDATE",
"_parentId": "CAR_INSPECT_INDEX",
@ -299,20 +271,6 @@
"redirect": null,
"meta": null
},
"FORM_BUILD_DELETE":{
"id":"FORM_BUILD_DELETE",
"_parentId":"FORM_BUILD",
"label":"生成删除",
"sort":3,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"tool:gen:remove",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_INSPECTOR_QUERY": {
"id": "CAR_INSPECTOR_QUERY",
"_parentId": "CAR_INSPECTOR_INDEX",
@ -327,34 +285,6 @@
"redirect": null,
"meta": null
},
"FORM_BUILD_GENERATE":{
"id":"FORM_BUILD_GENERATE",
"_parentId":"FORM_BUILD",
"label":"生成代码",
"sort":5,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"tool:gen:code",
"isBtn":true,
"redirect":null,
"meta":null
},
"NOTICE_MANAGE_DELETE":{
"id":"NOTICE_MANAGE_DELETE",
"_parentId":"NOTICE_MANAGE",
"label":"公告删除",
"sort":4,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:notice:remove",
"isBtn":true,
"redirect":null,
"meta":null
},
"OUTER_COMPANY_QUERY": {
"id": "OUTER_COMPANY_QUERY",
"_parentId": "-1",
@ -374,25 +304,6 @@
"link": null
}
},
"CODE_GENERATION":{
"id":"CODE_GENERATION",
"_parentId":"SYSTEM_TOOL",
"label":"代码生成",
"sort":2,
"alwaysShow":false,
"name":"Gen",
"path":"gen",
"component":"tool/gen/index",
"perms":"tool:gen:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"代码生成",
"icon":"code",
"noCache":false,
"link":null
}
},
"POST_MANAGE_EXPORT": {
"id": "POST_MANAGE_EXPORT",
"_parentId": "POST_MANAGE",
@ -454,25 +365,6 @@
"redirect": null,
"meta": null
},
"PARAM_CONFIG":{
"id":"PARAM_CONFIG",
"_parentId":"SYSTEM_MANAGE",
"label":"参数设置",
"sort":7,
"alwaysShow":false,
"name":"Config",
"path":"config",
"component":"system/config/index",
"perms":"system:config:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"参数设置",
"icon":"edit",
"noCache":false,
"link":null
}
},
"CAR_COMPANY_ADD": {
"id": "CAR_COMPANY_ADD",
"_parentId": "CAR_COMPANY_INDEX",
@ -501,6 +393,20 @@
"redirect": null,
"meta": null
},
"CAR_INSPECT_DETAIL_EXPORT_PIC": {
"id": "CAR_INSPECT_DETAIL_EXPORT_PIC",
"_parentId": "CAR_INSPECT_DETAIL_INDEX",
"label": "导出图片",
"sort": 6,
"alwaysShow": false,
"name": null,
"path": null,
"component": null,
"perms": "business:inspectDetail:exportImages",
"isBtn": true,
"redirect": null,
"meta": null
},
"DEPT_MANAGE_ADD": {
"id": "DEPT_MANAGE_ADD",
"_parentId": "DEPT_MANAGE",
@ -581,25 +487,6 @@
"redirect": null,
"meta": null
},
"CACHE_MONITOR":{
"id":"CACHE_MONITOR",
"_parentId":"SYSTEM_MONITOR",
"label":"缓存监控",
"sort":5,
"alwaysShow":false,
"name":"Cache",
"path":"cache",
"component":"monitor/cache/index",
"perms":"monitor:cache:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"缓存监控",
"icon":"redis",
"noCache":false,
"link":null
}
},
"CAR_PRERECORD_DETAIL_INDEX": {
"id": "CAR_PRERECORD_DETAIL_INDEX",
"_parentId": "CAR_CHECK",
@ -619,25 +506,6 @@
"link": null
}
},
"SYSTEM_TOOL":{
"id":"SYSTEM_TOOL",
"_parentId":"-1",
"label":"系统工具",
"sort":3,
"alwaysShow":true,
"name":"Tool",
"path":"/tool",
"component":"Layout",
"perms":null,
"isBtn":false,
"redirect":"noRedirect",
"meta":{
"title":"系统工具",
"icon":"tool",
"noCache":false,
"link":null
}
},
"CAR_COMPANY_INDEX": {
"id": "CAR_COMPANY_INDEX",
"_parentId": "CAR_COMPANY",
@ -657,25 +525,6 @@
"link": null
}
},
"CACHE_LIST":{
"id":"CACHE_LIST",
"_parentId":"SYSTEM_MONITOR",
"label":"缓存列表",
"sort":6,
"alwaysShow":false,
"name":"CacheList",
"path":"cacheList",
"component":"monitor/cache/list",
"perms":"monitor:cache:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"缓存列表",
"icon":"redis-list",
"noCache":false,
"link":null
}
},
"CAR_SITE": {
"id": "CAR_SITE",
"_parentId": "-1",
@ -742,20 +591,6 @@
"redirect": null,
"meta": null
},
"ONLINE_USER_BATCH_EXIT":{
"id":"ONLINE_USER_BATCH_EXIT",
"_parentId":"ONLINE_USER",
"label":"批量强退",
"sort":2,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"monitor:online:batchLogout",
"isBtn":true,
"redirect":null,
"meta":null
},
"OUTER_COMPANY_QUERY_RECORD": {
"id": "OUTER_COMPANY_QUERY_RECORD",
"_parentId": "OUTER_COMPANY_QUERY",
@ -794,6 +629,20 @@
"link": null
}
},
"CAR_ORDERFORMAL_OVER": {
"id": "CAR_ORDERFORMAL_OVER",
"_parentId": "CAR_ORDERFORMAL_INDEX",
"label": "强制完成",
"sort": 4,
"alwaysShow": false,
"name": null,
"path": null,
"component": null,
"perms": "business:orderFormal:forceComplete",
"isBtn": true,
"redirect": null,
"meta": null
},
"CAR_INSPECTRESITE_UPDATE": {
"id": "CAR_INSPECTRESITE_UPDATE",
"_parentId": "CAR_INSPECTRESITE_INDEX",
@ -822,25 +671,6 @@
"redirect": null,
"meta": null
},
"NOTICE_MANAGE":{
"id":"NOTICE_MANAGE",
"_parentId":"SYSTEM_MANAGE",
"label":"通知公告",
"sort":8,
"alwaysShow":false,
"name":"Notice",
"path":"notice",
"component":"system/notice/index",
"perms":"system:notice:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"通知公告",
"icon":"message",
"noCache":false,
"link":null
}
},
"CAR_PRERECORD_QUERY": {
"id": "CAR_PRERECORD_QUERY",
"_parentId": "CAR_PRERECORD_INDEX",
@ -957,7 +787,7 @@
"id": "CAR_PRERECORD_IMPORT",
"_parentId": "CAR_PRERECORD_INDEX",
"label": "导入",
"sort":6,
"sort": 3,
"alwaysShow": false,
"name": null,
"path": null,
@ -1000,39 +830,20 @@
"link": null
}
},
"PARAM_CONFIG_ADD":{
"id":"PARAM_CONFIG_ADD",
"_parentId":"PARAM_CONFIG",
"label":"参数新增",
"sort":2,
"CAR_PRERECORD_DELETE": {
"id": "CAR_PRERECORD_DELETE",
"_parentId": "CAR_PRERECORD_INDEX",
"label": "删除",
"sort": 4,
"alwaysShow": false,
"name": null,
"path": null,
"component": null,
"perms":"system:config:add",
"perms": "business:preRecord:remove",
"isBtn": true,
"redirect": null,
"meta": null
},
"DATA_MONITOR":{
"id":"DATA_MONITOR",
"_parentId":"SYSTEM_MONITOR",
"label":"数据监控",
"sort":3,
"alwaysShow":false,
"name":"Druid",
"path":"druid",
"component":"monitor/druid/index",
"perms":"monitor:druid:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"数据监控",
"icon":"druid",
"noCache":false,
"link":null
}
},
"CAR_ORDERFORMAL_UPDATE": {
"id": "CAR_ORDERFORMAL_UPDATE",
"_parentId": "CAR_ORDERFORMAL_INDEX",
@ -1047,25 +858,6 @@
"redirect": null,
"meta": null
},
"FORM_BUILD":{
"id":"FORM_BUILD",
"_parentId":"SYSTEM_TOOL",
"label":"表单构建",
"sort":1,
"alwaysShow":false,
"name":"Build",
"path":"build",
"component":"tool/build/index",
"perms":"tool:build:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"表单构建",
"icon":"build",
"noCache":false,
"link":null
}
},
"DICT_MANAGE_DELETE": {
"id": "DICT_MANAGE_DELETE",
"_parentId": "DICT_MANAGE",
@ -1343,34 +1135,6 @@
"redirect": null,
"meta": null
},
"FORM_BUILD_UPDATE":{
"id":"FORM_BUILD_UPDATE",
"_parentId":"FORM_BUILD",
"label":"生成修改",
"sort":2,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"tool:gen:edit",
"isBtn":true,
"redirect":null,
"meta":null
},
"PARAM_CONFIG_QUERY":{
"id":"PARAM_CONFIG_QUERY",
"_parentId":"PARAM_CONFIG",
"label":"参数查询",
"sort":1,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:config:query",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_INSPECT_DETAIL_QUERY": {
"id": "CAR_INSPECT_DETAIL_QUERY",
"_parentId": "CAR_INSPECT_DETAIL_INDEX",
@ -1427,20 +1191,6 @@
"redirect": null,
"meta": null
},
"ONLINE_USER_ONE_EXIT":{
"id":"ONLINE_USER_ONE_EXIT",
"_parentId":"ONLINE_USER",
"label":"单条强退",
"sort":3,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"monitor:online:forceLogout",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_INSPECTRECORD_QUERY": {
"id": "CAR_INSPECTRECORD_QUERY",
"_parentId": "CAR_INSPECTRECORD_INDEX_",
@ -1549,25 +1299,6 @@
"redirect": null,
"meta": null
},
"SYSTEM_MONITOR":{
"id":"SYSTEM_MONITOR",
"_parentId":"-1",
"label":"系统监控",
"sort":2,
"alwaysShow":true,
"name":"Monitor",
"path":"/monitor",
"component":"Layout",
"perms":null,
"isBtn":false,
"redirect":"noRedirect",
"meta":{
"title":"系统监控",
"icon":"monitor",
"noCache":false,
"link":null
}
},
"CAR_COMPANY_DELETE": {
"id": "CAR_COMPANY_DELETE",
"_parentId": "CAR_COMPANY_INDEX",
@ -1713,20 +1444,6 @@
"link": null
}
},
"PARAM_CONFIG_DELETE":{
"id":"PARAM_CONFIG_DELETE",
"_parentId":"PARAM_CONFIG",
"label":"参数删除",
"sort":4,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:config:remove",
"isBtn":true,
"redirect":null,
"meta":null
},
"DEPT_MANAGE": {
"id": "DEPT_MANAGE",
"_parentId": "SYSTEM_MANAGE",
@ -1798,20 +1515,6 @@
"link": null
}
},
"NOTICE_MANAGE_QUERY":{
"id":"NOTICE_MANAGE_QUERY",
"_parentId":"NOTICE_MANAGE",
"label":"公告查询",
"sort":1,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:notice:query",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_PRERECORD_DETAIL_QUERY": {
"id": "CAR_PRERECORD_DETAIL_QUERY",
"_parentId": "CAR_PRERECORD_DETAIL_INDEX",
@ -1873,20 +1576,6 @@
"link": null
}
},
"FORM_BUILD_PREVIEW":{
"id":"FORM_BUILD_PREVIEW",
"_parentId":"FORM_BUILD",
"label":"预览代码",
"sort":4,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"tool:gen:preview",
"isBtn":true,
"redirect":null,
"meta":null
},
"MENU_MANAGE_DELETE": {
"id": "MENU_MANAGE_DELETE",
"_parentId": "MENU_MANAGE",
@ -1953,20 +1642,6 @@
"redirect": null,
"meta": null
},
"NOTICE_MANAGE_ADD":{
"id":"NOTICE_MANAGE_ADD",
"_parentId":"NOTICE_MANAGE",
"label":"公告新增",
"sort":2,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:notice:add",
"isBtn":true,
"redirect":null,
"meta":null
},
"CAR_POLLUTANT_QUERY": {
"id": "CAR_POLLUTANT_QUERY",
"_parentId": "CAR_POLLUTANT_INDEX",
@ -2070,63 +1745,16 @@
"redirect": null,
"meta": null
},
"NOTICE_MANAGE_UPDATE":{
"id":"NOTICE_MANAGE_UPDATE",
"_parentId":"NOTICE_MANAGE",
"label":"公告修改",
"sort":3,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:notice:edit",
"isBtn":true,
"redirect":null,
"meta":null
},
"SERVICE_MONITOR":{
"id":"SERVICE_MONITOR",
"_parentId":"SYSTEM_MONITOR",
"label":"服务监控",
"CAR_INSPECT_DELETE": {
"id": "CAR_INSPECT_DELETE",
"_parentId": "CAR_INSPECT_INDEX",
"label": "删除",
"sort": 4,
"alwaysShow": false,
"name":"Server",
"path":"server",
"component":"monitor/server/index",
"perms":"monitor:server:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"服务监控",
"icon":"server",
"noCache":false,
"link":null
}
},
"FORM_BUILD_QUERY":{
"id":"FORM_BUILD_QUERY",
"_parentId":"FORM_BUILD",
"label":"生成查询",
"sort":1,
"alwaysShow":false,
"name": null,
"path": null,
"component": null,
"perms":"tool:gen:query",
"isBtn":true,
"redirect":null,
"meta":null
},
"PARAM_CONFIG_EXPORT":{
"id":"PARAM_CONFIG_EXPORT",
"_parentId":"PARAM_CONFIG",
"label":"参数导出",
"sort":5,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:config:export",
"perms": "business:inspect:remove",
"isBtn": true,
"redirect": null,
"meta": null
@ -2164,39 +1792,6 @@
"redirect": null,
"meta": null
},
"PARAM_CONFIG_UPDATE":{
"id":"PARAM_CONFIG_UPDATE",
"_parentId":"PARAM_CONFIG",
"label":"参数修改",
"sort":3,
"alwaysShow":false,
"name":null,
"path":null,
"component":null,
"perms":"system:config:edit",
"isBtn":true,
"redirect":null,
"meta":null
},
"ONLINE_USER":{
"id":"ONLINE_USER",
"_parentId":"SYSTEM_MONITOR",
"label":"在线用户",
"sort":1,
"alwaysShow":false,
"name":"Online",
"path":"online",
"component":"monitor/online/index",
"perms":"monitor:online:list",
"isBtn":false,
"redirect":null,
"meta":{
"title":"在线用户",
"icon":"online",
"noCache":false,
"link":null
}
},
"CAR_PRERECORD_DETAIL_EXPORT": {
"id": "CAR_PRERECORD_DETAIL_EXPORT",
"_parentId": "CAR_PRERECORD_DETAIL_INDEX",

@ -5,6 +5,20 @@
<div slot="header" class="clearfix">
<span>更新日志</span>
</div>
<el-collapse v-model="version" accordion>
<el-collapse-item name="2.0.0" title="V2.0.0 - 2024.08.27">
<ol>
<li> 新增管控台-->车辆预录信息功能删除已生效的预录单并删除对应的车辆清单委托单及检查信息</li>
<li> 新增管控台-->车辆检查信息功能删除车辆信息</li>
<li> 新增管控台-->委托单信息功能新增批量导入车辆功能</li>
<li> 新增管控台-->委托单信息功能新增强制完成功能</li>
<li> 优化管控台-->车辆检查清单功能增加车型涉及查询列表详情导出表1和表2</li>
<li> 优化管控台-->车辆检查清单功能优化导出检查图片大文件功能</li>
<li> 优化APP-->新增污染物页面字体颜色调整</li>
</ol>
</el-collapse-item>
</el-collapse>
<el-collapse v-model="version" accordion>
<el-collapse-item name="1.0.8" title="V1.0.8 - 2023.11.29">
<ol>
@ -120,7 +134,7 @@ export default {
data() {
return {
//
version: "1.0.8",
version: "1.0.9",
};
},
methods: {},

@ -4,7 +4,7 @@
<groupId>com.jiuyv</groupId>
<artifactId>carcheck-console</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.5-SNAPSHOT</version>
<packaging>pom</packaging>
<description>上海中检机动车整车生物安全检查系统</description>
@ -17,7 +17,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.11</druid.version>
<druid.version>1.2.23</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>

@ -3,7 +3,7 @@
<parent>
<groupId>com.jiuyv.sptcc</groupId>
<artifactId>carbon-dataprocess</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.7-SNAPSHOT</version>
</parent>
<artifactId>carbon-dataprocess-api</artifactId>

@ -4,7 +4,7 @@
<parent>
<groupId>com.jiuyv.sptcc</groupId>
<artifactId>carbon-dataprocess</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.7-SNAPSHOT</version>
</parent>
<artifactId>carbon-dataprocess-service</artifactId>
@ -159,7 +159,19 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
</dependencies>
<build>

@ -2,12 +2,14 @@ package com.jiuyv.sptcc.carbon.dataprocess;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableDiscoveryClient
@EnableFeignClients
@SpringBootApplication
@EnableCaching
public class DataProcessApplication {
public static void main(String[] args) {

@ -12,6 +12,7 @@ public class SftpProperties {
private String password;
private String remoteDir;
private String fileSuffix;
private String nfcFileSuffix;
private String tempDir;
/**
@ -116,4 +117,12 @@ public class SftpProperties {
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public String getNfcFileSuffix() {
return nfcFileSuffix;
}
public void setNfcFileSuffix(String nfcFileSuffix) {
this.nfcFileSuffix = nfcFileSuffix;
}
}

@ -0,0 +1,25 @@
package com.jiuyv.sptcc.carbon.dataprocess.controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author ren_chao
* @since 2024-09-05
*/
@ControllerAdvice
public class Test02Controller {
@ExceptionHandler(TestException.class)
@ResponseBody
public String handleException(TestException ex) {
System.out.println("捕获到TestException。。。。。。");
// 处理异常并返回视图名
return "error";
}
static class TestException extends RuntimeException {
}
}

@ -1,42 +1,49 @@
package com.jiuyv.sptcc.carbon.dataprocess.controller;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcCalcFactor;
import com.jiuyv.sptcc.carbon.dataprocess.exception.ServiceException;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcTravelNotice;
import com.jiuyv.sptcc.carbon.dataprocess.enums.ChainStatusEnum;
import com.jiuyv.sptcc.carbon.dataprocess.feign.SmsSendFeign;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcTravelNoticeMapper;
import com.jiuyv.sptcc.carbon.dataprocess.service.ICalculateReductionService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IDataAuditService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IPushReductionService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IReadFileService;
import com.jiuyv.sptcc.carbon.dataprocess.service.ISignResultService;
import com.jiuyv.sptcc.carbon.dataprocess.service.impl.CalculateReductionServiceImpl;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.support.DefaultSingletonBeanRegistry;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ApplicationContext;
import org.springframework.core.metrics.StartupStep;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.crypto.Cipher;
import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
/**
* @author ren_chao
*/
@RestController
public class TestController {
private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);
@Autowired
private IReadFileService readFileService;
@ -52,11 +59,9 @@ public class TestController {
@Autowired
private IDataAuditService dataAuditService;
@Autowired
private SmsSendFeign smsSendFeign;
@Autowired
private ApplicationContext applicationContext;
private BcTravelNoticeMapper travelNoticeMapper;
@GetMapping("test00")
public String test00(@RequestParam("date") String date) {
@ -102,23 +107,65 @@ public class TestController {
}
@GetMapping("/test888")
public String test888(@RequestParam("sms") String sms, @RequestParam("code") String code, @RequestParam("phoneNo") String phoneNo) {
System.out.println("=================================");
System.out.println(sms);
System.out.println(code);
System.out.println(phoneNo);
System.out.println("=================================");
public String test888(@RequestParam("date") String date) {
if ("tt".equals(date)) {
throw new Test02Controller.TestException();
}
return "OK=================================";
}
return smsSendFeign.send(phoneNo, sms, code);
@GetMapping("/async-callable")
public Callable<String> asyncCallable() {
System.out.println("本来线程。。。。。::" + Thread.currentThread().getName());
return () -> {
// 模拟长时间任务
Thread.sleep(10000);
System.out.println("任务线程。。。。。::" + Thread.currentThread().getName());
return "异步结果........." + Thread.currentThread().getName();
};
}
public static void main2(String[] args) throws Exception {
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
// 加密
byte[] privateKey = Base64.decodeBase64("MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJYXMNSmNOb+tbKjr9NMvFKpG5d6sseMt+TAjdj9Bk4mgbdYXGOyqyPheJWexO0Cb0v33f8rHfVnVaOnr1vphVFjblmm22Q/BKQ7reEvVaWOwfk+Hw1MAkAHLCAaaPHpqmGGgsUY1u4bmJTS5SMgkZc/++XqAOcE65kjuYg2acv5AgMBAAECgYB1SLHzud1lFGzPp3Fh4HjY7ySMfmjt3lxk+MLfaPlgYF7E8ttfXOK3Kx2bbXHc8yYdaxeiqgLDHXiiZgp1/EkcT1XtzwMcQHB4uwoP6xdPv3DglfdXVrD+x6J2Qbszml4VG0kMuIm6a1BY5ru5dX5PkvOOtlExpSWtu+A/JYqxcQJBAP8ekzRG+OrOOwqDDer7VR91qgBdPFsaeCVp57Xhy8uxJGzE9KyuPwkZAknoWw2oc5FB2vYeCRiy0v2JEANr2pcCQQCWm8/H2u0pKLVRENtHhBH5wzOX77Lq/DBLU+WNF1QUFmT7/2YUWOXVjww2EFDlTXNWaWnSMc7+mdEea9crAS/vAkBXcGVHn6Ok5rY5rh1REn9kXvG7WjlbiEDxodC2+ALfd4FifkbWAIq+VYIBTtAWaEvj10xy2myHuJK0Lwv8ADVVAkEAiQ8oyw7/zvod77UwaOfW1/39oOJhZ5mzdYnXGExHlrQ+mFn3ksLH/k5c5YJ5rAOM1/G8fK4ZWveuKEopmRhOfwJBAIUF6GNCdMagbz5w/GuDxTZyKtnRLmJ+PIoeQe1bhR6KNP7lb1rtvvxodEsVy/rfMhudiH3BxUTTM/ySYPfAx84=");
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey);
Cipher cipher0 = Cipher.getInstance("RSA");
cipher0.init(Cipher.ENCRYPT_MODE, keyFactory.generatePrivate(keySpec));
String str = "url=/checkInInfo/reviewResult&token=2bce7d71-d60b-4858-a852-15380eba6c84&timestamp=" + System.currentTimeMillis();
byte[] bytes = cipher0.doFinal(str.getBytes(StandardCharsets.UTF_8));
System.out.println("加密串:");
System.out.println(Base64.encodeBase64String(bytes));
// 解密
byte[] publicKey = Base64.decodeBase64("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWFzDUpjTm/rWyo6/TTLxSqRuXerLHjLfkwI3Y/QZOJoG3WFxjsqsj4XiVnsTtAm9L993/Kx31Z1Wjp69b6YVRY25ZpttkPwSkO63hL1WljsH5Ph8NTAJABywgGmjx6aphhoLFGNbuG5iU0uUjIJGXP/vl6gDnBOuZI7mINmnL+QIDAQAB");
X509EncodedKeySpec keySpec2 = new X509EncodedKeySpec(publicKey);
Cipher cipher1 = Cipher.getInstance("RSA");
cipher1.init(Cipher.DECRYPT_MODE, keyFactory.generatePublic(keySpec2));
System.out.println("解密串:");
System.out.println(new String(cipher1.doFinal(bytes), StandardCharsets.UTF_8));
}
public static void main(String[] args) {
Map<String, String> map = new LinkedHashMap<>();
map.put("a", "a");
map.put("a", "b");
System.out.println(map);
String uri = "url=/checkInInfo/reviewResult&token=x-x-x-x-x&timestamp=1574821902392";
UriComponents components = UriComponentsBuilder.fromUriString("?"+uri).build();
Map<String, String> queryParams = components.getQueryParams().toSingleValueMap();
System.out.println(queryParams.get("url"));
System.out.println(queryParams.get("token"));
System.out.println(queryParams.get("timestamp"));
}

@ -9,6 +9,8 @@ import java.io.Serializable;
public class BcSubwayMileage implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String inStationId;
private String outStationId;
@ -58,4 +60,12 @@ public class BcSubwayMileage implements Serializable {
public void setOutStationName(String outStationName) {
this.outStationName = outStationName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

@ -14,6 +14,8 @@ public class BcTravelNotice implements Serializable {
*/
private String seqNo;
private String transType;
/**
*
*/
@ -604,4 +606,12 @@ public class BcTravelNotice implements Serializable {
public void setLstUpdTime(String lstUpdTime) {
this.lstUpdTime = lstUpdTime;
}
public String getTransType() {
return transType;
}
public void setTransType(String transType) {
this.transType = transType;
}
}

@ -0,0 +1,26 @@
package com.jiuyv.sptcc.carbon.dataprocess.enums;
/**
*
*
* @author ren_chao
*/
public enum TransTypeEnum {
BAR_CODE("BC_CODE", "乘车码"),
NFC_CARD("NFC_CARD", "NFC");
private final String code;
private final String info;
TransTypeEnum(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,23 @@
package com.jiuyv.sptcc.carbon.dataprocess.enums;
public enum WarnTypeEnum {
PUSH("PUSH", "碳减排量报送"),
CHAIN("CHAIN", "碳行为上链");
private final String code;
private final String info;
WarnTypeEnum(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,14 @@
package com.jiuyv.sptcc.carbon.dataprocess.feign;
import com.jiuyv.sptcc.carbon.auth.fegin.IAccountApi;
import com.jiuyv.sptcc.carbon.auth.fegin.ICardApi;
import org.springframework.cloud.openfeign.FeignClient;
/**
*
*
* @author ren_chao
*/
@FeignClient(value = "${carbon-data-process.auth-serve}", contextId = "carbonAuthNFCFeign")
public interface CarbonAuthNFCFeign extends ICardApi {
}

@ -0,0 +1,114 @@
package com.jiuyv.sptcc.carbon.dataprocess.mapper;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
/**
* The Class QueryAssistImpl.
*
* @author
* @since 2013-12-19 15:06:57
* @version 1.0.0
*/
@Component
@Scope("singleton")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class BatchExecutor extends SqlSessionDaoSupport {
/** logger. */
private static final Logger logger = LoggerFactory.getLogger(BatchExecutor.class);
/**
* SqlSessionFactory would normally be set by SqlSessionDaoSupport
*/
@Autowired
private SqlSessionFactory extendSqlSessionFactory;
/** 默认提交批数量 1000 */
private static final int DEF_BATCH_SIZE = 1000;
/**
*
*
* 使ExecutorType.BATCHSqlSessionAOP
*
* @param dao
* @param list
* @param insertStatementId
* Id使daoclass+".insert"
* @return
*/
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public <T> int batchExecute(String statementId, Collection<T> list) {
return batchExecuteTransaction(statementId, list);
}
/**
*
*
* 使ExecutorType.BATCHSqlSessionAOP
*
* @param dao
* @param list
* @param insertStatementId
* Id使daoclass+".insert"
* @return
*/
public <T> int batchExecuteTransaction(String statementId, Collection<T> list) {
if (StringUtils.isBlank(statementId) || list == null) {
logger.error("StatementId {} or Collection {} is invalid. ", new Object[] { statementId, list });
return 0;
}
if (list.isEmpty()) {
return 0;
}
if ( extendSqlSessionFactory != null) {
SqlSession session = this.extendSqlSessionFactory.openSession(ExecutorType.BATCH, false);
logger.info("batch mode: [{}] size:[{}] start...", statementId, list.size());
int er = 0;
int count = 0;
for (T obj : list) {
int effect = session.update(statementId, obj);
er += effect;
if (count % DEF_BATCH_SIZE == 0 || count == list.size() - 1) {
session.flushStatements();
session.commit();
}
count++;
}
logger.info("batch mode: [{}] size:[{}] end...", statementId, list.size());
session.close();
return er;
} else {
logger.error("未配置extendSqlSessionFactory");
return 0;
}
}
@Autowired
public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
super.setSqlSessionFactory(sqlSessionFactory);
}
}

@ -21,6 +21,11 @@ public interface BcSubwayMileageMapper {
*/
String selectMileage(@Param("inStationId") String inStationId, @Param("outStationId") String outStationId);
/**
*
*/
List<BcSubwayMileage> selectAllMileageRange(@Param("minId") String minId);
void updateMileage(@Param("list") List<BcSubwayMileage> list);
List<BcSubwayMileage> selectSubwayMileagePage(Map<String, Object> paramMap);

@ -56,4 +56,19 @@ public interface BcTravelNoticeMapper {
Set<String> selectTravelNoListByTravelNoList(@Param("list") List<BcTravelNotice> list);
void updateBatchBySeqNo(@Param("list") List<BcTravelNotice> list);
Integer selectUpChainCount();
int insertIfAbsent(BcTravelNotice notice);
List<BcTravelNotice> selectUpChainList(@Param("start") Integer start,
@Param("end") Integer end);
/**
*
* @param stlmDate
* @param minOrderNo
* @return
*/
List<BcTravelNotice> range(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("minOrderNo")String minOrderNo);
}

@ -1,21 +1,31 @@
package com.jiuyv.sptcc.carbon.dataprocess.quartz;
import com.jiuyv.sptcc.carbon.dataprocess.config.SmsProperties;
import com.jiuyv.sptcc.carbon.dataprocess.enums.CarbonDataEnum;
import com.jiuyv.sptcc.carbon.dataprocess.enums.ChainStatusEnum;
import com.jiuyv.sptcc.carbon.dataprocess.enums.WarnTypeEnum;
import com.jiuyv.sptcc.carbon.dataprocess.exception.ServiceException;
import com.jiuyv.sptcc.carbon.dataprocess.feign.SmsSendFeign;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.SysDateMapper;
import com.jiuyv.sptcc.carbon.dataprocess.service.ICalculateReductionService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IDataAuditService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IPushReductionService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IReadFileService;
import com.jiuyv.sptcc.carbon.dataprocess.service.ISignResultService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IWarnService;
import com.jiuyv.sptcc.carbon.dataprocess.util.DateUtil;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* xxl
@ -31,7 +41,8 @@ public class CarbonDataTask {
private final IPushReductionService pushReductionService;
private final ISignResultService signResultService;
private final IDataAuditService dataAuditService;
private final IWarnService warnService;
private final SysDateMapper sysDateMapper;
private final SmsSendFeign smsSendFeign;
private final SmsProperties smsProperties;
@ -40,6 +51,8 @@ public class CarbonDataTask {
IPushReductionService pushReductionService,
ISignResultService signResultService,
IDataAuditService dataAuditService,
IWarnService warnService,
SysDateMapper sysDateMapper,
SmsSendFeign smsSendFeign,
SmsProperties smsProperties) {
this.readFileService = readFileService;
@ -47,6 +60,8 @@ public class CarbonDataTask {
this.pushReductionService = pushReductionService;
this.signResultService = signResultService;
this.dataAuditService = dataAuditService;
this.warnService = warnService;
this.sysDateMapper = sysDateMapper;
this.smsSendFeign = smsSendFeign;
this.smsProperties = smsProperties;
}
@ -178,7 +193,115 @@ public class CarbonDataTask {
LOGGER.error("短信发送失败:[{}]", res);
}
}
} else {
LOGGER.info("短信发送未开启,消息[{}]", sms);
}
}
/**
*
*/
@XxlJob(value = "readNFCFileTask")
public void readNFCFileTask() {
try {
int count = readFileService.readNFCFileAndInsertDatabase(XxlJobHelper.getJobParam());
smsSend("中台NFC数据读取成功记录数" + count);
} catch (ServiceException e) {
LOGGER.error(e.getMessage(), e);
smsSend("中台NFC数据读取异常" + e.getMessage());
throw e;
} catch (Exception e) {
LOGGER.error("未知异常", e);
smsSend("中台NFC数据读取异常未知异常,请查看日志");
throw e;
}
}
/**
*
*/
@XxlJob(value = "dailyWarning")
public void dailyWarning() {
String param = XxlJobHelper.getJobParam();
LOGGER.info("getJobParam is :{}",param);
XxlJobHelper.log("getJobParam is :{}",param);
List<String> dates = new ArrayList<>();
if (StringUtils.isNotBlank(param)) {
param = param.trim();
if (param.contains("-")) {
// 起止日期判断
String startDate = param.split("-")[0];
String endDate = param.split("-")[1];
LocalDate end = DateUtil.parseString2LocalDate(endDate, DateUtil.DATE_8);
// 起始日期要小于结束日期
if (!DateUtil.parseString2LocalDate(startDate, DateUtil.DATE_8).isAfter(end)) {
// 加入起始日期
dates.add(startDate);
// 起始日期 + 1
startDate = DateUtil.dateAdd(startDate, 1);
// 主要起始日期不比结束日期后面
// 等效于起始日期小于等于结束日期
while (!DateUtil.parseString2LocalDate(startDate, DateUtil.DATE_8).isAfter(end)) {
// 加入起始日期
dates.add(startDate);
// 起始日期 + 1
startDate = DateUtil.dateAdd(startDate, 1);
}
} else {
// 否则代表时间输入有误
XxlJobHelper.handleFail();
return;
}
} else {
dates.add(param);
}
} else {
String today = sysDateMapper.currentTime().substring(0, 8);
dates.add(today);
}
try {
// 统计当日行程的上链和上送情况
for (String date : dates) {
Map<WarnTypeEnum, Map<String, Long>> result = warnService.countForWarn(date);
StringBuffer content = new StringBuffer();
content.append("【" + date + "】碳普惠日终统计。");
// 上送情况
if (result.containsKey(WarnTypeEnum.PUSH)) {
content.append("减排量上报情况:");
Map<String, Long> pushMap = result.get(WarnTypeEnum.PUSH);
for (Map.Entry<String, Long> entry : pushMap.entrySet()) {
try {
content.append("【" + CarbonDataEnum.valueOf(entry.getKey()).getInfo() + "】共" + entry.getValue() + "笔。");
} catch (Exception e) {
content.append("【未定义】共" + entry.getValue() + "笔。");
}
}
}
// 上链情况
if (result.containsKey(WarnTypeEnum.CHAIN)) {
content.append("碳行为上链情况:");
Map<String, Long> pushMap = result.get(WarnTypeEnum.CHAIN);
for (Map.Entry<String, Long> entry : pushMap.entrySet()) {
try {
content.append("【" + ChainStatusEnum.valueOf(entry.getKey()).getMsg() + "】共" + entry.getValue() + "笔。");
} catch (Exception e) {
content.append("【未定义】共" + entry.getValue() + "笔。");
}
}
}
// 发送短信
smsSend(content.toString());
}
} catch (ServiceException e) {
LOGGER.error(e.getMessage(), e);
smsSend("碳普惠日终统计异常:" + e.getMessage());
throw e;
} catch (Exception e) {
LOGGER.error("未知异常", e);
smsSend("碳普惠日终统计异常:未知异常,请查看日志");
throw e;
}
}
}

@ -0,0 +1,16 @@
package com.jiuyv.sptcc.carbon.dataprocess.service;
import java.util.Map;
/**
* service
*/
public interface ICacheService {
/**
*
* @return Map keyid_id
*/
Map<String, String> getAllMileage();
}

@ -0,0 +1,25 @@
package com.jiuyv.sptcc.carbon.dataprocess.service;
import java.io.File;
/**
*
*/
public interface IFileService {
/**
*
* @param dateStr
* @param currentTime
* @return
*/
File getBcTravelFile(String dateStr, String currentTime);
/**
* NFC
* @param dateStr
* @param currentTime
* @return
*/
File getNfcTravelFile(String dateStr, String currentTime);
}

@ -11,6 +11,11 @@ public interface IReadFileService {
*/
int readFileAndInsertDatabase(String dateStr);
/**
*
*/
int readNFCFileAndInsertDatabase(String dateStr);
/**
*
*/

@ -0,0 +1,16 @@
package com.jiuyv.sptcc.carbon.dataprocess.service;
import com.jiuyv.sptcc.carbon.dataprocess.enums.WarnTypeEnum;
import java.util.Map;
public interface IWarnService {
/**
*
* @param stlmDate
* @return
*/
Map<WarnTypeEnum, Map<String, Long>> countForWarn(String stlmDate);
}

@ -0,0 +1,45 @@
package com.jiuyv.sptcc.carbon.dataprocess.service.impl;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcSubwayMileage;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcSubwayMileageMapper;
import com.jiuyv.sptcc.carbon.dataprocess.service.ICacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* service
*/
@Service
public class CacheServiceImpl implements ICacheService {
private static final Logger LOGGER = LoggerFactory.getLogger(CacheServiceImpl.class);
@Autowired
private BcSubwayMileageMapper mileageDao;
/**
*
* @return Map keyid_id
*/
@Cacheable(value = "mileageCache", key = "'allMileage'", sync = true)
public Map<String, String> getAllMileage() {
LOGGER.info("get all mileage...");
Map<String, String> result = new HashMap<>();
String minId = "0";
List<BcSubwayMileage> list = mileageDao.selectAllMileageRange(minId);
while (!list.isEmpty()) {
result.putAll(list.stream().collect(Collectors.toMap(x -> x.getInStationId() + "_" + x.getOutStationId(), BcSubwayMileage::getMileage)));
minId = list.get(list.size() - 1).getId();
list = mileageDao.selectAllMileageRange(minId);
}
return result;
}
}

@ -45,7 +45,7 @@ public class DataAuditServiceImpl implements IDataAuditService {
*/
@Override
public void upChain() {
Integer count = travelNoticeMapper.selectCountByStatus(null, ChainStatusEnum.INIT.toString());
Integer count = travelNoticeMapper.selectUpChainCount();
LOGGER.info(">>>> 开始调用合约,总记录数:{}", count);
if (count == 0) {
return;
@ -54,8 +54,7 @@ public class DataAuditServiceImpl implements IDataAuditService {
int pageCount = count / PAGE_COUNT + 1;
for (int i = 1; i <= pageCount; i++) {
LOGGER.info(">>>> 调用合约第{}页", i);
List<BcTravelNotice> bcTravelNoticeList = travelNoticeMapper
.selectPageByStatus(null, ChainStatusEnum.INIT.toString(), 1, PAGE_COUNT);
List<BcTravelNotice> bcTravelNoticeList = travelNoticeMapper.selectUpChainList(1, PAGE_COUNT);
if (CollectionUtils.isEmpty(bcTravelNoticeList)) {
break;
}

@ -0,0 +1,110 @@
package com.jiuyv.sptcc.carbon.dataprocess.service.impl;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
import com.jiuyv.sptcc.carbon.dataprocess.config.sftp.SftpChannelPool;
import com.jiuyv.sptcc.carbon.dataprocess.config.sftp.SftpProperties;
import com.jiuyv.sptcc.carbon.dataprocess.exception.ServiceException;
import com.jiuyv.sptcc.carbon.dataprocess.service.IFileService;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
*
*/
@Service
public class FileService implements IFileService {
private static final Logger LOGGER = LoggerFactory.getLogger(FileService.class);
private static final DateTimeFormatter SDF = DateTimeFormatter.ofPattern("yyyyMMdd");
private final SftpChannelPool sftpChannelPool;
private final String remoteDir;
private final String fileSuffix;
private final String tempDir;
private final String nfcFileSuffix;
public FileService(SftpChannelPool sftpChannelPool,
SftpProperties sftpProperties) {
this.sftpChannelPool = sftpChannelPool;
this.remoteDir = sftpProperties.getRemoteDir();
this.fileSuffix = sftpProperties.getFileSuffix();
this.tempDir = sftpProperties.getTempDir();
this.nfcFileSuffix = sftpProperties.getNfcFileSuffix();
}
/**
*
* @param dateStr
* @param currentTime
* @return
*/
@Override
public File getBcTravelFile(String dateStr, String currentTime) {
if (StringUtils.isBlank(dateStr)) {
dateStr = LocalDate.parse(currentTime.substring(0, 8), SDF).minusDays(1).format(SDF);
}
String fileName = dateStr + fileSuffix;
return getFile(fileName);
}
/**
* NFC
* @param dateStr
* @param currentTime
* @return
*/
@Override
public File getNfcTravelFile(String dateStr, String currentTime) {
if (StringUtils.isBlank(dateStr)) {
dateStr = LocalDate.parse(currentTime.substring(0, 8), SDF).minusDays(1).format(SDF);
}
String fileName = dateStr + nfcFileSuffix;
return getFile(fileName);
}
/**
*
* @param fileName
* @return
*/
private File getFile(String fileName) {
ChannelSftp sftpChannel = sftpChannelPool.getSftpChannel();
LOGGER.info(">>>> 获取sftpChannel成功");
try (InputStream inputStream = sftpChannel.get(remoteDir + fileName);
ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
ZipEntry nextEntry;
while ((nextEntry = zipInputStream.getNextEntry()) != null && !nextEntry.isDirectory()) {
String filePath = tempDir + nextEntry.getName();
LOGGER.info(">>>> 下载并解压:{}", filePath);
try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {
IOUtils.copy(zipInputStream, fileOutputStream);
}
}
LOGGER.info(">>>> 文件下载成功");
} catch (IOException | SftpException e) {
LOGGER.error("获取文件出错", e);
throw new ServiceException("获取文件出错");
} finally {
sftpChannelPool.closeChannel(sftpChannel);
}
final File file = new File(tempDir, fileName.replace("zip", "csv"));
LOGGER.info(">>>> 开始读取文件:{}", file.getAbsolutePath());
return file;
}
}

@ -1,32 +1,35 @@
package com.jiuyv.sptcc.carbon.dataprocess.service.impl;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
import com.jiuyv.sptcc.carbon.auth.common.enums.OrgCodeEnum;
import com.jiuyv.sptcc.carbon.auth.common.enums.ScenCodeEnum;
import com.jiuyv.sptcc.carbon.auth.entity.CardBindStatusCheck;
import com.jiuyv.sptcc.carbon.auth.web.request.CardBindStatusCheckRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.GetUserBatchRequest;
import com.jiuyv.sptcc.carbon.auth.web.response.CardBindStatusCheckResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.R;
import com.jiuyv.sptcc.carbon.auth.web.response.ResultCode;
import com.jiuyv.sptcc.carbon.auth.web.response.UserHistoryBatchResponse;
import com.jiuyv.sptcc.carbon.dataprocess.config.sftp.SftpChannelPool;
import com.jiuyv.sptcc.carbon.dataprocess.config.sftp.SftpProperties;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcCalcFactor;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcSubwayMileage;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcTravelNotice;
import com.jiuyv.sptcc.carbon.dataprocess.enums.CarbonDataEnum;
import com.jiuyv.sptcc.carbon.dataprocess.enums.IndustryCodeEnum;
import com.jiuyv.sptcc.carbon.dataprocess.enums.TransTypeEnum;
import com.jiuyv.sptcc.carbon.dataprocess.exception.ServiceException;
import com.jiuyv.sptcc.carbon.dataprocess.feign.CarbonAuthFeign;
import com.jiuyv.sptcc.carbon.dataprocess.feign.CarbonAuthNFCFeign;
import com.jiuyv.sptcc.carbon.dataprocess.feign.CarbonDataProcessFeign;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BatchExecutor;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcCalcFactorMapper;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcSubwayMileageMapper;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcTravelNoticeMapper;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.SysDateMapper;
import com.jiuyv.sptcc.carbon.dataprocess.service.ICacheService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IFileService;
import com.jiuyv.sptcc.carbon.dataprocess.service.IReadFileService;
import com.jiuyv.sptcc.carbon.pushgate.dto.GResultDTO;
import com.jiuyv.sptcc.carbon.pushgate.dto.reduction.DictionaryReqVo;
import com.jiuyv.sptcc.carbon.pushgate.dto.reduction.ResDictionaryDTO;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,14 +39,11 @@ import org.springframework.util.CollectionUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@ -54,8 +54,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
*
@ -64,7 +62,7 @@ import java.util.zip.ZipInputStream;
@Service
public class ReadFileServiceImpl implements IReadFileService {
private static final Logger LOGGER = LoggerFactory.getLogger(ReadFileServiceImpl.class);
private static final int BATCH_SIZE = 2000;
private static final int BATCH_SIZE = 1000;
/**
*
@ -83,22 +81,19 @@ public class ReadFileServiceImpl implements IReadFileService {
private static final DateTimeFormatter REQ_SDF = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
private static final DecimalFormat MILEAGE_DF = new DecimalFormat("#.000");
private static final DecimalFormat STATION_ID_DF = new DecimalFormat("0000");
private final String BIND = "BIND";
private final Map<String, BcCalcFactor> calcFactorCache = new HashMap<>();
private final BcTravelNoticeMapper bcTravelNoticeMapper;
private final BcSubwayMileageMapper subwayMileageMapper;
private final BcCalcFactorMapper bcCalcFactorMapper;
private final SysDateMapper sysDateMapper;
private final CarbonAuthFeign carbonAuthFeign;
private final CarbonDataProcessFeign carbonDataProcessFeign;
private final SftpChannelPool sftpChannelPool;
private final String remoteDir;
private final String fileSuffix;
private final String tempDir;
private BatchExecutor executor;
private CarbonAuthFeign carbonAuthFeign;
private CarbonDataProcessFeign carbonDataProcessFeign;
private CarbonAuthNFCFeign carbonAuthNFCFeign;
private IFileService fileService;
private ICacheService cacheService;
private Map<String, String> mileageCache;
public ReadFileServiceImpl(BcTravelNoticeMapper bcTravelNoticeMapper,
BcSubwayMileageMapper subwayMileageMapper,
@ -106,18 +101,20 @@ public class ReadFileServiceImpl implements IReadFileService {
SysDateMapper sysDateMapper,
CarbonAuthFeign carbonAuthFeign,
CarbonDataProcessFeign carbonDataProcessFeign,
SftpChannelPool sftpChannelPool,
SftpProperties sftpProperties) {
CarbonAuthNFCFeign carbonAuthNFCFeign,
BatchExecutor executor,
IFileService fileService,
ICacheService cacheService) {
this.bcTravelNoticeMapper = bcTravelNoticeMapper;
this.subwayMileageMapper = subwayMileageMapper;
this.bcCalcFactorMapper = bcCalcFactorMapper;
this.sysDateMapper = sysDateMapper;
this.carbonAuthFeign = carbonAuthFeign;
this.carbonDataProcessFeign = carbonDataProcessFeign;
this.sftpChannelPool = sftpChannelPool;
this.remoteDir = sftpProperties.getRemoteDir();
this.fileSuffix = sftpProperties.getFileSuffix();
this.tempDir = sftpProperties.getTempDir();
this.carbonAuthNFCFeign = carbonAuthNFCFeign;
this.fileService = fileService;
this.executor = executor;
this.cacheService = cacheService;
}
/**
@ -126,10 +123,12 @@ public class ReadFileServiceImpl implements IReadFileService {
@Override
public synchronized int readFileAndInsertDatabase(String dateStr) {
String currentTime = sysDateMapper.currentTime();
File file = getFile(dateStr, currentTime);
File file = fileService.getBcTravelFile(dateStr, currentTime);
String csvName = file.getName();
long startTime = System.currentTimeMillis();
// 设置里程缓存
mileageCache = cacheService.getAllMileage();
LOGGER.info("mileageCache count:{}", mileageCache.size());
try (FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
BufferedReader br = new BufferedReader(isr)) {
@ -139,13 +138,55 @@ public class ReadFileServiceImpl implements IReadFileService {
if (CollectionUtils.isEmpty(list)) {
break;
}
list = filterDuplicates(list);
/*list = filterDuplicates(list);
if (CollectionUtils.isEmpty(list)) {
continue;
}
}*/
// 授权校验及其他信息配置
authVerify(list, currentTime);
bcTravelNoticeMapper.batchInsert(list);
batchInsertTravel(list);
count += list.size();
}
LOGGER.info(">>>> 文件入库成功。记录数{},耗时:{}秒", count, (System.currentTimeMillis() - startTime) / 1000);
return count;
} catch (IOException e) {
LOGGER.error("读取文件出错", e);
throw new ServiceException("读取文件出错");
} finally {
try {
Files.delete(file.toPath());
} catch (IOException e) {
LOGGER.error("文件删除失败", e);
}
}
}
/**
*
*/
public int readNFCFileAndInsertDatabase(String dateStr) {
String currentTime = sysDateMapper.currentTime();
File file = fileService.getNfcTravelFile(dateStr, currentTime);
String csvName = file.getName();
long startTime = System.currentTimeMillis();
// 设置里程缓存
mileageCache = cacheService.getAllMileage();
try (FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
BufferedReader br = new BufferedReader(isr)) {
int count = 0;
while (true) {
List<BcTravelNotice> list = getNFCTravelNoticeList(br, csvName);
if (CollectionUtils.isEmpty(list)) {
break;
}
/*list = filterDuplicates(list);
if (CollectionUtils.isEmpty(list)) {
continue;
}*/
// 授权校验及其他信息配置
authNFCVerify(list, currentTime);
batchInsertTravel(list);
count += list.size();
}
LOGGER.info(">>>> 文件入库成功。记录数{},耗时:{}秒", count, (System.currentTimeMillis() - startTime) / 1000);
@ -191,42 +232,6 @@ public class ReadFileServiceImpl implements IReadFileService {
}
/**
*
*/
private File getFile(String dateStr, String currentTime) {
if (StringUtils.isBlank(dateStr)) {
dateStr = LocalDate.parse(currentTime.substring(0, 8), SDF).minusDays(1).format(SDF);
}
String fileName = dateStr + fileSuffix;
// 下载并解压文件
ChannelSftp sftpChannel = sftpChannelPool.getSftpChannel();
LOGGER.info(">>>> 获取sftpChannel成功");
try (InputStream inputStream = sftpChannel.get(remoteDir + fileName);
ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
ZipEntry nextEntry;
while ((nextEntry = zipInputStream.getNextEntry()) != null && !nextEntry.isDirectory()) {
String filePath = tempDir + nextEntry.getName();
LOGGER.info(">>>> 下载并解压:{}", filePath);
try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {
IOUtils.copy(zipInputStream, fileOutputStream);
}
}
LOGGER.info(">>>> 文件下载成功");
} catch (IOException | SftpException e) {
LOGGER.error("获取文件出错", e);
throw new ServiceException("获取文件出错");
} finally {
sftpChannelPool.closeChannel(sftpChannel);
}
final File file = new File(tempDir, fileName.replace("zip", "csv"));
LOGGER.info(">>>> 开始读取文件:{}", file.getAbsolutePath());
return file;
}
private List<BcSubwayMileage> buildSubwayMileageList(Map<String, Double> data) {
List<BcSubwayMileage> list = new ArrayList<>();
for (Map.Entry<String, Double> entry : data.entrySet()) {
@ -234,6 +239,7 @@ public class ReadFileServiceImpl implements IReadFileService {
String[] split = entry.getKey().split("-");
subwayMileage.setInStationId(split[0]);
subwayMileage.setOutStationId(split[1]);
subwayMileage.setId(subwayMileage.getInStationId() + "_" + subwayMileage.getOutStationId());
subwayMileage.setMileage(MILEAGE_DF.format(entry.getValue()));
list.add(subwayMileage);
}
@ -273,13 +279,17 @@ public class ReadFileServiceImpl implements IReadFileService {
List<BcTravelNotice> list = new ArrayList<>();
Set<String> set = new HashSet<>();
String line;
while ((line = br.readLine()) != null && list.size() < BATCH_SIZE) {
while ((line = br.readLine()) != null) {
LOGGER.debug("获取记录:{}", line);
BcTravelNotice travelNotice = getBcTravelNotice(line, fileName);
if (travelNotice != null && !set.contains(travelNotice.getTravelNo())) {
set.add(travelNotice.getTravelNo());
checkAbnormalData(travelNotice);
list.add(travelNotice);
/*if (travelNotice != null && !set.contains(travelNotice.getTravelNo())) {
set.add(travelNotice.getTravelNo());
}*/
if (list.size() >= BATCH_SIZE) {
break;
}
}
return list;
@ -296,6 +306,7 @@ public class ReadFileServiceImpl implements IReadFileService {
}
travelNotice.setSeqNo("CARBON" + travelNo);
travelNotice.setTravelNo(travelNo);
travelNotice.setTransType(TransTypeEnum.BAR_CODE.getCode());
travelNotice.setIndustryCode(handleValue(split[1]));
travelNotice.setUserId(handleValue(split[2]));
travelNotice.setCcid(handleValue(split[3]));
@ -428,13 +439,11 @@ public class ReadFileServiceImpl implements IReadFileService {
private void calculateMileage(BcTravelNotice travelNotice) {
// 只有地铁计算里程 查不到里程,记里程异常状态
LOGGER.debug(">>>> 计算里程");
String mileage = subwayMileageMapper.selectMileage(travelNotice.getInStationId(), travelNotice.getOutStationId());
if (mileage == null) {
travelNotice.setStatus(CarbonDataEnum.MILEAGE_ERROR.getCode());
if (mileageCache.containsKey(travelNotice.getInStationId()+ "_" + travelNotice.getOutStationId())) {
travelNotice.setMileage(mileageCache.get(travelNotice.getInStationId()+ "_" + travelNotice.getOutStationId()));
} else {
travelNotice.setMileage(mileage);
travelNotice.setStatus(CarbonDataEnum.MILEAGE_ERROR.getCode());
}
}
/**
@ -467,4 +476,129 @@ public class ReadFileServiceImpl implements IReadFileService {
return STATION_ID_DF.format(Integer.parseInt(value));
}
private List<BcTravelNotice> getNFCTravelNoticeList(BufferedReader br, String fileName) throws IOException {
List<BcTravelNotice> list = new ArrayList<>();
String line;
while ((line = br.readLine()) != null) {
LOGGER.debug("获取记录:{}", line);
BcTravelNotice travelNotice = getNFCTravelNotice(line, fileName);
checkAbnormalData(travelNotice);
list.add(travelNotice);
/*if (travelNotice != null && !set.contains(travelNotice.getTravelNo())) {
set.add(travelNotice.getTravelNo());
checkAbnormalData(travelNotice);
list.add(travelNotice);
}*/
if (list.size() >= BATCH_SIZE) {
break;
}
}
return list;
}
private BcTravelNotice getNFCTravelNotice(String line, String fileName) {
String[] split = line.split(",");
BcTravelNotice travelNotice = new BcTravelNotice();
travelNotice.setSourceFileName(fileName);
String travelNo = handleValue(split[0]);
if (StringUtils.isBlank(travelNo)) {
LOGGER.info("该条记录缺少流水号:{}", line);
return null;
}
travelNotice.setSeqNo("NFC" + travelNo);
travelNotice.setTravelNo(travelNo);
travelNotice.setTransType(TransTypeEnum.NFC_CARD.getCode());
travelNotice.setIndustryCode(handleValue(split[1]));
travelNotice.setInStationId(handleStationId(split[2]));
travelNotice.setOutStationId(handleStationId(split[3]));
travelNotice.setIntoTransTime(handleTime(split[4]));
travelNotice.setOutTransTime(handleTime(split[5]));
travelNotice.setCardNo(handleValue(split[6]));
travelNotice.setInTransactionSerialNo(handleValue(split[7]));
travelNotice.setInStationName(handleValue(split[8]));
travelNotice.setInDeviceNo(handleValue(split[9]));
travelNotice.setInDeviceSerialNo(handleValue(split[10]));
travelNotice.setLineNo(handleValue(split[11]));
travelNotice.setLineName(handleValue(split[12]));
travelNotice.setOutTransactionSerialNo(handleValue(split[13]));
travelNotice.setOutStationName(handleValue(split[14]));
travelNotice.setOutDeviceNo(handleValue(split[15]));
travelNotice.setOutDeviceSerialNo(handleValue(split[16]));
return travelNotice;
}
/**
*
*/
private void authNFCVerify(List<BcTravelNotice> tnList, String currentTime) {
CardBindStatusCheckRequest request = new CardBindStatusCheckRequest();
request.setRequestId("requestId");
request.setReqTime(currentTime);
request.setOrgCode(OrgCodeEnum.DATAPROCESS.getCode());
List<CardBindStatusCheck> list = tnList.stream().map(this::buildNFCAuthRequest)
.filter(Objects::nonNull).collect(Collectors.toList());
request.setList(list);
LOGGER.debug(">>>> 开始授权查询");
R<CardBindStatusCheckResponse> r = carbonAuthNFCFeign.cardBindStatusCheck(request);
LOGGER.debug(">>>> 授权查询结果:{}", r.getCode());
if (!ResultCode.SUCCESS.getCode().equals(r.getCode())) {
throw new ServiceException("授权查询异常");
}
Map<String, CardBindStatusCheck> passSet = r.getData().getList().stream().filter( x -> (BIND.equals(x.getBindStatus())))
.collect(Collectors.toMap(CardBindStatusCheck::getTravelNo, v -> v));
for (BcTravelNotice tn : tnList) {
if (tn.getStatus() != null) {
continue;
}
if (passSet.containsKey(tn.getTravelNo())) {
CardBindStatusCheck check = passSet.get(tn.getTravelNo());
tn.setStatus(CarbonDataEnum.PROCESSING.getCode());
tn.setCcid(check.getCcid());
tn.setUserId(check.getUserId());
// 其他信息(里程和因子)
appendInfo(tn);
} else {
tn.setStatus(CarbonDataEnum.UNAUTHORIZED.getCode());
}
tn.setDataConfirmationTime(currentTime);
}
}
private CardBindStatusCheck buildNFCAuthRequest(BcTravelNotice tn) {
if (tn.getStatus() != null) {
return null;
}
CardBindStatusCheck authRequest = new CardBindStatusCheck();
authRequest.setCcid(tn.getCcid());
authRequest.setTravelNo(tn.getTravelNo());
authRequest.setExtentCardNo(tn.getCardNo());
String industryCode = tn.getIndustryCode();
if (IndustryCodeEnum.BUS.getCode().equals(industryCode)) {
authRequest.setScenCode(ScenCodeEnum.BUS.getCode());
authRequest.setTime(tn.getIntoTransTime());
return authRequest;
}
if (IndustryCodeEnum.SUBWAY.getCode().equals(industryCode)) {
authRequest.setScenCode(ScenCodeEnum.SUBLINE.getCode());
authRequest.setTime(tn.getOutTransTime());
return authRequest;
}
return null;
}
/**
*
* @param travels
*/
private void batchInsertTravel(List<BcTravelNotice> travels) {
if (CollectionUtils.isEmpty(travels)) {
return;
}
executor.batchExecute("com.jiuyv.sptcc.carbon.dataprocess.mapper.BcTravelNoticeMapper.insertIfAbsent", travels);
}
}

@ -0,0 +1,65 @@
package com.jiuyv.sptcc.carbon.dataprocess.service.impl;
import com.jiuyv.sptcc.carbon.dataprocess.domain.BcTravelNotice;
import com.jiuyv.sptcc.carbon.dataprocess.enums.WarnTypeEnum;
import com.jiuyv.sptcc.carbon.dataprocess.mapper.BcTravelNoticeMapper;
import com.jiuyv.sptcc.carbon.dataprocess.service.IWarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Service
*/
@Service
public class WarnServiceImpl implements IWarnService {
@Autowired
private BcTravelNoticeMapper travelNoticeMapper;
/**
*
* @param stlmDate
* @return
*/
public Map<WarnTypeEnum, Map<String, Long>> countForWarn(String stlmDate) {
Map<WarnTypeEnum, Map<String, Long>> result = new HashMap<>();
String startTime = stlmDate + "000000";
String endTime = stlmDate + "235959";
String minOrderNo = "0";
List<BcTravelNotice> list = travelNoticeMapper.range(startTime, endTime, minOrderNo);
while(!list.isEmpty()) {
for (BcTravelNotice notice : list) {
String status = notice.getStatus();
processMap(WarnTypeEnum.PUSH, status, result);
String chainStatus = notice.getChainStatus();
processMap(WarnTypeEnum.CHAIN, chainStatus, result);
minOrderNo = notice.getSeqNo();
}
list = travelNoticeMapper.range(startTime, endTime, minOrderNo);
}
return result;
}
/**
*
* @param warnTypeEnum
* @param status
* @param result
* @return
*/
private Map<WarnTypeEnum, Map<String, Long>> processMap(WarnTypeEnum warnTypeEnum, String status, Map<WarnTypeEnum, Map<String, Long>> result) {
if (!result.containsKey(warnTypeEnum)) {
result.put(warnTypeEnum, new HashMap<>());
}
if (!result.get(warnTypeEnum).containsKey(status)) {
result.get(warnTypeEnum).put(status, 0L);
}
result.get(warnTypeEnum).put(status, result.get(warnTypeEnum).get(status) +1);
return result;
}
}

@ -0,0 +1,302 @@
package com.jiuyv.sptcc.carbon.dataprocess.util;
import org.apache.commons.lang.StringUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
/**
* 8-format
*/
public static final String DATE_8 = "yyyyMMdd";
/**
* 14-format
*/
public static final String DATE_14 = "yyyyMMddHHmmss";
/**
* -format
*/
public static final String DATE_MMdd = "MMdd";
/**
* -format
*/
public static final String DATE_HHmmss = "HHmmss";
/**
* yyyyMMddHHmmss
*
* @return
*/
public static String getTime() {
LocalDateTime time = LocalDateTime.now();
DateTimeFormatter format = DateTimeFormatter.ofPattern(DATE_14);
return format.format(time);
}
/**
* yyyyMMdd
*
* @return
*/
public static String getDate() {
long currTime = System.currentTimeMillis();
Date date = new Date(currTime);
SimpleDateFormat format = new SimpleDateFormat(DATE_8);
return format.format(date);
}
/**
* yyyyMM
*
* @return
*/
public static String getMonth() {
return getMonth(0);
}
/**
* yyyyMM
*
* @param i
*
* @return
*/
public static String getMonth(int i) {
Date date = new Date(System.currentTimeMillis());
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, i);
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
return format.format(cal.getTime());
}
/**
*
*
* @param date
* @param pattern
* yyyyMMddhhmmss
* @return
*/
public static String getFormatDate(Date date, String pattern) {
return new SimpleDateFormat(pattern).format(date);
}
public static String getDateTime() {
long currTime = System.currentTimeMillis();
Date date = new Date(currTime);
SimpleDateFormat format = new SimpleDateFormat(DATE_14);
return format.format(date);
}
public static int compareDate(String startDay, String endDay) {
int n = 0;
DateFormat df = new SimpleDateFormat("yyyyMM");
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
endDay = endDay == null ? df.format(new Date()) : endDay;
try {
c1.setTime(df.parse(startDay));
c2.setTime(df.parse(endDay));
} catch (Exception e) {
}
while (!c1.after(c2)) { // 循环对比直到相等n 就是所要的结果
n++;
c1.add(Calendar.MONTH, 1); // 比较月份,月份+1
}
n--;
return n;
}
/**
* ( yyyyMMddHHmmss )
*
* @param startTm
* @param endTm
* @return
*/
public static int compareTime(String startTm, String endTm) {
LocalDateTime sdt = LocalDateTime.parse(startTm, DateTimeFormatter.ofPattern(DATE_14));
LocalDateTime edt = LocalDateTime.parse(endTm, DateTimeFormatter.ofPattern(DATE_14));
if (sdt.isBefore(edt)) {
return -1;
} else if (sdt.isEqual(edt)) {
return 0;
} else {
return 1;
}
}
/**
* ( yyyyMMdd )
*
* @param dateStr
*
* @return int 1dateStr-1dateStr0
*/
public static int compareDateWithNow(String dateStr) {
SimpleDateFormat timeFormator = new SimpleDateFormat(DATE_8);
try {
Date date = timeFormator.parse(dateStr);
Date current = new Date();
if (current.before(date)) {
return -1;
}
if (current.after(date)) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
throw new RuntimeException("解析日期时间格式出错,期望的字符串格式为[yyyyMMdd]");
}
}
public static int compareDate1WithNow(String dateStr) {
SimpleDateFormat timeFormator = new SimpleDateFormat("yyyyMM");
try {
Date date = timeFormator.parse(dateStr);
Date current = new Date();
if (current.before(date)) {
return -1;
}
if (current.after(date)) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
throw new RuntimeException("解析日期时间格式出错,期望的字符串格式为[yyyyMM]");
}
}
public static String getDateByFormat(String format) {
SimpleDateFormat formatter = new SimpleDateFormat(format);
return formatter.format(new Date());
}
/**
* 使Date
*/
public static Date parse(String strDate) throws ParseException {
return StringUtils.isBlank(strDate) ? null : parse(strDate, DATE_8);
}
/**
* 使FormatDate
*/
public static Date parse(String strDate, String pattern)
throws ParseException {
return StringUtils.isBlank(strDate) ? null : new SimpleDateFormat(
pattern).parse(strDate);
}
/**
*
*/
public static int getDiffDate(Date date, Date date1) {
return (int) ((date.getTime() - date1.getTime()) / (24 * 3600 * 1000));
}
public static String getMonthsFromDate(String begin, String end) {
int b = Integer.parseInt(begin.substring(0, 4));
int e = Integer.parseInt(end.substring(0, 4));
if (e < b) {
return "0";
} else if (e == b) {
b = Integer.parseInt(begin.substring(4, 6));
e = Integer.parseInt(end.substring(4, 6));
if (e < b) {
return "0";
} else {
return String.valueOf(e - b + 1);
}
} else {
int h = (e - b) * 12;
b = Integer.parseInt(begin.substring(4, 6));
e = Integer.parseInt(end.substring(4, 6));
return String.valueOf(h + e - b + 1);
}
}
public static String getDateAdd(String oldtime, long secs) {
SimpleDateFormat format = new SimpleDateFormat(DATE_14);
Date date1;
try {
date1 = format.parse(oldtime);
long Time = (date1.getTime() / 1000) + secs;
date1.setTime(Time * 1000);
String mydate1 = format.format(date1);
return mydate1;
} catch (ParseException e) {
return null;
}
}
public static long getdiffsecs(String time1, String time2) {
SimpleDateFormat format = new SimpleDateFormat(DATE_14);
Date date1;
Date date2;
try {
date1 = format.parse(time1);
date2=format.parse(time2);
long Timediff = (date1.getTime()-date2.getTime()) / 1000;
return Timediff;
} catch (ParseException e) {
return 0;
}
}
/**
* StringLocalDateTime
* @date 20201125 4:38:38
* @param currTime
* @param pattern
* @return LocalDateTime
*/
public static LocalDate parseString2LocalDate(String currTime, String pattern){
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(pattern);
return LocalDate.parse(currTime, dtf);
}
/**
*
*
* @param date yyyyMMdd
* @param day
* @return
* @throws ParseException
*/
public static String dateAdd(String date, int day) {
LocalDate time = LocalDate.parse(date,DateTimeFormatter.ofPattern(DATE_8));
time = time.plus(day, ChronoUnit.DAYS);
return time.format(DateTimeFormatter.ofPattern(DATE_8));
}
}

@ -0,0 +1,109 @@
server:
compression :
enabled : true
min-response-size: 1024
tomcat:
uri-encoding: UTF-8
connection-timeout: 60000
threads:
max: 200
eureka:
instance:
appname: ${spring.application.name}
lease-expiration-duration-in-seconds: 90
lease-renewal-interval-in-seconds: 10
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
client:
enabled: true
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://192.168.10.165:18888/eureka/
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=on)(LOAD_BALANCE=off)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.201)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.201)(PORT=1521)))(CONNECT_DATA=(SERVER = DEDICATED)(SID = jyorcl)))
username: tanphdev
password: tanphdev
hikari:
auto-commit: false
connection-init-sql: select 1 from dual
connection-test-query: select 1 from dual
minimum-idle: 5 # 最小空闲连接数量
idle-timeout: 180000 # 空闲连接存活最大时间默认60000010分钟
maximum-pool-size: 10 # 连接池最大连接数默认是10
connection-timeout: 30000 # 数据库连接超时时间,默认30秒即30000
max-lifetime: 1800000 # 此属性控制池中连接的最长生命周期值0表示无限生命周期默认1800000即30分钟
security:
user:
password: markettest
name: markettest
cache:
type: caffeine
cache-names:
- mileageCache
caffeine:
spec: initialCapacity=10,maximumSize=500,expireAfterWrite=60s
jackson:
default-property-inclusion: non_null
mybatis:
mapper-locations: classpath:mapper/**/*.xml
carbon-data-process:
enableUpChain: true
sftp:
host: 172.16.12.108
port: 22
username: flink
password: flink123
# 远端目录
remoteDir: /home/flink/zltmp/
# 本地临时目录
tempDir: C:\Users\RENCHAO\Desktop\temp-sss\aa\
# 连接池最大实例数
maxTotal: 5
# 连接池最大空闲数
maxIdle: 3
# 连接池最小空闲数
minIdle: 2
fileSuffix: _trans.zip
nfcFileSuffix: _NFCTravel.zip
gateway-serve: CARBON-PUSHGATE
auth-serve: CARBON-AUTH
xxl:
enable: false
job:
admin:
addresses: http://127.0.0.1:8080/xxl-job-admin
accessToken: default_token
#分别配置执行器的名称、ip地址、端口号
#注意:如果配置多个执行器时,防止端口冲突
executor:
appname: carbonDataProcess
address:
ip: 127.0.0.1
port: 9989
#执行器运行日志文件存储的磁盘位置,需要对该路径拥有读写权限
logpath: C:/Users/RENCHAO/Desktop/temp-sss/xxl/xxl-job/jobhandler
#执行器Log文件定期清理功能指定日志保存天数日志文件过期自动删除。限制至少保持3天否则功能不生效
#-1表示永不删除
logretentiondays: -1
#logging:
# level:
# com.jiuyv.sptcc.carbon.dataprocess.mapper: debug
sms:
enable: false
sendUrl: http://localhost:18878/smsBridge/wl/SmsServlet
phone-list:
- 13900000000

@ -1,49 +1,14 @@
mybatis:
config-location: classpath:mybatis-config.xml
mapperLocations: classpath:mapper/**/*.xml
server:
connection-timeout : 60000
compression :
enabled : true
min-response-size: 1024
tomcat:
uri-encoding: UTF-8
connection-timeout: 60000
threads:
max: 200
eureka:
instance:
appname: ${spring.application.name}
lease-expiration-duration-in-seconds: 90
lease-renewal-interval-in-seconds: 10
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
client:
enabled: true
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://192.168.10.165:18888/eureka/
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=on)(LOAD_BALANCE=off)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.201)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.201)(PORT=1521)))(CONNECT_DATA=(SERVER = DEDICATED)(SID = jyorcl)))
username: tanphdev
password: tanphdev
hikari:
auto-commit: false
connection-init-sql: select 1 from dual
connection-test-query: select 1 from dual
minimum-idle: 5 # 最小空闲连接数量
idle-timeout: 180000 # 空闲连接存活最大时间默认60000010分钟
maximum-pool-size: 10 # 连接池最大连接数默认是10
connection-timeout: 30000 # 数据库连接超时时间,默认30秒即30000
max-lifetime: 1800000 # 此属性控制池中连接的最长生命周期值0表示无限生命周期默认1800000即30分钟
security:
user:
password: markettest
name: markettest
jackson:
default-property-inclusion: non_null
contextPath:
feign:
httpclient:
enabled: false
@ -55,58 +20,3 @@ feign:
enabled: false
response:
enabled: false
mybatis:
mapper-locations: classpath:mapper/**/*.xml
carbon-data-process:
enableUpChain: true
sftp:
host: 172.16.12.108
port: 22
username: flink
password: flink123
# 远端目录
remoteDir: /home/flink/zltmp/
fileSuffix: _trans.zip
# 本地临时目录
tempDir: C:\Users\RENCHAO\Desktop\temp-sss\aa\
# 连接池最大实例数
maxTotal: 5
# 连接池最大空闲数
maxIdle: 3
# 连接池最小空闲数
minIdle: 2
gateway-serve: CARBON-PUSHGATE
auth-serve: CARBON-AUTH
xxl:
enable: false
job:
admin:
addresses: http://127.0.0.1:8080/xxl-job-admin
accessToken: default_token
#分别配置执行器的名称、ip地址、端口号
#注意:如果配置多个执行器时,防止端口冲突
executor:
appname: carbonDataProcess
address:
ip: 127.0.0.1
port: 9989
#执行器运行日志文件存储的磁盘位置,需要对该路径拥有读写权限
logpath: C:/Users/RENCHAO/Desktop/temp-sss/xxl/xxl-job/jobhandler
#执行器Log文件定期清理功能指定日志保存天数日志文件过期自动删除。限制至少保持3天否则功能不生效
#-1表示永不删除
logretentiondays: -1
#logging:
# level:
# com.jiuyv.sptcc.carbon.dataprocess.mapper: debug
sms:
enable: false
sendUrl: http://localhost:18878/smsBridge/wl/SmsServlet
phone-list:
- 13900000000

@ -3,8 +3,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jiuyv.sptcc.carbon.dataprocess.mapper.BcSubwayMileageMapper">
<cache eviction="LRU" size="10000"/>
<resultMap id="BaseResultMap" type="com.jiuyv.sptcc.carbon.dataprocess.domain.BcSubwayMileage">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<id property="inStationId" column="IN_STATION_ID" jdbcType="VARCHAR"/>
<id property="outStationId" column="OUT_STATION_ID" jdbcType="VARCHAR"/>
<result property="mileage" column="MILEAGE" jdbcType="DECIMAL"/>
@ -25,11 +25,21 @@
</where>
</select>
<select id="selectAllMileageRange" resultMap="BaseResultMap" fetchSize="10000">
select ID,IN_STATION_ID,OUT_STATION_ID,MILEAGE from (
select ID,IN_STATION_ID,OUT_STATION_ID,MILEAGE
from TBL_BC_SUBWAY_MILEAGE
where ID > #{minId}
order by ID asc
) where rownum &lt;= 10000
</select>
<update id="updateMileage">
MERGE INTO TBL_BC_SUBWAY_MILEAGE target
USING (
<foreach collection="list" item="m" separator="UNION ALL">
SELECT
#{m.id,jdbcType=VARCHAR} AS ID,
#{m.inStationId,jdbcType=VARCHAR} AS IN_STATION_ID,
#{m.outStationId,jdbcType=VARCHAR} AS OUT_STATION_ID,
#{m.mileage,jdbcType=DECIMAL} AS MILEAGE,
@ -45,8 +55,8 @@
target.IN_STATION_NAME = source.IN_STATION_NAME,
target.OUT_STATION_NAME = source.OUT_STATION_NAME
WHEN NOT MATCHED THEN
INSERT (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME)
VALUES (source.IN_STATION_ID, source.OUT_STATION_ID, source.MILEAGE, source.IN_STATION_NAME, source.OUT_STATION_NAME)
INSERT (ID,IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME)
VALUES (source.ID, source.IN_STATION_ID,source.OUT_STATION_ID, source.MILEAGE, source.IN_STATION_NAME, source.OUT_STATION_NAME)
</update>
<select id="selectMileage" resultType="java.lang.String">

@ -6,6 +6,7 @@
<resultMap id="BaseResultMap" type="com.jiuyv.sptcc.carbon.dataprocess.domain.BcTravelNotice">
<result property="seqNo" column="SEQ_NO" jdbcType="VARCHAR"/>
<result property="transType" column="TRANS_TYPE" jdbcType="VARCHAR"/>
<result property="methodId" column="METHOD_ID" jdbcType="VARCHAR"/>
<result property="baseFactor" column="BASE_FACTOR" jdbcType="VARCHAR"/>
<result property="factor" column="FACTOR" jdbcType="VARCHAR"/>
@ -53,7 +54,7 @@
</resultMap>
<sql id="Base_Column_List">
SEQ_NO,METHOD_ID,BASE_FACTOR,
SEQ_NO,TRANS_TYPE,METHOD_ID,BASE_FACTOR,
FACTOR,TRAVEL_NO,INDUSTRY_CODE,
USER_ID,CCID,IN_STATION_ID,
OUT_STATION_ID,OPEN_CHANNEL,INTO_TRANS_TIME,
@ -75,6 +76,9 @@
<if test="methodId != null">
METHOD_ID = #{methodId,jdbcType=VARCHAR},
</if>
<if test="transType != null">
TRANS_TYPE = #{transType,jdbcType=VARCHAR},
</if>
<if test="baseFactor != null">
BASE_FACTOR = #{baseFactor,jdbcType=VARCHAR},
</if>
@ -267,9 +271,15 @@
<if test="seqNo != null and seqNo != ''">
and SEQ_NO = #{seqNo,jdbcType=VARCHAR}
</if>
<if test="transType != null">
and TRANS_TYPE = #{transType,jdbcType=VARCHAR}
</if>
<if test="travelNo != null and travelNo != ''">
and TRAVEL_NO = #{travelNo,jdbcType=VARCHAR}
</if>
<if test="ccid != null and ccid != ''">
and CCID = #{ccid,jdbcType=VARCHAR}
</if>
<if test="startTime != null and startTime != ''">
and CREATE_TIME >= #{startTime,jdbcType=VARCHAR}
</if>
@ -309,19 +319,111 @@
</select>
<select id="selectTravelNoListByTravelNoList" resultType="java.lang.String">
WITH travel_list AS (
<foreach collection="list" item="tn" separator="UNION ALL">
SELECT #{tn.travelNo} AS TRAVEL_NO FROM dual
select travel_no from TBL_BC_TRAVEL_NOTICE where travel_no in
<foreach item="tn" collection="list" open="(" separator="," close=")">
#{tn.travelNo}
</foreach>
</select>
<select id="selectUpChainCount" resultType="java.lang.Integer">
SELECT COUNT(*) FROM TBL_BC_TRAVEL_NOTICE
WHERE CHAIN_STATUS IN ('INIT','CHAIN_FAILED') AND SEND_COUNT &lt; 6
</select>
<select id="selectUpChainList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM (
SELECT row_number() OVER (ORDER BY SEQ_NO) rn, t.*
FROM TBL_BC_TRAVEL_NOTICE t
WHERE CHAIN_STATUS IN ('INIT','CHAIN_FAILED') AND SEND_COUNT &lt; 6
)
SELECT tn.TRAVEL_NO
FROM TBL_BC_TRAVEL_NOTICE tn
JOIN travel_list tl ON tn.TRAVEL_NO = tl.TRAVEL_NO
WHERE rn BETWEEN #{start} AND #{end}
</select>
<update id="insertIfAbsent" parameterType="com.jiuyv.sptcc.carbon.dataprocess.domain.BcTravelNotice">
merge into TBL_BC_TRAVEL_NOTICE pw
using dual on (pw.travel_No = #{travelNo})
when not matched then
insert
(
SEQ_NO,
TRANS_TYPE,
METHOD_ID,
BASE_FACTOR,
FACTOR,
TRAVEL_NO,
INDUSTRY_CODE,
USER_ID,
CCID,
IN_STATION_ID,
OUT_STATION_ID,
OPEN_CHANNEL,
INTO_TRANS_TIME,
OUT_TRANS_TIME,
CARD_NO,
IN_TRANSACTION_SERIAL_NO,
IN_STATION_NAME,
IN_DEVICE_NO,
IN_DEVICE_SERIAL_NO,
LINE_NO,
LINE_NAME,
OUT_TRANSACTION_SERIAL_NO,
OUT_STATION_NAME,
OUT_DEVICE_NO,
OUT_DEVICE_SERIAL_NO,
MILEAGE,
DATA_CONFIRMATION_TIME,
SOURCE_FILE_NAME,
STATUS,
REMARK,
CREATE_USER,
CREATE_TIME,
LST_UPD_USER,
LST_UPD_TIME
) values(
#{seqNo,jdbcType=VARCHAR},
#{transType,jdbcType=VARCHAR},
#{methodId,jdbcType=VARCHAR},
#{baseFactor,jdbcType=VARCHAR},
#{factor,jdbcType=VARCHAR},
#{travelNo,jdbcType=VARCHAR},
#{industryCode,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR},
#{ccid,jdbcType=VARCHAR},
#{inStationId,jdbcType=VARCHAR},
#{outStationId,jdbcType=VARCHAR},
#{openChannel,jdbcType=VARCHAR},
#{intoTransTime,jdbcType=CHAR},
#{outTransTime,jdbcType=CHAR},
#{cardNo,jdbcType=VARCHAR},
#{inTransactionSerialNo,jdbcType=VARCHAR},
#{inStationName,jdbcType=VARCHAR},
#{inDeviceNo,jdbcType=VARCHAR},
#{inDeviceSerialNo,jdbcType=VARCHAR},
#{lineNo,jdbcType=VARCHAR},
#{lineName,jdbcType=VARCHAR},
#{outTransactionSerialNo,jdbcType=VARCHAR},
#{outStationName,jdbcType=VARCHAR},
#{outDeviceNo,jdbcType=VARCHAR},
#{outDeviceSerialNo,jdbcType=VARCHAR},
#{mileage,jdbcType=VARCHAR},
#{dataConfirmationTime,jdbcType=CHAR},
#{sourceFileName,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR},
'admin',
to_char(current_timestamp,'YYYYMMDDHH24MISS'),
'admin',
to_char(current_timestamp,'YYYYMMDDHH24MISS')
)
</update>
<insert id="batchInsert">
insert into TBL_BC_TRAVEL_NOTICE (
SEQ_NO,
TRANS_TYPE,
METHOD_ID,
BASE_FACTOR,
FACTOR,
@ -358,6 +460,7 @@
<foreach collection="list" item="tn" separator="UNION ALL">
SELECT
#{tn.seqNo,jdbcType=VARCHAR} AS SEQ_NO,
#{tn.transType,jdbcType=VARCHAR} AS TRANS_TYPE,
#{tn.methodId,jdbcType=VARCHAR} AS METHOD_ID,
#{tn.baseFactor,jdbcType=VARCHAR} AS BASE_FACTOR,
#{tn.factor,jdbcType=VARCHAR} AS FACTOR,
@ -410,7 +513,11 @@
update TBL_BC_TRAVEL_NOTICE
SET CHAIN_STATUS = #{chainStatus,jdbcType=VARCHAR}
<if test="txId != null and txId != ''">
,CHAIN_TX_ID = #{txId,jdbcType=VARCHAR}
,CHAIN_TX_ID = #{txId,jdbcType=VARCHAR},
SEND_COUNT = SEND_COUNT + 1
</if>
<if test="chainStatus == 'CHAIN_SUCCESS'">
,SEND_COUNT = 0
</if>
WHERE TRAVEL_NO IN
<foreach collection="list" item="travelNo" separator="," open="(" close=")">
@ -442,6 +549,7 @@
#{tn.seqNo} AS SEQ_NO,
#{tn.carbonFootprint} AS CARBON_FOOTPRINT,
#{tn.reductionCalculateTime} AS REDUCTION_CALCULATE_TIME,
#{tn.hashData} AS HASH_DATA,
#{tn.status} AS STATUS,
#{tn.chainStatus} AS CHAIN_STATUS
FROM dual
@ -452,9 +560,20 @@
UPDATE SET
target.CARBON_FOOTPRINT = source.CARBON_FOOTPRINT,
target.REDUCTION_CALCULATE_TIME = source.REDUCTION_CALCULATE_TIME,
target.HASH_DATA = source.HASH_DATA,
target.STATUS = source.STATUS,
target.CHAIN_STATUS = source.CHAIN_STATUS
</update>
<select id="range" resultMap="BaseResultMap" fetchSize="10000">
select SEQ_NO, STATUS, CHAIN_STATUS from (
select SEQ_NO, STATUS, CHAIN_STATUS
from TBL_BC_TRAVEL_NOTICE
where CREATE_TIME >= #{startTime}
and CREATE_TIME &lt;= #{endTime}
and SEQ_NO > #{minOrderNo}
order by SEQ_NO asc
) where rownum &lt;= 10000
</select>
</mapper>

@ -0,0 +1,51 @@
package com.jiuyv.sptcc.carbon.dataprocess.api;
import com.jiuyv.sptcc.carbon.auth.entity.CardBindStatusCheck;
import com.jiuyv.sptcc.carbon.auth.web.request.CardBindOperationRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.CardBindStatusCheckRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.CardWhiteListCheckRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.GetUserBatchRequest;
import com.jiuyv.sptcc.carbon.auth.web.response.CardBindOperationResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.CardBindStatusCheckResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.R;
import com.jiuyv.sptcc.carbon.auth.web.response.UserHistoryBatchResponse;
import com.jiuyv.sptcc.carbon.dataprocess.feign.CarbonAuthNFCFeign;
import java.util.ArrayList;
import java.util.List;
public class CarbonAuthCardFeignMock implements CarbonAuthNFCFeign {
@Override
public R<CardBindOperationResponse> cardBind(CardBindOperationRequest cardBindOperationRequest) {
return null;
}
@Override
public R<CardBindOperationResponse> cardUnbind(CardBindOperationRequest cardBindOperationRequest) {
return null;
}
@Override
public R<CardBindOperationResponse> cardBindStatus(CardBindOperationRequest cardBindStatusRequest) {
return null;
}
@Override
public R<Boolean> cardWhiteListCheck(CardWhiteListCheckRequest cardWhiteListCheckRequest) {
return null;
}
@Override
public R<CardBindStatusCheckResponse> cardBindStatusCheck(CardBindStatusCheckRequest request) {
List<CardBindStatusCheck> list = new ArrayList<>();
for (CardBindStatusCheck auth : request.getList()) {
auth.setCcid("did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG");
auth.setUserId("0000670723");
auth.setBindStatus("BIND");
list.add(auth);
}
CardBindStatusCheckResponse response = new CardBindStatusCheckResponse();
response.setList(list);
return R.ok(response);
}
}

@ -0,0 +1,53 @@
package com.jiuyv.sptcc.carbon.dataprocess.api;
import com.jiuyv.sptcc.carbon.auth.web.request.AccoutRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.AuthApplyRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.AuthRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.BoundRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.GetUserBatchRequest;
import com.jiuyv.sptcc.carbon.auth.web.request.GetUserRequest;
import com.jiuyv.sptcc.carbon.auth.web.response.AccountResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.AuthApplyResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.R;
import com.jiuyv.sptcc.carbon.auth.web.response.UserHistoryBatchResponse;
import com.jiuyv.sptcc.carbon.auth.web.response.UserHistoryResponse;
import com.jiuyv.sptcc.carbon.dataprocess.feign.CarbonAuthFeign;
import java.util.ArrayList;
import java.util.List;
public class CarbonAuthFeignMock implements CarbonAuthFeign {
@Override
public R<AccountResponse> getInfo(AccoutRequest request) {
return null;
}
@Override
public R<AuthApplyResponse> apply(AuthApplyRequest request) {
return null;
}
@Override
public R<Void> boundCcId(BoundRequest request) {
return null;
}
@Override
public R<UserHistoryResponse> getUserByCid(GetUserRequest request) {
return null;
}
@Override
public R<UserHistoryBatchResponse> getUserByCidBatch(GetUserBatchRequest request) {
List<UserHistoryBatchResponse.AuthRecord> list = new ArrayList<>();
for (GetUserBatchRequest.AuthRequest auth : request.getList()) {
UserHistoryBatchResponse.AuthRecord r = new UserHistoryBatchResponse.AuthRecord();
r.setTravelNo(auth.getTravelNo());
r.setAuthFlag(Boolean.TRUE);
list.add(r);
}
UserHistoryBatchResponse response = new UserHistoryBatchResponse();
response.setList(list);
return R.ok(response);
}
}

@ -0,0 +1,67 @@
package com.jiuyv.sptcc.carbon.dataprocess.api;
import com.jcraft.jsch.SftpException;
import com.jiuyv.sptcc.carbon.dataprocess.controller.DataProcessControllerTest;
import com.jiuyv.sptcc.carbon.dataprocess.exception.ServiceException;
import com.jiuyv.sptcc.carbon.dataprocess.service.IFileService;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class FileServiceMock implements IFileService {
private static final Logger LOGGER = LoggerFactory
.getLogger(DataProcessControllerTest.class);
@Override
public File getBcTravelFile(String dateStr, String currentTime) {
try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("20231023_QrTravel.zip");
ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
ZipEntry nextEntry;
while ((nextEntry = zipInputStream.getNextEntry()) != null && !nextEntry.isDirectory()) {
String filePath = System.getProperty("java.io.tmpdir") + "/" + nextEntry.getName();
LOGGER.info(">>>> 下载并解压:{}", filePath);
try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {
IOUtils.copy(zipInputStream, fileOutputStream);
}
}
LOGGER.info(">>>> 文件下载成功");
} catch (IOException e) {
LOGGER.error("获取文件出错", e);
throw new ServiceException("获取文件出错");
}
final File file = new File(System.getProperty("java.io.tmpdir"), "20231023_QrTravel.csv");
LOGGER.info(">>>> 开始读取文件:{}", file.getAbsolutePath());
return file;
}
@Override
public File getNfcTravelFile(String dateStr, String currentTime) {
try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("20231024_NFCTravel.zip");
ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
ZipEntry nextEntry;
while ((nextEntry = zipInputStream.getNextEntry()) != null && !nextEntry.isDirectory()) {
String filePath = System.getProperty("java.io.tmpdir") + "/" + nextEntry.getName();
LOGGER.info(">>>> 下载并解压:{}", filePath);
try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {
IOUtils.copy(zipInputStream, fileOutputStream);
}
}
LOGGER.info(">>>> 文件下载成功");
} catch (IOException e) {
LOGGER.error("获取文件出错", e);
throw new ServiceException("获取文件出错");
}
final File file = new File(System.getProperty("java.io.tmpdir"), "20231024_NFCTravel.csv");
LOGGER.info(">>>> 开始读取文件:{}", file.getAbsolutePath());
return file;
}
}

@ -0,0 +1,95 @@
package com.jiuyv.sptcc.carbon.dataprocess.controller;
import com.jiuyv.sptcc.carbon.dataprocess.DataProcessApplication;
import com.jiuyv.sptcc.carbon.dataprocess.api.CarbonAuthCardFeignMock;
import com.jiuyv.sptcc.carbon.dataprocess.api.CarbonAuthFeignMock;
import com.jiuyv.sptcc.carbon.dataprocess.api.FileServiceMock;
import com.jiuyv.sptcc.carbon.dataprocess.quartz.CarbonDataTask;
import com.jiuyv.sptcc.carbon.dataprocess.service.impl.ReadFileServiceImpl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.annotation.Resource;
/**
* test
* @author jiuyv
*
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = DataProcessApplication.class)
@ActiveProfiles("junit")//测试配置
public class DataProcessControllerTest {
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory
.getLogger(DataProcessControllerTest.class);
@Resource
@InjectMocks
private ReadFileServiceImpl readFileService;
@Resource
private CarbonDataTask task;
@Spy
private FileServiceMock fileServiceMock = new FileServiceMock();
@Spy
private CarbonAuthFeignMock carbonAuthFeignMock = new CarbonAuthFeignMock();
@Spy
private CarbonAuthCardFeignMock carbonAuthCardFeignMock = new CarbonAuthCardFeignMock();
@BeforeEach
public void initMocks() {
MockitoAnnotations.openMocks(this);
}
@Test
public void test1() {
LOGGER.info("---------------- 二维码行程读取 开始 ----------------");
Boolean isException = false;
try {
readFileService.readFileAndInsertDatabase("20231023");
} catch (Exception e) {
LOGGER.error("二维码行程读取运行失败",e);
isException = true;
}
Assertions.assertEquals(Boolean.FALSE, isException);
LOGGER.info("---------------- 二维码行程读取 结束 ----------------");
}
@Test
public void test2() {
LOGGER.info("---------------- NFC行程读取 开始 ----------------");
Boolean isException = false;
try {
readFileService.readNFCFileAndInsertDatabase("20231024");
} catch (Exception e) {
LOGGER.error("NFC行程读取运行失败",e);
isException = true;
}
Assertions.assertEquals(Boolean.FALSE, isException);
LOGGER.info("----------------NFC行程读取 结束 ----------------");
}
@Test
public void test3() {
LOGGER.info("---------------- 碳普惠日终统计 开始 ----------------");
task.dailyWarning();
LOGGER.info("---------------- 碳普惠日终统计 结束 ----------------");
}
}

@ -0,0 +1,111 @@
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=FALSE;MODE=Oracle
driver-class-name: org.h2.Driver
username: root
password: 123456
hikari:
auto-commit: false
connection-init-sql: select 1 from dual
connection-test-query: select 1 from dual
minimum-idle: 5
idle-timeout: 180000
maximum-pool-size: 10
connection-timeout: 30000
max-lifetime: 1800000
jpa:
hibernate:
ddl-auto: create
sql:
init:
schema-locations: classpath:db/schema.sql
data-locations: classpath:db/data.sql
mode: always
separator: ;
platform: h2
encoding: utf-8
cache:
type: caffeine
cache-names:
- mileageCache
caffeine:
spec: initialCapacity=10,maximumSize=500,expireAfterWrite=60s
server:
compression :
enabled : true
min-response-size: 1024
tomcat:
uri-encoding: UTF-8
connection-timeout: 60000
threads:
max: 200
cache:
type: caffeine
cache-names:
- changeStationCache
- mileageCache
- calcFactorCache
caffeine:
spec: initialCapacity=10,maximumSize=500,expireAfterWrite=60s
security:
user:
password: markettest
name: markettest
jackson:
default-property-inclusion: non_null
eureka:
instance:
appname: ${spring.application.name}
lease-expiration-duration-in-seconds: 90
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:
register-with-eureka: false
fetch-registry: false
serviceUrl:
defaultZone: http://192.168.10.165:18888/eureka/
feign:
httpclient:
enabled: false
#替换默认的http连接
okhttp:
enabled: true
compression:
request:
enabled: false
response:
enabled: false
mybatis:
mapper-locations: classpath:mapper/**/*.xml
carbon-data-process:
sftp:
host: 192.168.10.165
port: 22
username: tomcat
password: tomcat123
# 远端目录
remoteDir: /home/tomcat/transData/
# 本地临时目录
tempDir: /home/tomcat/carbon/dataprocess/temp/
# 连接池最大实例数
maxTotal: 5
# 连接池最大空闲数
maxIdle: 3
# 连接池最小空闲数
minIdle: 2
gateway-serve: FADEOUT
auth-serve: CARBON-AUTH
sms:
enable: false
sendUrl: http://168.10.35.161:18878/smsBridge/wl/SmsServlet
phone-list:
- 13862851173

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="dbUnitDatabaseConfig" class="com.github.springtestdbunit.bean.DatabaseConfigBean">
<property name="skipOracleRecyclebinTables" value="true" />
</bean>
<bean id="dbUnitDatabaseConnection"
class="com.github.springtestdbunit.bean.DatabaseDataSourceConnectionFactoryBean">
<property name="databaseConfig" ref="dbUnitDatabaseConfig" />
<property name="dataSource" ref="dataSource" />
<!-- oracle必须配置schema不配置会抛AmbiguousTableNameExceptionmysql不要配置schema否则执行@ExpectedDatabase的逻辑时会抛错 -->
<property name="schema" value="QRCODEDEV" />
</bean>
</beans>

@ -0,0 +1,72 @@
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1050', '10242.000', '', '','0112_1050');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0113', '0744', '10751.000', '', '','0113_0744');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0113', '0743', '8570.000', '', '','0113_0743');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1056', '16550.000', '', '','0112_1056');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1055', '15891.000', '', '','0112_1055');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1054', '14987.000', '', '','0112_1054');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1053', '14134.000', '', '','0112_1053');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1059', '19061.000', '', '','0112_1059');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1058', '18146.000', '', '','0112_1058');
insert into tbl_bc_subway_mileage (IN_STATION_ID, OUT_STATION_ID, MILEAGE, IN_STATION_NAME, OUT_STATION_NAME,ID)
values ('0112', '1057', '17202.000', '', '', '0112_1057');
insert into tbl_bc_calc_factor (FACTOR_ID, VERSION, METHOD_ID, SCENE_CODE, AVERAGE_MILEAGE, BASE_FACTOR, FACTOR, START_TIME, END_TIME)
values (1, '1', 'SHCER02020012024', '77', 5544.000, '0.13', '0.064', '20230425000000', '20241025000000');
insert into tbl_bc_calc_factor (FACTOR_ID, VERSION, METHOD_ID, SCENE_CODE, AVERAGE_MILEAGE, BASE_FACTOR, FACTOR, START_TIME, END_TIME)
values (2, '2', 'SHCER02020022024', '21', 0.000, '0.13', '0.064', '20230425000000', '20241025000000');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905828650974172700', 'SHCER02020022024', '0.13', '0.064', '20240905828650974172700', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0735', '1624', '', '20240905130121', '20240905195733', '52871661918', '22548', '岚皋路', '68164', '23228', '', '', '43901', '周浦东', '52877', '56833', '', '27918.000', '20240906151105', '1842', 'INIT', '', 'd8a6c156e8e7029893b8f986d541cf1710ad5213470b70c0723c1c9ae30da4c2', '20240905_NFCTravel.csv', '20240906151223', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', '20240906151126', 'admin', '20240906151126', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905489261484844794', 'SHCER02020022024', '0.13', '0.064', '20240905489261484844794', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0334', '1629', '', '20240905085111', '20240905140433', '52871661918', '48602', '淞滨路', '69751', '66528', '', '', '64048', '惠南', '73100', '43486', '', '52576.000', '20240906151105', '3470', 'INIT', '', '6b0bb50edb891067a8aa54eb21f165f3ccc54507edcd3d7ca0e3ae6122792d12', '20240905_NFCTravel.csv', '20240906151216', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', '20240906151110', 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905712306330396145', 'SHCER02020022024', '0.13', '0.064', '20240905712306330396145', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0837', '0510', '', '20240905025531', '20240905182843', '52871661918', '43757', '中兴路', '77677', '53318', '', '', '32670', '金平路', '25448', '30238', '', '31167.000', '20240906151105', '2057', 'INIT', '', 'e6d0239d5859b1b2126f15d2c1ec31c239a1ede1038966a611c38ffc9982faf4', '20240905_NFCTravel.csv', '20240906151221', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', '20240906151110', 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905525108757942255', 'SHCER02020022024', '0.13', '0.064', '20240905525108757942255', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '1448', '1541', '', '20240905155921', '20240905185620', '52871661918', '46479', '云顺路', '85829', '29797', '', '', '45071', '梅岭北路', '23169', '84811', '', '22439.000', '20240906151105', '1480', 'INIT', '', 'f4a06571ed184cf22349c485f0edc2d6f6e9903f6d7d095e95ba160fdacc8d47', '20240905_NFCTravel.csv', '20240906151217', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', '20240906151110', 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905649918160344918', 'SHCER02020012024', '0.13', '0.064', '20240905649918160344918', '77', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '', '', '', '20240905134558', '20240905134558', '52871661918', '20', '', '', '', '589', '589路', '20', '', '', '', '', '5544.000', '20240906151105', '365', 'INIT', '', 'c7535dabc0ed4ca18934bc51961e092841aece6d19d4aad34a04f279c46acffc', '20240905_NFCTravel.csv', '20240906151219', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', '20240906151110', 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905860375345522123', 'SHCER02020022024', '0.13', '0.064', '20240905860375345522123', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '1632', '1226', '', '20240905184917', '20240905214858', '52871661918', '45441', '临港大道', '23158', '69168', '', '', '75539', '桂林公园', '61408', '70744', '', '66635.000', '20240906151105', '4397', 'INIT', '', '73187cc5ba10b97be41e4d16f08166d92c3269f0699173591d3382ea2f42146a', '20240905_NFCTravel.csv', '20240906151223', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905222426144229754', 'SHCER02020022024', '0.13', '0.064', '20240905222426144229754', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '1724', '1062', '', '20240905061758', '20240905182702', '52871661918', '65254', '徐盈路', '81125', '25061', '', '', '70191', '同济大学', '34529', '41019', '', '29366.000', '20240906151105', '1938', 'INIT', '', 'd819ac1819a68d561997c76c333d38b82e09ee5b1493ccb83a2d630a77bc033e', '20240905_NFCTravel.csv', '20240906151213', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905392079630446236', 'SHCER02020022024', '0.13', '0.064', '20240905392079630446236', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0247', '0135', '', '20240905172130', '20240905203309', '52871661918', '78257', '陆家嘴', '29885', '54652', '', '', '18403', '共富新村', '48622', '27591', '', '17558.000', '20240906151105', '1158', 'INIT', '', 'a2dc6adee427f84b471fc722cdc5c78945fba38bb842d20d83cf518294634b8d', '20240905_NFCTravel.csv', '20240906151215', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905864347514967703', 'SHCER02020022024', '0.13', '0.064', '20240905864347514967703', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '1625', '0328', '', '20240905042714', '20240905112454', '52871661918', '41545', '鹤沙航城', '39035', '72704', '', '', '63209', '大柏树', '74897', '62804', '', '30029.000', '20240906151105', '1981', 'INIT', '', '051b7ec722e3a73138dadc8e9c60c338255eba28896cc84a2f7a1436a544644d', '20240905_NFCTravel.csv', '20240906151223', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905816129875891832', 'SHCER02020022024', '0.13', '0.064', '20240905816129875891832', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0929', '1821', '', '20240905030213', '20240905122138', '52871661918', '64512', '星中路', '56485', '34754', '', '', '19939', '航头', '88620', '69599', '', '36386.000', '20240906151105', '2401', 'INIT', '', '7e540783c14a271adc0b535ec4491073c0df44b7bd1cd2d9d6be58523936191a', '20240905_NFCTravel.csv', '20240906151222', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905148477451700702', 'SHCER02020022024', '0.13', '0.064', '20240905148477451700702', '21', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '0624', '0626', '', '20240905075022', '20240905201127', '52871661918', '18498', '华夏西路', '69322', '19281', '', '', '80148', '东明路', '89295', '85684', '', '2841.000', '20240906151105', '187', 'INIT', '', '5ebbe1318796bec7ee66a62d5ce25590943b30491f9b639812214ca07f898c63', '20240905_NFCTravel.csv', '20240906151212', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');
insert into tbl_bc_travel_notice (SEQ_NO, METHOD_ID, BASE_FACTOR, FACTOR, TRAVEL_NO, INDUSTRY_CODE, USER_ID, CCID, IN_STATION_ID, OUT_STATION_ID, OPEN_CHANNEL, INTO_TRANS_TIME, OUT_TRANS_TIME, CARD_NO, IN_TRANSACTION_SERIAL_NO, IN_STATION_NAME, IN_DEVICE_NO, IN_DEVICE_SERIAL_NO, LINE_NO, LINE_NAME, OUT_TRANSACTION_SERIAL_NO, OUT_STATION_NAME, OUT_DEVICE_NO, OUT_DEVICE_SERIAL_NO, BATCH_NO, MILEAGE, DATA_CONFIRMATION_TIME, CARBON_FOOTPRINT, CHAIN_STATUS, CHAIN_TX_ID, HASH_DATA, SOURCE_FILE_NAME, REDUCTION_CALCULATE_TIME, DATA_DELIVERY_TIME, STATUS, REMARK, BUSINESS_COMPLETION_TIME, NEXT_SEND_TIME, SEND_COUNT, SIGN_STATUS, SIGN_QUERY_COUNT, CREATE_USER, CREATE_TIME, LST_UPD_USER, LST_UPD_TIME, TRANS_TYPE)
values ('NFC20240905423133226986616', 'SHCER02020012024', '0.13', '0.064', '20240905423133226986616', '77', '0000670723', 'did:unitrust:7TYSznS7TFAPskJb3XDxbCDqZpaG', '', '', '', '20240905195215', '20240905195215', '52871661918', '48', '', '', '', '81', '81路', '48', '', '', '', '', '5544.000', '20240906151105', '365', 'INIT', '', '7ab1840b2a5231000ac9028ce3d5c4b0ff8b9ec88bd3811bfd7bda82ea29ce02', '20240905_NFCTravel.csv', '20240906151216', '', 'WAIT_FOR_SEND', '', '', '', 0, null, 0, 'admin', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 'admin', '20240906151110', 'NFC_CARD');

@ -0,0 +1,200 @@
set MODE oracle;
-- Create table
create table TBL_BC_CALC_FACTOR
(
FACTOR_ID NUMBER not null,
VERSION VARCHAR2(32 CHAR) not null,
METHOD_ID VARCHAR2(32 CHAR) not null,
SCENE_CODE VARCHAR2(16 CHAR) not null,
AVERAGE_MILEAGE NUMBER(10,3) not null,
BASE_FACTOR VARCHAR2(16 CHAR) not null,
FACTOR VARCHAR2(16 CHAR) not null,
START_TIME CHAR(14 CHAR) not null,
END_TIME CHAR(14 CHAR) not null
);
-- Add comments to the columns
comment on column TBL_BC_CALC_FACTOR.FACTOR_ID
is '主键ID';
comment on column TBL_BC_CALC_FACTOR.METHOD_ID
is '方法学版本编码';
comment on column TBL_BC_CALC_FACTOR.SCENE_CODE
is '场景编码【地铁subway公交bus】';
comment on column TBL_BC_CALC_FACTOR.AVERAGE_MILEAGE
is '平均里程存的是M计算时转换为KM';
comment on column TBL_BC_CALC_FACTOR.BASE_FACTOR
is '存的是gCO2/PKM计算时直接使用';
comment on column TBL_BC_CALC_FACTOR.FACTOR
is '存的是gCO2/PKM计算时直接使用';
-- Create/Recreate primary, unique and foreign key constraints
alter table TBL_BC_CALC_FACTOR
add primary key (FACTOR_ID);
-- Create table
create table TBL_BC_SUBWAY_MILEAGE
(
ID VARCHAR2(32 CHAR) not null,
IN_STATION_ID VARCHAR2(32 CHAR) not null,
OUT_STATION_ID VARCHAR2(32 CHAR) not null,
MILEAGE VARCHAR2(32 CHAR),
IN_STATION_NAME VARCHAR2(255 CHAR),
OUT_STATION_NAME VARCHAR2(255 CHAR),
constraint PK_TBL_BC_SUBWAY_MILEAGE primary key (ID)
);
-- Create table
create table TBL_BC_TRAVEL_NOTICE
(
SEQ_NO VARCHAR2(64 CHAR) default '' not null,
METHOD_ID VARCHAR2(32 CHAR),
BASE_FACTOR VARCHAR2(32 CHAR),
FACTOR VARCHAR2(32 CHAR),
TRAVEL_NO VARCHAR2(32 CHAR),
INDUSTRY_CODE VARCHAR2(32 CHAR),
USER_ID VARCHAR2(32 CHAR),
CCID VARCHAR2(128 CHAR),
IN_STATION_ID VARCHAR2(32 CHAR),
OUT_STATION_ID VARCHAR2(32 CHAR),
OPEN_CHANNEL VARCHAR2(32 CHAR),
INTO_TRANS_TIME CHAR(14 CHAR),
OUT_TRANS_TIME CHAR(14 CHAR),
CARD_NO VARCHAR2(32 CHAR),
IN_TRANSACTION_SERIAL_NO VARCHAR2(64 CHAR),
IN_STATION_NAME VARCHAR2(200 CHAR),
IN_DEVICE_NO VARCHAR2(64 CHAR),
IN_DEVICE_SERIAL_NO VARCHAR2(64 CHAR),
LINE_NO VARCHAR2(10 CHAR),
LINE_NAME VARCHAR2(200 CHAR),
OUT_TRANSACTION_SERIAL_NO VARCHAR2(64 CHAR),
OUT_STATION_NAME VARCHAR2(200 CHAR),
OUT_DEVICE_NO VARCHAR2(64 CHAR),
OUT_DEVICE_SERIAL_NO VARCHAR2(64 CHAR),
BATCH_NO VARCHAR2(32 CHAR),
MILEAGE VARCHAR2(32 CHAR),
DATA_CONFIRMATION_TIME CHAR(14 CHAR),
CARBON_FOOTPRINT VARCHAR2(32 CHAR),
CHAIN_STATUS VARCHAR2(32 CHAR),
CHAIN_TX_ID VARCHAR2(255 CHAR),
HASH_DATA VARCHAR2(512 CHAR),
SOURCE_FILE_NAME VARCHAR2(64 CHAR),
REDUCTION_CALCULATE_TIME CHAR(14 CHAR),
DATA_DELIVERY_TIME CHAR(14 CHAR),
STATUS VARCHAR2(32 CHAR),
REMARK VARCHAR2(255 CHAR),
BUSINESS_COMPLETION_TIME CHAR(14 CHAR),
NEXT_SEND_TIME CHAR(14 CHAR),
SEND_COUNT NUMBER(10) default 0 not null,
SIGN_STATUS NUMBER(2),
SIGN_QUERY_COUNT NUMBER(10) default 0 not null,
CREATE_USER VARCHAR2(32 CHAR) not null,
CREATE_TIME CHAR(14 CHAR) not null,
LST_UPD_USER VARCHAR2(32 CHAR) not null,
LST_UPD_TIME CHAR(14 CHAR) not null
);
-- Add comments to the columns
comment on column TBL_BC_TRAVEL_NOTICE.SEQ_NO
is '推送序号';
comment on column TBL_BC_TRAVEL_NOTICE.METHOD_ID
is '方法学版本编码';
comment on column TBL_BC_TRAVEL_NOTICE.BASE_FACTOR
is '基准线场景排放因子';
comment on column TBL_BC_TRAVEL_NOTICE.FACTOR
is '减排场景排放因子';
comment on column TBL_BC_TRAVEL_NOTICE.TRAVEL_NO
is '业务流水号';
comment on column TBL_BC_TRAVEL_NOTICE.INDUSTRY_CODE
is '交易类型';
comment on column TBL_BC_TRAVEL_NOTICE.USER_ID
is '交通卡用户号';
comment on column TBL_BC_TRAVEL_NOTICE.CCID
is '碳普惠子场景账户号';
comment on column TBL_BC_TRAVEL_NOTICE.IN_STATION_ID
is '进站编码';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_STATION_ID
is '出站编码';
comment on column TBL_BC_TRAVEL_NOTICE.OPEN_CHANNEL
is '拉码渠道';
comment on column TBL_BC_TRAVEL_NOTICE.INTO_TRANS_TIME
is '进站时间';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_TRANS_TIME
is '出站时间';
comment on column TBL_BC_TRAVEL_NOTICE.CARD_NO
is '卡号 交易卡号,明文';
comment on column TBL_BC_TRAVEL_NOTICE.IN_TRANSACTION_SERIAL_NO
is '进站交易流水号';
comment on column TBL_BC_TRAVEL_NOTICE.IN_STATION_NAME
is '进站名称';
comment on column TBL_BC_TRAVEL_NOTICE.IN_DEVICE_NO
is '进站设备号';
comment on column TBL_BC_TRAVEL_NOTICE.IN_DEVICE_SERIAL_NO
is '进站设备流水号';
comment on column TBL_BC_TRAVEL_NOTICE.LINE_NO
is '公交线路编码 例如01000';
comment on column TBL_BC_TRAVEL_NOTICE.LINE_NAME
is '公交线路名称 例如浦东32路';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_TRANSACTION_SERIAL_NO
is '出站交易流水号';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_STATION_NAME
is '出站名称';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_DEVICE_NO
is '出站设备号';
comment on column TBL_BC_TRAVEL_NOTICE.OUT_DEVICE_SERIAL_NO
is '出站设备流水号';
comment on column TBL_BC_TRAVEL_NOTICE.BATCH_NO
is '报送批次号';
comment on column TBL_BC_TRAVEL_NOTICE.MILEAGE
is '里程数,【-1表示异常】';
comment on column TBL_BC_TRAVEL_NOTICE.DATA_CONFIRMATION_TIME
is '数据确认时间';
comment on column TBL_BC_TRAVEL_NOTICE.CARBON_FOOTPRINT
is '碳排放量';
comment on column TBL_BC_TRAVEL_NOTICE.CHAIN_STATUS
is '上链状态 INIT:提交上链, AUDIT_FAILED:稽核规则校验失败, UP_CHAIN_FAILED:上链失败失败, SUCCESS:上链成功';
comment on column TBL_BC_TRAVEL_NOTICE.CHAIN_TX_ID
is '上链ID';
comment on column TBL_BC_TRAVEL_NOTICE.HASH_DATA
is '原始采集数据hash值';
comment on column TBL_BC_TRAVEL_NOTICE.SOURCE_FILE_NAME
is '来源文件名称';
comment on column TBL_BC_TRAVEL_NOTICE.REDUCTION_CALCULATE_TIME
is '减排量计算时间';
comment on column TBL_BC_TRAVEL_NOTICE.DATA_DELIVERY_TIME
is '数据报送时间';
comment on column TBL_BC_TRAVEL_NOTICE.STATUS
is '状态。INIT:初始化
MILEAGE_ERROR:
PROCESSING:
WAIT_FOR_SEND:
SUCCESS:
FAILED:';
comment on column TBL_BC_TRAVEL_NOTICE.REMARK
is '备注';
comment on column TBL_BC_TRAVEL_NOTICE.BUSINESS_COMPLETION_TIME
is '业务完成时间';
comment on column TBL_BC_TRAVEL_NOTICE.NEXT_SEND_TIME
is '下次发送时间';
comment on column TBL_BC_TRAVEL_NOTICE.SEND_COUNT
is '发送次数';
comment on column TBL_BC_TRAVEL_NOTICE.SIGN_STATUS
is '签发结果,-1:抽检不通过1:已签发2:自动签发不通过3:人工签发不通过';
comment on column TBL_BC_TRAVEL_NOTICE.SIGN_QUERY_COUNT
is '签发查询次数 【5次后不再查询】';
comment on column TBL_BC_TRAVEL_NOTICE.CREATE_USER
is '创建用户';
comment on column TBL_BC_TRAVEL_NOTICE.CREATE_TIME
is '创建时间';
comment on column TBL_BC_TRAVEL_NOTICE.LST_UPD_USER
is '最后更新用户';
comment on column TBL_BC_TRAVEL_NOTICE.LST_UPD_TIME
is '最后更新时间';
-- Create/Recreate primary, unique and foreign key constraints
alter table TBL_BC_TRAVEL_NOTICE
add primary key (SEQ_NO);
-- Create/Recreate indexes
create index IDX_BC_BTN_CREATE_TIME on TBL_BC_TRAVEL_NOTICE (CREATE_TIME);
create index IDX_BC_BTN_C_STATUS on TBL_BC_TRAVEL_NOTICE (CHAIN_STATUS);
create index IDX_BC_BTN_C_TX_ID on TBL_BC_TRAVEL_NOTICE (CHAIN_TX_ID);
create unique index indx_TRAVEL_NO on TBL_BC_TRAVEL_NOTICE (TRAVEL_NO);
alter table TBL_BC_TRAVEL_NOTICE add TRANS_TYPE VARCHAR2(32 CHAR);
create unique index UID_MILEAGE_STATION on TBL_BC_SUBWAY_MILEAGE (IN_STATION_ID, OUT_STATION_ID);

@ -3,7 +3,7 @@
<groupId>com.jiuyv.sptcc</groupId>
<artifactId>carbon-dataprocess</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.7-SNAPSHOT</version>
<packaging>pom</packaging>
<name>carbon-dataprocess</name>
@ -28,7 +28,7 @@
<logback.version>1.2.11</logback.version>
<spring-boot.version>2.6.7</spring-boot.version>
<carbon-pushgate-api.version>0.11.0</carbon-pushgate-api.version>
<carbon-auth-api.version>0.8.0</carbon-auth-api.version>
<carbon-auth-api.version>0.12.0</carbon-auth-api.version>
</properties>
<dependencyManagement>

@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath />
</parent>
<groupId>com.jiuyv</groupId>
<artifactId>carcheck-appgate</artifactId>
<version>1.0.1-SNAPSHOT</version>
<name>carcheck-appgate</name>
<description>carcheck-appgate</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<pagehelper.boot.version>1.4.1</pagehelper.boot.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
<commons.collections.version>3.2.2</commons.collections.version>
<druid.version>1.2.11</druid.version>
</properties>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Internal Releases</name>
<url>http://172.16.12.11:8082/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Internal Snapshots</name>
<url>http://172.16.12.11:8082/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<!-- SpringBoot的依赖配置 -->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.5.14</version>
<type>pom</type>
<scope>import</scope>
</dependency>-->
<!-- redis 缓存操作 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- pool 对象池 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 阿里数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- SpringBoot集成mybatis框架 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- 自定义验证注解 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.69</version>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- 文件上传工具类 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
</dependency>
<!-- collections工具类 -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons.collections.version}</version>
</dependency>
<!--常用工具类 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- json logstash encoder -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>6.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
<!-- <dependency>-->
<!-- <groupId>cn.hutool</groupId>-->
<!-- <artifactId>hutool-all</artifactId>-->
<!-- <version>5.8.20</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.1-jre</version>
</dependency>
<dependency>
<groupId>com.jiuyv</groupId>
<artifactId>smtools</artifactId>
<version>1.1.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<scm>
<connection>scm:svn:http://172.16.12.10/svn/carcheck/code/carcheck-appgate/trunk/</connection>
<developerConnection>scm:svn:http://172.16.12.10/svn/carcheck/code/carcheck-appgate/trunk/
</developerConnection>
</scm>
<repositories>
<repository>
<id>jiuyv</id>
<name>jiuyv</name>
<url>http://172.16.12.11:8082/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jiuyv</id>
<name>jiuyv Plugin Repository</name>
<url>http://172.16.12.11:8082/repository/maven-public/</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
</project>

@ -0,0 +1,15 @@
package com.jiuyv.appgate;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class CarcheckAppgateApplication {
public static void main(String[] args) {
SpringApplication.run(CarcheckAppgateApplication.class, args);
}
}

@ -0,0 +1,152 @@
package com.jiuyv.appgate.api;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jiuyv.appgate.common.AjaxResult;
import com.jiuyv.appgate.common.page.PageDomain;
import com.jiuyv.appgate.common.page.TableDataInfo;
import com.jiuyv.appgate.common.page.TableSupport;
import com.jiuyv.appgate.common.utils.CarcheckDateUtils;
import com.jiuyv.appgate.common.utils.CarcheckStringUtils;
import com.jiuyv.appgate.common.utils.PageUtils;
import com.jiuyv.appgate.common.utils.sql.SqlUtil;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
/**
* web
*
* @author admin
*/
public class BaseController
{
/**
* Date
*/
@InitBinder
public void initBinder(WebDataBinder binder)
{
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{
@Override
public void setAsText(String text)
{
setValue(CarcheckDateUtils.parseDate(text));
}
});
}
/**
*
*/
protected void startPage()
{
PageUtils.startPage();
}
/**
*
*/
protected void startOrderBy()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
if (CarcheckStringUtils.isNotEmpty(pageDomain.getOrderBy()))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.orderBy(orderBy);
}
}
/**
* 线
*/
protected void clearPage()
{
PageUtils.clearPage();
}
/**
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.OK.value());
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
*
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
*
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
*
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
*
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
/**
*
*
* @param rows
* @return
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
*
*
* @param result
* @return
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/**
*
*/
public String redirect(String url)
{
return CarcheckStringUtils.format("redirect:{}", url);
}
}

@ -0,0 +1,47 @@
package com.jiuyv.appgate.api;
import com.jiuyv.appgate.common.AjaxResult;
import com.jiuyv.appgate.service.IFileService;
import com.jiuyv.appgate.vo.file.ReqFileDeleteVO;
import com.jiuyv.appgate.vo.file.ResFileUploadVO;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/app/img")
public class FileController {
@Autowired
private IFileService fileService;
/**
*
*
* @param file
* @return
*/
@PostMapping("/upload")
public AjaxResult fileUpload(@RequestParam("file") MultipartFile file,
@RequestParam("orderId") String orderId,
@RequestParam("carVin") String carVin) {
ResFileUploadVO result = fileService.fileUpload(file, orderId, carVin);
return AjaxResult.success(result);
}
/**
*
*
* @param req
* @return
*/
@PostMapping("/delete")
public AjaxResult fileDelete(@RequestBody ReqFileDeleteVO req) {
fileService.fileDelete(req);
return AjaxResult.success();
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save