shicf
2024-06-12 b6fef3f329b2b42b7fabd2d7ec891b849fd3de81
设备管理点检保养
已修改1个文件
96 ■■■■■ 文件已修改
src/main/java/com/product/mobile/device/controller/DeviceManagerController.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/mobile/device/controller/DeviceManagerController.java
@@ -11,16 +11,19 @@
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.service.DeviceManagerService;
import com.product.device.service.idel.IDeviceArchivesService;
import com.product.device.service.idel.IDeviceInspectionService;
import com.product.device.service.idel.IDeviceMainenanceService;
import com.product.device.service.idel.IDeviceMaintenanceRecordService;
import com.product.mobile.core.config.MobileCoreCode;
import com.product.mobile.core.config.MobileCoreConst;
import com.product.module.sys.entity.SystemUser;
import com.product.module.sys.version.ApiVersion;
import com.product.task.device.service.DeviceManagerTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -47,8 +50,15 @@
    DeviceManagerService  deviceManagerService;
    @Autowired
    DeviceMainenanceService deviceMainenanceService;
    @Autowired
    CommonInspectionService commonInspectionService;
    @Autowired
    DeviceMaintenanceRecordService deviceMaintenanceRecordService;
    @Autowired
    DeviceInspectionConfigService deviceInspectionConfigService;
    /**
     * 任务列表
     *
@@ -76,7 +86,7 @@
                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());
            }
            String result=OK_List(deviceManagerTaskService.getsPersionNewTask(curUser));
            String result=OK_List(deviceManagerTaskService.getPersionNewTask(curUser));
            System.out.println(result);
            return result;
        } catch (BaseException e) {
@@ -154,7 +164,7 @@
             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));
             return !StringUtils.isEmpty(uuid)? this.OK_Add(uuid):this.error(new BaseException(DeviceCode.DEVICE_MAINTENANCE_CONTENT_DEL_FAIL));
         } catch (BaseException e) {
             e.printStackTrace();
             return error(e);
@@ -257,8 +267,48 @@
                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) {
                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.DEVICE_CODE)));
//            String result=result_OK_List(commonInspectionService.findDeviceSetting(fse.getString(DeviceConst.UUID)));
            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 = "/findDeviceInspection/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String findDevcInspection(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);
            }
            if (fse.getString(DeviceConst.DEVICE_NUMBER)==null && 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;
        } catch (BaseException e) {
            e.printStackTrace();
@@ -288,7 +338,7 @@
                return this.error(DeviceCode.SYSTEM_FORM_NODATA);
            }
            String result=result_OK_List(deviceMainenanceService.findDeviceMaintenanceSetting(fse.getString(DeviceConst.DEVICE_CODE),fse.getString("type")));
            String result=result_OK_List(deviceMainenanceService.findDeviceMaintenanceSetting(fse.getString(DeviceConst.UUID),fse.getString("type")));
            return result;
        } catch (BaseException e) {
            e.printStackTrace();
@@ -299,7 +349,7 @@
        }
    }
    /**
     * 设备保养配置
     * 设备点检信息保存
     * @throws IOException
     */
    @RequestMapping(value = "/save-inspection/{version}", method = RequestMethod.POST)
@@ -333,8 +383,40 @@
            return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR);
        }
    }
    /**
     * 设备保养信息保存
     * @throws IOException
     */
    @RequestMapping(value = "/save-maintenance/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String saveDevcieMaintenanceController(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);
            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);
        }
    }
    
}