| | |
| | | package com.xiaopeng.operation.task; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpPoint; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceAreaService; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceService; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | @Resource |
| | | |
| | | private IXpElectronicFenceService xpElectronicFenceService; |
| | | // 每隔1分钟执行一次 如果运营区域不处于启用状态 将关联的点位状态修改为已失效 |
| | | // 每隔1分钟执行一次 如果运营区域不处于启用状态 将关联的点位状态修改为已停用 |
| | | @Scheduled(fixedRate = 60 * 1000) |
| | | public void checkPointInFenceArea() { |
| | | List<XpElectronicFenceArea> electronicFenceAreaList = xpElectronicFenceAreaService.lambdaQuery().eq(XpElectronicFenceArea::getAreaStatus, 2) |
| | |
| | | if (!areaIds.isEmpty()){ |
| | | List<XpPoint> xpPoints = xpPointService.lambdaQuery() |
| | | .in(XpPoint::getElectronicAreaId, areaIds) |
| | | .eq(XpPoint::getOperationStatus, 2) |
| | | .list(); |
| | | for (XpPoint xpPoint : xpPoints) { |
| | | xpPoint.setFpElectronicAreaId(null); |
| | | xpPoint.setOperationStatus(4); |
| | | xpPoint.setOperationStatus(3); |
| | | } |
| | | xpPointService.updateBatchById(xpPoints); |
| | | } |
| | |
| | | if (!areaIds.isEmpty()){ |
| | | List<XpPoint> xpPoints = xpPointService.lambdaQuery() |
| | | .in(XpPoint::getElectronicAreaId, areaIds) |
| | | .eq(XpPoint::getOperationStatus, 2) |
| | | .list(); |
| | | for (XpPoint xpPoint : xpPoints) { |
| | | xpPoint.setFpElectronicAreaId(null); |
| | | xpPoint.setOperationStatus(4); |
| | | xpPoint.setOperationStatus(3); |
| | | } |
| | | xpPointService.updateBatchById(xpPoints); |
| | | } |