| | |
| | | import com.ruoyi.order.api.model.TEvaluationAutoReply; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.order.api.model.TVinChargingOrder; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TEvaluationAutoReplyService; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.TVinChargingOrderService; |
| | | import com.ruoyi.order.service.WxSubscribeMessageService; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | @Resource |
| | | private TVinChargingOrderService vinChargingOrderService; |
| | | |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | |
| | | BeanUtils.copyProperties(query, orderEvaluate); |
| | | Long userid = tokenService.getLoginUserApplet().getUserId(); |
| | | orderEvaluate.setAppUserId(userid); |
| | | if(query.getOrderType() == 1){ |
| | | Integer orderType = query.getOrderType(); |
| | | if(null == orderType){ |
| | | return AjaxResult.error("订单类型不能为空"); |
| | | } |
| | | if(orderType == 1){ |
| | | TChargingOrder chargingOrder = chargingOrderService.getById(query.getOrderId()); |
| | | if(null == chargingOrder){ |
| | | return AjaxResult.error("订单不存在"); |
| | | } |
| | | orderEvaluate.setAppUserCarId(chargingOrder.getAppUserCarId()); |
| | | }else if(orderType == 5){ |
| | | //VIN码充电订单,仅允许评价本人订单 |
| | | TVinChargingOrder vinChargingOrder = vinChargingOrderService.getById(query.getOrderId()); |
| | | if(null == vinChargingOrder || !userid.equals(vinChargingOrder.getAppUserId())){ |
| | | return AjaxResult.error("订单不存在"); |
| | | } |
| | | orderEvaluate.setAppUserCarId(vinChargingOrder.getAppUserCarId()); |
| | | }else{ |
| | | return AjaxResult.error("订单类型不支持评价"); |
| | | } |
| | | TAppUser appUser = appUserClient.getUserById(userid).getData(); |
| | | |
| | |
| | | appUser.setPoints(appUser.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser); |
| | | |
| | | TChargingOrder chargingOrder = chargingOrderService.getById(orderEvaluate.getOrderId()); |
| | | //积分变动明细 |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | appUserIntegralChange.setAppUserId(appUser.getId()); |
| | |
| | | appUserIntegralChange.setHistoricalIntegral(points); |
| | | appUserIntegralChange.setCurrentIntegral(points + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setOrderCode(getOrderCode(orderEvaluate.getOrderType(), orderEvaluate.getOrderId())); |
| | | appUserIntegralChange.setExtension(orderEvaluate.getOrderId().toString()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 根据评价的订单类型获取对应的订单编号 |
| | | * @param orderType 订单类型(1=充电订单,5=VIN码充电订单) |
| | | * @param orderId 订单id |
| | | * @return 订单编号 |
| | | */ |
| | | private String getOrderCode(Integer orderType, Long orderId) { |
| | | if(Integer.valueOf(5).equals(orderType)){ |
| | | TVinChargingOrder vinChargingOrder = vinChargingOrderService.getById(orderId); |
| | | return null == vinChargingOrder ? null : vinChargingOrder.getCode(); |
| | | } |
| | | TChargingOrder chargingOrder = chargingOrderService.getById(orderId); |
| | | return null == chargingOrder ? null : chargingOrder.getCode(); |
| | | } |
| | | |
| | | private void applyAutoReply(TOrderEvaluate orderEvaluate) { |
| | | TEvaluationAutoReply rule = evaluationAutoReplyService.matchRule(orderEvaluate.getContent(), orderEvaluate.getMark()); |
| | | if (rule == null || StringUtils.isEmpty(rule.getReplyContent())) { |