| | |
| | | return Result.error("请选择有效参数!"); |
| | | } |
| | | boolean result = mdcDeviceCalendarService.saveCalendar(calendarVo); |
| | | if(result){ |
| | | if (result) { |
| | | return Result.OK("保存成功"); |
| | | }else{ |
| | | } else { |
| | | return Result.error("未选择班次!"); |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "设备工作日历表-通过id删除", notes = "设备工作日历表-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | Date date = new Date(); |
| | | MdcDeviceCalendar mdcDeviceCalendar = mdcDeviceCalendarService.getById(id); |
| | | String todayDay = DateUtils.format(new Date(), DateUtils.STRDATE); |
| | | String todayDay = DateUtils.format(date, DateUtils.STRDATE); |
| | | String effectiveDate = mdcDeviceCalendar.getEffectiveDate(); |
| | | MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); |
| | | boolean b = Integer.parseInt(todayDay) > Integer.parseInt(effectiveDate); |
| | | if (mdcSystemParameters != null) { |
| | | String time = mdcSystemParameters.getValue(); |
| | | Date keyDate = DateUtils.setTimeForDay(new Date(), time); |
| | | Date keyDate = DateUtils.setTimeForDay(date, time); |
| | | // 20230920 20230910 20230922 |
| | | if (Integer.parseInt(todayDay) <= Integer.parseInt(effectiveDate)) { |
| | | mdcDeviceCalendarService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } else if (b && keyDate.before(new Date())) { |
| | | } else if ((Integer.parseInt(todayDay) - Integer.parseInt(effectiveDate)) == 1 && keyDate.after(date)) { |
| | | mdcDeviceCalendarService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | } else { |
| | | if (b) { |
| | | return Result.error("删除失败!"); |
| | | if (Integer.parseInt(todayDay) > Integer.parseInt(effectiveDate)) { |
| | | return Result.error("删除失败!此配置已作为设备基础数据计算效率!"); |
| | | } |
| | | mdcDeviceCalendarService.removeById(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | return Result.error("删除失败!"); |
| | | return Result.error("删除失败!此配置已作为设备基础数据计算效率!"); |
| | | } |
| | | |
| | | /** |