|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ylx.common.constant.MassageConstants;
|
|
|
import com.ylx.common.core.domain.entity.SysDept;
|
|
|
+import com.ylx.common.utils.DateUtils;
|
|
|
import com.ylx.common.utils.StringUtils;
|
|
|
import com.ylx.massage.domain.*;
|
|
|
import com.ylx.massage.enums.BillTypeEnum;
|
|
@@ -13,6 +14,7 @@ import com.ylx.massage.enums.OrderStatusEnum;
|
|
|
import com.ylx.massage.mapper.TConsumptionLogMapper;
|
|
|
import com.ylx.massage.service.*;
|
|
|
import com.ylx.massage.utils.DateTimeUtils;
|
|
|
+import com.ylx.massage.utils.LocationUtil;
|
|
|
import com.ylx.system.service.ISysDeptService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -34,6 +36,9 @@ public class massageTask {
|
|
|
@Resource
|
|
|
private TOrderService orderService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private LocationUtil locationUtil;
|
|
|
+
|
|
|
@Resource
|
|
|
private TJsService jsService;
|
|
|
|
|
@@ -338,4 +343,33 @@ public class massageTask {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void sysJsWeiZhi() {
|
|
|
+ log.info("开始执行同步技师位置时间,{}", DateUtils.getNowDate());
|
|
|
+ long flag = 1L;
|
|
|
+ while (flag > 0L) {
|
|
|
+ LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ objectLambdaQueryWrapper.gt(TJs::getId, String.valueOf(flag)).orderByAsc(TJs::getId);
|
|
|
+
|
|
|
+ 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 -> {
|
|
|
+ if (StringUtils.isNotBlank(tjs.getcPhone()) && null != tjs.getLongitude() && null != tjs.getLatitude()) {
|
|
|
+ locationUtil.geoAdd(LocationUtil.GEO_KEY, tjs.getcPhone(),
|
|
|
+ Double.parseDouble(tjs.getLongitude().toString()),
|
|
|
+ Double.parseDouble(tjs.getLatitude().toString()));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Optional<String> maxId = page1.getRecords().stream().max(Comparator.comparing(TJs::getId)).map(TJs::getId);
|
|
|
+ flag = Long.parseLong(maxId.orElse("0"));
|
|
|
+ } else {
|
|
|
+ flag = 0L;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("结束执行同步技师位置时间,{}", DateUtils.getNowDate());
|
|
|
+ }
|
|
|
+
|
|
|
}
|