| | |
| | | import com.doumee.dao.business.join.VisitsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.vo.ApproveDataVO; |
| | | import com.doumee.dao.system.dto.NoticesDTO; |
| | | import com.doumee.dao.system.join.NoticesJoinMapper; |
| | | import com.doumee.dao.system.model.Notices; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | |
| | | /** |
| | | * 内部人员H5页面首页 |
| | | * @param memberId |
| | | * @param isDetail 是否查询详细 1是;0否 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public InternalHomeVO getHomeData(Integer memberId){ |
| | | public InternalHomeVO getHomeDataH5(Integer memberId,Integer isDetail){ |
| | | InternalHomeVO internalHomeVO = new InternalHomeVO(); |
| | | internalHomeVO.setHomeImg(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.HOME_IMAGE).getCode()); |
| | | internalHomeVO.setTaskNum(approveMapper.selectCount(new QueryWrapper<Approve>().lambda().eq(Approve::getChekorId,memberId).eq(Approve::getStatus,Constants.ZERO))); |
| | | //任务数据 |
| | | List<Notices> noticesList = noticesJoinMapper. |
| | | selectList(new QueryWrapper<Notices>().lambda() |
| | | .eq(Notices::getUserId,memberId).orderByDesc(Notices::getCreateDate)); |
| | | internalHomeVO.setTaskNum(noticesList.size()); |
| | | if(Constants.equalsInteger(Constants.ONE,isDetail)){ |
| | | if(CollectionUtils.isNotEmpty(noticesList)){ |
| | | //待我处理的数据 |
| | | internalHomeVO.setNoticeWaitNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | internalHomeVO.setNoticeDealNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId) |
| | | &&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) |
| | | ).count() |
| | | ); |
| | | } |
| | | } |
| | | |
| | | return internalHomeVO; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public InternalHomeVO getHomeDataPC(NoticesDTO noticesDTO){ |
| | | InternalHomeVO internalHomeVO = new InternalHomeVO(); |
| | | internalHomeVO.setHomeImg(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.HOME_IMAGE).getCode()); |
| | | //任务数据 |
| | | List<Notices> noticesList = noticesJoinMapper. |
| | | selectList(new QueryWrapper<Notices>().lambda() |
| | | .ge(noticesDTO.getStartDate() != null, Notices::getCreateDate, Utils.Date.getStart(noticesDTO.getStartDate() )) |
| | | .le(noticesDTO.getEndDate() != null, Notices::getCreateDate, Utils.Date.getEnd(noticesDTO.getEndDate() )) |
| | | .eq(noticesDTO.getType() != null, Notices::getType, noticesDTO.getType()) |
| | | .eq(Notices::getUserId,noticesDTO.getMemberId()) |
| | | .orderByDesc(Notices::getCreateDate) |
| | | ); |
| | | internalHomeVO.setTaskNum(noticesList.size()); |
| | | if(CollectionUtils.isNotEmpty(noticesList)){ |
| | | //待我处理的数据 |
| | | internalHomeVO.setNoticeWaitNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ZERO) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | internalHomeVO.setNoticeDealNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getStatus(),Constants.ONE) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO) |
| | | ).count() |
| | | ); |
| | | |
| | | internalHomeVO.setNoticeCreateNum( |
| | | noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,noticesDTO.getMemberId())) |
| | | ); |
| | | |
| | | internalHomeVO.setNoticeCopyNum( |
| | | noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId()) |
| | | &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE) |
| | | ).count() |
| | | ); |
| | | } |
| | | |
| | | return internalHomeVO; |
| | | } |
| | | |
| | | /** |
| | | * 创建审批流程 |
| | |
| | | * @param approveList |
| | | */ |
| | | public void organizeApproveData(ApproveTempl approveTempl,List<ApproveParam> approveParamList,Member createMember,Integer businessId,List<Approve> approveList){ |
| | | |
| | | //创建默认人信息 |
| | | Approve createUserApprove = new Approve(); |
| | | createUserApprove.setRemark("发起申请"); |
| | | createUserApprove.setCreateDate(new Date()); |
| | | createUserApprove.setIsdeleted(Constants.ZERO); |
| | | createUserApprove.setTemplatId(approveTempl.getId()); |
| | | createUserApprove.setChekorId(createMember.getId()); |
| | | createUserApprove.setStatus(Constants.approveStatus.pass); |
| | | createUserApprove.setTitle("发起申请"); |
| | | createUserApprove.setStatusInfo(""); |
| | | createUserApprove.setIsEndCheck(Constants.ZERO); |
| | | createUserApprove.setObjId(businessId); |
| | | createUserApprove.setLevel(-1); |
| | | createUserApprove.setObjType(approveTempl.getType()); |
| | | createUserApprove.setApproveType(Constants.TWO); |
| | | createUserApprove.setDriverParam(Constants.ZERO); |
| | | createUserApprove.setAddrParam(Constants.ZERO); |
| | | createUserApprove.setType(Constants.ZERO); |
| | | approveList.add(createUserApprove); |
| | | |
| | | //审批业务数据 |
| | | for (int i = 0; i < approveParamList.size(); i++) { |
| | | ApproveParam approveParam = approveParamList.get(i); |
| | |
| | | if(i==0){ |
| | | if(jsonMap.isEmpty()){ |
| | | title = this.createNoticesData(noticeType,businessId,title,jsonMap); |
| | | } |
| | | if(j==0){ |
| | | //默认生成一条 申请人的数据 标记删除状态用于处理到 任务中心(我发起)使用 |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setIsdeleted(Constants.ONE); |
| | | notices.setObjId(businessId); |
| | | notices.setObjType(noticeType); |
| | | notices.setType(noticeType); |
| | | notices.setTitle(title); |
| | | notices.setParam1(JSONObject.toJSONString(jsonMap)); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setReaded(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(createMember.getId().toString()); |
| | | notices.setInfo("处理中"); |
| | | noticesJoinMapper.insert(notices); |
| | | } |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | |
| | | notices.setReaded(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(""); |
| | | notices.setInfo("待处理"); |
| | | noticesJoinMapper.insert(notices); |
| | | } |
| | |
| | | List<Approve> levelList = getLevelListFromResult(approveGroupList,approveDateVO,memberId); |
| | | List<Approve> copyList = getAllCopyList(approveGroupList); |
| | | //遍历level查询每一级别业务数据 |
| | | 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; |
| | | if(levelList!=null){ |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | ||Constants.equalsInteger(level.getStatus(),Constants.approveStatus.pass)){ |
| | | waitModel.setMemberName(waitList.size() +"人会签"); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(waitList)){ |
| | | waitModel.setCreateDate(waitList.get(Constants.ZERO).getCreateDate()); |
| | | } |
| | | waitModel.setApproveList(waitList); |
| | | list.add(waitModel); |
| | | }else if(waitList.size()>0){ |
| | |
| | | //如果是或签 |
| | | if(passList.size()>0){ |
| | | approveList.addAll(otherPassList); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | waitModel.setCreateDate(approveList.get(Constants.ZERO).getCreateDate()); |
| | | } |
| | | waitModel.setMemberName("已抄送"+ approveList.size() +"人"); |
| | | waitModel.setApproveList(approveList); |
| | |
| | | } |
| | | } |
| | | if(CollectionUtils.isEmpty(approveList)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批信息:级别数据异常"); |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批信息:级别数据异常"); |
| | | } |
| | | return approveList; |
| | | } |
| | |
| | | //修改自己的通知记录 |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(Notices::getParam2,approve.getStatus()) |
| | | .set(Notices::getParam2,Constants.TWO) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .eq(Notices::getId,notices.getId()) |
| | | ); |
| | | //修改 未处理的 通知数据 为抄送 |
| | |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getSendacopy,Constants.ONE) |
| | | .set(Notices::getParam2,approve.getStatus()) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .set(Notices::getParam2,Constants.TWO) |
| | | .eq(Notices::getObjId,notices.getObjId()) |
| | | .eq(Notices::getObjType,notices.getObjType()) |
| | | .eq(Notices::getReaded,Constants.ZERO) |
| | |
| | | if((Constants.equalsInteger(approve.getApproveType(),Constants.ZERO) |
| | | || Constants.equalsInteger( approve.getApproveType(),Constants.TWO)) && Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){ |
| | | //或签 / 单人审 且 终审 |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | } |
| | | dealBusinessBean = true; |
| | | }else if((approve.getApproveType().equals(Constants.ZERO) |
| | | || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()!=Constants.ONE){ |
| | | //或签 / 单人审 非终审 则开启下一步业务流程 |
| | | /**处理本级数据**/ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isNotEmpty(approveList)){ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | | .set(Approve::getStatus,Constants.approveStatus.otherDeal) |
| | | .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList()))); |
| | | } |
| | | /**开启下一级别的数据为待审核**/ |
| | | approveJoinMapper.update(null,new UpdateWrapper<Approve>() |
| | | .lambda() |
| | |
| | | dealBusinessBean = true; |
| | | } |
| | | } |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList); |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO); |
| | | } |
| | | //处理业务数据 |
| | | if(dealBusinessBean){ |
| | |
| | | * @param approve 审批记录 |
| | | * @param approveList 同级待审批数据 |
| | | */ |
| | | public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList){ |
| | | public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO){ |
| | | //1、修改自己的数据记录 |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(dealBusinessBean,Notices::getParam2,approve.getStatus()) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .set(dealBusinessBean,Notices::getParam2,Constants.ONE) |
| | | .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) |
| | | .eq(Notices::getId,notices.getId()) |
| | | ); |
| | | if(Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)){ |
| | |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(Notices::getSendacopy,Constants.ONE) |
| | | .set(dealBusinessBean,Notices::getParam2,approve.getStatus()) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) |
| | | .set(dealBusinessBean,Notices::getParam2,Constants.ONE) |
| | | .eq(Notices::getObjId,notices.getObjId()) |
| | | .eq(Notices::getObjType,notices.getObjType()) |
| | | .ne(Notices::getId,notices.getId()) |
| | |
| | | notices.setCreateDate(new Date()); |
| | | notices.setEditDate(new Date()); |
| | | notices.setParam2("2"); |
| | | notices.setParam3(""); |
| | | notices.setUserId(copyApprove.getChekorId()); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ONE); |
| | |
| | | notices.setId(null); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(""); |
| | | notices.setEditDate(new Date()); |
| | | notices.setUserId(nextDealApprove.getChekorId()); |
| | | notices.setStatus(Constants.ZERO); |