Commit b690f3e5 authored by hkl's avatar hkl

修改代码

parent 14c16f87
...@@ -188,7 +188,12 @@ ...@@ -188,7 +188,12 @@
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId> <artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j-spring-boot-starter.version}</version> <version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-ui</artifactId>
<version>2.0.2</version>
</dependency> </dependency>
<!-- 代码生成器 --> <!-- 代码生成器 -->
......
...@@ -18,7 +18,6 @@ import java.net.UnknownHostException; ...@@ -18,7 +18,6 @@ import java.net.UnknownHostException;
*/ */
@Slf4j @Slf4j
@SpringBootApplication @SpringBootApplication
//@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
public class JeecgSystemApplication extends SpringBootServletInitializer { public class JeecgSystemApplication extends SpringBootServletInitializer {
@Override @Override
......
...@@ -57,7 +57,7 @@ public class CodeGenerate { ...@@ -57,7 +57,7 @@ public class CodeGenerate {
// 设置过滤前缀 // 设置过滤前缀
.strategyConfig(builder -> { .strategyConfig(builder -> {
builder.addInclude(tables) // 设置需要生成的表名 builder.addInclude(tables) // 设置需要生成的表名
.addTablePrefix("t_sn", "t_da", "t_ek", "t_xd", "t_dsg", "t_djt", "t_jh", "t_dsa","t_mw"); // 设置过滤表前缀 .addTablePrefix("t_sn", "t_da", "t_ek", "t_xd", "t_dsg", "t_djt", "t_jh", "t_dsa", "t_mw"); // 设置过滤表前缀
// entity实体策略 // entity实体策略
builder.entityBuilder() builder.entityBuilder()
......
...@@ -32,8 +32,8 @@ public class MovementCheckDataUnitDeviceMap implements Serializable { ...@@ -32,8 +32,8 @@ public class MovementCheckDataUnitDeviceMap implements Serializable {
@ApiModelProperty("主键") @ApiModelProperty("主键")
@TableId("id") @TableId("id")
private String id; private String id;
@ApiModelProperty("创建人") @ApiModelProperty("创建人")
@TableField("create_by") @TableField("create_by")
private String createBy; private String createBy;
......
...@@ -1414,7 +1414,7 @@ public class AnalysisAlgorithm { ...@@ -1414,7 +1414,7 @@ public class AnalysisAlgorithm {
if (1 == analysisType) { if (1 == analysisType) {
finalTrackGauge = avgTrackGauge; finalTrackGauge = avgTrackGauge;
} else { } else {
finalTrackGauge = maxLevel; finalTrackGauge = maxTrackGauge;
} }
} }
...@@ -1760,6 +1760,12 @@ public class AnalysisAlgorithm { ...@@ -1760,6 +1760,12 @@ public class AnalysisAlgorithm {
} }
} }
if (ObjectUtil.isNotEmpty(movementCheckDataUnitDeviceMaps)) {
movementCheckDataUnitDeviceMapService.lambdaUpdate().eq(MovementCheckDataUnitDeviceMap::getCheckId, checkDataMap.getEkId()).remove();
movementCheckDataUnitDeviceMapService.saveBatch(movementCheckDataUnitDeviceMaps);
}
} }
/** /**
...@@ -1819,7 +1825,7 @@ public class AnalysisAlgorithm { ...@@ -1819,7 +1825,7 @@ public class AnalysisAlgorithm {
if (1 == analysisType) { if (1 == analysisType) {
finalTrackGauge = avgTrackGauge; finalTrackGauge = avgTrackGauge;
} else { } else {
finalTrackGauge = maxLevel; finalTrackGauge = maxTrackGauge;
} }
} }
......
...@@ -103,11 +103,11 @@ ...@@ -103,11 +103,11 @@
t2.remark t2.remark
FROM FROM
t_dsa_analysis_batch_unit_device_transfinite t1 t_dsa_analysis_batch_unit_device_transfinite t1
LEFT JOIN t_djt_movement_check_data_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.check_id = t2.check_id LEFT JOIN t_djt_movement_check_data_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.ek_id = t2.check_id
LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id
WHERE WHERE
t1.analysis_batch_unit_device_id = #{id} t1.analysis_batch_unit_device_id = #{id}
AND t1.check_type in (1,2) AND t1.ek_type in (1,2)
ORDER BY ORDER BY
t3.ek_code ASC t3.ek_code ASC
</select> </select>
...@@ -135,10 +135,10 @@ ...@@ -135,10 +135,10 @@
t2.spend, t2.spend,
t2.remark t2.remark
FROM t_dsa_analysis_batch_unit_device_transfinite t1 FROM t_dsa_analysis_batch_unit_device_transfinite t1
LEFT JOIN t_djt_movement_over_report_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.check_id = t2.check_id LEFT JOIN t_djt_movement_over_report_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.ek_id = t2.check_id
LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id
WHERE t1.analysis_batch_unit_device_id = #{id} WHERE t1.analysis_batch_unit_device_id = #{id}
AND t1.check_type = 3 AND t1.ek_type = 3
GROUP BY t2.id GROUP BY t2.id
ORDER BY t3.ek_code ASC ORDER BY t3.ek_code ASC
</select> </select>
...@@ -174,10 +174,10 @@ ...@@ -174,10 +174,10 @@
t2.standard, t2.standard,
t2.spend t2.spend
FROM t_dsa_analysis_batch_unit_device_transfinite t1 FROM t_dsa_analysis_batch_unit_device_transfinite t1
LEFT JOIN t_djt_movement_tqi_report_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.check_id = t2.check_id LEFT JOIN t_djt_movement_tqi_report_unit_device_map t2 ON t1.unit_id = t2.unit_id AND t1.unit_type = t2.unit_type AND t1.ek_id = t2.check_id
LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id LEFT JOIN t_djt_movement_records_master t3 ON t2.check_id = t3.id
WHERE t1.analysis_batch_unit_device_id = #{id} WHERE t1.analysis_batch_unit_device_id = #{id}
AND t1.check_type = 3 AND t1.ek_type = 3
GROUP BY t2.id GROUP BY t2.id
ORDER BY t3.ek_code ASC ORDER BY t3.ek_code ASC
</select> </select>
...@@ -206,10 +206,10 @@ ...@@ -206,10 +206,10 @@
FROM t_dsa_analysis_batch_unit_device_transfinite t1 FROM t_dsa_analysis_batch_unit_device_transfinite t1
LEFT JOIN t_djt_movement_additive_info_unit_device_map t2 ON t1.unit_id = t2.unit_id LEFT JOIN t_djt_movement_additive_info_unit_device_map t2 ON t1.unit_id = t2.unit_id
AND t1.unit_type = t2.unit_type AND t1.unit_type = t2.unit_type
AND t1.check_id = t2.movement_master_id AND t1.ek_id = t2.movement_master_id
LEFT JOIN t_djt_movement_records_master t3 ON t2.movement_master_id = t3.id LEFT JOIN t_djt_movement_records_master t3 ON t2.movement_master_id = t3.id
WHERE t1.analysis_batch_unit_device_id = #{id} WHERE t1.analysis_batch_unit_device_id = #{id}
AND t1.check_type = 4 AND t1.ek_type = 4
ORDER BY t3.ek_code ASC ORDER BY t3.ek_code ASC
</select> </select>
......
...@@ -80,6 +80,11 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -80,6 +80,11 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
analysisBatchCheckDataMapMapper.insert(analysisBatchCheckDataMap); analysisBatchCheckDataMapMapper.insert(analysisBatchCheckDataMap);
} }
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 执行分析 // 执行分析
MultiProducer.produce(analysisBatch.getId()); MultiProducer.produce(analysisBatch.getId());
} }
...@@ -88,7 +93,8 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -88,7 +93,8 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
public void updateRecord(AnalysisBatchSaveOrUpdateDTO dto) { public void updateRecord(AnalysisBatchSaveOrUpdateDTO dto) {
// 主表 // 主表
AnalysisBatch analysisBatch = BeanUtil.copyProperties(dto, AnalysisBatch.class); AnalysisBatch analysisBatch = BeanUtil.copyProperties(dto, AnalysisBatch.class);
analysisBatch.setAnalysisType(1); // 1-分析中 analysisBatch.setAnalysisType(dto.getAnalysisType());
analysisBatch.setAnalysisStatus(1); // 1-分析中
Integer[] speedLevels = StrUtil.getSpeedLevel(dto.getDictLabel()); Integer[] speedLevels = StrUtil.getSpeedLevel(dto.getDictLabel());
analysisBatch.setSpeedMin(speedLevels[0]); analysisBatch.setSpeedMin(speedLevels[0]);
analysisBatch.setSpeedMax(speedLevels[1]); analysisBatch.setSpeedMax(speedLevels[1]);
...@@ -124,6 +130,12 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -124,6 +130,12 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
analysisBatchCheckDataMapMapper.insert(analysisBatchCheckDataMap); analysisBatchCheckDataMapMapper.insert(analysisBatchCheckDataMap);
} }
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 执行分析 // 执行分析
MultiProducer.produce(analysisBatch.getId()); MultiProducer.produce(analysisBatch.getId());
} }
...@@ -142,7 +154,6 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -142,7 +154,6 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
analysisBatchCheckDataMapMapper.delete(wrapper); analysisBatchCheckDataMapMapper.delete(wrapper);
// 2.删除主信息 // 2.删除主信息
this.removeById(id); this.removeById(id);
} }
......
...@@ -115,7 +115,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -115,7 +115,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
public void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto) { public void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto) {
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class); WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
workBatch.setId(UUIDGenerator.generate()); workBatch.setId(UUIDGenerator.generate());
workBatch.setWorkStatus(9); // 9-已作业 workBatch.setWorkStatus(0);
workBatch.setSource(2); // 超限页面 workBatch.setSource(2); // 超限页面
this.save(workBatch); this.save(workBatch);
...@@ -153,7 +153,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -153,7 +153,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
public void batchSaveRecord(AnalysisBatchSaveDTO dto) { public void batchSaveRecord(AnalysisBatchSaveDTO dto) {
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class); WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
workBatch.setId(UUIDGenerator.generate()); workBatch.setId(UUIDGenerator.generate());
workBatch.setWorkStatus(9); // 9-已作业 workBatch.setWorkStatus(0); // 9-已作业
workBatch.setSource(2); // 超限页面 workBatch.setSource(2); // 超限页面
this.save(workBatch); this.save(workBatch);
...@@ -186,7 +186,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -186,7 +186,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override @Override
public Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto) { public Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto) {
return this.baseMapper.caseReportWorkBatch(pageData,dto); return this.baseMapper.caseReportWorkBatch(pageData, dto);
} }
......
...@@ -13,7 +13,6 @@ import java.util.Date; ...@@ -13,7 +13,6 @@ import java.util.Date;
public class StaticCheckVO { public class StaticCheckVO {
@ApiModelProperty("主键") @ApiModelProperty("主键")
@TableId("id")
private String id; private String id;
@ApiModelProperty("创建人") @ApiModelProperty("创建人")
......
...@@ -131,7 +131,7 @@ spring: ...@@ -131,7 +131,7 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: master:
url: jdbc:mysql://47.94.207.62:3306/hzgw?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://47.94.207.62:3306/hzgw2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root username: root
password: superAdmin&321 password: superAdmin&321
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
...@@ -131,7 +131,7 @@ spring: ...@@ -131,7 +131,7 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: master:
url: jdbc:mysql://127.0.0.1:3306/hzgw?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://127.0.0.1:3306/hzgw2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root username: root
password: superAdmin&321 password: superAdmin&321
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
...@@ -2,4 +2,4 @@ spring: ...@@ -2,4 +2,4 @@ spring:
application: application:
name: jeecg-system name: jeecg-system
profiles: profiles:
active: test active: dev
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
<xxl-job-core.version>2.2.0</xxl-job-core.version> <xxl-job-core.version>2.2.0</xxl-job-core.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<pegdown.version>1.6.0</pegdown.version> <pegdown.version>1.6.0</pegdown.version>
<knife4j-spring-boot-starter.version>2.0.2</knife4j-spring-boot-starter.version>
<knife4j-spring-ui.version>2.0.2</knife4j-spring-ui.version>
<!-- <knife4j-spring-ui.version>2.0.9</knife4j-spring-ui.version>
<knife4j-spring-boot-starter.version>3.0.3</knife4j-spring-boot-starter.version>-->
<!-- 数据库驱动 --> <!-- 数据库驱动 -->
<postgresql.version>42.2.25</postgresql.version> <postgresql.version>42.2.25</postgresql.version>
<ojdbc6.version>11.2.0.3</ojdbc6.version> <ojdbc6.version>11.2.0.3</ojdbc6.version>
...@@ -161,18 +157,6 @@ ...@@ -161,18 +157,6 @@
<artifactId>jeecg-boot-base-core</artifactId> <artifactId>jeecg-boot-base-core</artifactId>
<version>${jeecgboot.version}</version> <version>${jeecgboot.version}</version>
</dependency> </dependency>
<!-- system 单体 api -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- system 微服务 api -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-cloud-api</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
......
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
<?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.7.14</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.suntray</groupId>
<artifactId>subwayOA-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>subwayOA-app</name>
<description>地铁公务系统</description>
<repositories>
<repository>
<id>aliyun</id>
<name>aliyun Repository</name>
<url>https://maven.aliyun.com/repository/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.18</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.5.3.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.10.5</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.3</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.3</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dingtalk</artifactId>
<version>2.0.30</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.suntray.oa.app;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.net.UnknownHostException;
@SpringBootApplication
@Log4j2
public class SubwayOaApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(SubwayOaApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
log.info("\n----------------------------------------------------------\n\t" +
"Application " + env.getProperty("spring.application.name") + " is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}
package com.suntray.oa.app.common.constant;
/**
* @author 黄康林
* @function 通用错误码
*/
public enum CommonCode {
/**
* 成功操作
*/
C0000("0", "操作成功", null, null),
;
private String code;
private String message;
private String possibleReason;
private String suggestMeasure;
CommonCode(String code, String message) {
this.code = code;
this.message = message;
}
CommonCode(String code, String message, String possibleReason, String suggestMeasure) {
this.code = code;
this.message = message;
this.possibleReason = possibleReason;
this.suggestMeasure = suggestMeasure;
}
}
package com.suntray.oa.app.common.exception;
/**
* 系统业务异常类
*/
public class BusinessException extends RuntimeException {
}
package com.suntray.oa.app.common.exception;
import com.suntray.oa.app.common.response.BaseResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 全局异常处理器
*/
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(value = {Exception.class})
@ResponseBody
public <T> BaseResponse<T> deal(Exception e) {
BaseResponse<T> response = new BaseResponse<>();
if (e instanceof BusinessException) {
} else if (e instanceof ParamValidException) {
} else {
response.setCode(-1);
response.setSuccess(false);
response.setMessage("系统错误");
}
return response;
}
}
package com.suntray.oa.app.common.exception;
/**
* 系统参数异常类
*/
public class ParamValidException extends RuntimeException {
}
package com.suntray.oa.app.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "统一响应结构")
public class BaseResponse<T> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "成功标志")
private boolean success = true;
@ApiModelProperty(value = "返回处理消息")
private String message = "";
@ApiModelProperty(value = "返回代码")
private Integer code = 0;
@ApiModelProperty(value = "返回数据对象")
private T result;
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
public static BaseResponse<String> ok() {
return ok("操作成功");
}
public static BaseResponse<String> ok(String message) {
BaseResponse<String> response = new BaseResponse<>();
return response;
}
}
package com.suntray.oa.app.common.util;
import java.net.InetAddress;
public class UUIDGenerator {
/**
* 产生一个32位的UUID
*
* @return
*/
public static String generate() {
return new StringBuilder(32).append(format(getIp())).append(
format(getJvm())).append(format(getHiTime())).append(
format(getLoTime())).append(format(getCount())).toString();
}
private static final int IP;
static {
int ipadd;
try {
ipadd = toInt(InetAddress.getLocalHost().getAddress());
} catch (Exception e) {
ipadd = 0;
}
IP = ipadd;
}
private static short counter = (short) 0;
private static final int JVM = (int) (System.currentTimeMillis() >>> 8);
private final static String format(int intval) {
String formatted = Integer.toHexString(intval);
StringBuilder buf = new StringBuilder("00000000");
buf.replace(8 - formatted.length(), 8, formatted);
return buf.toString();
}
private final static String format(short shortval) {
String formatted = Integer.toHexString(shortval);
StringBuilder buf = new StringBuilder("0000");
buf.replace(4 - formatted.length(), 4, formatted);
return buf.toString();
}
private final static int getJvm() {
return JVM;
}
private final static short getCount() {
synchronized (UUIDGenerator.class) {
if (counter < 0) {
counter = 0;
}
return counter++;
}
}
/**
* Unique in a local network
*/
private final static int getIp() {
return IP;
}
/**
* Unique down to millisecond
*/
private final static short getHiTime() {
return (short) (System.currentTimeMillis() >>> 32);
}
private final static int getLoTime() {
return (int) System.currentTimeMillis();
}
private final static int toInt(byte[] bytes) {
int result = 0;
int length = 4;
for (int i = 0; i < length; i++) {
result = (result << 8) - Byte.MIN_VALUE + (int) bytes[i];
}
return result;
}
}
package com.suntray.oa.app.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import org.springframework.beans.factory.annotation.Value;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import springfox.documentation.service.Contact;
import springfox.documentation.builders.RequestHandlerSelectors;
@Slf4j
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {
@Value("${spring.application.name:default}")
private String applicationName;
@Bean
public Docket docket() {
// 指定使用Swagger2规范
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder()
// 简介(支持Markdown语法)
.description("地铁公务APP端api")
// 服务地址
.termsOfServiceUrl("API服务条款")
// 作者及联系信息
.contact(new Contact("地铁公务", "地铁公务", "地铁公务"))
// api版本
.version("1.0.0")
.build())
//分组名称(微服务项目可以用微服务名分组)
.groupName(applicationName)
.select()
// 定位api
// .apis(
// RequestHandlerSelectors.basePackage(getProjectBasePackage())
// .and(RequestHandlerSelectors.withClassAnnotation(RestController.class)
// .or(RequestHandlerSelectors.withClassAnnotation(Controller.class))
// )
// )
// .paths(PathSelectors.any())
.build();
// docket.securitySchemes(securitySchemes()).securityContexts(securityContexts());
return docket;
}
}
package com.suntray.oa.app.modules.test;
import com.suntray.oa.app.common.response.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "测试模块")
public class TestController {
@GetMapping(value = "/test1")
@ApiOperation(value = "test1")
public BaseResponse<String> test1() {
return BaseResponse.ok("添加成功");
}
}
server:
port: 16999
servlet:
context-path: /hzsomms-app/api
spring:
datasource:
druid:
url: jdbc:mysql://47.94.207.62:3306/hzgw?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root
password: superAdmin&321
driver-class-name: com.mysql.cj.jdbc.Driver
initial-size: 5
min-idle: 5
max-active: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validation-query: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
redis:
database: 0
host: 47.94.207.62
password: 'redis@123'
port: 6773
mybatis-plus:
mapper-locations: classpath*:com/suntray/subway/oa/app/modules/**/xml/*Mapper.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
call-setters-on-nulls: true
map-underscore-to-camel-case: true
server:
port: 16999
servlet:
context-path: /hzsomms-app/api
spring:
datasource:
druid:
url: jdbc:mysql://192.168.81.81:3306/hzgw?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root
password: huang123
driver-class-name: com.mysql.cj.jdbc.Driver
initial-size: 5
min-idle: 5
max-active: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validation-query: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
redis:
database: 0
host: 47.94.207.62
password: 'redis@123'
port: 6773
mybatis-plus:
mapper-locations: classpath*:com/suntray/subway/oa/app/modules/**/xml/*Mapper.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
call-setters-on-nulls: true
map-underscore-to-camel-case: true
#第三方APP对接
third-app:
# 钉钉小程序应用凭证
dingtalk:
AgentId: 2690626997
AppKey: dingmuvi6qfwaqcpanry
AppSecret: DPgW5bP0ljIeEFB9LKpbDlrZY78MfzE-HMVL3yV1wIhTaaQdJ3PCv1jFMmr-kvAi
spring:
application:
name: subwayOA-app
profiles:
active: test
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 -->
<property name="LOG_HOME" value="../logs" />
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>30</MaxHistory>
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
</encoder>
</appender>
<!-- 生成 error html格式日志开始 -->
<appender name="HTML" class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<!--设置日志级别,过滤掉info日志,只输入error日志-->
<level>ERROR</level>
</filter>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%p%d%msg%M%F{32}%L</pattern>
</layout>
</encoder>
<file>${LOG_HOME}/error-log.html</file>
</appender>
<!-- 生成 error html格式日志结束 -->
<!-- 每天生成一个html格式的日志开始 -->
<appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>30</MaxHistory>
<MaxFileSize>10MB</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%p%d%msg%M%F{32}%L</pattern>
</layout>
</encoder>
</appender>
<!-- 每天生成一个html格式的日志结束 -->
<!--myibatis log configure -->
<logger name="com.apache.ibatis" level="TRACE" />
<logger name="java.sql.Connection" level="DEBUG" />
<logger name="java.sql.Statement" level="DEBUG" />
<logger name="java.sql.PreparedStatement" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="HTML" />
<appender-ref ref="FILE_HTML" />
</root>
</configuration>
\ No newline at end of file
package com.suntray.oa.app;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SubwayOaAppApplicationTests {
@Test
void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment