| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.exception.ExceptionCast; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.base.entity.SysUpload; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.model.DepartVo; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.lang.reflect.Executable; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IPredictiveWorkPlanService predictiveWorkPlanService; |
| | | |
| | | |
| | | /** |
| | | * 预测性维护方案 列表 |
| | |
| | | return Result.OK("编辑成功!"); |
| | | } |
| | | |
| | | // /** |
| | | // * 通过id删除 |
| | | // * |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // @AutoLog(value = "mom_eam_equipment-通过id删除") |
| | | // @ApiOperation(value="mom_eam_equipment-通过id删除", notes="mom_eam_equipment-通过id删除") |
| | | // //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:delete") |
| | | // @DeleteMapping(value = "/delete") |
| | | // public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | // Equipment equipment = equipmentService.getById(id); |
| | | // equipment.setDelFlag(1); |
| | | // equipmentService.updateById(equipment); |
| | | // return Result.OK("删除成功!"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 批量删除 |
| | | // * |
| | | // * @param ids |
| | | // * @return |
| | | // */ |
| | | // @AutoLog(value = "mom_eam_equipment-批量删除") |
| | | // @ApiOperation(value="mom_eam_equipment-批量删除", notes="mom_eam_equipment-批量删除") |
| | | // //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:deleteBatch") |
| | | // @DeleteMapping(value = "/deleteBatch") |
| | | // public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | // List<String> stringList = Arrays.asList(ids.split(",")); |
| | | // for (String id : stringList) { |
| | | // Equipment equipment = equipmentService.getById(id); |
| | | // equipment.setDelFlag(1); |
| | | // equipmentService.updateById(equipment); |
| | | // } |
| | | //// this.equipmentService.removeByIds(Arrays.asList(ids.split(","))); |
| | | // return Result.OK("批量删除成功!"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 通过id查询 |
| | | // * |
| | | // * @param id |
| | | // * @return |
| | | // */ |
| | | // //@AutoLog(value = "mom_eam_equipment-通过id查询") |
| | | // @ApiOperation(value="mom_eam_equipment-通过id查询", notes="mom_eam_equipment-通过id查询") |
| | | // @GetMapping(value = "/queryById") |
| | | // public Result<Equipment> queryById(@RequestParam(name="id",required=true) String id) { |
| | | // Equipment equipment = equipmentService.getById(id); |
| | | // if(equipment==null) { |
| | | // return Result.error("未找到对应数据"); |
| | | // } |
| | | // return Result.OK(equipment); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 导出excel |
| | | // * |
| | | // * @param request |
| | | // * @param equipment |
| | | // */ |
| | | // //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:exportXls") |
| | | // @RequestMapping(value = "/exportXls") |
| | | // public ModelAndView exportXls(HttpServletRequest request, Equipment equipment) { |
| | | // return super.exportXls(request, equipment, Equipment.class, "mom_eam_equipment"); |
| | | // } |
| | | // |
| | | //// /** |
| | | //// * 通过excel导入数据 |
| | | //// * |
| | | //// * @param request |
| | | //// * @param response |
| | | //// * @return |
| | | //// */ |
| | | //// //@RequiresPermissions("mom_eam_equipment:importExcel") |
| | | //// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | //// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | //// return super.importExcel(request, response, Equipment.class); |
| | | //// } |
| | | // |
| | | // |
| | | // /** |
| | | // * 设备建账 获取组织部门 |
| | | // * qsw 2023-4-28 |
| | | // */ |
| | | // @GetMapping("getSysDeparts") |
| | | // public Result<?> getSysDeparts() { |
| | | // List<DepartVo> sysDeparts = equipmentService.getSysDeparts(); |
| | | // return Result.ok(sysDeparts); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备使用记录 |
| | | // * qsw 2023-7-28 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeUseRecordList") |
| | | // public Result<?> getResumeUseRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeUseRecordList = equipmentService.getResumeUseRecordList(pageNo, pageSize, params); |
| | | // return Result.ok(resumeUseRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备点检记录 |
| | | // * qsw 2023-7-28 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeInspectionRecordList") |
| | | // public Result<?> getResumeInspectionRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeInspectionRecordList = equipmentService.getResumeInspectionRecordList(pageNo, pageSize, params); |
| | | // LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // for (Map<String, Object> record : resumeInspectionRecordList.getRecords()) { |
| | | // String id = (String)record.get("id"); |
| | | // String inspectionType = (String)record.get("inspectionType"); |
| | | // if("日常点检".equals(inspectionType)){ |
| | | // List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() |
| | | // .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | // .eq(InspectionOrderDetail::getJudgmentResult, "fail") |
| | | // .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // |
| | | // List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() |
| | | // .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | // .eq(InspectionOrderDetail::getJudgmentResult,"pass") |
| | | // .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | // }else{ |
| | | // List<SpecialtyInspectionOrderDetail> failCount = specialtyInspectionOrderDetailService.lambdaQuery() |
| | | // .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) |
| | | // .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"fail") |
| | | // .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); |
| | | // |
| | | // List<SpecialtyInspectionOrderDetail> passCount = specialtyInspectionOrderDetailService.lambdaQuery() |
| | | // .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) |
| | | // .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"pass") |
| | | // .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); |
| | | // record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | // } |
| | | // } |
| | | // return Result.ok(resumeInspectionRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备保养记录 |
| | | // * qsw 2023-7-31 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeMaintenanceRecordList") |
| | | // public Result<?> getResumeMaintenanceRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeMaintenanceRecordList = equipmentService.getResumeMaintenanceRecordList(pageNo, pageSize, params); |
| | | // return Result.ok(resumeMaintenanceRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备维修记录 |
| | | // * qsw 2023-7-31 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeRepairRecordList") |
| | | // public Result<?> getResumeRepairRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeRepairRecordList = equipmentService.getResumeRepairRecordList(pageNo, pageSize, params); |
| | | // return Result.ok(resumeRepairRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备检定记录 |
| | | // * qsw 2023-7-31 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeCalibrationRecordList") |
| | | // public Result<?> getResumeCalibrationRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeCalibrationRecordList = equipmentService.getResumeCalibrationRecordList(pageNo, pageSize, params); |
| | | // for (Map<String, Object> record : resumeCalibrationRecordList.getRecords()) { |
| | | // String id = (String)record.get("id"); |
| | | // String status = (String)record.get("status"); |
| | | // String managementMode = (String)record.get("managementMode"); |
| | | // if("4".equals(status)){ |
| | | // if("data".equals(managementMode)){ |
| | | // List<CalibrationOrderDetail> calibrationOrderDetails = calibrationOrderDetailService.lambdaQuery() |
| | | // .eq(CalibrationOrderDetail::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderDetail::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderDetail::getDelFlag,"0").list(); |
| | | // if(calibrationOrderDetails.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // }else{ |
| | | // List<CalibrationOrderReport> calibrationOrderReports = calibrationOrderReportService.lambdaQuery() |
| | | // .eq(CalibrationOrderReport::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderReport::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderReport::getDelFlag, "0").list(); |
| | | // if(calibrationOrderReports.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // return Result.ok(resumeCalibrationRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // *设备履历 获取设备处置记录 |
| | | // * qsw 2023-7-31 |
| | | // */ |
| | | // @GetMapping(value = "/getResumeChangeRecordList") |
| | | // public Result<?> getResumeChangeRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | // IPage<Map<String, Object>> resumeChangeRecordList = equipmentService.getResumeChangeRecordList(pageNo, pageSize, params); |
| | | // return Result.ok(resumeChangeRecordList); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 根据状态查询设备列表 |
| | | // */ |
| | | // @GetMapping(value = "/getEquipmentListByStatus") |
| | | // public Result<IPage<Equipment>> getEquipmentList(Equipment equipment,String status, |
| | | // @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | // @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | // HttpServletRequest req) { |
| | | // QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | // List<String> statusList = Arrays.asList(status.split(",")); |
| | | // Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | // queryWrapper.in("equipment_status",statusList); |
| | | // IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | // return Result.OK(pageList); |
| | | // }/** |
| | | // * 导入 |
| | | // * @return |
| | | // */ |
| | | // @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | // MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | // LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
| | | // String exceptionInfo = ""; |
| | | // int exceptionNum = 0; |
| | | // for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { |
| | | // MultipartFile file = entity.getValue(); |
| | | // ImportParams params = new ImportParams(); |
| | | // params.setNeedSave(true); |
| | | // try { |
| | | // List<EquipmentImportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), EquipmentImportVo.class, params); |
| | | // for(int i = 0;i<list.size();i++){ |
| | | // EquipmentImportVo equipmentImportVo = list.get(i); |
| | | // EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(new QueryWrapper<EquipmentCategory>().eq("name",equipmentImportVo.getEquipmentCategoryName()),false); |
| | | // if( |
| | | // StringUtils.isBlank(equipmentImportVo.getNum()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getName()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getUseId()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentUda1()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getManageId()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getTeamId()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentImportanceId()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentCategoryName()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentStatus()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentUda3()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentUda5()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getEquipmentUda2()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getProjectApprovalNo()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getFundSource()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getAcceptanceCheckDate()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getFactoryNo()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getConstructorId()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getSourceCountry()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getModel()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getSpecification()) |
| | | // || StringUtils.isBlank(equipmentImportVo.getGpo()) |
| | | // ){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:数据有未填项,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // }else if(ObjectUtils.isNull(equipmentCategory)) |
| | | // { |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:该设备所属类别不存在,请先维护设备类别;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else{ |
| | | // Equipment oriEquipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentImportVo.getNum()),false); |
| | | // if(ObjectUtils.isNull(oriEquipment)){ |
| | | // Equipment equipment = new Equipment(); |
| | | // equipment.setNum(equipmentImportVo.getNum()) |
| | | // .setName(equipmentImportVo.getName()) |
| | | // .setUseId(equipmentImportVo.getUseId()) |
| | | // .setEquipmentUda1(equipmentImportVo.getEquipmentUda1()) |
| | | // .setManageId(equipmentImportVo.getManageId()) |
| | | // .setTeamId(equipmentImportVo.getTeamId()) |
| | | // .setEquipmentImportanceId(equipmentImportVo.getEquipmentImportanceId()) |
| | | // .setEquipmentCategoryId(equipmentCategory.getId()) |
| | | // .setSpecificEquipment(equipmentImportVo.getKeyEquipmentIdentification()) |
| | | // .setSecurityConfiguration(equipmentImportVo.getSecurityConfiguration()) |
| | | // .setCoolingSystem(equipmentImportVo.getCoolingSystem()) |
| | | // .setFireExtinguisher(equipmentImportVo.getFireExtinguisher()) |
| | | // .setFireExtinguisherValidityPeriod(equipmentImportVo.getFireExtinguisherValidityPeriod()) |
| | | // .setOperatingSystem(equipmentImportVo.getOperatingSystem()) |
| | | // .setSystem(equipmentImportVo.getSystem()) |
| | | // .setPort(equipmentImportVo.getPort()) |
| | | // .setCoordinateNum(equipmentImportVo.getCoordinateNum()) |
| | | // .setEquipmentStatus(equipmentImportVo.getEquipmentStatus()) |
| | | // .setEquipmentUda3(equipmentImportVo.getEquipmentUda3()) |
| | | // .setEquipmentUda4(equipmentImportVo.getEquipmentUda4()) |
| | | // .setEquipmentUda5(equipmentImportVo.getEquipmentUda5()) |
| | | // .setLocation(equipmentImportVo.getEquipmentUda2()) |
| | | // .setLastVerificationDate(equipmentImportVo.getLeaveFactoryDate()) |
| | | // .setProjectApprovalNo(equipmentImportVo.getProjectApprovalNo()) |
| | | // .setFundSource(equipmentImportVo.getFundSource()) |
| | | // .setAcceptanceCheckDate(equipmentImportVo.getAcceptanceCheckDate()) |
| | | // .setFactoryNumber(equipmentImportVo.getFactoryNo()) |
| | | // .setConstructorId(equipmentImportVo.getConstructorId()) |
| | | // .setSourceCountry(equipmentImportVo.getSourceCountry()) |
| | | // .setModel(equipmentImportVo.getModel()) |
| | | // .setSpecification(equipmentImportVo.getSpecification()) |
| | | // .setGpo(equipmentImportVo.getGpo()); |
| | | // equipmentService.save(equipment); |
| | | // }else { |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:统一编码已存在,数据重复导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // } |
| | | // } |
| | | // if(exceptionNum!=0){ |
| | | // String headInfo = "小导提醒您!设备台账:导入成功"+(list.size()-exceptionNum)+"条,失败"+exceptionNum+"条"; |
| | | // MessageDTO messageDTO = new MessageDTO(); |
| | | // messageDTO.setTitle(headInfo); |
| | | // messageDTO.setFromUser("数据导入小助手-小导"); |
| | | // messageDTO.setCategory("导入操作附加信息"); |
| | | // messageDTO.setContent(exceptionInfo); |
| | | // messageDTO.setToUser(user.getUsername()); |
| | | // sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | // return Result.OK(headInfo+",可在-系统消息-查看导入详情"); |
| | | // } |
| | | // return Result.OK("导入成功,已导入全部数据。"); |
| | | // } catch (Exception e) { |
| | | // log.error(e.getMessage(), e); |
| | | // return Result.error("文件导入失败:" + e.getMessage()); |
| | | // } |
| | | // } |
| | | // return Result.error("文件导入失败!"); |
| | | // } |
| | | //升版 |
| | | @RequestMapping(value = "/revise", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> revise(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { |
| | | predictiveWorkPlanService.revise(predictiveWorkPlan); |
| | | return Result.OK("生版成功!"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/versionTakeEffect", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<String> versionTakeEffect(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { |
| | | |
| | | LambdaQueryChainWrapper<PredictiveWorkPlan> lambdaQuery = predictiveWorkPlanService.lambdaQuery(); |
| | | lambdaQuery.eq(PredictiveWorkPlan::getNum, predictiveWorkPlan.getNum()) |
| | | .eq(PredictiveWorkPlan::getStatus, "2").list(); |
| | | List<PredictiveWorkPlan> predictiveWorkPlanList = lambdaQuery.list(); |
| | | for (PredictiveWorkPlan temp : predictiveWorkPlanList) { |
| | | temp.setStatus("3"); |
| | | predictiveWorkPlanService.updateById(temp); |
| | | } |
| | | boolean b = predictiveWorkPlanService.updateById(predictiveWorkPlan); |
| | | if (b) { |
| | | return Result.OK("生效成功!"); |
| | | } else { |
| | | return Result.error("生效失败!"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/getReviseVersion") |
| | | public Result<?> getReviseVersion(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { |
| | | List<PredictiveWorkPlan> predictiveWorkPlanList = predictiveWorkPlanService.lambdaQuery().eq(PredictiveWorkPlan::getNum, predictiveWorkPlan.getNum()) |
| | | .orderByDesc(PredictiveWorkPlan::getPlanVersion).list(); |
| | | String version = predictiveWorkPlanList.get(0).getPlanVersion(); |
| | | BigDecimal versionB = null; |
| | | if (StringUtils.isBlank(version)) { |
| | | versionB = new BigDecimal(0); |
| | | } else { |
| | | versionB = new BigDecimal(version); |
| | | } |
| | | BigDecimal versionCode = versionB.add(new BigDecimal(1)); |
| | | return Result.ok(versionCode.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
| | | predictiveWorkPlanService.delete(id); |
| | | return Result.OK("删除成功!"); |
| | | } |
| | | |
| | | |
| | | } |