| | |
| | | package com.product.device.controller; |
| | | |
| | | |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | import com.product.util.BaseUtil; |
| | | import com.product.util.support.AbstractBaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import net.bytebuddy.asm.Advice.This; |
| | | |
| | | import com.product.device.service.DeviceMainenanceService; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.druid.util.StringUtils; |
| | | import com.product.admin.service.idel.ISystemMenusService; |
| | | import com.product.core.config.CoreConst; |
| | | import com.product.core.controller.support.AbstractBaseController; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.entity.RequestParameterEntity; |
| | | 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.QuickResponseService; |
| | | import com.product.device.service.ide.IDeviceMainenanceService; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | |
| | | import java.io.IOException; |
| | | /** |
| | | * 设备维修 |
| | | */ |
| | | /** |
| | | * 设备保养 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/device/maintenance") |
| | | public class DeviceMaintenanceController extends AbstractBaseController { |
| | | @Autowired |
| | | DeviceMainenanceService deviceMainenanceService; |
| | | |
| | | |
| | | |
| | | public class DeviceMaintenanceController extends AbstractBaseController { |
| | | @Autowired |
| | | DeviceMainenanceService deviceMainenanceService; |
| | | |
| | | |
| | | @PostMapping("/{version}") |
| | | @ApiVersion(1) |
| | | public String getMaintainByCurrentYear(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.getMaintainByCurrentYear(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/month/{version}") |
| | | @ApiVersion(1) |
| | | public String getMaintainMonth(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.getMaintainMonth(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复核维保记录 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/review/{version}") |
| | | @ApiVersion(1) |
| | | public String reviewRecord(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | if (!deviceMainenanceService.maintenanceReview(fse)) { |
| | | //更新失败 |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_REVIEW_FAIL); |
| | | } |
| | | return OK(); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保统计 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/year-maintenance/{version}") |
| | | @ApiVersion(1) |
| | | public String yearMaintenance(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.yearMaintenance(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_YEAR_FAIL, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保任务完成情况 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/year-maintenance-finish/{version}") |
| | | @ApiVersion(1) |
| | | public String yearMaintenanceFinish(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.yearMaintenanceFinish(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_YEAR_FINISH_FAIL, e); |
| | | } |
| | | } |
| | | } |