|
@@ -13,6 +13,7 @@ import com.ylx.common.utils.StringUtils;
|
|
|
import com.ylx.massage.domain.*;
|
|
|
import com.ylx.massage.domain.vo.TJsVo;
|
|
|
import com.ylx.massage.enums.JsStatusEnum;
|
|
|
+import com.ylx.massage.enums.OrderStatusEnum;
|
|
|
import com.ylx.massage.mapper.TJsMapper;
|
|
|
import com.ylx.massage.service.*;
|
|
|
import com.ylx.massage.utils.LocationUtil;
|
|
@@ -27,6 +28,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -56,6 +58,9 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
|
|
|
@Resource
|
|
|
private WeChatUtil weChatUtil;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private TOrderService orderService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Page<TJs> getAll(Page<TJs> page, TJsVo param) {
|
|
@@ -152,6 +157,30 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
|
|
|
|
|
|
}
|
|
|
@Override
|
|
|
+ public boolean upPost(TJs js) {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(js.getId())) {
|
|
|
+ throw new ServiceException("技师ID不能为空");
|
|
|
+ }
|
|
|
+ if (js.getnStatus2() == null) {
|
|
|
+ throw new ServiceException("岗位状态不能为空");
|
|
|
+ }
|
|
|
+ //上岗
|
|
|
+ if (Objects.equals(js.getnStatus2(), JsStatusEnum.POST_ON_DUTY.getCode())) {
|
|
|
+ //岗位状态为1时,设置nStatus为1
|
|
|
+ js.setnStatus(JsStatusEnum.JS_SERVICEABLE.getCode());
|
|
|
+ }
|
|
|
+ if (Objects.equals(js.getnStatus2(), JsStatusEnum.POST_NOT_ON_DUTY.getCode())) {
|
|
|
+ //判断该技师是否有服务中的订单
|
|
|
+ List<TOrder> list = orderService.list(new LambdaQueryWrapper<TOrder>().eq(TOrder::getnStatus, OrderStatusEnum.SERVICE).eq(TOrder::getcJsId, js.getId()));
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ throw new ServiceException("您有服务中的订单,不能下岗");
|
|
|
+ }
|
|
|
+ js.setnStatus(JsStatusEnum.JS_NO_SERVICE.getCode());
|
|
|
+ }
|
|
|
+ return this.updateById(js);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
public TJs getByJsId(String jsId, String openId) {
|
|
|
if (jsId == null || jsId.trim().isEmpty()) {
|
|
|
// 处理空或空白的jsId
|