| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.common.EmailService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.sun.corba.se.spi.orbutil.threadpool.Work; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.catalina.Manager; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public Integer create(Workorder workorder) { |
| | | this.isValidBaseParam(workorder); |
| | | workorder.setCreateDate(new Date()); |
| | | workorder.setEditDate(new Date()); |
| | | workorder.setMemberId(workorder.getMemberId()); |
| | | workorder.setIsdeleted(Constants.ZERO); |
| | | workorder.setCode(this.getNextCode(workorder.getType())); |
| | | workorder.setEmailStatus(Constants.ZERO); |
| | | workorder.setCreateDate(new Date()); |
| | | //处理人员类信息 |
| | | this.dealNoticeData(workorder); |
| | | //处理SHE事件状态 |
| | |
| | | * @param csInfo 抄送信息 |
| | | */ |
| | | public void sendQwMsg(Workorder workorder,String qwIds,Member member,String categoryName,Integer contentType,String csInfo){ |
| | | if(Constants.equalsInteger(workorder.getType(),Constants.TWO)){ |
| | | workorder = workorderMapper.selectById(workorder.getDcaRecordId()); |
| | | } |
| | | if(StringUtils.isEmpty(qwIds)){ |
| | | return; |
| | | } |
| | |
| | | qywxSendMsgRequest.setTextcard(textCard); |
| | | QywxUtil.sendMsg(systemDictDataBiz.queryByCode(Constants.QYWX,Constants.QYWX_TOKEN).getCode(), |
| | | qywxSendMsgRequest); |
| | | |
| | | |
| | | //https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=https://dmtest.ahapp.net/lianhelihua_web/&response_type=code&scope=snsapi_base&state={status}#wechat_redirect |
| | | } |
| | | |
| | | private static final String jumpUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={corpId}&redirect_uri={ourUrl}"; |
| | | |
| | | private static final String [] qwDetailUrls = {"/pages/details_she/details_she","/pages/workOrder_dca/workOrder_dca","","/pages/workOrder_she/workOrder_she"}; |
| | | |
| | | /** |
| | | * 通知文案整理 |
| | |
| | | public QywxTextCardMsgRequest dealMessageContent(Workorder workorder,String userName ,String categoryName,Integer contentType,String csInfo){ |
| | | QywxTextCardMsgRequest textCard = new QywxTextCardMsgRequest(); |
| | | String message = ""; |
| | | textCard.setUrl(qwDetailUrls[workorder.getType()]+"?id="+workorder.getId()); |
| | | String url = jumpUrl.replace("{corpId}",systemDictDataBiz.queryByCode(Constants.QYWX,Constants.QYWX_CORPID).getCode()); |
| | | String jumpOurUrl = systemDictDataBiz.queryByCode(Constants.QYWX,Constants.JUMP_OUT_URL).getCode().replace("{status}", |
| | | workorder.getType()+"_"+workorder.getId()); |
| | | textCard.setUrl(url.replace("{ourUrl}",jumpOurUrl)); |
| | | log.error("企微链接地址"+url); |
| | | if(Constants.equalsInteger(workorder.getType(),Constants.ZERO)){ |
| | | textCard.setTitle("【SHE事件上报】"); |
| | | if(Constants.equalsInteger(workorder.getMemberType(),Constants.ZERO)){ |
| | |
| | | }else { |
| | | message = Constants.equalsInteger(workorder.getMemberType(),Constants.ONE)?"同事":"供应商"; |
| | | } |
| | | message = message + "-" + workorder.getMemberNames() + " " + DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm") + workorder.getLocationName() + categoryName; |
| | | message = message + "-" + workorder.getMemberNames() + " " + DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm") + "/" +workorder.getLocationName() + "/" + categoryName; |
| | | textCard.setDescription("<div class=\"normal\">"+message+"</div>"); |
| | | |
| | | }else{ |
| | |
| | | message = message + " <div class=\"normal\">"+ DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm") +"/"+ workorder.getLocationName() +"/"+ categoryName+"</div>"; |
| | | }else{ |
| | | message = message + " <div class=\"normal\">"+ (org.apache.commons.lang3.StringUtils.isNotBlank(userName)?userName:"系统") + (Constants.equalsInteger(contentType,Constants.ZERO)?"任务分配给你":(Constants.equalsInteger(contentType,Constants.ONE)?"对该工单进行了催促,请尽快处理":((Constants.equalsInteger(contentType,Constants.TWO)?"抄送给你":"已处理一项")))) +"</div>"; |
| | | message = message + " <div class=\"normal\">观察主题"+ categoryName +"</div>"; |
| | | message = message + " <div class=\"normal\">观察主题 "+ categoryName +"</div>"; |
| | | message = message + " <div class=\"normal\">符合:"+ workorder.getDcaYesNum() +" 不符合:"+workorder.getDcaNoNum()+"</div>"; |
| | | if(Constants.equalsInteger(contentType,Constants.TWO)){ |
| | | message = message + " <div class=\"normal\">说明:"+ csInfo +"</div>"; |
| | | message = message + " <div class=\"normal\">说明 "+ csInfo +"</div>"; |
| | | } |
| | | } |
| | | textCard.setDescription(message); |
| | |
| | | if (Constants.equalsInteger(workorder.getType(), Constants.THREE) || Constants.equalsInteger(workorder.getType(), Constants.TWO) ) { |
| | | //处理上报日志 DCA工单 日志存储至子业务 不存在于父级 与跌绊滑 |
| | | String logTitle = Constants.equalsInteger(workorder.getType(), Constants.THREE) ? "跌绊滑风险" : "DCA"; |
| | | this.saveLog(null,workorder,Constants.ZERO,workorder.getMemberId(),workOrderStatus.getLogTitle().replace("{title}",logTitle),null,null); |
| | | workorder.setCreateDate(workorder.getSubmitDate()); |
| | | this.saveLog(null,workorder,Constants.ZERO,workorder.getMemberId(),workOrderStatus.getLogTitle().replace("{title}",logTitle),null,null,null); |
| | | } |
| | | } |
| | | |
| | |
| | | workorderMapper.insert(dcaWorkOrder); |
| | | //存储日志 |
| | | this.dealLogData(dcaWorkOrder,workOrderStatus); |
| | | |
| | | //存储待办人员信息 |
| | | this.saveNotice(Arrays.asList(dcaWorkOrder.getQwnoticeMemberIds().split(",")),dcaWorkOrder.getId(),Constants.ZERO,Constants.ZERO); |
| | | |
| | | List<Multifile> multifileList = dcaNoProblemDTO.getMultifileList(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | |
| | | multifileMapper.insert(multifileList); |
| | | } |
| | | } |
| | | }else{ |
| | | workorder.setStatus(Constants.WorkOrderStatus.sheClose.getKey()); |
| | | workorderMapper.updateById(workorder); |
| | | } |
| | | |
| | | //查询主题下的所有观察项 |
| | |
| | | //存储DCA工单详情 |
| | | Map<String,Object> detail = new HashMap<>(); |
| | | detail.put("title","观察主题:"+type.getName()); |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda().eq(Category::getType,4).eq(Category::getParentId,workorder.getTypeId())); |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda().eq(Category::getType,4) |
| | | .eq(Category::getIsdeleted,Constants.ZERO) |
| | | .eq(Category::getParentId,workorder.getTypeId())); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryList)){ |
| | | List<Map<String,Object>> childMapList = new ArrayList<>(); |
| | | for (Category category:categoryList) { |
| | | Map<String,Object> childMap = new HashMap<>(); |
| | | childMap.put("childTitle",category.getName()); |
| | | List<Category> problemList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted,Constants.ZERO) |
| | | .eq(Category::getType,6).eq(Category::getParentId,category.getId())); |
| | | List<Map<String,Object>> problemMapList = new ArrayList<>(); |
| | | Integer index = Constants.ONE; |
| | |
| | | * @param afterWorkorder |
| | | * @param objType 操作类型 0任务上报 1任务分配物业主管 2任务分配处理人 3任务处理关闭 4任务催促 |
| | | * @param memberId |
| | | * @param paramr2 处理人 |
| | | * @param paramr2 转交给的处理人 |
| | | */ |
| | | public Integer saveLog(String beforeJson,Workorder afterWorkorder,Integer objType,Integer memberId,String title,String content,String paramr2){ |
| | | public Integer saveLog(String beforeJson,Workorder afterWorkorder,Integer objType,Integer memberId,String title,String content,String paramr2,String remark){ |
| | | WorkorderLog workorderLog = new WorkorderLog(); |
| | | workorderLog.setCreateDate(new Date()); |
| | | workorderLog.setEditDate(new Date()); |
| | | workorderLog.setCreateDate(afterWorkorder.getEditDate()); |
| | | workorderLog.setEditDate(afterWorkorder.getEditDate()); |
| | | workorderLog.setIsdeleted(Constants.ZERO); |
| | | workorderLog.setBeforeContent(beforeJson); |
| | | workorderLog.setAfterContent(JSONObject.toJSONString(afterWorkorder)); |
| | |
| | | workorderLog.setObjType(objType); |
| | | workorderLog.setTitle(title); |
| | | workorderLog.setContent(content); |
| | | workorderLog.setRemark(remark); |
| | | workorderLogMapper.insert(workorderLog); |
| | | return workorderLog.getId(); |
| | | } |
| | |
| | | if(Objects.isNull(workorder)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | |
| | | this.dealButton(workorder,member); |
| | | //查询附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO) |
| | |
| | | } |
| | | workorder.setMultifileList(multifileList); |
| | | } |
| | | |
| | | //查询日志信息 |
| | | workorder.setLogList(this.getLogList(workorder)); |
| | | workorder.setLogList(this.getLogList(workorder,member)); |
| | | if(Constants.equalsInteger(workorder.getType(),Constants.ONE)){ |
| | | //如果是DCA提交记录,查询子工单集合 |
| | | Workorder param = new Workorder(); |
| | | param.setIsdeleted(Constants.ZERO); |
| | | param.setDcaRecordId(workorder.getId()); |
| | | workorder.setDcaChildList(findList(param)); |
| | | List<Workorder> dcaChildList = findList(param); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(dcaChildList)){ |
| | | for (Workorder dcaChild:dcaChildList) { |
| | | this.dealButton(dcaChild,member); |
| | | } |
| | | workorder.setManagerId(dcaChildList.stream().filter(i->Objects.nonNull(i.getManagerId())).map(i->i.getManagerId()).collect(Collectors.joining(","))); |
| | | } |
| | | workorder.setDcaChildList(dcaChildList); |
| | | } |
| | | return workorder; |
| | | } |
| | |
| | | } |
| | | List<String> passOnUserList = new ArrayList<>(); |
| | | //待分配状态 处理转交按钮 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitConfirm.getKey())&&Constants.equalsInteger(workorder.getStatus(),Constants.ZERO)){ |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitConfirm.getKey()) |
| | | ){ |
| | | passOnUserList.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | }else if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitAllocation.getKey())&&(Constants.equalsInteger(workorder.getStatus(),Constants.ONE) |
| | | || Constants.equalsInteger(workorder.getStatus(),Constants.TWO))){ |
| | | } |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitAllocation.getKey()) |
| | | || Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitDeal.getKey()) |
| | | ){ |
| | | passOnUserList.add(workorder.getManagerId()); |
| | | } |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(passOnUserList)){ |
| | |
| | | } |
| | | |
| | | |
| | | public List<WorkorderLog> getLogList(Workorder workorder){ |
| | | public List<WorkorderLog> getLogList(Workorder workorder,Member loginMember){ |
| | | List<WorkorderLog> logList = workorderLogMapper.selectJoinList(WorkorderLog.class, |
| | | new MPJLambdaWrapper<WorkorderLog>() |
| | | .selectAll(WorkorderLog.class) |
| | |
| | | .orderByDesc(WorkorderLog::getId) |
| | | ); |
| | | |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(logList)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.WORKORDER_LOG_FILE_PATH).getCode(); |
| | | Boolean canOpenUrgeButton = true; |
| | | for (WorkorderLog workorderLog:logList) { |
| | | workorderLog.setUrgeButton(Constants.ZERO); |
| | | //物业主管处理中 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.ONE)){ |
| | | Member member = memberMapper.selectById(workorderLog.getParam1()); |
| | | if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId()) |
| | | && member.getQwId().equals(workorder.getManagerId()) ){ |
| | | workorderLog.setUrgeButton(Constants.ONE); |
| | | if(Constants.equalsInteger(workorderLog.getObjType(),Constants.TWO)||Constants.equalsInteger(workorderLog.getObjType(),Constants.ONE)){ |
| | | //物业主管处理中 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.ONE)){ |
| | | Member member = memberMapper.selectById(workorderLog.getParam1()); |
| | | if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId()) |
| | | && Objects.nonNull(loginMember) && Constants.equalsInteger(member.getId(),loginMember.getId()) |
| | | && workorder.getQwnoticeMemberIds().indexOf(member.getQwId())>=Constants.ZERO){ |
| | | workorderLog.setUrgeButton(Constants.ONE); |
| | | } |
| | | } |
| | | //工程师处理中 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.TWO)){ |
| | | Member member = memberMapper.selectById(workorderLog.getParam1()); |
| | | if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId()) |
| | | && canOpenUrgeButton |
| | | && (workorder.getQwnoticeMemberIds().indexOf(member.getQwId()) >= Constants.ZERO || member.getQwId().equals(workorder.getManagerId()) ) |
| | | ){ |
| | | workorderLog.setUrgeButton(Constants.ONE); |
| | | canOpenUrgeButton = false; |
| | | } |
| | | } |
| | | } |
| | | //工程师处理中 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.TWO)){ |
| | | Member member = memberMapper.selectById(workorderLog.getParam1()); |
| | | if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId()) |
| | | && member.getQwId().equals(workorder.getDealerId()) && canOpenUrgeButton){ |
| | | workorderLog.setUrgeButton(Constants.ONE); |
| | | canOpenUrgeButton = false; |
| | | if(!Constants.equalsInteger(workorderLog.getObjType(),Constants.FOUR)){ |
| | | //查询附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .ne(Multifile::getObjType,Constants.multiFileType.upload) |
| | | .eq(Multifile::getObjId,workorderLog.getId()) |
| | | .orderByAsc(Multifile::getId)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | | multifile.setFileurlFull(path+multifile.getFileurl()); |
| | | } |
| | | workorderLog.setMultifileList(multifileList); |
| | | } |
| | | } |
| | | //查询附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .ne(Multifile::getObjType,Constants.multiFileType.upload) |
| | | .eq(Multifile::getObjId,workorderLog.getId()) |
| | | .orderByAsc(Multifile::getId)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | | multifile.setFileurlFull(path+multifile.getFileurl()); |
| | | } |
| | | workorderLog.setMultifileList(multifileList); |
| | | } |
| | | } |
| | | } |
| | |
| | | .ne(org.apache.commons.lang3.StringUtils.isNotBlank(pageWrap.getQwId()),Workorder::getType,Constants.TWO) |
| | | .in(Objects.nonNull(pageWrap.getDealStatus())&& |
| | | Constants.equalsInteger(pageWrap.getDealStatus(),Constants.ZERO), |
| | | Workorder::getStatus,Constants.WorkOrderStatus.waitConfirm.getKey(),Constants.WorkOrderStatus.waitAllocation.getKey(),Constants.WorkOrderStatus.waitDeal.getKey()) |
| | | Workorder::getStatus,Constants.WorkOrderStatus.waitConfirm.getKey(), |
| | | Constants.WorkOrderStatus.waitAllocation.getKey(),Constants.WorkOrderStatus.waitDeal.getKey()) |
| | | .in(Objects.nonNull(pageWrap.getDealStatus())&& |
| | | Constants.equalsInteger(pageWrap.getDealStatus(),Constants.ONE), |
| | | Workorder::getStatus,Constants.WorkOrderStatus.sheClose.getKey(),Constants.WorkOrderStatus.close.getKey(),Constants.WorkOrderStatus.wtsClose.getKey()) |
| | |
| | | .eq( pageWrap.getDcaNoNum() != null, Workorder::getDcaNoNum, pageWrap.getDcaNoNum()) |
| | | .eq( pageWrap.getDcaRecordId() != null, Workorder::getDcaRecordId, pageWrap.getDcaRecordId()) |
| | | .likeRight( pageWrap.getTypeIdPath() != null,"c3.id_path", pageWrap.getTypeIdPath()) |
| | | .eq( pageWrap.getDcaCsIds() != null, Workorder::getDcaCsIds, pageWrap.getDcaCsIds()) ; |
| | | .eq( pageWrap.getDcaCsIds() != null, Workorder::getDcaCsIds, pageWrap.getDcaCsIds()) |
| | | .ge( pageWrap.getQueryStartTime() != null, Workorder::getCreateDate,pageWrap.getQueryStartTime()) |
| | | .le( pageWrap.getQueryEndTime() != null, Workorder::getCreateDate,pageWrap.getQueryEndTime()) ; |
| | | if ( pageWrap.getMemberName() != null) { |
| | | queryWrapper.and( ms->ms.like(Member::getName, pageWrap.getMemberName()) |
| | | .or().like(Member::getPhone, pageWrap.getMemberName()) ); |
| | | } |
| | | queryWrapper.orderByDesc(Workorder::getProblemId); |
| | | queryWrapper.orderByDesc(Workorder::getId); |
| | | return queryWrapper; |
| | | } |
| | | |
| | |
| | | if(workorder.getQwnoticeMemberIds().indexOf(closeDTO.getMember().getQwId())<Constants.ZERO && !workorder.getManagerId().equals(closeDTO.getMember().getQwId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | qwIds = Arrays.asList(workorder.getQwnoticeMemberIds()); |
| | | if(workorder.getManagerId().equals(closeDTO.getMember().getQwId())){ |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | }else if(workorder.getQwnoticeMemberIds().indexOf(closeDTO.getMember().getQwId())>Constants.ZERO){ |
| | | workorder.setStatus(Constants.WorkOrderStatus.sheClose.getKey()); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | qwIds.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | qwIds.add(workorder.getManagerId()); |
| | | qwIds.remove(closeDTO.getMember().getQwId()); |
| | | }else if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitDeal.getKey())){ |
| | |
| | | && !workorder.getDealerId().equals(closeDTO.getMember().getQwId()) ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | qwIds = Arrays.asList(workorder.getQwnoticeMemberIds()); |
| | | qwIds.add(workorder.getDealerId()); |
| | | if(workorder.getManagerId().equals(closeDTO.getMember().getQwId())){ |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | }else if(workorder.getDealerId().equals(closeDTO.getMember().getQwId())){ |
| | | workorder.setStatus(Constants.WorkOrderStatus.close.getKey()); |
| | | }else if(workorder.getQwnoticeMemberIds().indexOf(closeDTO.getMember().getQwId())>Constants.ZERO){ |
| | | workorder.setStatus(Constants.WorkOrderStatus.sheClose.getKey()); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | qwIds.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | qwIds.add(workorder.getManagerId()); |
| | | qwIds.remove(closeDTO.getMember().getQwId()); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"工单状态已流转"); |
| | |
| | | workorder.setEditDate(new Date()); |
| | | workorder.setDealTime(new Date()); |
| | | workorder.setDealInfo(closeDTO.getInfo()); |
| | | //子工单 则查询父级工单数据 是否付存在未完成的 如果不存在未完成的则进行主工单状态变化 |
| | | if(Constants.equalsInteger(workorder.getType(),Constants.TWO)&& |
| | | workorderMapper.selectCount(new QueryWrapper<Workorder>().lambda().eq(Workorder::getDcaRecordId,workorder.getDcaRecordId()).eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .ne(Workorder::getId,workorder.getId()).in(Workorder::getStatus, |
| | | Constants.WorkOrderStatus.waitConfirm.getKey(),Constants.WorkOrderStatus.waitAllocation.getKey(),Constants.WorkOrderStatus.waitDeal.getKey() |
| | | ))<=Constants.ZERO){ |
| | | Workorder parentWorkorder = new Workorder(); |
| | | parentWorkorder.setId(workorder.getDcaRecordId()); |
| | | parentWorkorder.setEditDate(new Date()); |
| | | parentWorkorder.setStatus(Constants.WorkOrderStatus.close.getKey()); |
| | | workorderMapper.updateById(parentWorkorder); |
| | | } |
| | | workorderMapper.updateById(workorder); |
| | | //处理上报日志 |
| | | Integer logId = this.saveLog(beforeJson,workorder,Constants.THREE,workorder.getMemberId(),"任务已处理",closeDTO.getInfo(),null); |
| | | Integer logId = this.saveLog(beforeJson,workorder,Constants.THREE,closeDTO.getMember().getId(),"任务已处理",closeDTO.getInfo(),null,closeDTO.getInfo()); |
| | | List<Multifile> multifileList = closeDTO.getMultifileList(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | |
| | | public void passOn(PassOnDTO passOnDTO){ |
| | | if(Objects.isNull(passOnDTO) |
| | | || Objects.isNull(passOnDTO.getWorkorderId()) |
| | | || Objects.isNull(passOnDTO.getPassOnUserId()) |
| | | || org.apache.commons.lang3.StringUtils.isBlank(passOnDTO.getPassOnUserId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Member member = memberMapper.selectById(passOnDTO.getPassOnUserId()); |
| | | Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getQwId,passOnDTO.getPassOnUserId())); |
| | | if(Objects.isNull(member)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到被转交人信息"); |
| | | } |
| | |
| | | workorder.setStatus(Constants.WorkOrderStatus.waitDeal.getKey()); |
| | | } |
| | | workorder.setEditDate(new Date()); |
| | | workorder.setUrgeDate(DateUtil.afterHoursDate(new Date(),24)); |
| | | workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10)); |
| | | workorderMapper.updateById(workorder); |
| | | String paramr2 = member.getCompanyName()+"/"+member.getName(); |
| | | //处理上报日志 |
| | | Integer logId = this.saveLog(beforeJson,workorder, |
| | | Constants.equalsInteger(passOnDTO.getPassOnType(),Constants.ZERO)?Constants.ONE:Constants.TWO |
| | | ,workorder.getMemberId(),"任务分配",passOnDTO.getInfo(),paramr2); |
| | | List<Multifile> multifileList = workorder.getMultifileList(); |
| | | ,passOnDTO.getMember().getId(),"任务分配",passOnDTO.getInfo(),paramr2,null); |
| | | List<Multifile> multifileList = passOnDTO.getMultifileList(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | | multifile.setObjId(logId); |
| | |
| | | Category category = categoryMapper.selectById(workorder.getTypeId()); |
| | | if(Objects.nonNull(passOnDTO.getMember())&&Objects.nonNull(category)){ |
| | | // 发送企微通知 |
| | | this.sendQwMsg(workorder,member.getQwId(),passOnDTO.getMember(),category.getName(),Constants.ZERO,null); |
| | | this.sendQwMsg(workorder,passOnDTO.getPassOnUserId(),passOnDTO.getMember(),category.getName(),Constants.ZERO,null); |
| | | } |
| | | //存储待办人员信息 |
| | | this.saveNotice(Arrays.asList(passOnDTO.getMember().getQwId().split(",")),workorder.getId(),Constants.ZERO,Constants.TWO); |
| | | this.saveNotice(Arrays.asList(passOnDTO.getPassOnUserId().split(",")), |
| | | Constants.equalsInteger(workorder.getType(),Constants.TWO)?workorder.getDcaRecordId():workorder.getId(),Constants.ZERO,Constants.TWO); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted, Constants.ZERO) |
| | | .isNotNull(Member::getQwId) |
| | | .in(Member::getId, sendCopyDTO.getUserIds().split(","))); |
| | | .in(Member::getQwId, sendCopyDTO.getUserIds().split(","))); |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(memberList)) { |
| | | List<String> qwIdList = memberList.stream().map(i -> i.getQwId()).collect(Collectors.toList()); |
| | | Category category = categoryMapper.selectById(workorder.getTypeId()); |
| | | if (Objects.nonNull(category)) { |
| | | // 发送企微通知 |
| | | this.sendQwMsg(workorder, String.join(",", qwIdList), sendCopyDTO.getMember(), category.getName(), Constants.ONE, null); |
| | | this.sendQwMsg(workorder, String.join(",", qwIdList), sendCopyDTO.getMember(), category.getName(), Constants.TWO, sendCopyDTO.getInfo()); |
| | | } |
| | | //存储待办信息 |
| | | this.saveNotice(qwIdList, workorder.getId(), Constants.ONE, Constants.ONE); |
| | | this.saveNotice(qwIdList, Constants.equalsInteger(workorder.getType(),Constants.TWO)?workorder.getDcaRecordId():workorder.getId(), Constants.ONE, Constants.ONE); |
| | | } |
| | | |
| | | } |
| | |
| | | public void urge(Integer workorderId,Member member){ |
| | | Workorder workorder = workorderMapper.selectById(workorderId); |
| | | workorder.setEditDate(new Date()); |
| | | workorder.setUrgeDate(DateUtil.afterHoursDate(new Date(),24)); |
| | | workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10)); |
| | | workorderMapper.updateById(workorder); |
| | | if(Objects.isNull(workorder)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到工单数据"); |
| | |
| | | //如果已分配 wts 则是催促wts |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitAllocation.getKey())){ |
| | | urgeUser = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO).eq(Member::getQwId,workorder.getManagerId()).last("limit 1 ")); |
| | | }else if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitAllocation.getKey())){ |
| | | }else if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitDeal.getKey())){ |
| | | urgeUser = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO).eq(Member::getQwId,workorder.getDealerId()).last("limit 1 ")); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"状态已流转无法进行该操作"); |
| | | } |
| | | |
| | | this.saveLog(null,workorder, |
| | | Constants.ONE |
| | | ,member.getId(),"催促","已催促 "+urgeUser.getCompanyName() + "/" + urgeUser.getName(),null); |
| | | Constants.FOUR |
| | | ,member.getId(),"催促","已催促 "+urgeUser.getCompanyName() + "/" + urgeUser.getName(),null,null); |
| | | //发送企微通知 |
| | | Category category = categoryMapper.selectById(workorder.getTypeId()); |
| | | if(Objects.nonNull(category)){ |
| | | // 发送企微通知 |
| | | this.sendQwMsg(workorder,urgeUser.getQwId(),null,category.getName(),Constants.ONE,null); |
| | | this.sendQwMsg(workorder,urgeUser.getQwId(),member,category.getName(),Constants.ONE,null); |
| | | } |
| | | |
| | | } |
| | |
| | | public void jobUrge(){ |
| | | List<Workorder> workorderList = workorderMapper.selectList(new QueryWrapper<Workorder>().lambda().eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .in(Workorder::getStatus,Constants.WorkOrderStatus.waitAllocation.getKey(),Constants.WorkOrderStatus.waitDeal.getKey()) |
| | | .apply(" urge_time > now() ") |
| | | .apply(" URGE_DATE < now() ") |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(workorderList)){ |
| | | for (Workorder workorder:workorderList) { |
| | | this.autoUrge(workorder); |
| | | workorder.setEditDate(new Date()); |
| | | workorder.setUrgeDate(DateUtil.afterHoursDate(new Date(),24)); |
| | | workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10));//DateUtil.afterHoursDate(new Date(),24)); |
| | | workorderMapper.updateById(workorder); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public void saveNotice(List<String> qwIdList ,Integer workorderId,Integer isSendCopy,Integer type){ |
| | | public void saveNotice(List<String> qwIdList , Integer workorderId, Integer isSendCopy, Integer type){ |
| | | List<Notices> noticesList = new ArrayList<>(); |
| | | for (String qwId:qwIdList) { |
| | | //存储抄送记录 |
| | |
| | | workOrderDataVO.setSheTotal(Constants.ZERO); |
| | | workOrderDataVO.setUnCloseTotal(Constants.ZERO); |
| | | workOrderDataVO.setTotal(Constants.ZERO); |
| | | workOrderDataVO.setDcaNoTotal(Constants.ZERO); |
| | | workOrderDataVO.setDcaYesTotal(Constants.ZERO); |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(dataList)){ |
| | | for(Workorder e :dataList){ |
| | | if(Constants.equalsInteger(e.getType(),Constants.ONE)){ |
| | | workOrderDataVO.setDcaYesTotal(workOrderDataVO.getDcaYesTotal()+Constants.formatIntegerNum(e.getDcaYesNum()));//DCA符合项 |
| | | workOrderDataVO.setDcaNoTotal(workOrderDataVO.getDcaNoTotal()+Constants.formatIntegerNum(e.getDcaNoNum()));//DCA不符合项 |
| | | } |
| | | } |
| | | workOrderDataVO.setTotal(dataList.size()); |
| | | workOrderDataVO.setGcsTotal(dataList.stream().filter(j->Constants.equalsInteger(j.getStatus(),Constants.WorkOrderStatus.close.getKey())).collect(Collectors.toList()).size()); |
| | | workOrderDataVO.setSheTotal(dataList.stream().filter(j->Constants.equalsInteger(j.getStatus(),Constants.WorkOrderStatus.sheClose.getKey())).collect(Collectors.toList()).size()); |
| | |
| | | @Override |
| | | public WorkorderIndexNumVO getIndexData(Workorder workorder) { |
| | | WorkorderIndexNumVO model = new WorkorderIndexNumVO(); |
| | | List<WorkOrderDataVO> workOrderDataVOList = new ArrayList<>(); |
| | | Date startdate = getStartDateByType(workorder.getTimeType()); |
| | | //查询今年所有的数据 |
| | | List<Workorder> list = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .ge(startdate!=null,Workorder::getCreateDate,startdate) |
| | | // .lt(endDate!=null,Workorder::getCreateDate,endDate) |
| | | .groupBy(Workorder::getType )); |
| | | if(list !=null){ |
| | | for(Workorder w : list){ |
| | |
| | | } |
| | | } |
| | | } |
| | | List<Workorder> todays = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .apply("to_days(create_date)=to_days(now())") |
| | | .groupBy(Workorder::getType )); |
| | | if(todays !=null){ |
| | | for(Workorder w : todays){ |
| | | if(Constants.equalsInteger(w.getType(),Constants.ZERO)){ |
| | | //SHE |
| | | model.setTodaySheNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.ONE)){ |
| | | //DCA提交数 |
| | | model.setTodayDcaNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.TWO)){ |
| | | //DCA子工单 |
| | | model.setTodayDcaChildNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.THREE)){ |
| | | //跌绊滑 |
| | | model.setTodayDbhNum(Constants.formatLongNum(w.getNum())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Workorder> yeslist = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .in(Workorder::getStatus,Constants.THREE,Constants.FOUR,Constants.FIVE) |
| | | .in(Workorder::getType,Constants.THREE,Constants.TWO) |
| | | .ge(startdate!=null,Workorder::getCreateDate,startdate) |
| | | .groupBy(Workorder::getType )); |
| | | if(yeslist !=null){ |
| | | for(Workorder w : yeslist){ |
| | |
| | | } |
| | | } |
| | | } |
| | | Workorder dcaList = workorderMapper.selectJoinOne(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("sum(dca_yes_num) as dcaYesNum,sum(dca_no_num) as dcaNoNum") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .eq(Workorder::getType,Constants.ONE) ); |
| | | if(dcaList !=null){ |
| | | //DCA符合项和不符合项统计 |
| | | model.setDcaYesNum((long)Constants.formatIntegerNum(dcaList.getDcaYesNum())); |
| | | model.setDcaNoNum((long)Constants.formatIntegerNum(dcaList.getDcaNoNum())); |
| | | if(workorder.getTimeType() == null){ |
| | | List<Workorder> todays = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .apply("to_days(create_date)=to_days(now())") |
| | | .groupBy(Workorder::getType )); |
| | | if(todays !=null){ |
| | | for(Workorder w : todays){ |
| | | if(Constants.equalsInteger(w.getType(),Constants.ZERO)){ |
| | | //SHE |
| | | model.setTodaySheNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.ONE)){ |
| | | //DCA提交数 |
| | | model.setTodayDcaNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.TWO)){ |
| | | //DCA子工单 |
| | | model.setTodayDcaChildNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.THREE)){ |
| | | //跌绊滑 |
| | | model.setTodayDbhNum(Constants.formatLongNum(w.getNum())); |
| | | } |
| | | } |
| | | } |
| | | Workorder dcaList = workorderMapper.selectJoinOne(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("sum(dca_yes_num) as dcaYesNum,sum(dca_no_num) as dcaNoNum") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .eq(Workorder::getType,Constants.ONE) ); |
| | | if(dcaList !=null){ |
| | | //DCA符合项和不符合项统计 |
| | | model.setDcaYesNum((long)Constants.formatIntegerNum(dcaList.getDcaYesNum())); |
| | | model.setDcaNoNum((long)Constants.formatIntegerNum(dcaList.getDcaNoNum())); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return model; |
| | | } |
| | | |
| | | private Date getStartDateByType(Integer timeType) { |
| | | Date date = null; |
| | | if(timeType == null){ |
| | | return null; |
| | | } else if (timeType == 0) { |
| | | //本周 |
| | | date = DateUtil.getBeginDayOfWeek(0); |
| | | }else if (timeType == 1) { |
| | | //本月 |
| | | date = DateUtil.getBeginDayOfMonth(0); |
| | | }else if (timeType == 2) { |
| | | //本季度 |
| | | date = DateUtil.getBeginDayOfSeason(0); |
| | | }else if (timeType == 3) { |
| | | //本年 |
| | | date = DateUtil.getBeginDayOfYear(0); |
| | | } |
| | | |
| | | |
| | | |
| | | return date; |
| | | } |
| | | |
| | | } |