Commit 35d3ce25 authored by hkl's avatar hkl

feat: 1.车站bug提交

parent b877db1c
......@@ -52,7 +52,7 @@ public class ShiroConfig {
/**
* Filter Chain定义说明
*
* <p>
* 1、一个URL可以配置多个Filter,使用逗号分隔
* 2、当设置多个过滤器时,全部验证通过,才视为通过
* 3、部分过滤器可指定参数,如perms,roles
......@@ -65,12 +65,12 @@ public class ShiroConfig {
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
//支持yml方式,配置拦截排除
if(jeecgBaseConfig!=null && jeecgBaseConfig.getShiro()!=null){
if (jeecgBaseConfig != null && jeecgBaseConfig.getShiro() != null) {
String shiroExcludeUrls = jeecgBaseConfig.getShiro().getExcludeUrls();
if(oConvertUtils.isNotEmpty(shiroExcludeUrls)){
if (oConvertUtils.isNotEmpty(shiroExcludeUrls)) {
String[] permissionUrl = shiroExcludeUrls.split(",");
for(String url : permissionUrl){
filterChainDefinitionMap.put(url,"anon");
for (String url : permissionUrl) {
filterChainDefinitionMap.put(url, "anon");
}
}
}
......@@ -124,14 +124,15 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon");
//积木报表排除
filterChainDefinitionMap.put("/jmreport/**", "anon");
filterChainDefinitionMap.put("/**/*.js.map", "anon");
filterChainDefinitionMap.put("/**/*.css.map", "anon");
// filterChainDefinitionMap.put("/jmreport/**", "anon");
// filterChainDefinitionMap.put("/**/*.js.map", "anon");
// filterChainDefinitionMap.put("/**/*.css.map", "anon");
filterChainDefinitionMap.put("/test/**", "anon");
//大屏模板例子
filterChainDefinitionMap.put("/test/bigScreen/**", "anon");
filterChainDefinitionMap.put("/bigscreen/template1/**", "anon");
filterChainDefinitionMap.put("/bigscreen/template1/**", "anon");
// filterChainDefinitionMap.put("/test/bigScreen/**", "anon");
// filterChainDefinitionMap.put("/bigscreen/template1/**", "anon");
// filterChainDefinitionMap.put("/bigscreen/template1/**", "anon");
//filterChainDefinitionMap.put("/test/jeecgDemo/rabbitMqClientTest/**", "anon"); //MQ测试
//filterChainDefinitionMap.put("/test/jeecgDemo/html", "anon"); //模板页面
//filterChainDefinitionMap.put("/test/jeecgDemo/redis/**", "anon"); //redis测试
......@@ -155,7 +156,7 @@ public class ShiroConfig {
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
//如果cloudServer为空 则说明是单体 需要加载跨域配置【微服务跨域切换】
Object cloudServer = env.getProperty(CommonConstant.CLOUD_SERVER_KEY);
filterMap.put("jwt", new JwtFilter(cloudServer==null));
filterMap.put("jwt", new JwtFilter(cloudServer == null));
shiroFilterFactoryBean.setFilters(filterMap);
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
filterChainDefinitionMap.put("/**", "jwt");
......@@ -189,6 +190,7 @@ public class ShiroConfig {
/**
* 下面的代码是添加注解支持
*
* @return
*/
@Bean
......@@ -255,11 +257,11 @@ public class ShiroConfig {
redisManager.setPassword(lettuceConnectionFactory.getPassword());
}
manager = redisManager;
}else{
} else {
// redis集群支持,优先使用集群配置
RedisClusterManager redisManager = new RedisClusterManager();
Set<HostAndPort> portSet = new HashSet<>();
lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost() , node.getPort())));
lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost(), node.getPort())));
//update-begin--Author:scott Date:20210531 for:修改集群模式下未设置redis密码的bug issues/I3QNIC
if (oConvertUtils.isNotEmpty(lettuceConnectionFactory.getPassword())) {
JedisCluster jedisCluster = new JedisCluster(portSet, 2000, 2000, 5,
......
......@@ -13,7 +13,7 @@ import java.util.HashMap;
import java.util.Map;
public class CodeGenerate {
public static String url = "jdbc:mysql://47.94.207.62:3306/hzsomms?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull";
public static String url = "jdbc:mysql://47.94.207.62:3306/hzgw?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull";
public static String username = "root";
public static String password = "superAdmin&321";
......@@ -25,12 +25,11 @@ public class CodeGenerate {
String outputDir = projectPath + "\\jeecg-module-system\\src\\main\\java\\";
// 模块名
String moduleName = "maintenanceWork";
String moduleName = "checkData.equipmentCheckData";
// 表名
String[] tables = {
"t_mw_work_batch",
"t_mw_work_batch_detail",
"t_djt_movement_tqi_report_unit_device_map",
};
......
......@@ -85,15 +85,15 @@ public class MovementCheckDataUnitDeviceMap implements Serializable {
@TableField("check_id")
private String checkId;
@ApiModelProperty("检查项目id")
@ApiModelProperty("检查项目id[注:轨检车是tqi的id]")
@TableField("check_item_id")
private String checkItemId;
@ApiModelProperty("检查开始里程")
@ApiModelProperty("检查开始里程 [注:轨检车和添乘仪此id为null]")
@TableField("check_item_starting_mileage")
private BigDecimal checkItemStartingMileage;
@ApiModelProperty("检查结束里程")
@ApiModelProperty("检查结束里程 [注:轨检车和添乘仪此id为null]")
@TableField("check_item_end_mileage")
private BigDecimal checkItemEndMileage;
......
package org.jeecg.modules.checkData.equipmentCheckData.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 动静态几何尺寸-轨检车单元设备映射
* </p>
*
* @author hkl
* @since 2023-08-22
*/
@Getter
@Setter
@TableName("t_djt_movement_over_report_unit_device_map")
@ApiModel(value = "MovementOverReportUnitDeviceMap对象", description = "动静态几何尺寸-轨检车单元设备映射")
public class MovementOverReportUnitDeviceMap implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId("id")
private String id;
@ApiModelProperty("创建人")
@TableField("create_by")
private String createBy;
@ApiModelProperty("创建日期")
@TableField("create_time")
private Date createTime;
@ApiModelProperty("更新人")
@TableField("update_by")
private String updateBy;
@ApiModelProperty("更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty("设备单元id")
@TableField("unit_id")
private String unitId;
@ApiModelProperty("设备单元编码")
@TableField("unit_code")
private String unitCode;
@ApiModelProperty("设备单元类型1-钢轨,2-曲线,3-竖曲线,4-道岔")
@TableField("unit_type")
private Integer unitType;
@ApiModelProperty("设备单元类型名称")
@TableField("unit_type_name")
private String unitTypeName;
@ApiModelProperty("设备单元起始里程")
@TableField("unit_starting_mileage")
private BigDecimal unitStartingMileage;
@ApiModelProperty("设备单元中心里程")
@TableField("unit_center_mileage")
private BigDecimal unitCenterMileage;
@ApiModelProperty("设备单元终点里程")
@TableField("unit_end_mileage")
private BigDecimal unitEndMileage;
@ApiModelProperty("检查数据类型 1-人工静态检查 2-轨检仪静态检查 3-轨检车检查 4-添乘仪检查")
@TableField("check_type")
private Integer checkType;
@ApiModelProperty("检查主表id")
@TableField("check_id")
private String checkId;
@ApiModelProperty("轨检车超限表id")
@TableField("over_report_id")
private String overReportId;
@ApiModelProperty("超限里程")
@TableField("over_report_mileage")
private BigDecimal overReportMileage;
@ApiModelProperty("超限类型")
@TableField("over_type")
private String overType;
@ApiModelProperty("超限等级")
@TableField("over_level")
private Integer overLevel;
@ApiModelProperty("峰值(mm或g)")
@TableField("peak_value")
private String peakValue;
@ApiModelProperty("管理数据差")
@TableField("data_difference")
private String dataDifference;
@ApiModelProperty("线性")
@TableField("xianxing")
private String xianxing;
@ApiModelProperty("检测标准")
@TableField("standard")
private String standard;
@ApiModelProperty("速度(km/h)")
@TableField("spend")
private String spend;
@ApiModelProperty("备注")
@TableField("remark")
private String remark;
}
package org.jeecg.modules.checkData.equipmentCheckData.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 轨检车-tqi单元总结报告和单元映射关联关系
* </p>
*
* @author hkl
* @since 2023-08-24
*/
@Getter
@Setter
@TableName("t_djt_movement_tqi_report_unit_device_map")
@ApiModel(value = "MovementTqiReportUnitDeviceMap对象", description = "轨检车-tqi单元总结报告和单元映射关联关系")
public class MovementTqiReportUnitDeviceMap implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
@TableId("id")
private String id;
@ApiModelProperty("创建人")
@TableField("create_by")
private String createBy;
@ApiModelProperty("创建日期")
@TableField("create_time")
private Date createTime;
@ApiModelProperty("更新人")
@TableField("update_by")
private String updateBy;
@ApiModelProperty("更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty("检查主表id")
@TableField("check_id")
private String checkId;
@ApiModelProperty("检查数据类型 1-人工静态检查 2-轨检仪静态检查 3-轨检车检查 4-添乘仪检查")
@TableField("check_type")
private Integer checkType;
@TableField("unit_id")
private String unitId;
@TableField("unit_code")
private String unitCode;
@TableField("unit_type")
private Integer unitType;
@TableField("unit_type_name")
private String unitTypeName;
@TableField("unit_starting_mileage")
private BigDecimal unitStartingMileage;
@TableField("unit_center_mileage")
private BigDecimal unitCenterMileage;
@TableField("unit_end_mileage")
private BigDecimal unitEndMileage;
@ApiModelProperty("tqi报告id")
@TableField("tqi_report_id")
private String tqiReportId;
@ApiModelProperty("开始里程(m)")
@TableField("start_mileage")
private BigDecimal startMileage;
@ApiModelProperty("终点里程(m)")
@TableField("end_mileage")
private BigDecimal endMileage;
@ApiModelProperty("区间名称")
@TableField("section_name")
private String sectionName;
@ApiModelProperty("高低左")
@TableField("high_low_left")
private String highLowLeft;
@ApiModelProperty("高低右")
@TableField("high_low_right")
private String highLowRight;
@ApiModelProperty("轨向左")
@TableField("track_left")
private String trackLeft;
@ApiModelProperty("轨向右")
@TableField("track_right")
private String trackRight;
@ApiModelProperty("水平(mm)")
@TableField("level")
private String level;
@ApiModelProperty("轨距(mm)")
@TableField("track_gauge")
private String trackGauge;
@ApiModelProperty("三角坑(mm)")
@TableField("triangular_pit")
private String triangularPit;
@ApiModelProperty("TQI数值")
@TableField("tqi_come_upon")
private String tqiComeUpon;
@ApiModelProperty("TQI超标")
@TableField("tqi_above_standard")
private String tqiAboveStandard;
@ApiModelProperty("扣分")
@TableField("deduct")
private String deduct;
@ApiModelProperty("检测标准")
@TableField("standard")
private String standard;
@ApiModelProperty("速度(km/h)")
@TableField("spend")
private String spend;
}
package org.jeecg.modules.checkData.equipmentCheckData.mapper;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementOverReportUnitDeviceMap;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 动静态几何尺寸-轨检车单元设备映射 Mapper 接口
* </p>
*
* @author hkl
* @since 2023-08-22
*/
public interface MovementOverReportUnitDeviceMapMapper extends BaseMapper<MovementOverReportUnitDeviceMap> {
}
package org.jeecg.modules.checkData.equipmentCheckData.mapper;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementTqiReportUnitDeviceMap;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 轨检车-tqi单元总结报告和单元映射关联关系 Mapper 接口
* </p>
*
* @author hkl
* @since 2023-08-24
*/
public interface MovementTqiReportUnitDeviceMapMapper extends BaseMapper<MovementTqiReportUnitDeviceMap> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.checkData.equipmentCheckData.mapper.MovementOverReportUnitDeviceMapMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.checkData.equipmentCheckData.mapper.MovementTqiReportUnitDeviceMapMapper">
</mapper>
package org.jeecg.modules.checkData.equipmentCheckData.service;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementOverReportUnitDeviceMap;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 动静态几何尺寸-轨检车单元设备映射 服务类
* </p>
*
* @author hkl
* @since 2023-08-22
*/
public interface IMovementOverReportUnitDeviceMapService extends IService<MovementOverReportUnitDeviceMap> {
}
package org.jeecg.modules.checkData.equipmentCheckData.service;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementTqiReportUnitDeviceMap;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 轨检车-tqi单元总结报告和单元映射关联关系 服务类
* </p>
*
* @author hkl
* @since 2023-08-24
*/
public interface IMovementTqiReportUnitDeviceMapService extends IService<MovementTqiReportUnitDeviceMap> {
}
package org.jeecg.modules.checkData.equipmentCheckData.service.impl;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementOverReportUnitDeviceMap;
import org.jeecg.modules.checkData.equipmentCheckData.mapper.MovementOverReportUnitDeviceMapMapper;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementOverReportUnitDeviceMapService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 动静态几何尺寸-轨检车单元设备映射 服务实现类
* </p>
*
* @author hkl
* @since 2023-08-22
*/
@Service
public class MovementOverReportUnitDeviceMapServiceImpl extends ServiceImpl<MovementOverReportUnitDeviceMapMapper, MovementOverReportUnitDeviceMap> implements IMovementOverReportUnitDeviceMapService {
}
package org.jeecg.modules.checkData.equipmentCheckData.service.impl;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementTqiReportUnitDeviceMap;
import org.jeecg.modules.checkData.equipmentCheckData.mapper.MovementTqiReportUnitDeviceMapMapper;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementTqiReportUnitDeviceMapService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 轨检车-tqi单元总结报告和单元映射关联关系 服务实现类
* </p>
*
* @author hkl
* @since 2023-08-24
*/
@Service
public class MovementTqiReportUnitDeviceMapServiceImpl extends ServiceImpl<MovementTqiReportUnitDeviceMapMapper, MovementTqiReportUnitDeviceMap> implements IMovementTqiReportUnitDeviceMapService {
}
......@@ -97,7 +97,7 @@ public class AnalysisBatchUnitDevicePointScore implements Serializable {
@ApiModelProperty("测点值")
@TableField("point_value")
private Integer pointValue;
private Double pointValue;
@ApiModelProperty("测点得分")
@TableField("point_score")
......
......@@ -14,4 +14,7 @@ public class SubwaySectionQueryDTO {
@ApiModelProperty(value = "线别id")
private String lineAliasId;
@ApiModelProperty(value = "线路Id")
private String railLine;
}
......@@ -23,16 +23,16 @@
t1.remark
FROM
t_sn_subway_section t1 LEFT JOIN t_sn_light_rail t2 ON t1.light_rail_id = t2.id
<where>
1=1
WHERE t2.status = 1
<if test="query.sectionName != null and query.sectionName != ''">
AND t1.section_name like concat('%',#{query.sectionName},'%')
</if>
<if test="query.lineAliasId !=null and query.lineAliasId!=''">
AND t1.line_alias_id = #{query.lineAliasId}
</if>
AND t2.status = 1
</where>
<if test="query.railLine !=null and query.railLine!=''">
AND t1.light_rail_id = #{query.railLine}
</if>
</select>
<select id="getTreeSubwaySectionList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT t.id,
......
......@@ -60,8 +60,8 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
SubwaySection subwaySection = BeanUtil.copyProperties(dto, SubwaySection.class);
LightRail rail = lightRailMapper.selectById(dto.getLightRailId()); // 线路id
subwaySection.setLightRailName(rail.getRailLineName());// 线路昵称
subwaySection.setSectionStartingMileage(startTrainStation.getEndMileage()); // 区间起始里程
subwaySection.setSectionEndMileage(endTrainStation.getStartingMileage());// 区间结束里程
subwaySection.setSectionStartingMileage(startTrainStation.getCenterMileage()); // 区间起始里程
subwaySection.setSectionEndMileage(endTrainStation.getCenterMileage());// 区间结束里程
//维护区间的更新人和更新时间
subwaySection.setUpdateTime(new Date());
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
......
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -26,7 +25,10 @@ import org.jeecg.common.desensitization.annotation.SensitiveEncode;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.*;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.common.util.PasswordUtil;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.system.entity.*;
......@@ -39,11 +41,9 @@ import org.jeecg.modules.system.vo.lowapp.DepartAndUserInfo;
import org.jeecg.modules.system.vo.lowapp.DepartInfo;
import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -134,7 +134,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
//TODO 外部模拟登陆临时账号,列表不显示
queryWrapper.ne("username", "_reserve_user_external");
queryWrapper.eq("del_flag",0);
// queryWrapper.eq("del_flag",0);
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
IPage<SysUser> pageList = this.page(page, queryWrapper);
......
......@@ -2,4 +2,4 @@ spring:
application:
name: jeecg-system
profiles:
active: dev
active: hkl
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>
</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 BaseResponse<?> deal(Exception e) {
BaseResponse<?> 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: dev
<?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