| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.usermodel.CellType; |
| | |
| | | Map<String, XSSFPictureData> pics = ie.getExcelPictures(); |
| | | if(type == 1) { |
| | | List<CasesImport> importList = (ie.getDataList(CasesImport.class,null)); |
| | | model.setCaseList(isvalidImpartCasesParam(loginUserInfo,pics,importList)); |
| | | model.setCaseList(isvalidImpartCasesParam(loginUserInfo,importList)); |
| | | model.setTotalNum(model.getCaseList().size()); |
| | | }else{ |
| | | List<MemberImport> importList = (ie.getDataList(MemberImport.class,null)); |
| | | model.setMemberList(isvalidImpartMemberParam(loginUserInfo,categoryList,pics,importList)); |
| | | model.setMemberList(isvalidImpartMemberParam(loginUserInfo,categoryList,importList)); |
| | | model.setTotalNum(model.getMemberList().size()); |
| | | } |
| | | importRecordMapper.insert(model); |
| | |
| | | // redisTemplate.delete(Constants.RedisKeys.IMPORTING_RECORD); |
| | | } |
| | | } |
| | | private List<Member> isvalidImpartMemberParam(LoginUserInfo user, List<Category> categoryList ,Map<String, XSSFPictureData> pics, List<MemberImport> memberList) { |
| | | private List<Member> isvalidImpartMemberParam(LoginUserInfo user, List<Category> categoryList , List<MemberImport> memberList) { |
| | | if(memberList ==null || memberList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,未读取到有效数据"); |
| | | } |
| | | if(pics ==null || pics.size()==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,未读取到任何职业照图片数据"); |
| | | } |
| | | List<Member> insertMember = new ArrayList<>(); |
| | | List<Member> allList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | |
| | | return insertMember; |
| | | |
| | | } |
| | | private List<Cases> isvalidImpartCasesParam(LoginUserInfo user, Map<String, XSSFPictureData> pics, List<CasesImport> casesImportList) { |
| | | private List<Cases> isvalidImpartCasesParam(LoginUserInfo user, List<CasesImport> casesImportList) { |
| | | if(casesImportList ==null || casesImportList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,未读取到有效数据"); |
| | | } |
| | | if(pics ==null || pics.size()==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,未读取到任何职业照图片数据"); |
| | | } |
| | | List<Cases> insertList = new ArrayList<>(); |
| | | List<Member> allList = memberMapper.selectList(new QueryWrapper<Member>().lambda() |
| | |
| | | param.getImageList().addAll(param.getImageList3()!=null?param.getImageList3():new ArrayList<>()); |
| | | param.getImageList().addAll(param.getImageList4()!=null?param.getImageList4():new ArrayList<>()); |
| | | param.getImageList().addAll(param.getImageList5()!=null?param.getImageList5():new ArrayList<>()); |
| | | /* if(param.getImageList() == null |
| | | /* if(param.getImageList() == null |
| | | ||param.getImageList().size() == 0 ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据, 案例图信息不能为空"); |
| | | }*/ |
| | |
| | | List<ImportRecord> records = importRecordMapper.selectList(new QueryWrapper<ImportRecord>() |
| | | .select("id,total_num,(select count(c.id) from cases c where c.import_id= import_record.id) as doneNum") |
| | | .lambda() |
| | | .eq(ImportRecord::getDetail,Constants.ZERO) |
| | | .eq(ImportRecord::getDeleted,Constants.ZERO) |
| | | .ne(ImportRecord::getStatus,Constants.TWO) |
| | | ); |
| | | for(ImportRecord importRecord : records){ |