| | |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsReportService; |
| | | import com.ruoyi.inspect.service.RawMaterialOrderService; |
| | | import com.ruoyi.inspect.service.SealUsageLedgerService; |
| | | import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler; |
| | | import com.ruoyi.inspect.util.ReportSealLayoutUtil; |
| | | import com.ruoyi.inspect.util.ReportSignaturePictureUtils; |
| | |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private InsReportMapper insReportMapper; |
| | | @Resource |
| | | private SealUsageLedgerService sealUsageLedgerService; |
| | | @Resource |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int ratifyReport(Integer id, Integer isRatify, String ratifyTell, String sealIds, |
| | | Integer maSealId, Integer reportSealId, Integer seamSealId) { |
| | | InsReport insReport = insReportMapper.selectById(id); |
| | | if (id == null || (isRatify == null || (isRatify != 0 && isRatify != 1))) { |
| | | throw new ErrorException("批准参数不正确"); |
| | | } |
| | | InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getId, id) |
| | | .last("FOR UPDATE")); |
| | | if (insReport == null) { |
| | | throw new ErrorException("报告不存在"); |
| | | } |
| | | if (Objects.equals(insReport.getIsRatify(), 1)) { |
| | | throw new ErrorException("报告已批准,请勿重复操作"); |
| | | } |
| | | if (Objects.equals(insReport.getExamineUserId(), SecurityUtils.getUserId().intValue())) { |
| | | throw new ErrorException("审核人和批准人不能为同一人,请重新选择批准人"); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | return insReportMapper.updateById(insReport); |
| | | int affected = insReportMapper.updateById(insReport); |
| | | if (affected != 1) { |
| | | throw new ErrorException("报告批准状态保存失败"); |
| | | } |
| | | sealUsageLedgerService.recordApprovedReport(insReport); |
| | | return affected; |
| | | } |
| | | |
| | | /** |