Commit f1b8c8dc authored by hkl's avatar hkl

feat:1.人工检查数据导入bug

parent 2a2816f0
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
<properties> <properties>
<package.environment>dev</package.environment> <package.environment>dev</package.environment>
</properties> </properties>
</profile> </profile>
<!-- 黄康林本地配置--> <!-- 黄康林本地配置-->
......
...@@ -95,10 +95,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -95,10 +95,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
private IMovementTqiStandardManagerService movementTqiStandardManagerService; private IMovementTqiStandardManagerService movementTqiStandardManagerService;
@Resource @Resource
private AnalysisAlgorithmMapper analysisAlgorithmMapper; private AnalysisAlgorithmMapper analysisAlgorithmMapper;
@Resource
private IRailInspectionEquipmentItemService railInspectionEquipmentItemService;
@Resource
private IRailInspectionEquipmentItemDetailService railInspectionEquipmentItemDetailService;
@Resource @Resource
private AsyncTask asyncTask; private AsyncTask asyncTask;
...@@ -285,40 +281,9 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -285,40 +281,9 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
@ApiOperation(value = "删除动静态几何尺寸数据及相关联的数据", notes = "删除动静态几何尺寸数据及相关联的数据") @ApiOperation(value = "删除动静态几何尺寸数据及相关联的数据", notes = "删除动静态几何尺寸数据及相关联的数据")
@GetMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@ApiParam(name = "动静态几何尺寸数据id", required = true) String id, @ApiParam(name = "动静态几何尺寸数据类型", required = true) String type) { public Result<String> delete(@ApiParam(name = "动静态几何尺寸数据id", required = true) String id, @ApiParam(name = "动静态几何尺寸数据类型", required = true) String type) {
if ("1".equals(type)) {
//人工静态检查相关 this.movementRecordsMasterFace.delete(id, type);
//删除里程详情
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
//删除里程相关
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
} else if ("2".equals(type)) {
// 删除里程
railInspectionEquipmentItemService.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, id).remove();
// 删除里程明细
railInspectionEquipmentItemDetailService.lambdaUpdate().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, id).remove();
} else if ("4".equals(type)) {
//删除添乘仪详情
movementAdditiveInfoService.lambdaUpdate().eq(MovementAdditiveInfo::getMovementMasterId, id).remove();
} else if ("3".equals(type)) {
//删除轨检车-》轨道动态几何尺寸容许值差管理值
movementDiferenceManagerService.lambdaUpdate().eq(MovementDiferenceManager::getMovementMasterId, id).remove();
//删除轨检车-》超限记录报告
movementOverReportService.lambdaUpdate().eq(MovementOverReport::getMovementMasterId, id).remove();
//删除轨检车-》区段总结报告
movementSectionReportService.lambdaUpdate().eq(MovementSectionReport::getMovementMasterId, id).remove();
//删除轨检车-》公里总结报告表
movementSummaryReportService.lambdaUpdate().eq(MovementSummaryReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里总结报告
movementTqiKilometerReportService.lambdaUpdate().eq(MovementTqiKilometerReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里状态评定标准
movementTqiKilometerStandardManagerService.lambdaUpdate().eq(MovementTqiKilometerStandardManager::getMovementMasterId, id).remove();
//删除轨检车-》TQI总结报告
movementTqiReportService.lambdaUpdate().eq(MovementTqiReport::getMovementMasterId, id).remove();
//删除轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
movementTqiStandardManagerService.lambdaUpdate().eq(MovementTqiStandardManager::getMovementMasterId, id).remove();
}
//删除动静态几何尺寸数据
this.service.lambdaUpdate().eq(MovementRecordsMaster::getId, id).remove();
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
......
...@@ -19,4 +19,6 @@ public interface MovementRecordsMasterFace { ...@@ -19,4 +19,6 @@ public interface MovementRecordsMasterFace {
void updateLabourCheckItem(MovementCourse record); void updateLabourCheckItem(MovementCourse record);
void uploadFile(MultipartFile file, String id); void uploadFile(MultipartFile file, String id);
void delete(String id, String type);
} }
...@@ -8,13 +8,12 @@ import com.alibaba.fastjson.JSONObject; ...@@ -8,13 +8,12 @@ import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementCourse; import org.jeecg.modules.checkData.entity.*;
import org.jeecg.modules.checkData.entity.MovementCourseInfo;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.face.MovementRecordsMasterFace; import org.jeecg.modules.checkData.face.MovementRecordsMasterFace;
import org.jeecg.modules.checkData.service.IMovementCourseInfoService; import org.jeecg.modules.checkData.service.*;
import org.jeecg.modules.checkData.service.IMovementCourseService; import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchCheckDataMap;
import org.jeecg.modules.checkData.service.IMovementRecordsMasterService; import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisAlgorithmMapper;
import org.jeecg.modules.dynamicStaticAnalysis.service.IAnalysisBatchCheckDataMapService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -25,6 +24,7 @@ import java.math.BigDecimal; ...@@ -25,6 +24,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -39,6 +39,32 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -39,6 +39,32 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
@Resource @Resource
private IMovementRecordsMasterService movementRecordsMasterService; private IMovementRecordsMasterService movementRecordsMasterService;
@Resource
private IMovementOverReportService movementOverReportService;
@Resource
private IMovementSectionReportService movementSectionReportService;
@Resource
private IMovementSummaryReportService movementSummaryReportService;
@Resource
private IMovementTqiKilometerReportService movementTqiKilometerReportService;
@Resource
private IMovementTqiKilometerStandardManagerService movementTqiKilometerStandardManagerService;
@Resource
private IMovementTqiReportService movementTqiReportService;
@Resource
private IMovementTqiStandardManagerService movementTqiStandardManagerService;
@Resource
private IMovementDiferenceManagerService movementDiferenceManagerService;
@Resource
private IMovementAdditiveInfoService movementAdditiveInfoService;
@Resource
private IRailInspectionEquipmentItemService railInspectionEquipmentItemService;
@Resource
private IRailInspectionEquipmentItemDetailService railInspectionEquipmentItemDetailService;
@Resource
private IAnalysisBatchCheckDataMapService analysisBatchCheckDataMapService;
@Override @Override
public void saveLabourCheckItem(MovementCourse record) { public void saveLabourCheckItem(MovementCourse record) {
...@@ -299,6 +325,56 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -299,6 +325,56 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
} }
} }
@Override
public void delete(String id, String type) {
List<AnalysisBatchCheckDataMap> existAnalysisList = analysisBatchCheckDataMapService.lambdaQuery()
.eq(AnalysisBatchCheckDataMap::getEkId, id)
.list();
if (ObjectUtil.isNotEmpty(existAnalysisList)) {
Optional<String> optionalStr = existAnalysisList.stream()
.map(AnalysisBatchCheckDataMap::getAnalysisBatchCode)
.reduce((analysisBatchCode1, analysisBatchCode2) -> analysisBatchCode1 + "," + analysisBatchCode2);
String msg = "该数据下关联分析批次:【" + optionalStr.get() + "】";
throw JeecgBootException.error(msg);
}
if ("1".equals(type)) {
//人工静态检查相关
//删除里程详情
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
//删除里程相关
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
} else if ("2".equals(type)) {
// 删除里程
railInspectionEquipmentItemService.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, id).remove();
// 删除里程明细
railInspectionEquipmentItemDetailService.lambdaUpdate().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, id).remove();
} else if ("4".equals(type)) {
//删除添乘仪详情
movementAdditiveInfoService.lambdaUpdate().eq(MovementAdditiveInfo::getMovementMasterId, id).remove();
} else if ("3".equals(type)) {
//删除轨检车-》轨道动态几何尺寸容许值差管理值
movementDiferenceManagerService.lambdaUpdate().eq(MovementDiferenceManager::getMovementMasterId, id).remove();
//删除轨检车-》超限记录报告
movementOverReportService.lambdaUpdate().eq(MovementOverReport::getMovementMasterId, id).remove();
//删除轨检车-》区段总结报告
movementSectionReportService.lambdaUpdate().eq(MovementSectionReport::getMovementMasterId, id).remove();
//删除轨检车-》公里总结报告表
movementSummaryReportService.lambdaUpdate().eq(MovementSummaryReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里总结报告
movementTqiKilometerReportService.lambdaUpdate().eq(MovementTqiKilometerReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里状态评定标准
movementTqiKilometerStandardManagerService.lambdaUpdate().eq(MovementTqiKilometerStandardManager::getMovementMasterId, id).remove();
//删除轨检车-》TQI总结报告
movementTqiReportService.lambdaUpdate().eq(MovementTqiReport::getMovementMasterId, id).remove();
//删除轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
movementTqiStandardManagerService.lambdaUpdate().eq(MovementTqiStandardManager::getMovementMasterId, id).remove();
}
//删除动静态几何尺寸数据
movementRecordsMasterService.lambdaUpdate().eq(MovementRecordsMaster::getId, id).remove();
}
/** /**
* 当前行处理器 * 当前行处理器
......
...@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster; import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem; import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem;
...@@ -28,6 +30,7 @@ import java.io.IOException; ...@@ -28,6 +30,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -105,7 +108,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -105,7 +108,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
items.add(item); items.add(item);
// 读取item详情 // 读取item详情
int skipRow = readItemDetail(i, titleHeader, item.getId(), rowRecords, itemDetails); int skipRow = readItemDetail(i, titleHeader, item, rowRecords, itemDetails);
i = i + skipRow; i = i + skipRow;
sort++; sort++;
} else { } else {
...@@ -127,7 +130,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -127,7 +130,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
} }
} }
private int readItemDetail(int rows, String titleHeader, String itemId, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) { private int readItemDetail(int rows, String titleHeader, RailInspectionEquipmentItem item, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) {
// 解析检查项目:1行:跳过2行不解析 // 解析检查项目:1行:跳过2行不解析
List<Object> checkItems = rowRecords.get(rows + 2); List<Object> checkItems = rowRecords.get(rows + 2);
// 解析测点:1行 // 解析测点:1行
...@@ -153,7 +156,8 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -153,7 +156,8 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail(); RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail();
itemDetail.setId(UUIDGenerator.generate()); itemDetail.setId(UUIDGenerator.generate());
itemDetail.setRailInspectionEquipmentItemId(itemId); itemDetail.setRailInspectionEquipmentId(item.getRailInspectionEquipmentId());
itemDetail.setRailInspectionEquipmentItemId(item.getId());
// 检查项目 // 检查项目
String checkItem = checkItems.get(i).toString(); String checkItem = checkItems.get(i).toString();
itemDetail.setCheckItem(checkItem); itemDetail.setCheckItem(checkItem);
...@@ -173,7 +177,17 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -173,7 +177,17 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
// 测点值向后偏移一个 // 测点值向后偏移一个
itemDetail.setMeasurePoint(measurePoint + 1); itemDetail.setMeasurePoint(measurePoint + 1);
// 获取登录用户信息
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (ObjectUtil.isNotEmpty(loginUser)) {
itemDetail.setCreateBy(loginUser.getRealname());
itemDetail.setUpdateBy(loginUser.getRealname());
}
itemDetail.setInfoSort(sort++); itemDetail.setInfoSort(sort++);
itemDetail.setDelFlag("0");
itemDetail.setCreateTime(new Date());
itemDetail.setUpdateTime(new Date());
itemDetails.add(itemDetail); itemDetails.add(itemDetail);
} }
......
...@@ -740,7 +740,12 @@ public class AnalysisAlgorithm { ...@@ -740,7 +740,12 @@ public class AnalysisAlgorithm {
// 2.根据分析批次的里程查询出映射单元 // 2.根据分析批次的里程查询出映射单元
List<MovementOverReportUnitDeviceMap> overReportUnitDeviceMaps = new ArrayList<>(); List<MovementOverReportUnitDeviceMap> overReportUnitDeviceMaps = new ArrayList<>();
List<MovementTqiReportUnitDeviceMap> movementTqiReportUnitDeviceMaps = new ArrayList<>(); List<MovementTqiReportUnitDeviceMap> movementTqiReportUnitDeviceMaps = new ArrayList<>();
List<String> unitDeviceIds = new ArrayList<>();
for (Map<String, Object> unitDevice : unitDeviceList) { for (Map<String, Object> unitDevice : unitDeviceList) {
// 添加所有单元ID
String unitDeviceId = Convert.toStr(unitDevice.get("id"));
unitDeviceIds.add(unitDeviceId);
BigDecimal startMileage = Convert.toBigDecimal(unitDevice.get("startMileage")); BigDecimal startMileage = Convert.toBigDecimal(unitDevice.get("startMileage"));
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage")); BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
BigDecimal endMileage = Convert.toBigDecimal(unitDevice.get("endMileage")); BigDecimal endMileage = Convert.toBigDecimal(unitDevice.get("endMileage"));
...@@ -1054,6 +1059,20 @@ public class AnalysisAlgorithm { ...@@ -1054,6 +1059,20 @@ public class AnalysisAlgorithm {
unitDevice.put("railVehicleCheckScoreList", scoreList); unitDevice.put("railVehicleCheckScoreList", scoreList);
} }
// 3.先删除旧的关联关系,在新增
movementOverReportUnitDeviceMapService.lambdaUpdate()
.in(MovementOverReportUnitDeviceMap::getUnitId, unitDeviceIds)
.remove();
movementOverReportUnitDeviceMapService.saveBatch(overReportUnitDeviceMaps);
movementTqiReportUnitDeviceMapService.lambdaUpdate()
.in(MovementTqiReportUnitDeviceMap::getUnitId, unitDeviceIds)
.remove();
movementTqiReportUnitDeviceMapService.saveBatch(movementTqiReportUnitDeviceMaps);
} }
/** /**
......
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;
...@@ -42,7 +43,9 @@ public class AnalysisBatchUnitDeviceController extends JeecgController<AnalysisB ...@@ -42,7 +43,9 @@ public class AnalysisBatchUnitDeviceController extends JeecgController<AnalysisB
@PostMapping(value = "/listRecord") @PostMapping(value = "/listRecord")
public Result<IPage<AnalysisBatchUnitDeviceVO>> listRecord(@RequestBody AnalysisBatchUnitDeviceDTO dto) { public Result<IPage<AnalysisBatchUnitDeviceVO>> listRecord(@RequestBody AnalysisBatchUnitDeviceDTO dto) {
Page<AnalysisBatchUnitDeviceVO> pageData = new Page<>(dto.getPageNo(), dto.getPageSize()); Page<AnalysisBatchUnitDeviceVO> pageData = new Page<>(dto.getPageNo(), dto.getPageSize());
pageData = this.service.listRecord(pageData, dto); if (ObjectUtil.isNotEmpty(dto.getUnitTypeList()) && ObjectUtil.isNotEmpty(dto.getGradeJudgeList())) {
pageData = this.service.listRecord(pageData, dto);
}
return Result.OK(pageData); return Result.OK(pageData);
......
...@@ -300,7 +300,7 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -300,7 +300,7 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
message = "选中" + totalNum + "条数据已删除数据" + successNum + "条"; message = "选中" + totalNum + "条数据已删除数据" + successNum + "条";
if (totalNum - successNum > 0) { if (totalNum - successNum > 0) {
message = message + ",未删除" + failNum + "条。未删除" + failMessage + "原因是线路下面有关联设备故不能被删除"; message = message + ",未删除" + failNum + "条。未删除" + failMessage + "原因是区间下面有关联数据故不能被删除";
} }
return Result.batchDelete(message); return Result.batchDelete(message);
} }
......
package org.jeecg.modules.system.controller; package org.jeecg.modules.system.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.SqlInjectionUtil; import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.mapper.SysDictMapper; import org.jeecg.modules.system.mapper.SysDictMapper;
import org.jeecg.modules.system.model.DuplicateCheckVo; import org.jeecg.modules.system.model.DuplicateCheckVo;
import org.jeecg.modules.system.security.DictQueryBlackListHandler; import org.jeecg.modules.system.security.DictQueryBlackListHandler;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -25,7 +21,7 @@ import io.swagger.annotations.Api; ...@@ -25,7 +21,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.List; import java.util.*;
/** /**
* @Title: DuplicateCheckAction * @Title: DuplicateCheckAction
...@@ -40,14 +36,59 @@ import java.util.List; ...@@ -40,14 +36,59 @@ import java.util.List;
@Api(tags = "重复校验") @Api(tags = "重复校验")
public class DuplicateCheckController { public class DuplicateCheckController {
@Autowired @Resource
SysDictMapper sysDictMapper; private SysDictMapper sysDictMapper;
@Autowired @Resource
DictQueryBlackListHandler dictQueryBlackListHandler; private DictQueryBlackListHandler dictQueryBlackListHandler;
@Autowired @RequestMapping(value = "/checks", method = RequestMethod.GET)
private ISysUserService sysUserService; @ApiOperation("重复校验接口")
public Result<String> doDuplicateChecks(HttpServletRequest request) {
Map<String, String[]> requestParameterMap = request.getParameterMap();
// 如果参数为空或者表名不传
if (requestParameterMap.size() == 0 || ObjectUtil.isEmpty(requestParameterMap.get("tableName"))) {
Result<String> rs = new Result<>();
rs.setCode(500);
rs.setSuccess(true);
rs.setMessage("数据为空,不作处理!");
return rs;
}
Map<String, String> map = new LinkedHashMap<>();
StringBuilder checkSql = new StringBuilder();
String[] sqlInjCheckValues = new String[requestParameterMap.size()];
int i = 0;
for (Map.Entry<String, String[]> entry : requestParameterMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue()[0];
if (ObjectUtil.isEmpty(value)) {
continue;
}
sqlInjCheckValues[i++] = value;
checkSql.append(value).append(SymbolConstant.COMMA);
map.put(key, value);
}
// SQL注入校验(只限制非法串改数据库)
SqlInjectionUtil.filterContent(sqlInjCheckValues);
if (!dictQueryBlackListHandler.isPass(checkSql.toString())) {
return Result.error(dictQueryBlackListHandler.getError());
}
// 验证参数
Long num = sysDictMapper.duplicateCheckCountSqlByPrams(map);
if (num == null || num == 0) {
// 该值可用
return Result.ok("该值可用!");
} else {
// 该值不可用
log.info("该值不可用,系统中已存在!");
return Result.error("");
}
}
/** /**
* 校验数据是否在系统中是否存在 * 校验数据是否在系统中是否存在
...@@ -93,40 +134,11 @@ public class DuplicateCheckController { ...@@ -93,40 +134,11 @@ public class DuplicateCheckController {
} else { } else {
// 该值不可用 // 该值不可用
log.info("该值不可用,系统中已存在!"); log.info("该值不可用,系统中已存在!");
// return Result.error("该值不可用,系统中已存在!");
return Result.error(""); return Result.error("");
} }
} }
/** /**
* 校验用户相关信息是否存在
*
* @return
*/
// @RequestMapping(value = "/checkUser", method = RequestMethod.GET)
// @ApiOperation("校验用户相关信息是否存在")
// public Result<String> checkUser(@ApiParam(name = "需要校验的参数", required = true) String name,@ApiParam(name = "类型", required = true) String type) {
// LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery();
// if("1".equals(type)){
// lambdaQuery.eq(SysUser::getUsername, name);
// }
// if("2".equals(type)){
// lambdaQuery.eq(SysUser::getRealname, name);
// }
// if("3".equals(type)){
// lambdaQuery.eq(SysUser::getWorkNo, name);
// }
// if("4".equals(type)){
// lambdaQuery.eq(SysUser::getPhone, name);
// }
// lambdaQuery.eq(SysUser::getDelFlag, 0);
// List<SysUser> list = sysUserService.list(lambdaQuery);
// if (list != null && list.size() > 0) {
// return Result.error("参数已存在");
// }
// return Result.ok("");
// }
/**
* VUEN-2584【issue】平台sql注入漏洞几个问题 * VUEN-2584【issue】平台sql注入漏洞几个问题
* 部分特殊函数 可以将查询结果混夹在错误信息中,导致数据库的信息暴露 * 部分特殊函数 可以将查询结果混夹在错误信息中,导致数据库的信息暴露
* *
......
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