| | |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import cn.stylefeng.guns.modular.business.dto.*; |
| | | import cn.stylefeng.guns.modular.business.dto.request.CounsellingOrderRequest; |
| | | import cn.stylefeng.guns.modular.business.dto.request.CounsellingReservationRequest; |
| | | import cn.stylefeng.guns.modular.business.dto.request.CounsellingUserRequest; |
| | | import cn.stylefeng.guns.modular.business.dto.request.CreateCounsellingOrderRequest; |
| | | import cn.stylefeng.guns.modular.business.dto.request.*; |
| | | import cn.stylefeng.guns.modular.business.entity.*; |
| | | import cn.stylefeng.guns.modular.business.service.*; |
| | | import cn.stylefeng.guns.modular.business.service.impl.ImBizService; |
| | | import cn.stylefeng.rest.ijpay.controller.AliPayController; |
| | | import cn.stylefeng.rest.ijpay.controller.WxPayController; |
| | | import cn.stylefeng.roses.kernel.auth.api.context.LoginContext; |
| | | import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser; |
| | | import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo; |
| | | import cn.stylefeng.roses.kernel.customer.modular.entity.Customer; |
| | | import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService; |
| | |
| | | this.counsellingUserService.updateById(counsellingUserOld); |
| | | |
| | | |
| | | |
| | | CounsellingInfo counsellingInfo = this.counsellingInfoService.getById(counsellingOrder.getCounsellingInfoId()); |
| | | |
| | | |
| | | //将此条消息加入到可聊天的表中t_mental_appointment |
| | | MentalAppointment mentalAppointment = MentalAppointment.builder() |
| | | .userId(counsellingOrder.getUserId()) |
| | | .type("1") |
| | | .statusFlag(1) |
| | | .appointmentDay(new SimpleDateFormat("yyyy-MM-dd").parse(counsellingReservationRequest.getDayTime())) |
| | | .beginTimePoint(counsellingReservationRequest.getTimePoint().split("-")[0]) |
| | | .endTimePoint(counsellingReservationRequest.getTimePoint().split("-")[1]) |
| | | .workerId(counsellingUserOld.getUserId()) |
| | | .workerId(counsellingInfo.getUserId()) |
| | | .build(); |
| | | // 用户信息 |
| | | CustomerInfo customerInfo = customerService.getCustomerInfoById(counsellingOrder.getUserId()); |
| | | mentalAppointment.setUserName(customerInfo.getRealName()); |
| | | mentalAppointment.setPhone(customerInfo.getLinkPhone()); |
| | | mentalAppointmentService.save(mentalAppointment); |
| | | CounsellingInfo counsellingInfo = this.counsellingInfoService.getById(counsellingOrder.getCounsellingInfoId()); |
| | | |
| | | // 发送IM消息 |
| | | ImPushDataDTO pushData1 = ImPushDataDTO.builder() |
| | | .type(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getCode()) |
| | | .title(ImPushTypeEnum.C_TO_W_IM_1V1_START_CONSULT.getName()) |
| | | .content("预约成功"+",请注意预约时间:"+counsellingOrder.getEffectiveEndTime()+"~"+counsellingOrder.getEffectiveEndTime()) |
| | | .content("预约成功"+",请注意预约时间:"+counsellingReservationRequest.getDayTime()+counsellingReservationRequest.getTimePoint()) |
| | | // .content("预约成功!") |
| | | .objId(ObjUtil.toString(counsellingInfo.getId())) |
| | | .data1(ObjUtil.toString(counsellingOrder.getUserId())) |
| | |
| | | new String[]{ObjUtil.toString(counsellingInfo.getUserId())}, |
| | | pushData1); |
| | | |
| | | // // 推送消息内容 |
| | | // String pushContent = "你的预约("+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes()+")已确认,请按时参加"; |
| | | // // IM推送数据json |
| | | // ImPushDataDTO pushData = ImPushDataDTO.builder() |
| | | // .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_SUCCESS.getCode()) |
| | | // .objId(ObjUtil.toString(counsellingOrderReservation.getId())) |
| | | // .title("通知") |
| | | // .content(pushContent) |
| | | //// .extra("("+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes()+")") |
| | | // .build(); |
| | | // // 发送首次预约 |
| | | // imBizService.messageSendSystem(counsellingOrderReservation.getUserId()+"", new String[]{counsellingOrderReservation.getUserId()+""}, pushData, ImUserTypeEnum.USER, null, true); |
| | | // 推送消息内容 |
| | | String pushContent = "你的预约("+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes()+")已确认,请按时参加"; |
| | | // IM推送数据json |
| | | ImPushDataDTO pushData = ImPushDataDTO.builder() |
| | | .type(ImPushTypeEnum.S_TO_W_TIP_CONSULT_PAY_SUCCESS.getCode()) |
| | | .objId(ObjUtil.toString(counsellingOrderReservation.getId())) |
| | | .title("通知") |
| | | .content(pushContent) |
| | | // .extra("("+DateUtil.formatDate(counsellingOrder.getFirstAppointmentDate())+" "+counsellingOrder.getFirstAppointmentTimes()+")") |
| | | .build(); |
| | | // 发送首次预约 |
| | | imBizService.messageSendSystem(counsellingOrderReservation.getUserId()+"", new String[]{counsellingOrderReservation.getUserId()+""}, pushData, ImUserTypeEnum.USER, null, true); |
| | | }else{ |
| | | counsellingOrderReservation.setStauts(1); |
| | | counsellingOrderReservation.setReservationType(2); |
| | |
| | | customerService.updateCustomerRemoveCache(customer); |
| | | } |
| | | |
| | | try { |
| | | |
| | | CustomerUpdateRequest customerUpdateRequest = counsellingReservationRequest.getCustomerUpdateRequest(); |
| | | Customer customer = new Customer(); |
| | | BeanUtil.copyProperties(customerUpdateRequest,customer); |
| | | LoginUser loginUser = LoginContext.me().getLoginUser(); |
| | | customer.setCustomerId(loginUser.getUserId()); |
| | | customerService.updateById(customer); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.info("编辑用户报错"); |
| | | } |
| | | |
| | | return new SuccessResponseData<>(counsellingOrderReservation); |
| | | } |