Browse Source

'bug'

master
daixiantong 4 years ago
parent
commit
4883f95060
1 changed files with 1 additions and 11 deletions
  1. +1
    -11
      src/main/java/com/taauav/admin/service/impl/TauvWaterDataServiceImpl.java

+ 1
- 11
src/main/java/com/taauav/admin/service/impl/TauvWaterDataServiceImpl.java View File

@@ -83,7 +83,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
* @return
*/
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public Response importData(MultipartFile file) {
List<List<Object>> objectList = null;
try {
@@ -91,7 +91,6 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
String[] titleList = new String[]{"*任务单号", "*区属", "*河湖名称", "化学需氧量", "氨氮", "总磷", "总氮", "溶解氧", "浊度"};
for (int i = 0; i < titleList.length; i++) {
if (!titleList[i].equals(headList.get(i))) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("请使用正确的导入模板");
}
}
@@ -102,7 +101,6 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
return response.failure(e.getMessage());
}
if (objectList.size() == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("导入数据不能为空");
}
Integer m = 2;
@@ -111,15 +109,12 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
String areaName = data.get(1).toString().trim();
String driverName = data.get(2).toString().trim();
if (StringUtils.isEmpty(inspectNo)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行任务单号不能为空");
}
if (StringUtils.isEmpty(areaName)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行区属不能为空");
}
if (StringUtils.isEmpty(driverName)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行河湖名称不能为空");
}

@@ -130,7 +125,6 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
inspectWrapper.last("limit 1");
TauvInspectDriver inspectDriver = inspectDriverMapper.selectOne(inspectWrapper);
if (inspectDriver == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行任务单号错误");
}
// 区属校验
@@ -140,7 +134,6 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
cityWrapper.last("limit 1");
SysCity city = cityMapper.selectOne(cityWrapper);
if (city == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行区属错误");
}
// 河湖校验
@@ -151,7 +144,6 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
driverWrapper.last("limit 1");
TauvDriver driver = driverMapper.selectOne(driverWrapper);
if (driver == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行河湖名称错误");
}
// 关系校验
@@ -164,11 +156,9 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
wrapper.last("limit 1");
TauvInspectDriver tauvInspectDriver = inspectDriverMapper.selectOne(wrapper);
if (tauvInspectDriver == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行任务单号、区属、河湖名称关系错误");
}
if (tauvInspectDriver.getStatus() != 4) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response.failure("第" + m + "行任务未完成");
}
// 判断水质数据表该任务、区属、河湖对应数据是否存在

Loading…
Cancel
Save