| | |
| | | import com.doumee.core.utils.DESUtil; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.wx.wxPlat.WxPlatNotice; |
| | | import com.doumee.dao.admin.response.MemberInfoDTO; |
| | | import com.doumee.dao.business.DeviceRoleMapper; |
| | | import com.doumee.dao.business.MemberMapper; |
| | |
| | | import com.doumee.dao.business.join.DeviceJoinMapper; |
| | | import com.doumee.dao.business.join.VisitsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.web.response.VisitDetailVO; |
| | | import com.doumee.service.business.VisitsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | @Autowired |
| | | private DeviceJoinMapper deviceJoinMapper; |
| | | |
| | | @Autowired |
| | | private WxPlatNotice wxPlatNotice; |
| | | |
| | | @Override |
| | | public Integer create(Visits visits) { |
| | |
| | | getHkDeviceRoles(visits); |
| | | //检验拜访人是否合法 |
| | | Member visitMember = isValideVisitedUser(visits.getReceptMemberId()); |
| | | if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType()) &&!IdcardUtil.isValidCard(visits.getIdcardNo())){ |
| | | if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())&&visits.getIdcardNo().length()!=18 |
| | | //&&!IdcardUtil.isValidCard(visits.getIdcardNo()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!"); |
| | | } |
| | | Date date = new Date(); |
| | |
| | | if(StringUtils.isNotBlank(erpId)){ |
| | | visits.setErpId(erpId); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!"); |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!"); |
| | | } |
| | | visitsMapper.insert(visits); |
| | | initWithVisitInfo(visits); |
| | | updateProblemLog(visits,problemLog,member); |
| | | //发送微信公众号通知 |
| | | wxPlatNotice.sendVisitAuditTemplateNotice(visits, |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_PREFIX).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_AUDIT_VISIT).getCode()); |
| | | return visits.getId(); |
| | | } |
| | | |
| | |
| | | return PageData.from(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public VisitDetailVO getVisitDetail(Integer id){ |
| | | Visits visits = visitsMapper.selectById(id); |
| | | if(Objects.isNull(visits)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | Member member = memberMapper.selectById(visits.getReceptMemberId()); |
| | | if(Objects.isNull(member)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到被访员工信息"); |
| | | } |
| | | VisitDetailVO visitDetailVO = new VisitDetailVO(); |
| | | visitDetailVO.setStatus(visits.getStatus()); |
| | | visitDetailVO.setCarNos(visits.getCarNos()); |
| | | visitDetailVO.setVisitUserName(member.getName()); |
| | | visitDetailVO.setVisitReason(visits.getReason()); |
| | | visitDetailVO.setVisitTime(DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm") + " 至 " + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm") ); |
| | | if(StringUtils.isNotBlank(visits.getDoors())){ |
| | | List<DeviceRole> deviceRoleList = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda() |
| | | .select(DeviceRole::getName) |
| | | .eq(DeviceRole::getIsdeleted,Constants.ZERO) |
| | | .in(DeviceRole::getId,visits.getDoors().split(","))); |
| | | if(CollectionUtils.isNotEmpty(deviceRoleList)){ |
| | | visitDetailVO.setDoorGroupName( |
| | | deviceRoleList.stream().map(m->m.getName()).collect(Collectors.toList()) |
| | | ); |
| | | } |
| | | } |
| | | visitDetailVO.setWithVisitsList(visitsMapper.selectList(new QueryWrapper<Visits>().lambda() |
| | | .select(Visits::getName,Visits::getPhone) |
| | | .eq(Visits::getParentId,id))); |
| | | return visitDetailVO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |