| | |
| | | @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事件状态 |
| | |
| | | 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)); |
| | | 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{ |
| | |
| | | if (Constants.equalsInteger(workorder.getType(), Constants.THREE) || Constants.equalsInteger(workorder.getType(), Constants.TWO) ) { |
| | | //处理上报日志 DCA工单 日志存储至子业务 不存在于父级 与跌绊滑 |
| | | String logTitle = Constants.equalsInteger(workorder.getType(), Constants.THREE) ? "跌绊滑风险" : "DCA"; |
| | | workorder.setCreateDate(workorder.getSubmitDate()); |
| | | this.saveLog(null,workorder,Constants.ZERO,workorder.getMemberId(),workOrderStatus.getLogTitle().replace("{title}",logTitle),null,null); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | */ |
| | | public Integer saveLog(String beforeJson,Workorder afterWorkorder,Integer objType,Integer memberId,String title,String content,String paramr2){ |
| | | WorkorderLog workorderLog = new WorkorderLog(); |
| | | workorderLog.setCreateDate(new Date()); |
| | | workorderLog.setEditDate(new Date()); |
| | | workorderLog.setCreateDate(afterWorkorder.getCreateDate()); |
| | | workorderLog.setEditDate(afterWorkorder.getCreateDate()); |
| | | workorderLog.setIsdeleted(Constants.ZERO); |
| | | workorderLog.setBeforeContent(beforeJson); |
| | | workorderLog.setAfterContent(JSONObject.toJSONString(afterWorkorder)); |
| | |
| | | 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()) ){ |
| | | && 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()) |
| | | && member.getQwId().equals(workorder.getDealerId()) && canOpenUrgeButton){ |
| | | && member.getQwId().equals(workorder.getManagerId()) && canOpenUrgeButton){ |
| | | workorderLog.setUrgeButton(Constants.ONE); |
| | | canOpenUrgeButton = false; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | qwIds = Arrays.asList(workorder.getQwnoticeMemberIds()); |
| | | 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())){ |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,当前工单非您的工单,无法进行处理"); |
| | | } |
| | | workorder.setStatus(Constants.WorkOrderStatus.wtsClose.getKey()); |
| | | qwIds = Arrays.asList(workorder.getQwnoticeMemberIds()); |
| | | qwIds.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | qwIds.add(workorder.getDealerId()); |
| | | qwIds.remove(closeDTO.getMember().getQwId()); |
| | | }else{ |
| | |
| | | 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(),"未查询到被转交人信息"); |
| | | } |
| | |
| | | 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(); |
| | | List<Multifile> multifileList = passOnDTO.getMultifileList(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifileList)){ |
| | | for (Multifile multifile:multifileList) { |
| | | multifile.setObjId(logId); |
| | |
| | | } |
| | | |
| | | this.saveLog(null,workorder, |
| | | Constants.ONE |
| | | Constants.FOUR |
| | | ,member.getId(),"催促","已催促 "+urgeUser.getCompanyName() + "/" + urgeUser.getName(),null); |
| | | //发送企微通知 |
| | | Category category = categoryMapper.selectById(workorder.getTypeId()); |
| | |
| | | workOrderDataVO.setGcsTotal(Constants.ZERO); |
| | | workOrderDataVO.setWtsTotal(Constants.ZERO); |
| | | workOrderDataVO.setSheTotal(Constants.ZERO); |
| | | workOrderDataVO.setDcaNoTotal(Constants.ZERO); |
| | | workOrderDataVO.setDcaYesTotal(Constants.ZERO); |
| | | workOrderDataVO.setUnCloseTotal(Constants.ZERO); |
| | | workOrderDataVO.setTotal(Constants.ZERO); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(dataList)){ |
| | | workOrderDataVO.setTotal(dataList.size()); |
| | | 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.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()); |
| | | workOrderDataVO.setWtsTotal(dataList.stream().filter(j->Constants.equalsInteger(j.getStatus(),Constants.WorkOrderStatus.wtsClose.getKey())).collect(Collectors.toList()).size()); |
| | |
| | | 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()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | .groupBy(Workorder::getType )); |
| | | if(yeslist !=null){ |
| | | for(Workorder w : yeslist){ |
| | | if(Constants.equalsInteger(w.getType(),Constants.TWO)){ |
| | | //DCA子工单已解决和未解决 |
| | | model.setDcaChildYesNum(Constants.formatLongNum(w.getNum())); |
| | | model.setDcaChildNoNum(Constants.formatLongNum(model.getDcaChildNum()) -model.getDcaChildYesNum()); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.THREE)){ |
| | | //跌绊滑已解决和未解决 |
| | | model.setDbhYesNum(Constants.formatLongNum(w.getNum())); |
| | | model.setDbhNoNum(Constants.formatLongNum(model.getDbhNum()) -model.getDbhYesNum()); |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |