From 4922df1ffd1d0fff4fc93d63fe7461628db118e6 Mon Sep 17 00:00:00 2001 From: shicf <shi_chongfu@163.com> Date: 星期四, 21 三月 2024 15:11:58 +0800 Subject: [PATCH] 移动端 --- src/main/java/com/product/mobile/device/controller/DeviceManagerController.java | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 114 insertions(+), 6 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 448beec..8970492 100644 --- a/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java +++ b/src/main/java/com/product/mobile/device/controller/DeviceManagerController.java @@ -9,9 +9,13 @@ import com.product.core.exception.BaseException; 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.DeviceMainenanceService; import com.product.device.service.DeviceManagerService; -import com.product.device.service.ide.IDeviceMainenanceService; +import com.product.device.service.idel.IDeviceArchivesService; +import com.product.device.service.idel.IDeviceInspectionService; +import com.product.device.service.idel.IDeviceMainenanceService; import com.product.mobile.core.config.MobileCoreCode; import com.product.mobile.core.config.MobileCoreConst; import com.product.module.sys.entity.SystemUser; @@ -43,6 +47,8 @@ DeviceManagerService deviceManagerService; @Autowired DeviceMainenanceService deviceMainenanceService; + @Autowired + CommonInspectionService commonInspectionService; /** * 浠诲姟鍒楄〃 * @@ -102,11 +108,13 @@ SpringMVCContextHolder.getSystemLogger().error(MobileCoreCode.SYSTEM_FORM_NODATA.getValue(), MobileCoreCode.SYSTEM_FORM_NODATA.getText()); return this.error(MobileCoreCode.SYSTEM_FORM_NODATA); } - if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("asset_code")) ) { + System.out.println(fse.getString("device_number")); + if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("device_number")) ) { SpringMVCContextHolder.getSystemLogger().error(MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText()); return this.error(MobileCoreCode.SYSTEM_ACQUIRE_PARAM_FAIL); } - String result=OK_List(deviceManagerService.findDeviceAndSub(fse.getString("uuid"),fse.getString("asset_code"))); + System.out.println(222222); + String result=result_OK_List(deviceManagerService.findDeviceAndSub(fse.getString("uuid"),fse.getString("device_number"))); System.out.println(result); return result; } catch (BaseException e) { @@ -138,11 +146,12 @@ SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("asset_code")) ) { + 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); System.out.println(uuid); return !StringUtils.isEmpty(uuid)? this.OK_Add(uuid):this.error(new BaseException(DeviceCode.DEVICE_CREATE_FAILURE_ERROR)); @@ -179,7 +188,7 @@ SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - DataTableEntity dt=deviceManagerService.findDevicePersion(fse.getString("asset_code")); + DataTableEntity dt=deviceManagerService.findDevicePersion(fse.getString("device_number")); return this.OK_List( dt ); } catch (BaseException e) { @@ -211,7 +220,7 @@ SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } - if (StringUtils.isEmpty(fse.getString("asset_code")) ) { + if (StringUtils.isEmpty(fse.getString("device_number")) ) { SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); return this.error(DeviceCode.SYSTEM_FORM_NODATA); } @@ -229,4 +238,103 @@ return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); } } + /** + * 璁惧鐐规閰嶇疆 + * @throws IOException + */ + @RequestMapping(value = "/findDeviceSetting/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findDevcieSetting(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); + } + + String result=result_OK_List(commonInspectionService.findDeviceSetting(fse.getString(DeviceConst.DEVICE_CODE))); + return result; + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + } + } + /** + * 璁惧淇濆吇閰嶇疆 + * @throws IOException + */ + @RequestMapping(value = "/findDeviceMaintenanceSetting/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findDevcieMaintenancesSetting(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); + } + + String result=result_OK_List(deviceMainenanceService.findDeviceMaintenanceSetting(fse.getString(DeviceConst.DEVICE_CODE),fse.getString("type"))); + return result; + } catch (BaseException e) { + e.printStackTrace(); + return error(e); + } catch (Exception e) { + e.printStackTrace(); + return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); + } + } + /** + * 璁惧淇濆吇閰嶇疆 + * @throws IOException + */ + @RequestMapping(value = "/save-inspection/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String saveDevcieInspection(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); + String uuid=Service.saveInspection(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); + } + } + + + + } -- Gitblit v1.9.2