From 1ae0b0d88f6818e13e322597f6d4065e4effd8bf Mon Sep 17 00:00:00 2001 From: 许鹏程 <1821349743@qq.com> Date: 星期四, 29 五月 2025 10:16:57 +0800 Subject: [PATCH] 更新 --- src/main/java/com/product/mobile/device/controller/DeviceManagerController.java | 273 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 225 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java b/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java index f096703..4758b5f 100644 --- a/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java +++ b/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java @@ -10,14 +10,15 @@ import com.product.core.spring.context.SpringMVCContextHolder; import com.product.device.config.DeviceCode; import com.product.device.config.DeviceConst; -import com.product.device.service.CommonInspectionService; -import com.product.device.service.DeviceInspectionConfigService; -import com.product.device.service.DeviceMainenanceService; -import com.product.device.service.DeviceMaintenanceRecordService; +import com.product.device.inspection.service.CommonInspectionService; +import com.product.device.inspection.service.DeviceInspectionConfigService; +import com.product.device.maintenance.service.DeviceMainenanceService; +import com.product.device.maintenance.service.DeviceMaintenancePlanService; +import com.product.device.maintenance.service.DeviceMaintenanceRecordService; import com.product.device.service.DeviceManagerService; import com.product.device.service.idel.IDeviceInspectionService; -import com.product.device.service.idel.IDeviceMainenanceService; import com.product.device.service.idel.IDeviceMaintenanceRecordService; +import com.product.device.service.idel.IDeviceRepairFaultService; import com.product.mobile.core.config.MobileCoreCode; import com.product.mobile.core.config.MobileCoreConst; import com.product.module.sys.entity.SystemUser; @@ -32,6 +33,7 @@ import java.io.IOException; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; /** @@ -42,23 +44,26 @@ @RestController @RequestMapping("/api/mobile/device") public class DeviceManagerController extends AbstractBaseController { - - + @Autowired + DeviceMaintenancePlanService deviceMaintenancePlanService; @Autowired DeviceManagerTaskService deviceManagerTaskService; @Autowired DeviceManagerService deviceManagerService; @Autowired DeviceMainenanceService deviceMainenanceService; - + @Autowired CommonInspectionService commonInspectionService; - + @Autowired DeviceMaintenanceRecordService deviceMaintenanceRecordService; - + @Autowired - DeviceInspectionConfigService deviceInspectionConfigService; + DeviceInspectionConfigService deviceInspectionConfigService; + + @Resource + IDeviceRepairFaultService deviceRepairFaultService;; /** * 浠诲姟鍒楄〃 * @@ -94,10 +99,10 @@ return error(e); } catch (Exception e) { e.printStackTrace(); - return error(MobileCoreCode.GET_NAV_BAR_CONFIG_LIST_FAIL); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } - + /** * 璁惧淇℃伅 * @@ -119,12 +124,12 @@ return this.error(MobileCoreCode.SYSTEM_FORM_NODATA); } System.out.println(fse.getString("device_number")); - if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("device_number")) ) { + if (StringUtils.isEmpty(fse.getString("uuid"))) { SpringMVCContextHolder.getSystemLogger().error(MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText()); return this.error(MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL); } System.out.println(222222); - String result=result_OK_List(deviceManagerService.findDeviceAndSub(fse.getString("uuid"),fse.getString("device_number"))); + String result=result_List_OK(deviceManagerService.findDeviceAndSub(fse.getString("uuid"),fse.getString("device_number"))); System.out.println(result); return result; } catch (BaseException e) { @@ -132,7 +137,7 @@ return error(e); } catch (Exception e) { e.printStackTrace(); - return error(MobileCoreCode.GET_NAV_BAR_CONFIG_LIST_FAIL); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -144,7 +149,7 @@ @RequestMapping(value = "/failure/create/{version}", method = RequestMethod.POST) @ApiVersion(1) public String createFailure(HttpServletRequest request) throws IOException { - + try { FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); @@ -156,13 +161,13 @@ SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("device_number")) ) { - SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); - return this.error(DeviceCode.SYSTEM_FORM_NODATA); - } - IDeviceMainenanceService service = (IDeviceMainenanceService) getProxyInstance(deviceMainenanceService); - fse.remove("uuid"); - String uuid=service.saveDeviceFailure(fse); +// if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("device_number")) ) { +// SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); +// return this.error(DeviceCode.SYSTEM_FORM_NODATA); +// } + IDeviceRepairFaultService service = (IDeviceRepairFaultService) getProxyInstance(deviceRepairFaultService); +// fse.remove("uuid"); + String uuid=service.deviceFaultReview(fse); System.out.println(uuid); return !StringUtils.isEmpty(uuid)? this.OK_Add(uuid):this.error(new BaseException(DeviceCode.DEVICE_MAINTENANCE_CONTENT_DEL_FAIL)); } catch (BaseException e) { @@ -170,7 +175,7 @@ return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -182,7 +187,7 @@ @RequestMapping(value = "/persion/{version}", method = RequestMethod.POST) @ApiVersion(1) public String devicePersion(HttpServletRequest request) throws IOException { - + try { FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); @@ -199,14 +204,14 @@ return this.error(DeviceCode.SYSTEM_FORM_NODATA); } DataTableEntity dt=deviceManagerService.findDevicePersion(fse.getString("device_number")); - + return this.OK_List( dt ); } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -218,7 +223,7 @@ @RequestMapping(value = "/create/maintain/task/{version}", method = RequestMethod.POST) @ApiVersion(1) public String deviceMainTainTaskPersion(HttpServletRequest request) throws IOException { - + try { FieldSetEntity fse = null; Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); @@ -245,7 +250,7 @@ return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -267,20 +272,22 @@ SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - if (fse.getString(DeviceConst.DEVICE_NUMBER)==null && fse.getString(DeviceConst.UUID)==null) { + if (fse.getString(DeviceConst.UUID)==null) { SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - String result=OK_List(deviceInspectionConfigService.findInspectionSettingForApp(fse)); - -// String result=result_OK_List(commonInspectionService.findDeviceSetting(fse.getString(DeviceConst.UUID))); - return result; + fse=deviceInspectionConfigService.findInspectionSettingForApp(fse); + if(FieldSetEntity.isEmpty(fse)) { + return this.error(DeviceCode.COMMON_DATA_ERROR); + }else { + return result_List_OK(fse); + } } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -306,8 +313,8 @@ SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - String result=OK_List(deviceInspectionConfigService.findInspectionSettingForApp(fse)); - + String result=result_List_OK(deviceInspectionConfigService.findInspectionSettingForApp(fse)); + // String result=result_OK_List(commonInspectionService.findDeviceSetting(fse.getString(DeviceConst.UUID))); return result; } catch (BaseException e) { @@ -315,7 +322,7 @@ return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -338,14 +345,14 @@ return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - String result=result_OK_List(deviceMainenanceService.findDeviceMaintenanceSetting(fse.getString(DeviceConst.UUID),fse.getString("type"))); + String result=result_OK_List(deviceMainenanceService.findDeviceMaintenanceSetting(fse.getString(DeviceConst.DEVICE_UUID),fse.getString("type"),fse.getString("plan_uuid"))); return result; } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -374,13 +381,48 @@ }else { return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); } - + } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); + } + } + /** + * 璁惧鐐规淇℃伅璇︽儏 + * @throws IOException + */ + @RequestMapping(value = "/find-inspection/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findDevcieInspection(HttpServletRequest request) { + + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); + return this.error(DeviceCode.SYSTEM_FORM_NODATA); + } + IDeviceInspectionService Service = (IDeviceInspectionService) getProxyInstance(commonInspectionService); + FieldSetEntity record=Service.findInspectionRecord(fse.getUUID()); + if(record!=null) { + return this.result_List_OK(record); + }else { + return error(DeviceCode.COMMON_DATA_ERROR); + } + + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } /** @@ -402,21 +444,156 @@ SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - IDeviceMaintenanceRecordService Service = (IDeviceMaintenanceRecordService) getProxyInstance(deviceMaintenanceRecordService); - String uuid=Service.saveMaintenanceDevice(fse); + IDeviceMaintenanceRecordService service = (IDeviceMaintenanceRecordService) getProxyInstance(deviceMaintenanceRecordService); + String uuid=service.saveMaintenanceDevice(fse); if(uuid!=null) { return this.OK_Add(uuid); }else { return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); } - + } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); - return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); } } - + /** + * 璁惧淇濆吇淇℃伅璇︽儏 + * @throws IOException + */ + @RequestMapping(value = "/find-maintenance/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findDevcieMaintenance(HttpServletRequest request) { + + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); + return this.error(DeviceCode.SYSTEM_FORM_NODATA); + } + IDeviceMaintenanceRecordService service = (IDeviceMaintenanceRecordService) getProxyInstance(deviceMaintenanceRecordService); +// FieldSetEntity record=service.findMaintenanceRecord(fse.getUUID()); + FieldSetEntity record=service.findMaintenanceRecordForMobile(fse.getUUID()); + if(record!=null) { + return this.result_List_OK(record); + }else { + return error(DeviceCode.COMMON_DATA_ERROR); + } + + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); + } + } + /** + * 璁惧鍙拌处 + * @throws IOException + */ + @RequestMapping(value = "/list/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String listDevcie(HttpServletRequest request) { + + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null) { + SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); + return this.error(DeviceCode.SYSTEM_FORM_NODATA); + } + // 鍒ゆ柇鍒嗛〉鍙傛暟鏄惁姝e父 + if (StringUtils.isEmpty(fse.getString(MobileCoreConst.PAGESIZE)) + || StringUtils.isEmpty(fse.getString(MobileCoreConst.CPAGE))) { + + SpringMVCContextHolder.getSystemLogger().error(MobileCoreCode.SYSTEM_FORM_COUNT.getValue(), MobileCoreCode.SYSTEM_FORM_COUNT.getText()); + return this.error(MobileCoreCode.SYSTEM_FORM_COUNT.getValue(), MobileCoreCode.SYSTEM_FORM_COUNT.getText()); + } + return this.OK_List(deviceManagerService.deviceList(fse.getString("searchKey"),fse.getInteger(MobileCoreConst.PAGESIZE),fse.getInteger(MobileCoreConst.CPAGE))); + + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); + } + } + /** + * 淇濆吇浜哄憳棰嗗彇淇濆吇浠诲姟 + * @throws IOException + */ + @RequestMapping(value = "/receive-task/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String receiveTask(HttpServletRequest request) { + + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null || fse.getObject("plan_uuid")==null) { + SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); + return this.error(DeviceCode.SYSTEM_FORM_NODATA); + } + Object b= deviceMaintenancePlanService.receivePlanTask(fse.getString("plan_uuid")); + + return this.OK(); + + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); + } + } + /** + * 淇濆吇浜哄憳寮�濮嬩繚鍏绘墦鍗★紝鏇存柊璁″垝浠诲姟鐘舵�佸拰鐢垫鐘舵�� + * + * @throws IOException + */ + @RequestMapping(value = "/status-update/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String statusUpdate(HttpServletRequest request) { + + try { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + if (bean == null || fse == null || (fse.getObject("plan_uuid")==null && fse.getObject("device_uuid")==null)) { + SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); + return this.error(DeviceCode.SYSTEM_FORM_NODATA); + } + + deviceMaintenancePlanService.statusUpdate(fse.getString("plan_uuid"),fse.getString("device_uuid"),fse.getString("maintenance_type")); + + return this.OK(); + + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(MobileCoreCode.APP_COMMON_ERROR_CODE); + } + } } -- Gitblit v1.9.2