| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.example.jz.dao.*; |
| | | import com.example.jz.enums.CauseEnums; |
| | | import com.example.jz.exception.BusinessException; |
| | | import com.example.jz.modle.PageParam; |
| | | import com.example.jz.modle.dto.AddReportDto; |
| | | import com.example.jz.modle.dto.CauseDto; |
| | |
| | | |
| | | @Override |
| | | @SneakyThrows |
| | | @Transactional(rollbackFor = BusinessException.class) |
| | | public void loadFile(MultipartFile multipartFile) { |
| | | ArrayList<CauseLoadDto> causeLoadDtos = new ArrayList<>(); |
| | | EasyExcel.read(multipartFile.getInputStream(),CauseLoadDto.class, new AnalysisEventListener<CauseLoadDto>() { |
| | |
| | | a -> { |
| | | Cause cause = new Cause(); |
| | | BeanUtils.copyProperties(a, cause); |
| | | if (StringUtils.isBlank(a.getStatus())){ |
| | | throw new BusinessException("状态不能为空"); |
| | | } |
| | | if (a.getStatus().equals(CauseEnums.UNCHECKED.getMsg())) { |
| | | cause.setStatus(CauseEnums.UNCHECKED.value()); |
| | | } |
| | |
| | | cause.setStatus(CauseEnums.HASBEENDROPPED.value()); |
| | | } |
| | | cause.setCtime(new Date()); |
| | | if (StringUtils.isBlank(a.getUserName())){ |
| | | throw new BusinessException("负责人不允许为空"); |
| | | } |
| | | if (userDao.selectOne(new QueryWrapper<User>().eq("real_name", a.getUserName()))==null){ |
| | | throw new BusinessException("负责人不存在"); |
| | | } |
| | | cause.setUserId(userDao.selectOne(new QueryWrapper<User>().eq("real_name", a.getUserName())).getId()); |
| | | causeDao.insert(cause); |
| | | }); |