|
@@ -52,6 +52,13 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
private final GisAboutService gisAboutService;
|
|
|
private final CustomPointService customPointService;
|
|
|
|
|
|
+ private final XjFjService xjFjService;
|
|
|
+ private final XjLdtyxService xjLdtyxService;
|
|
|
+ private final XjTygService xjTygService;
|
|
|
+ private final XjConService xjConService;
|
|
|
+ private final XjMenuService xjMenuService;
|
|
|
+ private final XjFileService xjFileService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage getMaintenancePage(Page page, MaintenanceSearch maintenanceSearch) {
|
|
|
return page.setRecords(customMaintenanceMapper.getMaintenancePage(page, maintenanceSearch));
|
|
@@ -102,17 +109,92 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public Boolean addMaintenance(HttpServletRequest request, AddMaintenance addMaintenance) {
|
|
|
- Long childPlanId = addMaintenance.getChildPlanId();
|
|
|
- Long pointId = addMaintenance.getPlanTempPointId();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ public Boolean addXj(HttpServletRequest request, XjUpload xjUpload) {
|
|
|
+ Long childPlanId = xjUpload.getChildPlanId();
|
|
|
+ Long pointId = xjUpload.getPlanTempPointId();
|
|
|
|
|
|
Date now = Date8Util.getCurrentDate();
|
|
|
|
|
@@ -126,51 +208,97 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
.set(PlanPointTemp::getCheckDate, now));
|
|
|
|
|
|
|
|
|
- maintenanceService.save(addMaintenance);
|
|
|
- Long recordId = addMaintenance.getId();
|
|
|
- if (addMaintenance.getContent() == null || addMaintenance.getContent().size() == 0) {
|
|
|
+ Long typeId = xjUpload.getTypeId();
|
|
|
+ Long recordId = null;
|
|
|
+ if (typeId == 1) {
|
|
|
+ XjLdtyx xjLdtyx = new XjLdtyx();
|
|
|
+ xjLdtyx.setAddress(xjUpload.getAddress());
|
|
|
+ xjLdtyx.setCheckDate(xjUpload.getCheckDate());
|
|
|
+ xjLdtyx.setChildPlanId(xjUpload.getChildPlanId());
|
|
|
+ xjLdtyx.setPlanTempPointId(xjUpload.getPlanTempPointId());
|
|
|
+ xjLdtyx.setDeviceId(xjUpload.getDeviceId());
|
|
|
+ xjLdtyx.setNote(xjUpload.getNote());
|
|
|
+ xjLdtyx.setCompanyId(xjUpload.getCompanyId());
|
|
|
+ xjLdtyx.setRunPressure(xjUpload.getRunPressure());
|
|
|
+ xjLdtyx.setTruncationPressure(xjUpload.getTruncationPressure());
|
|
|
+ xjLdtyx.setUserid(xjUpload.getUserid());
|
|
|
+ xjLdtyx.setX(xjUpload.getX());
|
|
|
+ xjLdtyx.setY(xjUpload.getY());
|
|
|
+ xjLdtyxService.save(xjLdtyx);
|
|
|
+ recordId = xjLdtyx.getId();
|
|
|
+ } else if (typeId == 2) {
|
|
|
+ XjTyg xjTyg = new XjTyg();
|
|
|
+ xjTyg.setAddress(xjUpload.getAddress());
|
|
|
+ xjTyg.setCheckDate(xjUpload.getCheckDate());
|
|
|
+ xjTyg.setChildPlanId(xjUpload.getChildPlanId());
|
|
|
+ xjTyg.setPlanTempPointId(xjUpload.getPlanTempPointId());
|
|
|
+ xjTyg.setDeviceId(xjUpload.getDeviceId());
|
|
|
+ xjTyg.setNote(xjUpload.getNote());
|
|
|
+ xjTyg.setCompanyId(xjUpload.getCompanyId());
|
|
|
+ xjTyg.setRunPressure(xjUpload.getRunPressure());
|
|
|
+ xjTyg.setDiffusePressure(xjUpload.getDiffusePressure());
|
|
|
+ xjTyg.setWorkPressure(xjUpload.getWorkPressure());
|
|
|
+ xjTyg.setUserid(xjUpload.getUserid());
|
|
|
+ xjTyg.setX(xjUpload.getX());
|
|
|
+ xjTyg.setY(xjUpload.getY());
|
|
|
+ xjTygService.save(xjTyg);
|
|
|
+ recordId = xjTyg.getId();
|
|
|
+ } else if (typeId == 3) {
|
|
|
+ XjFj xjFj = new XjFj();
|
|
|
+ xjFj.setAddress(xjUpload.getAddress());
|
|
|
+ xjFj.setCheckDate(xjUpload.getCheckDate());
|
|
|
+ xjFj.setChildPlanId(xjUpload.getChildPlanId());
|
|
|
+ xjFj.setPlanTempPointId(xjUpload.getPlanTempPointId());
|
|
|
+ xjFj.setDeviceId(xjUpload.getDeviceId());
|
|
|
+ xjFj.setNote(xjUpload.getNote());
|
|
|
+ xjFj.setCompanyId(xjUpload.getCompanyId());
|
|
|
+ xjFj.setUserid(xjUpload.getUserid());
|
|
|
+ xjFj.setX(xjUpload.getX());
|
|
|
+ xjFj.setY(xjUpload.getY());
|
|
|
+ xjFj.setMaterial(xjUpload.getMaterial());
|
|
|
+ xjFj.setSpecification(xjUpload.getSpecification());
|
|
|
+ xjFjService.save(xjFj);
|
|
|
+ recordId = xjFj.getId();
|
|
|
+ }
|
|
|
+ if (xjUpload.getContent() == null || xjUpload.getContent().size() == 0) {
|
|
|
throw new ToflyDeniedException("检查内容不能为空");
|
|
|
}
|
|
|
-
|
|
|
- addMaintenance.getContent().forEach(content -> {
|
|
|
- if (content.getParentId() == null) {
|
|
|
- throw new ToflyDeniedException("检查设施不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- MaintenanceContent maintenanceContent = new MaintenanceContent();
|
|
|
- maintenanceContent.setRecordId(recordId);
|
|
|
- maintenanceContent.setMenuId(content.getParentId());
|
|
|
- maintenanceContent.setNote(content.getNote());
|
|
|
- maintenanceContentService.save(maintenanceContent);
|
|
|
-
|
|
|
- if (StringUtil.isNotEmpty(content.getMenuIds())) {
|
|
|
- for (Long id : content.getMenuIds()) {
|
|
|
- MaintenanceContent maintenanceContent2 = new MaintenanceContent();
|
|
|
- maintenanceContent2.setRecordId(recordId);
|
|
|
- maintenanceContent2.setMenuId(Long.valueOf(id));
|
|
|
- maintenanceContentService.save(maintenanceContent2);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ Long finalRecordId = recordId;
|
|
|
+ xjUpload.getContent().stream().forEach(content -> {
|
|
|
+ XjCon xjCon = new XjCon();
|
|
|
+ xjCon.setRecordId(finalRecordId);
|
|
|
+ xjCon.setTypeId(content);
|
|
|
+ xjCon.setTypeId(typeId);
|
|
|
+ xjConService.save(xjCon);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
MultiValueMap<String, MultipartFile> multiFileMap = ((MultipartHttpServletRequest) request).getMultiFileMap();
|
|
|
multiFileMap.forEach((k, v) -> {
|
|
|
|
|
|
v.forEach(file -> {
|
|
|
+ XjFile xjFile = new XjFile();
|
|
|
+ xjFile.setRecordId(finalRecordId);
|
|
|
+ xjFile.setXjType(typeId);
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
- String filePath = filePathBean.getMaintenance() + IdWorker.getIdStr() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|
|
+ String filePath = filePathBean.getXj() + IdWorker.getIdStr() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|
|
boolean b = FtpUtil.uploadFile2Ftp(file, filePath);
|
|
|
- if (b) {
|
|
|
- MaintenanceFile maintenanceFile = new MaintenanceFile();
|
|
|
- maintenanceFile.setFilePath(filePath);
|
|
|
- maintenanceFile.setFileName(fileName);
|
|
|
- maintenanceFile.setMaintenanceId(addMaintenance.getId());
|
|
|
- maintenanceFileService.save(maintenanceFile);
|
|
|
+ xjFile.setFilePath(filePath);
|
|
|
+ xjFile.setFileName(fileName);
|
|
|
+
|
|
|
+ if (k.contains("photo")) {
|
|
|
+ xjFile.setFileType("1");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (k.contains("audio")) {
|
|
|
+ xjFile.setFileType("2");
|
|
|
}
|
|
|
+ xjFileService.save(xjFile);
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
|
|
|
ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
|
executorService.execute(new Runnable() {
|
|
@@ -191,7 +319,7 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
Long recordId = addMaintenance.getId();
|
|
|
maintenanceContentService.remove(Wrappers.<MaintenanceContent>lambdaQuery().eq(MaintenanceContent::getRecordId, recordId));
|
|
|
|
|
|
- if(addMaintenance.getContent() != null) {
|
|
|
+ if (addMaintenance.getContent() != null) {
|
|
|
addMaintenance.getContent().forEach(content -> {
|
|
|
|
|
|
MaintenanceContent maintenanceContent = new MaintenanceContent();
|
|
@@ -366,7 +494,7 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
maintenanceDeviceService.save(addMaintenanceDevice);
|
|
|
Long recordId = addMaintenanceDevice.getId();
|
|
|
|
|
|
- if(addMaintenanceDevice.getContent() != null) {
|
|
|
+ if (addMaintenanceDevice.getContent() != null) {
|
|
|
addMaintenanceDevice.getContent().stream().forEach(content -> {
|
|
|
MaintenanceDeviceCon maintenanceDeviceCon = new MaintenanceDeviceCon();
|
|
|
maintenanceDeviceCon.setDeviceRecordId(recordId);
|
|
@@ -400,7 +528,7 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
public void run() {
|
|
|
customPointService.percentUpdate(childPlanId.toString());
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -412,7 +540,7 @@ public class CustomMaintenanceServiceImpl implements CustomMaintenanceService {
|
|
|
Long recordId = addMaintenanceDevice.getId();
|
|
|
maintenanceDeviceConService.remove(Wrappers.<MaintenanceDeviceCon>lambdaQuery().eq(MaintenanceDeviceCon::getDeviceRecordId, recordId));
|
|
|
|
|
|
- if (addMaintenanceDevice.getContent() != null){
|
|
|
+ if (addMaintenanceDevice.getContent() != null) {
|
|
|
addMaintenanceDevice.getContent().forEach(content -> {
|
|
|
MaintenanceDeviceCon maintenanceDeviceCon = new MaintenanceDeviceCon();
|
|
|
maintenanceDeviceCon.setDeviceRecordId(recordId);
|