|
@@ -8,12 +8,14 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.project.base.domain.TBaseDevice;
|
|
import com.ruoyi.project.base.domain.TBaseDevice;
|
|
import com.ruoyi.project.base.domain.TBasePoint;
|
|
import com.ruoyi.project.base.domain.TBasePoint;
|
|
import com.ruoyi.project.base.mapper.TBaseDeviceMapper;
|
|
import com.ruoyi.project.base.mapper.TBaseDeviceMapper;
|
|
|
|
+import com.ruoyi.project.base.mapper.TBasePointMapper;
|
|
import com.ruoyi.project.base.service.ITBasePointService;
|
|
import com.ruoyi.project.base.service.ITBasePointService;
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
@@ -22,6 +24,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.mybatis.spring.MyBatisSystemException;
|
|
import org.mybatis.spring.MyBatisSystemException;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -50,6 +53,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
public class TBasePointController extends BaseController {
|
|
public class TBasePointController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITBasePointService tBasePointService;
|
|
private ITBasePointService tBasePointService;
|
|
|
|
+ @Resource
|
|
|
|
+ private TBasePointMapper tBasePointMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ISysDictTypeService isysDictTypeService;
|
|
private ISysDictTypeService isysDictTypeService;
|
|
@@ -156,8 +161,8 @@ public class TBasePointController extends BaseController {
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
List<Long> ids = new ArrayList<>();
|
|
List<Long> ids = new ArrayList<>();
|
|
- for (TBasePoint t: list
|
|
|
|
- ) {
|
|
|
|
|
|
+ for (TBasePoint t : list
|
|
|
|
+ ) {
|
|
ids.add(t.getPointId());
|
|
ids.add(t.getPointId());
|
|
}
|
|
}
|
|
TBasePoint point = new TBasePoint();
|
|
TBasePoint point = new TBasePoint();
|
|
@@ -171,7 +176,7 @@ public class TBasePointController extends BaseController {
|
|
@PutMapping("/handleUpload")
|
|
@PutMapping("/handleUpload")
|
|
public AjaxResult handleUpload(@RequestBody TBasePoint tBasePoint) {
|
|
public AjaxResult handleUpload(@RequestBody TBasePoint tBasePoint) {
|
|
tBasePoint.setUpdaterCode(getUserId());
|
|
tBasePoint.setUpdaterCode(getUserId());
|
|
- if ((tBasePointService.updateTBasePointByUploadFile(tBasePoint)>0))
|
|
|
|
|
|
+ if ((tBasePointService.updateTBasePointByUploadFile(tBasePoint) > 0))
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
else
|
|
else
|
|
return AjaxResult.error("未找到对应名称的PID图号/组件照片号");
|
|
return AjaxResult.error("未找到对应名称的PID图号/组件照片号");
|
|
@@ -311,6 +316,11 @@ public class TBasePointController extends BaseController {
|
|
entity.setRemarks(cellValue);
|
|
entity.setRemarks(cellValue);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (StringUtils.isEmpty(entity.getPointType())) {
|
|
|
|
+ logger.info("缺少必填项");
|
|
|
|
+ failRow.add(finalI + 1);
|
|
|
|
+ throw new InterruptedException(); //中止线程
|
|
|
|
+ }
|
|
entity.setCreaterCode(userId);
|
|
entity.setCreaterCode(userId);
|
|
entity.setApproveStatus(0L);
|
|
entity.setApproveStatus(0L);
|
|
TBaseDevice device = tBaseDeviceMapper.selectTBaseDeviceByCode(entity);
|
|
TBaseDevice device = tBaseDeviceMapper.selectTBaseDeviceByCode(entity);
|
|
@@ -324,20 +334,16 @@ public class TBasePointController extends BaseController {
|
|
entity.setRegionId(device.getRegionId());
|
|
entity.setRegionId(device.getRegionId());
|
|
logger.info("entity:" + entity);
|
|
logger.info("entity:" + entity);
|
|
//进行数据更新
|
|
//进行数据更新
|
|
- TBasePoint tBasePoint = tBasePointService.selectTBasePointByGroupCodeAndExtendCode(entity);
|
|
|
|
- if (tBasePoint == null) {
|
|
|
|
- entity.setUpdatedate(new Date());
|
|
|
|
- entity.setUpdaterCode(userId);
|
|
|
|
- tBasePointService.insertTBasePoint(entity);
|
|
|
|
- successNumber.getAndIncrement();
|
|
|
|
- } else {
|
|
|
|
- logger.info("重复数据");
|
|
|
|
- failRow.add(finalI + 1);
|
|
|
|
- throw new InterruptedException();//中止线程
|
|
|
|
- }
|
|
|
|
|
|
+ entity.setUpdatedate(new Date());
|
|
|
|
+ entity.setUpdaterCode(userId);
|
|
|
|
+ tBasePointMapper.insertTBasePoint(entity);
|
|
|
|
+ successNumber.getAndIncrement();
|
|
}
|
|
}
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
logger.info("中止线程" + Thread.currentThread().getName());
|
|
logger.info("中止线程" + Thread.currentThread().getName());
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
+ logger.info("重复数据");
|
|
|
|
+ failRow.add(finalI + 1);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
failRow.add(finalI + 1);
|
|
failRow.add(finalI + 1);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|