|
@@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.aoyang.common.param.PageParam;
|
|
import com.aoyang.common.param.PageParam;
|
|
|
import com.aoyang.tms.controller.param.TruckEscortAddParam;
|
|
import com.aoyang.tms.controller.param.TruckEscortAddParam;
|
|
|
import com.aoyang.tms.controller.param.TruckEscortListParam;
|
|
import com.aoyang.tms.controller.param.TruckEscortListParam;
|
|
|
|
|
+import com.aoyang.tms.entity.Truck;
|
|
|
|
|
+import com.aoyang.tms.entity.TruckDriver;
|
|
|
import com.aoyang.tms.entity.TruckEscort;
|
|
import com.aoyang.tms.entity.TruckEscort;
|
|
|
import com.aoyang.tms.entity.User;
|
|
import com.aoyang.tms.entity.User;
|
|
|
import com.aoyang.tms.mapper.TruckEscortMapper;
|
|
import com.aoyang.tms.mapper.TruckEscortMapper;
|
|
|
import com.aoyang.tms.service.CommonService;
|
|
import com.aoyang.tms.service.CommonService;
|
|
|
|
|
+import com.aoyang.tms.service.TruckDriverService;
|
|
|
import com.aoyang.tms.service.TruckEscortService;
|
|
import com.aoyang.tms.service.TruckEscortService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -19,6 +22,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import java.security.acl.LastOwnerException;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -37,6 +42,8 @@ public class TruckEscortServiceImpl extends ServiceImpl<TruckEscortMapper, Truck
|
|
|
TruckEscortMapper truckEscortMapper;
|
|
TruckEscortMapper truckEscortMapper;
|
|
|
@Resource
|
|
@Resource
|
|
|
private CommonService commonService;
|
|
private CommonService commonService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TruckDriverService truckDriverService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public IPage<TruckEscort> findPage(PageParam<TruckEscortListParam> pageParam) {
|
|
public IPage<TruckEscort> findPage(PageParam<TruckEscortListParam> pageParam) {
|
|
@@ -85,6 +92,7 @@ public class TruckEscortServiceImpl extends ServiceImpl<TruckEscortMapper, Truck
|
|
|
@Override
|
|
@Override
|
|
|
public boolean add(TruckEscortAddParam param) {
|
|
public boolean add(TruckEscortAddParam param) {
|
|
|
boolean flag = false;
|
|
boolean flag = false;
|
|
|
|
|
+ //添加用户
|
|
|
User user = new User();
|
|
User user = new User();
|
|
|
user.setBaseRole("driver");
|
|
user.setBaseRole("driver");
|
|
|
user.setUserType(2);
|
|
user.setUserType(2);
|
|
@@ -118,6 +126,17 @@ public class TruckEscortServiceImpl extends ServiceImpl<TruckEscortMapper, Truck
|
|
|
truckEscort.setTruckId(param.getTruckId());
|
|
truckEscort.setTruckId(param.getTruckId());
|
|
|
}
|
|
}
|
|
|
flag = saveOrUpdate(truckEscort);
|
|
flag = saveOrUpdate(truckEscort);
|
|
|
|
|
+ //添加truck_driver
|
|
|
|
|
+ TruckDriver truckDriver = new TruckDriver();
|
|
|
|
|
+ truckDriver.setOrgId(param.getOrgId());
|
|
|
|
|
+ truckDriver.setCreateDate(LocalDateTime.now());
|
|
|
|
|
+ truckDriver.setCreater(param.getCreater());
|
|
|
|
|
+ truckDriver.setCreaterName(param.getCreaterName());
|
|
|
|
|
+ truckDriver.setDriverId(userSave.getUserId());
|
|
|
|
|
+ truckDriver.setDriverName(userSave.getUserName());
|
|
|
|
|
+ boolean saveTruckDriver = truckDriverService.save(truckDriver);
|
|
|
|
|
+ log.info("添加押运员,保存truckDriver,参数:{},结果:{}", JSON.toJSONString(truckDriver), saveTruckDriver);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
@@ -133,6 +152,19 @@ public class TruckEscortServiceImpl extends ServiceImpl<TruckEscortMapper, Truck
|
|
|
user.setUserName(param.getEscortName());
|
|
user.setUserName(param.getEscortName());
|
|
|
}
|
|
}
|
|
|
commonService.updateUser(user);
|
|
commonService.updateUser(user);
|
|
|
|
|
+
|
|
|
|
|
+ //删除truck_driver
|
|
|
|
|
+ boolean deleteFlag = truckDriverService.delete(param.getEscortId());
|
|
|
|
|
+ log.info("新增押运员,删除truckDriver,参数:{},结果:{}", JSON.toJSONString(param.getEscortId()), deleteFlag);
|
|
|
|
|
+ TruckDriver truckDriver = new TruckDriver();
|
|
|
|
|
+ truckDriver.setOrgId(param.getOrgId());
|
|
|
|
|
+ truckDriver.setCreateDate(LocalDateTime.now());
|
|
|
|
|
+ truckDriver.setCreater(param.getCreater());
|
|
|
|
|
+ truckDriver.setCreaterName(param.getCreaterName());
|
|
|
|
|
+ truckDriver.setDriverId(param.getEscortId());
|
|
|
|
|
+ truckDriver.setDriverName(user.getUserName());
|
|
|
|
|
+ boolean saveTruckDriver = truckDriverService.save(truckDriver);
|
|
|
|
|
+ log.info("新增押运员,新增truckDriver,参数:{},结果:{}", JSON.toJSONString(truckDriver), saveTruckDriver);
|
|
|
}
|
|
}
|
|
|
return updateById(param);
|
|
return updateById(param);
|
|
|
}
|
|
}
|