| 
														
															@@ -3,6 +3,7 @@ package com.ylx.massage.service.impl; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cn.hutool.core.collection.CollectionUtil; 
														 | 
														
														 | 
														
															 import cn.hutool.core.collection.CollectionUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.alibaba.fastjson.JSONArray; 
														 | 
														
														 | 
														
															 import com.alibaba.fastjson.JSONArray; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.alibaba.fastjson.JSONObject; 
														 | 
														
														 | 
														
															 import com.alibaba.fastjson.JSONObject; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 
														 | 
														
														 | 
														
															 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 
														 | 
														
														 | 
														
															 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.baomidou.mybatisplus.core.toolkit.StringUtils; 
														 | 
														
														 | 
														
															 import com.baomidou.mybatisplus.core.toolkit.StringUtils; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -11,10 +12,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.common.constant.MassageConstants; 
														 | 
														
														 | 
														
															 import com.ylx.common.constant.MassageConstants; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.common.exception.ServiceException; 
														 | 
														
														 | 
														
															 import com.ylx.common.exception.ServiceException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.domain.*; 
														 | 
														
														 | 
														
															 import com.ylx.massage.domain.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.ylx.massage.enums.BillTypeEnum; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.enums.JsStatusEnum; 
														 | 
														
														 | 
														
															 import com.ylx.massage.enums.JsStatusEnum; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.enums.OrderStatusEnum; 
														 | 
														
														 | 
														
															 import com.ylx.massage.enums.OrderStatusEnum; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.mapper.TOrderMapper; 
														 | 
														
														 | 
														
															 import com.ylx.massage.mapper.TOrderMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.service.*; 
														 | 
														
														 | 
														
															 import com.ylx.massage.service.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.ylx.massage.utils.MassageUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ylx.massage.utils.OrderNumberGenerator; 
														 | 
														
														 | 
														
															 import com.ylx.massage.utils.OrderNumberGenerator; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.apache.commons.compress.utils.Lists; 
														 | 
														
														 | 
														
															 import org.apache.commons.compress.utils.Lists; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
														
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -53,6 +56,10 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Resource 
														 | 
														
														 | 
														
															     @Resource 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private TAddressService addressService; 
														 | 
														
														 | 
														
															     private TAddressService addressService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Resource 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private TConsumptionLogService consumptionLogService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //    @Resource 
														 | 
														
														 | 
														
															 //    @Resource 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //    private TInfoService infoService; 
														 | 
														
														 | 
														
															 //    private TInfoService infoService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -70,6 +77,13 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (order.getcGoods().isEmpty()) { 
														 | 
														
														 | 
														
															         if (order.getcGoods().isEmpty()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             throw new ServiceException("请选择项目"); 
														 | 
														
														 | 
														
															             throw new ServiceException("请选择项目"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //计算车费 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (order.getDistance() != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            BigDecimal bigDecimal = MassageUtil.calculateTaxiFare(order.getDistance()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            order.setFare(bigDecimal.setScale(MassageConstants.INTEGER_TWO, RoundingMode.HALF_UP).toString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            throw new ServiceException("距离不能为空"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //获取用户默认地址 
														 | 
														
														 | 
														
															         //获取用户默认地址 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         TAddress address = addressService.getByOpenId(order.getcOpenId()); 
														 | 
														
														 | 
														
															         TAddress address = addressService.getByOpenId(order.getcOpenId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (address == null) { 
														 | 
														
														 | 
														
															         if (address == null) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -118,6 +132,14 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             paramUser.setnNum(user.getnNum() + MassageConstants.INTEGER_ZERO); 
														 | 
														
														 | 
														
															             paramUser.setnNum(user.getnNum() + MassageConstants.INTEGER_ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             paramUser.setId(user.getId()); 
														 | 
														
														 | 
														
															             paramUser.setId(user.getId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             wxUserService.updateById(paramUser); 
														 | 
														
														 | 
														
															             wxUserService.updateById(paramUser); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            //增加消费记录 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            TConsumptionLog tConsumptionLog = new TConsumptionLog(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tConsumptionLog.setAmount(orderNew.getdTotalMoney().negate()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tConsumptionLog.setBillNo(orderNew.getOrderNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tConsumptionLog.setOpenId(orderNew.getcOpenId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tConsumptionLog.setBillType(BillTypeEnum.BALANCE_PAYMENT.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tConsumptionLog.setNote("余额支付"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            consumptionLogService.save(tConsumptionLog); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 更新项目数据 
														 | 
														
														 | 
														
															             // 更新项目数据 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             JSONArray objects = orderNew.getcGoods(); 
														 | 
														
														 | 
														
															             JSONArray objects = orderNew.getcGoods(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             objects.forEach(item -> { 
														 | 
														
														 | 
														
															             objects.forEach(item -> { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -130,10 +152,14 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             }); 
														 | 
														
														 | 
														
															             }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             TOrder orderParam = new TOrder(); 
														 | 
														
														 | 
														
															             TOrder orderParam = new TOrder(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             orderParam.setcId(orderNew.getcId()); 
														 | 
														
														 | 
														
															             orderParam.setcId(orderNew.getcId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            //orderParam.setnStatus(OrderStatusEnum.WAIT_JD.getCode()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            orderParam.setnStatus(OrderStatusEnum.SERVICE.getCode()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            orderParam.setnStatus(OrderStatusEnum.WAIT_JD.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            //加钟的订单支付完直接服务中 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (StringUtils.isNotBlank(order.getParentNo())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                orderParam.setnStatus(OrderStatusEnum.SERVICE.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            orderParam.setnStatus(OrderStatusEnum.SERVICE.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             //更新及技师状态 
														 | 
														
														 | 
														
															             //更新及技师状态 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            updateJs (orderNew); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            updateJs(orderNew); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return updateById(orderParam); 
														 | 
														
														 | 
														
															             return updateById(orderParam); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -176,7 +202,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         TOrder orderParam = new TOrder(); 
														 | 
														
														 | 
														
															         TOrder orderParam = new TOrder(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         orderParam.setcId(orderNew.getcId()); 
														 | 
														
														 | 
														
															         orderParam.setcId(orderNew.getcId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-//        orderParam.setnStatus(OrderStatusEnum.REFUSE.getCode()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        orderParam.setnStatus(OrderStatusEnum.REFUSE.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return updateById(orderParam); 
														 | 
														
														 | 
														
															         return updateById(orderParam); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -211,6 +237,15 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         jsUser.setdAllMoney(jsUser.getdAllMoney().add(multiply)); 
														 | 
														
														 | 
														
															         jsUser.setdAllMoney(jsUser.getdAllMoney().add(multiply)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         wxUserService.updateById(jsUser); 
														 | 
														
														 | 
														
															         wxUserService.updateById(jsUser); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //增加消费记录 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        TConsumptionLog tConsumptionLog = new TConsumptionLog(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tConsumptionLog.setAmount(multiply); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tConsumptionLog.setBillNo(orderNew.getOrderNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tConsumptionLog.setOpenId(jsUser.getcOpenid()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tConsumptionLog.setBillType(BillTypeEnum.INCOME.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        tConsumptionLog.setNote("技师收益"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        consumptionLogService.save(tConsumptionLog); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //        // 如果该技师有推荐人员 
														 | 
														
														 | 
														
															 //        // 如果该技师有推荐人员 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //        if(StringUtils.isNotBlank(jsUser.getcUpUser())){ 
														 | 
														
														 | 
														
															 //        if(StringUtils.isNotBlank(jsUser.getcUpUser())){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 //            // 获取技师上级对应的用户 
														 | 
														
														 | 
														
															 //            // 获取技师上级对应的用户 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -285,6 +320,12 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public TOrder getByNo(String orderNo) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        LambdaQueryWrapper<TOrder> objectLambdaQueryWrapper = new LambdaQueryWrapper<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return this.getOne(objectLambdaQueryWrapper.eq(TOrder::getOrderNo, orderNo)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private TOrder gettOrder(TOrder order) { 
														 | 
														
														 | 
														
															     private TOrder gettOrder(TOrder order) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         LambdaUpdateWrapper<TOrder> objectLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); 
														 | 
														
														 | 
														
															         LambdaUpdateWrapper<TOrder> objectLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         objectLambdaUpdateWrapper.eq(TOrder::getOrderNo, order.getOrderNo()); 
														 | 
														
														 | 
														
															         objectLambdaUpdateWrapper.eq(TOrder::getOrderNo, order.getOrderNo()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -317,15 +358,15 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         TOrder orderNew = this.getById(order); 
														 | 
														
														 | 
														
															         TOrder orderNew = this.getById(order); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 检查订单对应的技师是否存在 
														 | 
														
														 | 
														
															         // 检查订单对应的技师是否存在 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        updateJs (orderNew); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        updateJs (orderNew); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 更新订单状态 
														 | 
														
														 | 
														
															         // 更新订单状态 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         TOrder orderParam = new TOrder(); 
														 | 
														
														 | 
														
															         TOrder orderParam = new TOrder(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         orderParam.setcId(order.getcId()); 
														 | 
														
														 | 
														
															         orderParam.setcId(order.getcId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        orderParam.setnStatus(OrderStatusEnum.SERVICE.getCode()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        orderParam.setnStatus(OrderStatusEnum.RECEIVED_ORDER.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.updateById(orderParam); 
														 | 
														
														 | 
														
															         this.updateById(orderParam); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private void updateJs (TOrder orderNew) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private void updateJs(TOrder orderNew) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         TJs js = jsService.getById(orderNew.getcJsId()); 
														 | 
														
														 | 
														
															         TJs js = jsService.getById(orderNew.getcJsId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (js == null) { 
														 | 
														
														 | 
														
															         if (js == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             throw new IllegalStateException("无法找到对应的技师"); 
														 | 
														
														 | 
														
															             throw new IllegalStateException("无法找到对应的技师"); 
														 |