| | |
| | | import org.apache.xpath.operations.Bool; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | //已处理数据 |
| | | internalHomeVO.setNoticeDealNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | &&StringUtils.equals(i.getParam4(),i.getUserId().toString()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ONE) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | |
| | | //我发起的数据 |
| | | internalHomeVO.setNoticeCreateNum( |
| | | noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,memberId)) |
| | | ); |
| | | |
| | | //抄送我的数据 |
| | | internalHomeVO.setNoticeCopyNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) |
| | |
| | | if(CollectionUtils.isNotEmpty(approveCopyList)){ |
| | | this.organizeApproveCopyData(approveTempl,approveParamList,businessId,approveList); |
| | | } |
| | | approveMapper.insertBatchSomeColumn(approveList); |
| | | approveJoinMapper.insert(approveList); |
| | | // approveJoinMapper.insert(approveList); |
| | | |
| | | } |
| | | |
| | |
| | | createUserApprove.setIsdeleted(Constants.ZERO); |
| | | createUserApprove.setTemplatId(approveTempl.getId()); |
| | | createUserApprove.setChekorId(createMember.getId()); |
| | | createUserApprove.setCheckDate(createUserApprove.getCreateDate()); |
| | | createUserApprove.setStatus(Constants.approveStatus.pass); |
| | | createUserApprove.setTitle("发起申请"); |
| | | createUserApprove.setStatusInfo(""); |
| | |
| | | approve.setChekorId(memberId); |
| | | approve.setStatus(i==0?Constants.ONE:Constants.ZERO); |
| | | approve.setStatusInfo(i==0?"审批中":"待审批"); |
| | | approve.setTitle("审批人"); |
| | | approve.setIsEndCheck((i+1) == approveParamList.size()?Constants.ONE:Constants.ZERO); |
| | | approve.setObjId(businessId); |
| | | approve.setLevel(i+1); |
| | |
| | | for(Approve level:levelList){ |
| | | List<Approve> tlist = getLevelInfoFromList(level,approveGroupList); |
| | | approveDateVO.getApproveList().addAll(tlist); |
| | | if(tlist.size() ==0 |
| | | ||Constants.equalsInteger(Constants.approveStatus.unPass, tlist.get(0).getStatus()) |
| | | ||Constants.equalsInteger(Constants.approveStatus.cancel, tlist.get(0).getStatus())){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | waitModel.setApproveList(copyList); |
| | | approveDateVO.getApproveList().add(waitModel); |
| | | } |
| | | System.out.println(JSONObject.toJSONString(approveDateVO)); |
| | | return approveDateVO; |
| | | } |
| | | |
| | |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | waitModel.setCreateDate(approveList.get(Constants.ZERO).getCreateDate()); |
| | | } |
| | | if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.pass)){ |
| | | waitModel.setMemberName("已抄送"+ approveList.size() +"人"); |
| | | }else if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.wait)){ |
| | | waitModel.setMemberName("处理中"); |
| | | } |
| | | waitModel.setApproveList(approveList); |
| | | list.add(waitModel); |
| | | } |
| | | //如果是或签 |
| | | // if(otherPassList.size()>0){ |
| | | // Approve waitModel = new Approve(); |
| | | // waitModel.setApproveType(Constants.ONE); |
| | | // waitModel.setStatusInfo(StringUtils.defaultString(level.getTitle(),"审批人")+"(抄送或签审批人)"); |
| | | // waitModel.setStatus(Constants.ONE); |
| | | // waitModel.setApproveList(otherPassList); |
| | | // list.add(waitModel); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | }else if(Constants.equalsInteger(Constants.approveStatus.auditIng,approve.getStatus())||Constants.equalsInteger(Constants.approveStatus.wait,approve.getStatus())){ |
| | | waitList.add(approve); |
| | | }else if(Constants.equalsInteger(Constants.approveStatus.unPass,approve.getStatus())){ |
| | | refuseModel = approve; |
| | | BeanUtils.copyProperties(approve,refuseModel); |
| | | } |
| | | } |
| | | } |
| | |
| | | .eq(Notices::getUserId,approve.getChekorId()) |
| | | .eq(Notices::getSendacopy,Constants.ZERO) |
| | | .eq(Notices::getIsdeleted,Constants.ZERO) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(Objects.isNull(notices)){ |
| | | log.info("未查询到通知记录"); |
| | |
| | | approve.setCheorId(approveDTO.getLoginUserInfo().getMemberId().toString()); |
| | | approve.setCheckorName(approveDTO.getLoginUserInfo().getRealname()); |
| | | approve.setCheckDate(new Date()); |
| | | approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"已同意":approveDTO.getCheckInfo()); |
| | | approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"已同意":"已驳回"); |
| | | //本级所有 待审批记录 |
| | | List<Approve> approveList = approveJoinMapper.selectJoinList(Approve.class, |
| | | new MPJLambdaWrapper<Approve>() |
| | |
| | | Boolean dealBusinessBean = false; |
| | | //审批驳回情况 |
| | | if(approveDTO.getStatus().equals(Constants.THREE)){ |
| | | dealBusinessBean = true; |
| | | //修改其他所有待审批和审批中记录数据 |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherUnPass) |
| | | .set(Approve::getCheckDate,new Date()) |
| | | .in(Approve::getStatus,Constants.approveStatus.auditIng,Constants.approveStatus.wait) |
| | | .eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | |
| | | ); |
| | | } |
| | | } |
| | | return; |
| | | }else{ |
| | | //处理其他业务数据 |
| | | if((Constants.equalsInteger(approve.getApproveType(),Constants.ZERO) |
| | |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .set(Approve::getCheckDate,new Date()) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | } |
| | | dealBusinessBean = true; |
| | |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .set(Approve::getCheckDate,new Date()) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | } |
| | | /**开启下一级别的数据为待审核**/ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.auditIng) |
| | | .set(Approve::getTitle,"审批人") |
| | | .set(Approve::getCheckDate,new Date()) |
| | | .eq(Approve::getStatus,Constants.approveStatus.wait) |
| | | .eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .eq(Approve::getLevel,(approve.getLevel()+1)) |
| | | ); |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | this.updDriver(approveDTO,approve,false); |
| | | } |
| | | }else if(approve.getApproveType().equals(Constants.ONE)){ |
| | | //会签 且终审 |
| | | //无他人审批的情况 则修改数据状态 |
| | |
| | | .eq(Approve::getType,Constants.ZERO) |
| | | .eq(Approve::getLevel,(approve.getLevel() + Constants.ONE)) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(nextApproveList)){ |
| | | if(CollectionUtils.isEmpty(nextApproveList)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流数据异常"); |
| | | } |
| | | Notices newNotices = new Notices(); |
| | |
| | | visitsMapper.updateById(visits); |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | // 市内外用车申请 |
| | | CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.isNull(carUseBook)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到用车记录"); |
| | | } |
| | | carUseBook.setStatus(approveDTO.getStatus()); |
| | | carUseBook.setEditDate(new Date()); |
| | | carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId()); |
| | | //如果配置修改司机 且 入参了更换后司机信息 |
| | | if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){ |
| | | CarDriver carDriver = carDriverMapper.selectById(approveDTO.getDriverId()); |
| | | if(Objects.isNull(carDriver)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到司机信息"); |
| | | } |
| | | carUseBook.setDriverId(carDriver.getId()); |
| | | } |
| | | carUseBookMapper.updateById(carUseBook); |
| | | this.updDriver(approveDTO,approve,true); |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){ |
| | | //TODO 物流车预约 |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public void updDriver(ApproveDTO approveDTO,Approve approve,Boolean dealBusinessBean){ |
| | | // 市内外用车申请 |
| | | CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.isNull(carUseBook)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到用车记录"); |
| | | } |
| | | if(dealBusinessBean){ |
| | | carUseBook.setStatus(approveDTO.getStatus()); |
| | | }else{ |
| | | if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){ |
| | | carUseBook.setStatus(Constants.ONE); |
| | | } |
| | | } |
| | | carUseBook.setEditDate(new Date()); |
| | | carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId()); |
| | | //如果配置修改司机 且 入参了更换后司机信息 |
| | | if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){ |
| | | CarDriver carDriver = carDriverMapper.selectOne(new QueryWrapper<CarDriver>().lambda() |
| | | .eq(CarDriver::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getStatus,Constants.ZERO) |
| | | .eq(CarDriver::getMemberId,approveDTO.getDriverId())); |
| | | if(Objects.isNull(carDriver)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到司机信息"); |
| | | } |
| | | carUseBook.setDriverId(carDriver.getMemberId()); |
| | | } |
| | | carUseBookMapper.updateById(carUseBook); |
| | | } |
| | | |
| | | |
| | | } |