| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | |
| | | 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; |
| | |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.xpath.operations.Bool; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @date 2023/12/28 14:09 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApproveServiceImpl implements ApproveService { |
| | | |
| | | @Autowired |
| | |
| | | /** |
| | | * 内部人员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; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | waitModel.setApproveList(copyList); |
| | | approveDateVO.getApproveList().add(waitModel); |
| | | } |
| | | |
| | | return approveDateVO; |
| | | } |
| | | |
| | |
| | | ||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; |
| | | } |
| | |
| | | if(!approve.getStatus().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批记录状态错误!"); |
| | | } |
| | | |
| | | //根据审批记录查询 当前处理数据对应的 通知记录 |
| | | Integer noticeType = Constants.approveTypeToNoticeType(approve.getObjType()); |
| | | Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() |
| | | .eq(Notices::getObjId,approve.getObjId()) |
| | | .eq(Notices::getObjType,noticeType) |
| | | .eq(Notices::getUserId,approve.getChekorId()) |
| | | .eq(Notices::getSendacopy,Constants.ZERO) |
| | | .eq(Notices::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | if(Objects.isNull(notices)){ |
| | | log.info("未查询到通知记录"); |
| | | return; |
| | | } |
| | | //处理审批信息 |
| | | approve.setStatus(approveDTO.getStatus()); |
| | | approve.setCheckInfo(approveDTO.getCheckInfo()); |
| | |
| | | approve.setCheckorName(approveDTO.getLoginUserInfo().getRealname()); |
| | | approve.setCheckDate(new Date()); |
| | | approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"已同意":approveDTO.getCheckInfo()); |
| | | Visits visits = new Visits(); |
| | | CarUseBook carUseBook = new CarUseBook(); |
| | | this.dealBusinessData(approveDTO,approve,visits,carUseBook); |
| | | //本级所有 待审批记录 |
| | | List<Approve> approveList = approveJoinMapper.selectJoinList(Approve.class, |
| | | new MPJLambdaWrapper<Approve>() |
| | |
| | | .eq(Approve::getObjType,approveDTO.getObjType()) |
| | | .eq(Approve::getLevel,approve.getLevel()) |
| | | .eq(Approve::getStatus,Constants.ONE) |
| | | .eq(Approve::getType,Constants.ZERO) |
| | | .ne(Approve::getId,approve.getId()) |
| | | ); |
| | | //业务数据下配置的所有抄送记录 |
| | | List<Approve> approveCopyList = approveJoinMapper.selectJoinList(Approve.class, |
| | | new MPJLambdaWrapper<Approve>() |
| | | .selectAll(Approve.class) |
| | | .eq(Approve::getIsdeleted,Constants.ZERO) |
| | | .eq(Approve::getObjId,approveDTO.getObjId()) |
| | | .eq(Approve::getObjType,approveDTO.getObjType()) |
| | | .eq(Approve::getType,Constants.ONE) |
| | | ); |
| | | //处理本次审批的业务数据 |
| | | approveMapper.updateById(approve); |
| | |
| | | .eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .ne(Approve::getId,approve.getId())); |
| | | //处理所有Notice通知为已处理 |
| | | if(approve.getApproveType().equals(Constants.ZERO)){ |
| | | //修改自己的通知记录 |
| | | 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,Constants.TWO) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .eq(Notices::getId,notices.getId()) |
| | | ); |
| | | //修改 未处理的 通知数据 为抄送 |
| | | if (!Constants.equalsInteger(approve.getApproveType(),Constants.TWO)){ |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getSendacopy,Constants.ONE) |
| | | .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) |
| | | .ne(Notices::getId,notices.getId()) |
| | | ); |
| | | } |
| | | } |
| | | return; |
| | | }else{ |
| | | //处理其他业务数据 |
| | | if((approve.getApproveType().equals(Constants.ZERO) |
| | | || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()==Constants.ONE){ |
| | | 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() |
| | |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .eq(Approve::getLevel,(approve.getLevel()+1)) |
| | | ); |
| | | //TODO 更新消息数据 发送下一级数据消息 |
| | | }else if(approve.getApproveType().equals(Constants.ONE)&&approve.getIsEndCheck()==Constants.ONE){ |
| | | //会签 且终审 |
| | | if(approveList.size()==Constants.ZERO){ |
| | | }else if(approve.getApproveType().equals(Constants.ONE)){ |
| | | //会签 且终审 |
| | | //无他人审批的情况 则修改数据状态 |
| | | if(Constants.equalsInteger(approveList.size(),Constants.ZERO)&&Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){ |
| | | dealBusinessBean = true; |
| | | } |
| | | } |
| | | this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO); |
| | | } |
| | | |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ |
| | | // 访客 三类业务数据 |
| | | visitsMapper.updateById(visits); |
| | | if(dealBusinessBean){ |
| | | //TODO 发送审批通过消息 |
| | | |
| | | }else if(approveDTO.getStatus().equals(Constants.THREE)){ |
| | | //TODO 审批未通过通知 |
| | | |
| | | } |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | // 市内外用车申请 |
| | | if(dealBusinessBean){ |
| | | //TODO 发送审批通过消息 |
| | | carUseBookMapper.updateById(carUseBook); |
| | | }else if(approveDTO.getStatus().equals(Constants.THREE)){ |
| | | //TODO 审批未通过通知 |
| | | |
| | | } |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){ |
| | | //TODO 物流车预约 |
| | | |
| | | //处理业务数据 |
| | | if(dealBusinessBean){ |
| | | this.dealBusinessData(approveDTO,approve); |
| | | } |
| | | } |
| | | |
| | | public void passNextNotices(Boolean dealBusinessBean,Approve approve){ |
| | | //根据审批记录查询 通知记录 |
| | | Integer noticeType = Constants.approveTypeToNoticeType(approve.getObjType()); |
| | | Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda() |
| | | .eq(Notices::getObjId,approve.getObjId()) |
| | | .eq(Notices::getObjType,noticeType) |
| | | .eq(Notices::getUserId,approve.getChekorId()) |
| | | .eq(Notices::getSendacopy,Constants.ZERO) |
| | | .eq(Notices::getIsdeleted,Constants.ZERO) |
| | | /** |
| | | * 处理待办信息 |
| | | * @param dealBusinessBean 是否需要进行更新业务数据状态 |
| | | * @param approve 审批记录 |
| | | * @param approveList 同级待审批数据 |
| | | */ |
| | | 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(Notices::getStatus,Constants.ONE) |
| | | .set(dealBusinessBean,Notices::getParam2,Constants.ONE) |
| | | .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId()) |
| | | .eq(Notices::getId,notices.getId()) |
| | | ); |
| | | if(Objects.isNull(notices)){ |
| | | return; |
| | | } |
| | | |
| | | |
| | | if(Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)){ |
| | | //或签 |
| | | //1、修改自己的数据记录 |
| | | |
| | | //2、更新他人的同级记录 为抄送 |
| | | |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda() |
| | | .set(Notices::getEditDate,new Date()) |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(Notices::getSendacopy,Constants.ONE) |
| | | .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()) |
| | | ); |
| | | //3、如果不是终审生成下一级的数据记录 |
| | | |
| | | |
| | | if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)&&!dealBusinessBean){ |
| | | this.saveNextNotice(notices,approve); |
| | | } |
| | | }else if(Constants.equalsInteger(approve.getApproveType(),Constants.ONE)){ |
| | | //会签 |
| | | //1、修改自己的数据记录 |
| | | |
| | | //2、根据是否为最后一位审批人 如果不是 则结束 |
| | | |
| | | //3、 如果是最后一位审批人 且不是终审开启下一级数据 |
| | | |
| | | //2、如果是最后一位审批人 且不是终审开启下一级数据 |
| | | if(Constants.equalsInteger(Constants.ZERO,approveList.size())){ |
| | | if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ |
| | | this.saveNextNotice(notices,approve); |
| | | } |
| | | } |
| | | }else{ |
| | | //单人签 |
| | | //1、修改自己的数据记录 |
| | | |
| | | //2、 是否是终审 开启下一级数据 |
| | | if(Constants.equalsInteger(approve.getIsEndCheck(),Constants.ZERO)){ |
| | | this.saveNextNotice(notices,approve); |
| | | } |
| | | } |
| | | //终审业务 且 处理数据 进行抄送发送 |
| | | if (Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE) && dealBusinessBean) { |
| | | if(CollectionUtils.isNotEmpty(copyList)){ |
| | | Notices copyNotices = new Notices(); |
| | | for (Approve copyApprove:copyList) { |
| | | if(Objects.isNull(copyNotices)){ |
| | | BeanUtils.copyProperties(notices,copyNotices); |
| | | notices.setId(null); |
| | | 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.setReaded(Constants.ZERO); |
| | | noticesJoinMapper.insert(notices); |
| | | }else{ |
| | | notices.setId(null); |
| | | notices.setUserId(copyApprove.getChekorId()); |
| | | noticesJoinMapper.insert(notices); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | //业务通过 修改审批对应消息记录 |
| | | if(Constants.equalsInteger(approve.getStatus(),Constants.approveStatus.pass)){ |
| | | |
| | | } |
| | | // |
| | | |
| | | //终审业务 发送抄送 |
| | | if (Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)) { |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public void dealBusinessData(ApproveDTO approveDTO,Approve approve,Visits visits,CarUseBook carUseBook){ |
| | | |
| | | public void saveNextNotice(Notices notices,Approve approve){ |
| | | List<Approve> nextApproveList = approveJoinMapper.selectList(new QueryWrapper<Approve>() |
| | | .lambda() |
| | | .eq(Approve::getObjId,approve.getObjId()) |
| | | .eq(Approve::getObjType,approve.getObjType()) |
| | | .eq(Approve::getType,Constants.ZERO) |
| | | .eq(Approve::getLevel,(approve.getLevel() + Constants.ONE)) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(nextApproveList)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"审批流数据异常"); |
| | | } |
| | | Notices newNotices = new Notices(); |
| | | for (Approve nextDealApprove:nextApproveList) { |
| | | if(Objects.isNull(newNotices)){ |
| | | BeanUtils.copyProperties(notices,newNotices); |
| | | notices.setId(null); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setParam2("0"); |
| | | notices.setParam3(""); |
| | | notices.setEditDate(new Date()); |
| | | notices.setUserId(nextDealApprove.getChekorId()); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setReaded(Constants.ZERO); |
| | | noticesJoinMapper.insert(notices); |
| | | }else{ |
| | | notices.setId(null); |
| | | notices.setUserId(nextDealApprove.getChekorId()); |
| | | noticesJoinMapper.insert(notices); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void dealBusinessData(ApproveDTO approveDTO,Approve approve){ |
| | | if(approveDTO.getObjType().equals(Constants.approveObjectType.unConstructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.constructionVisit) |
| | | ||approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)){ |
| | | // 访客 三类业务数据 |
| | | visits = visitsMapper.selectById(approveDTO.getObjId()); |
| | | Visits visits = visitsMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.isNull(visits)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到申请记录"); |
| | | } |
| | | visits.setStatus(approveDTO.getStatus()); |
| | | visits.setEditDate(new Date()); |
| | | visits.setEditor(approveDTO.getLoginUserInfo().getMemberId()); |
| | | |
| | | |
| | | visitsMapper.updateById(visits); |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals( |
| | | Constants.approveObjectType.unCityUseCar)){ |
| | | // 市内外用车申请 |
| | | carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); |
| | | CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId()); |
| | | if(Objects.isNull(carUseBook)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到用车记录"); |
| | | } |
| | |
| | | } |
| | | carUseBook.setDriverId(carDriver.getId()); |
| | | } |
| | | |
| | | carUseBookMapper.updateById(carUseBook); |
| | | }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){ |
| | | //TODO 物流车预约 |
| | | |