Browse Source

fix:头像框标识逻辑

wrj 10 months ago
parent
commit
774d77250c

+ 5 - 3
nightFragrance-massage/src/main/java/com/ylx/massage/domain/TJs.java

@@ -11,10 +11,12 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
+import org.dom4j.tree.DefaultText;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -214,7 +216,7 @@ public class TJs implements Serializable {
      */
      */
     @TableField("c_time")
     @TableField("c_time")
     @ApiModelProperty("注册时间")
     @ApiModelProperty("注册时间")
-    private String cTime;
+    private Date cTime;
 
 
     /**
     /**
      * 是否带头像框 0否 1是
      * 是否带头像框 0否 1是
@@ -422,11 +424,11 @@ public class TJs implements Serializable {
         this.nTong = nTong;
         this.nTong = nTong;
     }
     }
 
 
-    public String getcTime() {
+    public Date getcTime() {
         return cTime;
         return cTime;
     }
     }
 
 
-    public void setcTime(String cTime) {
+    public void setcTime(Date cTime) {
         this.cTime = cTime;
         this.cTime = cTime;
     }
     }
 
 

+ 10 - 3
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TJsServiceImpl.java

@@ -21,6 +21,7 @@ import com.ylx.massage.utils.DateTimeUtils;
 import com.ylx.massage.utils.LocationUtil;
 import com.ylx.massage.utils.LocationUtil;
 import com.ylx.massage.utils.WeChatUtil;
 import com.ylx.massage.utils.WeChatUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
@@ -63,6 +64,9 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
     @Resource
     @Resource
     private TOrderService orderService;
     private TOrderService orderService;
 
 
+    @Resource(name = "commonAsyncExecutor")
+    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+
 
 
     @Override
     @Override
     public Page<TJs> getAll(Page<TJs> page, TJsVo param) {
     public Page<TJs> getAll(Page<TJs> page, TJsVo param) {
@@ -117,14 +121,17 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
         LambdaQueryWrapper<TJs> jsLambdaQueryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<TJs> jsLambdaQueryWrapper = new LambdaQueryWrapper<>();
         jsLambdaQueryWrapper.eq(TJs::getId, js.getId()).eq(TJs::getnTong, JsStatusEnum.JS_NOT_PASS.getCode());
         jsLambdaQueryWrapper.eq(TJs::getId, js.getId()).eq(TJs::getnTong, JsStatusEnum.JS_NOT_PASS.getCode());
         js.setnTong(JsStatusEnum.JS_PASS.getCode());
         js.setnTong(JsStatusEnum.JS_PASS.getCode());
-
+        js.setnB2(1);
+        js.setcTime(new Date());
         LambdaQueryWrapper<TWxUser> wxLambdaQueryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<TWxUser> wxLambdaQueryWrapper = new LambdaQueryWrapper<>();
         wxLambdaQueryWrapper.eq(TWxUser::getcOpenid, js1.getcOpenId());
         wxLambdaQueryWrapper.eq(TWxUser::getcOpenid, js1.getcOpenId());
         TWxUser tWxUser = new TWxUser();
         TWxUser tWxUser = new TWxUser();
+        //角色状态修改
         tWxUser.setRole(1);
         tWxUser.setRole(1);
         wxUserService.update(tWxUser, wxLambdaQueryWrapper);
         wxUserService.update(tWxUser, wxLambdaQueryWrapper);
-
+        //修改审核状态
         boolean update = this.update(js, jsLambdaQueryWrapper);
         boolean update = this.update(js, jsLambdaQueryWrapper);
+        //修改新技师标识
         js.setcOpenId(js1.getcOpenId());
         js.setcOpenId(js1.getcOpenId());
         this.jsNotification(js);
         this.jsNotification(js);
 
 
@@ -271,7 +278,7 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
         // 审核状态
         // 审核状态
         js.setnTong(JsStatusEnum.JS_NOT_PASS.getCode());
         js.setnTong(JsStatusEnum.JS_NOT_PASS.getCode());
         js.setnB1(MassageConstants.INTEGER_ZERO);
         js.setnB1(MassageConstants.INTEGER_ZERO);
-        js.setnB2(MassageConstants.INTEGER_ONE);
+        js.setnB2(MassageConstants.INTEGER_ZERO);
         js.setnB3(MassageConstants.INTEGER_ZERO);
         js.setnB3(MassageConstants.INTEGER_ZERO);
         js.setDtCreateTime(LocalDateTime.now());
         js.setDtCreateTime(LocalDateTime.now());
     }
     }

+ 7 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TOrderServiceImpl.java

@@ -442,6 +442,13 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
         TJs jsParam = new TJs();
         TJs jsParam = new TJs();
         jsParam.setId(orderNew.getcJsId());
         jsParam.setId(orderNew.getcJsId());
         jsParam.setnStatus(JsStatusEnum.JS_SERVICEABLE.getCode());
         jsParam.setnStatus(JsStatusEnum.JS_SERVICEABLE.getCode());
+        //判断热度标识
+        List<TOrder> list = list(new LambdaQueryWrapper<TOrder>().eq(TOrder::getcJsId, orderNew.getcJsId())
+                .ge(TOrder::getDtCreateTime, DateTimeUtils.addDays(new Date(), -3))
+                .ge(TOrder::getnStatus, OrderStatusEnum.WAIT_EVALUATE.getCode()));
+        if (list.size() >= 2) {
+            jsParam.setnB3(MassageConstants.INTEGER_ONE);
+        }
         // 更新技师状态
         // 更新技师状态
         jsService.updateById(jsParam);
         jsService.updateById(jsParam);
         // 更新技师钱包金额
         // 更新技师钱包金额

+ 70 - 3
nightFragrance-massage/src/main/java/com/ylx/massage/task/massageTask.java

@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ylx.common.constant.MassageConstants;
 import com.ylx.common.constant.MassageConstants;
+import com.ylx.massage.domain.TJs;
 import com.ylx.massage.domain.TOrder;
 import com.ylx.massage.domain.TOrder;
 import com.ylx.massage.enums.OrderStatusEnum;
 import com.ylx.massage.enums.OrderStatusEnum;
+import com.ylx.massage.service.TJsService;
 import com.ylx.massage.service.TOrderService;
 import com.ylx.massage.service.TOrderService;
 import com.ylx.massage.utils.DateTimeUtils;
 import com.ylx.massage.utils.DateTimeUtils;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -13,12 +15,12 @@ import org.springframework.stereotype.Component;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 
 
 /**
 /**
  * @author jianlong
  * @author jianlong
  * @date 2024-04-19 14:11
  * @date 2024-04-19 14:11
- *
  */
  */
 @Slf4j
 @Slf4j
 @Component("massageTask")
 @Component("massageTask")
@@ -27,6 +29,8 @@ public class massageTask {
     @Resource
     @Resource
     private TOrderService orderService;
     private TOrderService orderService;
 
 
+    private TJsService jsService;
+
     public void cancelOrder() {
     public void cancelOrder() {
 
 
         Date nowDate = new Date();
         Date nowDate = new Date();
@@ -35,7 +39,7 @@ public class massageTask {
         Date date = DateTimeUtils.addMinute(nowDate, -5);
         Date date = DateTimeUtils.addMinute(nowDate, -5);
         log.info("开始执行取消订单任务当前时间减5分钟,{}", date);
         log.info("开始执行取消订单任务当前时间减5分钟,{}", date);
         long total = 1L;
         long total = 1L;
-        while(total > 0L){
+        while (total > 0L) {
             total = extracted(date);
             total = extracted(date);
         }
         }
 
 
@@ -53,7 +57,7 @@ public class massageTask {
 
 
         Page<TOrder> resPage = orderService.page(page, objectLambdaQueryWrapper);
         Page<TOrder> resPage = orderService.page(page, objectLambdaQueryWrapper);
         if (CollectionUtil.isNotEmpty(resPage.getRecords())) {
         if (CollectionUtil.isNotEmpty(resPage.getRecords())) {
-            resPage.getRecords().forEach(order->{
+            resPage.getRecords().forEach(order -> {
                 TOrder newOrder = new TOrder();
                 TOrder newOrder = new TOrder();
                 //todo 订单锁
                 //todo 订单锁
                 newOrder.setcId(order.getcId());
                 newOrder.setcId(order.getcId());
@@ -65,4 +69,67 @@ public class massageTask {
         return resPage.getTotal();
         return resPage.getTotal();
 
 
     }
     }
+
+    public void cancelNewJs() {
+
+        Date nowDate = new Date();
+        log.info("开始执行取消新技师标识任务当前时间,{}", nowDate);
+
+        long total = 1L;
+        while (total > 0L) {
+            LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            Date date = DateTimeUtils.addDays(nowDate, -7);
+
+            log.info("开始执行取新技师当前时间减7天,{}", date);
+            objectLambdaQueryWrapper.eq(TJs::getnB2, MassageConstants.INTEGER_ONE).le(TJs::getcTime, date).orderByAsc(TJs::getcTime);
+
+            Page<TJs> page = new Page<>();
+            page.setSize(MassageConstants.TWO_HUNDRED);
+
+            Page<TJs> page1 = jsService.page(page, objectLambdaQueryWrapper);
+
+            if (CollectionUtil.isNotEmpty(page1.getRecords())) {
+                page1.getRecords().forEach(tjs -> {
+                    TJs js = new TJs();
+                    js.setId(tjs.getId());
+                    js.setnB2(MassageConstants.INTEGER_ZERO);
+                    jsService.updateById(js);
+                    log.info("取消新技师标识,{}", js.getcOpenId() + js.getcName());
+                });
+            }
+            total = page1.getTotal();
+        }
+    }
+
+    public void cancelHotJs() {
+
+        Date nowDate = new Date();
+        log.info("开始执行取消技师热度标识任务当前时间,{}", nowDate);
+
+        Date date = DateTimeUtils.addDays(nowDate, -3);
+        long total = 1L;
+        while (total > 0L) {
+            LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            objectLambdaQueryWrapper.eq(TJs::getnB3, MassageConstants.INTEGER_ONE);
+
+            Page<TJs> page = new Page<>();
+            page.setSize(MassageConstants.TWO_HUNDRED);
+            Page<TJs> page1 = jsService.page(page, objectLambdaQueryWrapper);
+
+            if (CollectionUtil.isNotEmpty(page1.getRecords())) {
+                page1.getRecords().forEach(tjs -> {
+                    List<TOrder> list = orderService.list(new LambdaQueryWrapper<TOrder>().eq(TOrder::getcJsId, tjs.getId()).ge(TOrder::getDtCreateTime, date));
+                    if(CollectionUtil.isEmpty(list) || list.size() < 3){
+                        TJs js = new TJs();
+                        js.setId(tjs.getId());
+                        js.setnB3(MassageConstants.INTEGER_ZERO);
+                        jsService.updateById(js);
+                        log.info("取消热度技师标识,{}", js.getcOpenId() + js.getcName());
+                    }
+                });
+            }
+            total = page1.getTotal();
+        }
+    }
+
 }
 }