| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFDateUtil; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.util.DateUtils; |
| | |
| | | currentDate = c.getTime(); |
| | | OperationCertificate operationCertificate = new OperationCertificate(); |
| | | operationCertificate.setNum(identityService.getNumByTypeAndLength("OperationCertificate", 4)); |
| | | operationCertificate.setUserId(operationCertificateApplyDetail.getUserId()); |
| | | SysUser sysUser = userService.getById(operationCertificateApplyDetail.getUserId()); |
| | | if(sysUser != null){ |
| | | operationCertificate.setUserId(sysUser.getUsername()); |
| | | } |
| | | operationCertificate.setEquipmentIds(operationCertificateApplyDetail.getEquipmentIds()); |
| | | operationCertificate.setCurrentCycleScore(12); |
| | | operationCertificate.setIssueDate(new Date()); |
| | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param operationCertificatePage |
| | | * @param operationCertificate |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "操作证书管理-编辑") |
| | | @ApiOperation(value="操作证书管理-编辑", notes="操作证书管理-编辑") |
| | | //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_operation_certificate:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody OperationCertificatePage operationCertificatePage) { |
| | | OperationCertificate operationCertificate = new OperationCertificate(); |
| | | BeanUtils.copyProperties(operationCertificatePage, operationCertificate); |
| | | public Result<String> edit(@RequestBody OperationCertificate operationCertificate) { |
| | | // OperationCertificate operationCertificate = new OperationCertificate(); |
| | | // BeanUtils.copyProperties(operationCertificatePage, operationCertificate); |
| | | OperationCertificate operationCertificateEntity = operationCertificateService.getById(operationCertificate.getId()); |
| | | if(operationCertificateEntity==null) { |
| | | return Result.error("未找到对应数据"); |
| | | } |
| | | operationCertificateService.updateMain(operationCertificate, operationCertificatePage.getOperationCertificateDetailList()); |
| | | return Result.OK("编辑成功!"); |
| | | operationCertificateService.updateMain(operationCertificate, operationCertificate.getOperationCertificateDetailList()); |
| | | return Result.OK("操作证扣分成功!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | OperationCertificateImportVo operationCertificateImportVo = list.get(i); |
| | | OperationCertificate operationCertificate = new OperationCertificate(); |
| | | operationCertificate.setNum(identityService.getNumByTypeAndLength("OperationCertificate",4)); |
| | | //判空 |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getName())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:人员不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getTechnicalLevel())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:技能等级不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getProfession())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:工种不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getWorkNo())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:工作证号不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getAppointmentCardNum())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:上岗证号不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getEquipmentNum())){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:统一编号不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(operationCertificateImportVo.getIssueDate() == null){ |
| | | errorMessage.add("第" + (i + 1) + "行导入失败,原因:发证日期不能为空!"); |
| | | errorLines++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isBlank(operationCertificateImportVo.getNum())){ |
| | | operationCertificate.setNum(identityService.getNumByTypeAndLength("OperationCertificate",4)); |
| | | }else { |
| | | operationCertificate.setNum(operationCertificateImportVo.getNum()); |
| | | } |
| | | //根据人员姓名查询人员id |
| | | List<SysUser> userList = userService.lambdaQuery().eq(SysUser::getRealname,operationCertificateImportVo.getName().trim()) |
| | | .eq(SysUser::getWorkNo,operationCertificateImportVo.getWorkNo().trim()).eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0).list(); |
| | |
| | | } catch (Exception e) { |
| | | errorMessage.add("发生异常:" + e.getMessage()); |
| | | log.error(e.getMessage(), e); |
| | | return (Result<?>) errorMessage; |
| | | return Result.error(errorMessage.toString()); |
| | | // return (Result<?>) errorMessage; |
| | | } finally { |
| | | try { |
| | | file.getInputStream().close(); |