Commit 2de09b3c authored by hkl's avatar hkl

feat:1.动静态分析代码核心业务代码提交

parent 7eff6fb5
...@@ -9,3 +9,4 @@ rebel.xml ...@@ -9,3 +9,4 @@ rebel.xml
## front ## front
**/*.lock **/*.lock
/jeecg-module-system/src/main/java/org/jeecg/modules/test/
...@@ -70,6 +70,20 @@ public class MybatisInterceptor implements Interceptor { ...@@ -70,6 +70,20 @@ public class MybatisInterceptor implements Interceptor {
field.setAccessible(false); field.setAccessible(false);
} }
} }
if ("updateBy".equals(field.getName())) {
//获取登录用户信息
if (sysUser != null) {
// 登录账号
field.setAccessible(true);
field.set(parameter, sysUser.getUsername());
field.setAccessible(false);
}
}
if ("updateTime".equals(field.getName())) {
field.setAccessible(true);
field.set(parameter, new Date());
field.setAccessible(false);
}
//注入部门编码 //注入部门编码
if ("sysOrgCode".equals(field.getName())) { if ("sysOrgCode".equals(field.getName())) {
field.setAccessible(true); field.setAccessible(true);
......
package org.jeecg.config.init;
import com.alibaba.druid.filter.config.ConfigTools;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.codegenerate.database.CodegenDatasourceConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Description: 代码生成器,自定义DB配置
* 【加了此类,则online模式DB连接,使用平台的配置,jeecg_database.properties配置无效;
* 但是使用GUI模式代码生成,还是走jeecg_database.properties配置】
* 提醒: 达梦数据库需要修改下面的参数${spring.datasource.dynamic.datasource.master.url:}配置
* @author: scott
* @date: 2021年02月18日 16:30
*/
@Slf4j
//@Configuration
public class CodeGenerateDbConfig {
@Value("${spring.datasource.dynamic.datasource.master.url:}")
private String url;
@Value("${spring.datasource.dynamic.datasource.master.username:}")
private String username;
@Value("${spring.datasource.dynamic.datasource.master.password:}")
private String password;
@Value("${spring.datasource.dynamic.datasource.master.driver-class-name:}")
private String driverClassName;
@Value("${spring.datasource.dynamic.datasource.master.druid.public-key:}")
private String publicKey;
@Bean
public CodeGenerateDbConfig initCodeGenerateDbConfig() {
if(StringUtils.isNotBlank(url)){
if(StringUtils.isNotBlank(publicKey)){
try {
password = ConfigTools.decrypt(publicKey, password);
} catch (Exception e) {
e.printStackTrace();
log.error(" 代码生成器数据库连接,数据库密码解密失败!");
}
}
CodegenDatasourceConfig.initDbConfig(driverClassName,url, username, password);
log.info(" Init CodeGenerate Config [ Get Db Config From application.yml ] ");
}
return null;
}
}
package org.jeecg.config.init;
import cn.hutool.core.io.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Component;
import java.io.File;
import java.net.URL;
import java.nio.charset.StandardCharsets;
/**
* 自动初始化代码生成器模板
* <p>
* 解决JAR发布需要手工配置代码生成器模板问题
* @author zhang
*/
@Slf4j
@Component
public class CodeTemplateInitListener implements ApplicationListener<ApplicationReadyEvent> {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
try {
log.info(" Init Code Generate Template [ 检测如果是JAR启动环境,Copy模板到config目录 ] ");
this.initJarConfigCodeGeneratorTemplate();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ::Jar包启动模式下::
* 初始化代码生成器模板文件
*/
private void initJarConfigCodeGeneratorTemplate() throws Exception {
//1.获取jar同级下的config路径
String configPath = System.getProperty("user.dir") + File.separator + "config" + File.separator;
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources("classpath*:jeecg/code-template-online/**/*");
for (Resource re : resources) {
URL url = re.getURL();
String filepath = url.getPath();
//System.out.println("native url= " + filepath);
filepath = java.net.URLDecoder.decode(filepath, "utf-8");
//System.out.println("decode url= " + filepath);
//2.在config下,创建jeecg/code-template-online/*模板
String createFilePath = configPath + filepath.substring(filepath.indexOf("jeecg/code-template-online"));
// 非jar模式不生成模板
// 不生成目录,只生成具体模板文件
if (!filepath.contains(".jar!/BOOT-INF/lib/") || !createFilePath.contains(".")) {
continue;
}
if (!FileUtil.exist(createFilePath)) {
log.info("create file codeTemplate = " + createFilePath);
FileUtil.writeString(IOUtils.toString(url, StandardCharsets.UTF_8), createFilePath, "UTF-8");
}
}
}
}
package org.jeecg.config.init;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.config.JeecgCloudCondition;
import org.jeecg.modules.system.service.ISysGatewayRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
/**
* @desc: 启动程序,初始化路由配置
* @author: flyme
*/
@Slf4j
@Component
@Conditional(JeecgCloudCondition.class)
public class SystemInitListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
@Autowired
private ISysGatewayRouteService sysGatewayRouteService;
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
log.info(" 服务已启动,初始化路由配置 ###################");
String context = "AnnotationConfigServletWebServerApplicationContext";
if (applicationReadyEvent.getApplicationContext().getDisplayName().indexOf(context) > -1) {
sysGatewayRouteService.addRoute2Redis(CacheConstant.GATEWAY_ROUTES);
}
}
@Override
public int getOrder() {
return 1;
}
}
package org.jeecg.config.init;
import org.jeecg.modules.dynamicStaticAnalysis.algorithm.SingleConsumer;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
* 系统初始化加载
*/
@Component
public class SystemInitRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
// 开启消费者
new Thread(SingleConsumer::consume).start();
}
}
...@@ -30,7 +30,7 @@ import java.util.List; ...@@ -30,7 +30,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/checkData/dynamicStaticGeometricData/railInspectionEquipmentItem") @RequestMapping("/checkData/dynamicStaticGeometricData/railInspectionEquipmentItem")
@Api("检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目") @Api(tags = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目")
public class RailInspectionEquipmentItemController extends JeecgController<RailInspectionEquipmentItem, IRailInspectionEquipmentItemService> { public class RailInspectionEquipmentItemController extends JeecgController<RailInspectionEquipmentItem, IRailInspectionEquipmentItemService> {
@Resource @Resource
......
package org.jeecg.modules.dynamicStaticAnalysis.algorithm;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class Buffer {
/**
* 缓冲队列最大缓存能力
*/
private static final int MAX_CAPACITY = 20;
/**
* 缓冲队列
* 这个队列是一个基于链表的阻塞队列,它的容量可以是有界的或无界的。
* 当使用有界容量时,如果队列已满,新的插入操作会被阻塞,直到有空间可用。
* 因为队列可以无限增长(无界),所以在插入元素时不会发生阻塞。
*/
public static final BlockingQueue<String> queue = new LinkedBlockingQueue<>(MAX_CAPACITY);
}
package org.jeecg.modules.dynamicStaticAnalysis.algorithm;
import lombok.extern.slf4j.Slf4j;
/**
* 多生产者模型-单消费者模型
* 多生产者
*/
@Slf4j
public class MultiProducer {
public static void produce(String analysisBatchId) {
try {
Buffer.queue.put(analysisBatchId);
log.info("MultiProducer[生产者]|线程id:【" + Thread.currentThread().getId() + "】=============分析批次ID:【" + analysisBatchId+"】");
} catch (InterruptedException e) {
e.printStackTrace();
log.error("MultiProducer:");
}
}
}
package org.jeecg.modules.dynamicStaticAnalysis.algorithm;
import lombok.extern.slf4j.Slf4j;
/**
* 多生产者模型-单消费者模型
* 单消费者
*/
@Slf4j
public class SingleConsumer {
public static void consume() {
try {
while (true) {
String analysisBatchId = Buffer.queue.take();
log.info("SingleConsumer[消费者]|线程id:【" + Thread.currentThread().getId() + "】=============分析批次ID:【" + analysisBatchId+"】");
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
...@@ -26,7 +26,7 @@ import java.util.List; ...@@ -26,7 +26,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/dynamicStaticAnalysis/allowValueConfig") @RequestMapping("/dynamicStaticAnalysis/allowValueConfig")
@Api("动静态分析-参数配置-容许值差") @Api(tags = "动静态分析-参数配置-容许值差")
public class AllowValueConfigController extends JeecgController<AllowValueConfig, IAllowValueConfigService> { public class AllowValueConfigController extends JeecgController<AllowValueConfig, IAllowValueConfigService> {
......
package org.jeecg.modules.dynamicStaticAnalysis.controller; package org.jeecg.modules.dynamicStaticAnalysis.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -18,6 +19,9 @@ import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO; ...@@ -18,6 +19,9 @@ import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -29,7 +33,7 @@ import java.util.Arrays; ...@@ -29,7 +33,7 @@ import java.util.Arrays;
*/ */
@RestController @RestController
@RequestMapping("/dynamicStaticAnalysis/analysisBatch") @RequestMapping("/dynamicStaticAnalysis/analysisBatch")
@Api("动静态分析-分析批次") @Api(tags = "动静态分析-分析批次")
public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAnalysisBatchService> { public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAnalysisBatchService> {
@AutoLog(value = "动静态分析-分析批次-获取检查数据") @AutoLog(value = "动静态分析-分析批次-获取检查数据")
...@@ -40,7 +44,6 @@ public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAna ...@@ -40,7 +44,6 @@ public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAna
CheckBatchDTO dto) { CheckBatchDTO dto) {
Page<CheckBatchVO> pageData = new Page<>(pageNo, pageSize); Page<CheckBatchVO> pageData = new Page<>(pageNo, pageSize);
pageData = this.service.getCheckData(pageData, dto); pageData = this.service.getCheckData(pageData, dto);
return Result.OK(pageData); return Result.OK(pageData);
} }
...@@ -54,6 +57,21 @@ public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAna ...@@ -54,6 +57,21 @@ public class AnalysisBatchController extends JeecgController<AnalysisBatch, IAna
Page<AnalysisBatchQueryVO> pageData = new Page<>(pageNo, pageSize); Page<AnalysisBatchQueryVO> pageData = new Page<>(pageNo, pageSize);
pageData = this.service.listRecord(pageData, dto); pageData = this.service.listRecord(pageData, dto);
// 查询明细
List<AnalysisBatchQueryVO> records = pageData.getRecords();
if (ObjectUtil.isNotEmpty(records)) {
List<String> analysisBatchIds = records.stream().map(AnalysisBatchQueryVO::getId).collect(Collectors.toList());
List<CheckBatchVO> checkBatchList = this.service.listRecordDetail(analysisBatchIds);
if (ObjectUtil.isNotEmpty(checkBatchList)) {
Map<String, List<CheckBatchVO>> analysisBatchMap = checkBatchList.stream().collect(Collectors.groupingBy(CheckBatchVO::getAnalysisBatchId));
records.forEach(record -> {
List<CheckBatchVO> checkBatchVOS = analysisBatchMap.get(record.getId());
record.setCheckBatchList(checkBatchVOS);
});
}
}
return Result.OK(pageData); return Result.OK(pageData);
} }
......
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/dynamicStaticAnalysis/dispatchingConfig") @RequestMapping("/dynamicStaticAnalysis/dispatchingConfig")
@Api("动静态分析-参数配置-派工配置") @Api(tags = "动静态分析-参数配置-派工配置")
public class DispatchingConfigController extends JeecgController<DispatchingConfig, IDispatchingConfigService> { public class DispatchingConfigController extends JeecgController<DispatchingConfig, IDispatchingConfigService> {
@AutoLog(value = "动静态分析-参数配置-派工配置-查询所有参数") @AutoLog(value = "动静态分析-参数配置-派工配置-查询所有参数")
......
...@@ -55,17 +55,17 @@ public class AnalysisBatch implements Serializable { ...@@ -55,17 +55,17 @@ public class AnalysisBatch implements Serializable {
@TableField("light_rail_id") @TableField("light_rail_id")
private String lightRailId; private String lightRailId;
@ApiModelProperty("所属线路名称") // @ApiModelProperty("所属线路名称")
@TableField("light_rail_name") // @TableField("light_rail_name")
private String lightRailName; // private String lightRailName;
@ApiModelProperty("所属线别id") @ApiModelProperty("所属线别id")
@TableField("line_alias_id") @TableField("line_alias_id")
private String lineAliasId; private String lineAliasId;
@ApiModelProperty("所属线别名称") // @ApiModelProperty("所属线别名称")
@TableField("line_alias_name") // @TableField("line_alias_name")
private String lineAliasName; // private String lineAliasName;
@ApiModelProperty("起始里程") @ApiModelProperty("起始里程")
@TableField("starting_mileage") @TableField("starting_mileage")
......
...@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO; import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO; import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import java.util.List;
/** /**
* <p> * <p>
* 动静态分析-分析批次表 Mapper 接口 * 动静态分析-分析批次表 Mapper 接口
...@@ -21,4 +23,6 @@ public interface AnalysisBatchMapper extends BaseMapper<AnalysisBatch> { ...@@ -21,4 +23,6 @@ public interface AnalysisBatchMapper extends BaseMapper<AnalysisBatch> {
Page<CheckBatchVO> getCheckData(Page<CheckBatchVO> pageData, CheckBatchDTO dto); Page<CheckBatchVO> getCheckData(Page<CheckBatchVO> pageData, CheckBatchDTO dto);
Page<AnalysisBatchQueryVO> listRecord(Page<AnalysisBatchQueryVO> pageData, AnalysisBatchQueryDTO dto); Page<AnalysisBatchQueryVO> listRecord(Page<AnalysisBatchQueryVO> pageData, AnalysisBatchQueryDTO dto);
List<CheckBatchVO> listRecordDetail(List<String> analysisBatchIds);
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getCheckData" resultType="org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO"> <select id="getCheckData" resultType="org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO">
SELECT SELECT
t1.id, t1.id ek_id,
t1.ek_code, t1.ek_code,
t1.type ek_type, t1.type ek_type,
t1.end_mileage, t1.end_mileage,
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
AND t1.ek_code like concat('%',#{dto.ekCode},'%') AND t1.ek_code like concat('%',#{dto.ekCode},'%')
</if> </if>
<if test="dto.ekType != null and dto.ekType != ''"> <if test="dto.ekType != null and dto.ekType != ''">
AND t1.type like concat('%',#{dto.ekCode},'%') AND t1.type = #{dto.ekType}
</if> </if>
<if test="dto.lightRailId != null and dto.lightRailId != ''"> <if test="dto.lightRailId != null and dto.lightRailId != ''">
AND t1.light_rail_id = #{dto.lightRailId} AND t1.light_rail_id = #{dto.lightRailId}
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
<select id="listRecord" resultType="org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO"> <select id="listRecord" resultType="org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO">
SELECT SELECT
t1.id, t1.id,
t1.update_by,
t1.update_time,
t1.analysis_batch_code, t1.analysis_batch_code,
t1.light_rail_id, t1.light_rail_id,
t1.light_rail_name, t1.light_rail_name,
...@@ -57,4 +59,27 @@ ...@@ -57,4 +59,27 @@
FROM FROM
t_dsa_analysis_batch t1 t_dsa_analysis_batch t1
</select> </select>
<select id="listRecordDetail" resultType="org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO">
SELECT
t1.analysis_batch_id,
t2.id ek_id,
t2.ek_code,
t2.type ek_type,
t2.end_mileage,
t2.starting_mileage,
t2.light_rail_id,
t2.light_rail_name,
t2.line_alias_id,
t2.line_alias_name,
t2.verify_by,
t2.verify_time,
t2.check_time,
t2.remark
FROM t_dsa_analysis_batch_check_data_map t1
LEFT JOIN t_djt_movement_records_master t2 ON t1.ek_id = t2.id AND t2.del_flag = '0'
WHERE t1.analysis_batch_id IN
<foreach collection="analysisBatchIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
...@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO; import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO; import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import java.util.List;
/** /**
* <p> * <p>
* 动静态分析-分析批次表 服务类 * 动静态分析-分析批次表 服务类
...@@ -28,4 +30,6 @@ public interface IAnalysisBatchService extends IService<AnalysisBatch> { ...@@ -28,4 +30,6 @@ public interface IAnalysisBatchService extends IService<AnalysisBatch> {
Page<AnalysisBatchQueryVO> listRecord(Page<AnalysisBatchQueryVO> pageData, AnalysisBatchQueryDTO dto); Page<AnalysisBatchQueryVO> listRecord(Page<AnalysisBatchQueryVO> pageData, AnalysisBatchQueryDTO dto);
void deleteRecord(String id); void deleteRecord(String id);
List<CheckBatchVO> listRecordDetail(List<String> analysisBatchIds);
} }
...@@ -47,7 +47,7 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -47,7 +47,7 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
// 主表 // 主表
AnalysisBatch analysisBatch = BeanUtil.copyProperties(dto, AnalysisBatch.class); AnalysisBatch analysisBatch = BeanUtil.copyProperties(dto, AnalysisBatch.class);
analysisBatch.setId(UUIDGenerator.generate()); analysisBatch.setId(UUIDGenerator.generate());
analysisBatch.setAnalysisType(1); // 1-分析中 analysisBatch.setAnalysisStatus(1); // 1-分析中
// 明细 // 明细
List<AnalysisBatchCheckDataMap> analysisBatchCheckDataMaps = new ArrayList<>(); List<AnalysisBatchCheckDataMap> analysisBatchCheckDataMaps = new ArrayList<>();
...@@ -130,5 +130,10 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A ...@@ -130,5 +130,10 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
this.removeById(id); this.removeById(id);
} }
@Override
public List<CheckBatchVO> listRecordDetail(List<String> analysisBatchIds) {
return this.baseMapper.listRecordDetail(analysisBatchIds);
}
} }
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
...@@ -65,4 +66,7 @@ public class AnalysisBatchQueryVO { ...@@ -65,4 +66,7 @@ public class AnalysisBatchQueryVO {
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
@ApiModelProperty("动静态分析-检查批次VO")
private List<CheckBatchVO> checkBatchList;
} }
...@@ -16,6 +16,9 @@ import java.util.Date; ...@@ -16,6 +16,9 @@ import java.util.Date;
@ApiModel(value = "CheckBatchVO对象", description = "动静态分析-检查批次VO") @ApiModel(value = "CheckBatchVO对象", description = "动静态分析-检查批次VO")
public class CheckBatchVO { public class CheckBatchVO {
@ApiModelProperty("分析批次id")
private String analysisBatchId;
@ApiModelProperty("检查id") @ApiModelProperty("检查id")
private String ekId; private String ekId;
......
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