|
|
@@ -4,15 +4,13 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.aoyang.common.result.Result;
|
|
|
import com.aoyang.tms.controller.vo.LocationVO;
|
|
|
import com.aoyang.tms.controller.vo.WorkerInfo;
|
|
|
+import com.aoyang.tms.entity.Truck;
|
|
|
+import com.aoyang.tms.entity.TruckDriver;
|
|
|
import com.aoyang.tms.entity.TruckEscort;
|
|
|
import com.aoyang.tms.entity.TruckSimCard;
|
|
|
import com.aoyang.tms.feign.StrategyFeignClient;
|
|
|
import com.aoyang.tms.feign.result.TmsMongoDoc;
|
|
|
-import com.aoyang.tms.feign.result.Truck;
|
|
|
-import com.aoyang.tms.feign.result.TruckDriver;
|
|
|
-import com.aoyang.tms.service.CommonService;
|
|
|
-import com.aoyang.tms.service.TruckEscortService;
|
|
|
-import com.aoyang.tms.service.TruckSimCardService;
|
|
|
+import com.aoyang.tms.service.*;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
@@ -23,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -43,6 +40,12 @@ public class CommonServiceImpl implements CommonService {
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
|
|
|
@Resource
|
|
|
+ private TruckService truckService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private TruckDriverService truckDriverService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private TruckSimCardService truckSimCardService;
|
|
|
|
|
|
@Resource
|
|
|
@@ -53,7 +56,9 @@ public class CommonServiceImpl implements CommonService {
|
|
|
WorkerInfo workerInfo = new WorkerInfo();
|
|
|
workerInfo.setTruckId(truckId);
|
|
|
log.info("findTruckInfo findTruck 参数:{}", JSON.toJSONString(truckId));
|
|
|
- Truck truck = findTruck(truckId);
|
|
|
+ Truck truckParam = new Truck();
|
|
|
+ truckParam.setTruckId(truckId);
|
|
|
+ Truck truck = truckService.getById(truckParam);
|
|
|
log.info("findTruckInfo findTruck 结果:{}", JSON.toJSONString(truck));
|
|
|
if (truck != null) {
|
|
|
workerInfo.setTruckStatus(truck.getTmsStatus());
|
|
|
@@ -63,7 +68,7 @@ public class CommonServiceImpl implements CommonService {
|
|
|
workerInfo.setDeptName(truck.getDeptName());
|
|
|
}
|
|
|
log.info("findTruckInfo findTruckDrivers 参数:{}", JSON.toJSONString(truckId));
|
|
|
- List<TruckDriver> truckDrivers = findTruckDrivers(truckId);
|
|
|
+ List<TruckDriver> truckDrivers = truckDriverService.findTruckDrivers(truckId);
|
|
|
log.info("findTruckInfo findTruckDrivers 结果:{}", JSON.toJSONString(truckDrivers));
|
|
|
if (truckDrivers != null && truckDrivers.size() > 0) {
|
|
|
workerInfo.setDriverIdOne(truckDrivers.get(0).getDriverId());
|
|
|
@@ -87,28 +92,6 @@ public class CommonServiceImpl implements CommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TruckDriver> findTruckDrivers(Long truckId) {
|
|
|
- TruckDriver truckDriver = new TruckDriver();
|
|
|
- truckDriver.setTruckId(truckId);
|
|
|
- Result<List<TruckDriver>> result = strategyFeignClient.findTruckDrivers(truckDriver);
|
|
|
- if (verifyResult(result)) {
|
|
|
- return result.getData();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Truck findTruck(Long truckId) {
|
|
|
- Truck truck = new Truck();
|
|
|
- truck.setTruckId(truckId);
|
|
|
- Result<Truck> result = strategyFeignClient.findTruck(truck);
|
|
|
- if (verifyResult(result)) {
|
|
|
- return result.getData();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public Integer findOrgTruckNumber(Long orgId, Long deptId) {
|
|
|
Truck truck = new Truck();
|
|
|
truck.setOrgId(orgId);
|
|
|
@@ -124,14 +107,14 @@ public class CommonServiceImpl implements CommonService {
|
|
|
|
|
|
@Override
|
|
|
public Boolean updateTruckTmsStatus(Long truckId, Integer tmsStatus) {
|
|
|
- Truck truck = new Truck();
|
|
|
- truck.setTruckId(truckId);
|
|
|
- truck.setTmsStatus(tmsStatus);
|
|
|
- Result<Boolean> result = strategyFeignClient.updateTruckTmsStatus(truck);
|
|
|
- if (verifyResult(result)) {
|
|
|
- return result.getData();
|
|
|
- }
|
|
|
- return null;
|
|
|
+ //先通过主键拿出来,然后更新其状态
|
|
|
+ Truck truckParam = new Truck();
|
|
|
+ truckParam.setTruckId(truckId);
|
|
|
+ Truck truck4Update = truckService.getById(truckParam);
|
|
|
+ truck4Update.setTruckId(truckParam.getTruckId());
|
|
|
+ truck4Update.setTmsStatus(truckParam.getTmsStatus());
|
|
|
+ Boolean flag = truckService.updateById(truck4Update);
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
@Override
|