Commit ab35a02c by 刘泽志

阶段版本问题修改

parent c394e9c9
......@@ -127,7 +127,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@PutMapping("/template")
@PostMapping("/template/update")
@ApiOperation("修改模板")
public AjaxResult updateTemplate(@RequestBody @Validated UpdateTemplateParam param) {
DataImportTemplate template = new DataImportTemplate();
......@@ -138,7 +138,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@DeleteMapping("/template")
@GetMapping("/template/delete")
@ApiOperation("删除模板")
public AjaxResult deleteTemplate(@RequestParam String templateId) {
dataImportService.removeById(templateId);
......@@ -193,7 +193,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@PutMapping("/dict")
@PostMapping("/dict/update")
@ApiOperation("修改字典")
public AjaxResult updateDict(@RequestBody @Validated UpdateDictParam param) {
DataDict template = new DataDict();
......@@ -203,7 +203,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@DeleteMapping("/dict")
@GetMapping("/dict/delete")
@ApiOperation("删除字典")
public AjaxResult deleteDict(@RequestParam String dictId) {
dictService.removeById(dictId);
......@@ -289,7 +289,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@PutMapping("/field")
@PostMapping("/field/update")
@ApiOperation("修改字段")
public AjaxResult updateField(@RequestBody @Validated UpdateFieldParam param) {
DataField field = new DataField();
......@@ -299,7 +299,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@DeleteMapping("/field")
@GetMapping("/field/delete")
@ApiOperation("删除字段")
public AjaxResult deleteField(@RequestParam String fieldId) {
dataFieldService.removeById(fieldId);
......@@ -341,7 +341,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@PutMapping("/rule")
@PostMapping("/rule/update")
@ApiOperation("修改规则")
public AjaxResult updateRule(@RequestBody @Validated UpdateRuleParam param) {
DataRule rule = new DataRule();
......@@ -351,7 +351,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@DeleteMapping("/rule")
@GetMapping("/rule/delete")
@ApiOperation("删除规则")
public AjaxResult deleteRule(@RequestParam String ruleId) {
dataRuleService.removeById(ruleId);
......@@ -534,7 +534,8 @@ public class DataImportController {
dataField.setCode(code);
dataField.setTitle(title);
dataField.setUnit(unit);
dataField.setCoordinate("F," + i);
// TODO 这里坐标修改为i+1是因为excel文件中展示的第一行号是1,符合直觉
dataField.setCoordinate("F," + (i + 1));
dataField.setSort(i + 1);
dataField.createField();
fieldList.add(dataField);
......@@ -758,7 +759,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@PutMapping("/rule/template")
@PostMapping("/rule/template/update")
@ApiOperation("修改规则By Template")
public AjaxResult updateRuleByTemplate(@RequestBody @Validated UpdateRuleParam param) {
DataRule rule = new DataRule();
......@@ -768,7 +769,7 @@ public class DataImportController {
}
@IgnoreWebSecurity
@DeleteMapping("/rule/template")
@GetMapping("/rule/template/delete")
@ApiOperation("删除规则By Template")
public AjaxResult deleteRuleByTemplate(@RequestParam String ruleId,
@RequestParam String templateId) {
......
......@@ -83,7 +83,7 @@ public class SysDatasourceController extends BaseController {
* 修改数据源配置
*/
@IgnoreWebSecurity
@PutMapping
@PostMapping("/update")
public AjaxResult edit(@RequestBody SysDatasource sysDatasource) {
return toAjax(sysDatasourceService.updateSysDatasource(sysDatasource));
}
......@@ -92,7 +92,7 @@ public class SysDatasourceController extends BaseController {
* 删除数据源配置
*/
@IgnoreWebSecurity
@DeleteMapping("/{datasourceIds}")
@GetMapping("/delete/{datasourceIds}")
public AjaxResult remove(@PathVariable Long[] datasourceIds) {
return toAjax(sysDatasourceService.deleteSysDatasourceByDatasourceIds(datasourceIds));
}
......
......@@ -11,7 +11,9 @@ import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......@@ -50,7 +52,7 @@ public class DiConfig {
flag++;
} else if (flag == 1 && StringUtils.equals(getValue(cell), vo.getTitle())) {
// 代表code与title都能对应上
return getWord(cell.getColumnIndex() + 1) + "," + cell.getRowIndex();
return getWord(cell.getColumnIndex() + 1) + "," + cell.getRowIndex() + 1;
}
}
}
......@@ -58,22 +60,32 @@ public class DiConfig {
}
/**
* 获取数据长度
* 获取横坐标数据结果,直接获取columnIndex
*
* @param vo
* @param sheet
* @return
*/
public static int getLength(VerifyVO vo, Sheet sheet) {
public static List<Integer> getLength(VerifyVO vo, Sheet sheet) {
final String[] coords = vo.getCoordinate().split(",");
int start = DiConfig.getIndex(coords[0]);
Row row = sheet.getRow(Integer.parseInt(coords[1]));
for (int i = start; ; i++) {
Row row = sheet.getRow(Integer.parseInt(coords[1]) - 1);
List<Integer> list = new ArrayList<>();
// 空值出现次数,出现次数大于2的时候停止循环
int flag = 0;
for (int i = start; flag <= 2; i++) {
final Cell cell = row.getCell(i, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
if (StringUtils.isBlank(getValue(cell))) {
return i - start;
final String value = getValue(cell);
if (StringUtils.isBlank(value)) {
flag++;
} else if (StringUtils.equals(value, "-")) {
flag = 0;
} else {
flag = 0;
list.add(cell.getColumnIndex());
}
}
return list;
}
@PostConstruct
......
package com.tbyf.his.web.dataImport.core;
import java.util.Arrays;
import java.util.List;
/**
* DataImport常量
*
......@@ -64,4 +67,9 @@ public class DiConstants {
*/
public static final String RULE_COMBINE = "组合规则";
/**
* 默认不处理的数据
*/
public static final List<String> WHITE = Arrays.asList("-");
}
......@@ -8,6 +8,7 @@ import com.tbyf.his.common.utils.StringUtils;
import com.tbyf.his.common.utils.poi.ExcelUtil;
import com.tbyf.his.framework.datasource.DataSourceUtil;
import com.tbyf.his.web.dataImport.core.DiConfig;
import com.tbyf.his.web.dataImport.core.DiConstants;
import com.tbyf.his.web.dataImport.core.RuleVO;
import com.tbyf.his.web.dataImport.core.RuleValidator;
import com.tbyf.his.web.dataImport.domain.vo.ExcelVO;
......@@ -64,7 +65,8 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
.filter(item -> StringUtils.isNotBlank(item.getCoordinate()))
.findFirst();
// 数据长度/条数
final int length = DiConfig.getLength(first.get(), sheet);
final List<Integer> columnList = DiConfig.getLength(first.get(), sheet);
final int length = columnList.size();
// 第一步解析数据到values
for (int a = 0; a < verifyList.size(); a++) {
final VerifyVO vo = verifyList.get(a);
......@@ -77,12 +79,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
vo.setCoordinate(s);
}
final String[] coords = vo.getCoordinate().split(",");
int columnStart = DiConfig.getIndex(coords[0]);
int rowStart = Integer.parseInt(coords[1]);
// TODO 这里减1的原因是excel表名的行号1实际上的下标为0
int rowStart = Integer.parseInt(coords[1]) - 1;
final Row row = sheet.getRow(rowStart);
for (int b = columnStart; b < columnStart + length; b++) {
for (Integer column : columnList) {
try {
final Cell cell = row.getCell(b, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
final Cell cell = row.getCell(column, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
vo.addValue(DiConfig.getValue(cell));
} catch (Exception ignore) {
}
......@@ -118,6 +120,10 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
vo.setValue(item.getValues().get(i));
// 置空错误信息
vo.setResult(null);
// TODO 特殊数据无需做错误校验
if (DiConstants.WHITE.contains(vo.getValue())) {
break;
}
final RuleValidator validator = DiConfig.getValidator(vo.getMode());
validator.validate(vo);
if (StringUtils.isNotBlank(vo.getResult())) {
......
# 数据源配置
spring:
datasource:
druid:
# 主库数据源
master:
url: jdbc:mysql://10.18.103.101:3306/his_base?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: esb@123456
driverClassName: com.mysql.cj.jdbc.Driver
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: true
# url: jdbc:oracle:thin:@192.168.0.39:1521:orcl
url: jdbc:oracle:thin:@10.18.103.111:1521:ORCL
# username: xhyy
username: DATACENTER
password: data
driverClassName: oracle.jdbc.OracleDriver
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: admin
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="C:/his/logs"/>
<property name="log.path" value="./logs"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 引入spring boot默认的logback配置文件,使用CONSOLE_LOG_PATTERN就可以打印默认的彩色日志-->
......
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