| | |
| | | visits.setMemberId(member.getId()); |
| | | //初始化访客信息 |
| | | initVisitInfo(visits,date); |
| | | visitsMapper.insert(visits); |
| | | //发起ERP审批申请 |
| | | String erpId = startSendErpCheck(visits,visitMember); |
| | | if(StringUtils.isNotBlank(erpId)){ |
| | | visits.setErpId(erpId); |
| | | visitsMapper.updateById(visits); |
| | | }else{ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!"); |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,发起拜访审批申请失败!"); |
| | | } |
| | | visitsMapper.insert(visits); |
| | | initWithVisitInfo(visits); |
| | | updateProblemLog(visits,problemLog,member); |
| | | //创建审批记录 |
| | |
| | | ApproveAddRequest param = new ApproveAddRequest(); |
| | | List<Visits> withUserVisitsList = visits.getWithUserList(); |
| | | List<UserInfoRequest> withUserList = new ArrayList<>(); |
| | | UserInfoRequest mainUser = new UserInfoRequest(); |
| | | mainUser.setName(visits.getName()); |
| | | mainUser.setIdNo(DESUtil.decrypt(Constants.EDS_PWD, visits.getIdcardNo())); |
| | | mainUser.setSex(visits.getSex()); |
| | | mainUser.setPhone(visits.getPhone()); |
| | | mainUser.setFaceImg(visits.getFaceImg()); |
| | | mainUser.setHealthImg(visits.getImgurl()); |
| | | withUserList.add(mainUser); |
| | | |
| | | if(CollectionUtils.isNotEmpty(withUserVisitsList)){ |
| | | for (Visits v:withUserVisitsList) { |
| | | UserInfoRequest userInfoRequest = new UserInfoRequest(); |
| | |
| | | userInfoRequest.setHealthImg(v.getImgurl()); |
| | | withUserList.add(userInfoRequest); |
| | | } |
| | | param.setWithUserList(withUserList); |
| | | } |
| | | param.setWithUserList(withUserList); |
| | | |
| | | |
| | | param.setId(visits.getId()); |
| | | param.setBeVisitedUserId(visitMember.getErpId()); |
| | | param.setVisitorWorkUint(visits.getCompanyName()); |
| | | param.setPurpose(visits.getReason()); |
| | | param.setStartTime(DateUtil.getDate(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss")); |
| | | param.setEndTime(DateUtil.getDate(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss")); |
| | | param.setStartTime(DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss")); |
| | | param.setEndTime(DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss")); |
| | | param.setBeVisitedOrgId(visitMember.getErpOrgId()); |
| | | if(StringUtils.isNotBlank(visits.getCarNos())){ |
| | | param.setCarNo(Arrays.asList(visits.getCarNos().split(","))); |
| | | } |
| | |
| | | } |
| | | ApproveInfoResponse response = ErpTool.submitApprove(ErpConstants.approveUrl,param); |
| | | if(!Objects.isNull(response)){ |
| | | return response.getId().toString(); |
| | | return visits.getId().toString(); |
| | | } |
| | | return null; |
| | | } |