|
@@ -10,6 +10,8 @@ import com.yh.saas.plugin.yiliangyiyun.mapper.DriverViewInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverCarInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverCarInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverPayeeInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverPayeeInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverViewInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverViewInfoService;
|
|
|
|
+import com.yh.saas.common.support.util.IdGenerator;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -19,6 +21,7 @@ import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 记录司机信息 服务实现类
|
|
* 记录司机信息 服务实现类
|
|
@@ -29,12 +32,70 @@ import java.util.Map;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper, DriverViewInfo> implements IDriverViewInfoService {
|
|
public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper, DriverViewInfo> implements IDriverViewInfoService {
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IDriverCarInfoService driverCarInfoService;
|
|
private IDriverCarInfoService driverCarInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private IDriverPayeeInfoService driverPayeeInfoService;
|
|
private IDriverPayeeInfoService driverPayeeInfoService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 添加信息
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String addInfo(DriverViewInfo driverViewInfo) {
|
|
|
|
+ //新增主键id
|
|
|
|
+ driverViewInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ //货车信息新增
|
|
|
|
+ List<DriverCarInfo> driverCarInfoList = driverViewInfo.getDriverCarInfoList();
|
|
|
|
+ if (!CollectionUtils.isEmpty(driverCarInfoList)) {
|
|
|
|
+ for (DriverCarInfo driverCarInfo : driverCarInfoList) {
|
|
|
|
+ driverCarInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ driverCarInfo.setDriverId(driverViewInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //收款人账户信息新增
|
|
|
|
+ List<DriverPayeeInfo> driverPayeeInfoList = driverViewInfo.getDriverPayeeInfoList();
|
|
|
|
+ if (!CollectionUtils.isEmpty(driverPayeeInfoList)) {
|
|
|
|
+ for (DriverPayeeInfo driverPayeeInfo : driverPayeeInfoList) {
|
|
|
|
+ driverPayeeInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ driverPayeeInfo.setDriverId(driverViewInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ boolean one = this.insert(driverViewInfo);
|
|
|
|
+ boolean two = driverCarInfoService.insertBatch(driverCarInfoList);
|
|
|
|
+ boolean three = driverPayeeInfoService.insertBatch(driverPayeeInfoList);
|
|
|
|
+
|
|
|
|
+ // 假如 都成功返回ok
|
|
|
|
+ if (one && two && three) {
|
|
|
|
+ return "OK";
|
|
|
|
+ } else {
|
|
|
|
+ return "NG";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 编辑信息
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String editInfo(DriverViewInfo driverViewInfo) {
|
|
|
|
+ //主表信息编辑
|
|
|
|
+
|
|
|
|
+ this.updateById(driverViewInfo);
|
|
|
|
+ //货车信息编辑
|
|
|
|
+ List<DriverCarInfo> driverCarInfoList = driverViewInfo.getDriverCarInfoList();
|
|
|
|
+ this.updateById(driverViewInfo);
|
|
|
|
+ driverCarInfoService.updateBatchById(driverCarInfoList);
|
|
|
|
+ //收款人账户信息编辑
|
|
|
|
+ List<DriverPayeeInfo> driverPayeeInfoList = driverViewInfo.getDriverPayeeInfoList();
|
|
|
|
+ this.updateById(driverViewInfo);
|
|
|
|
+ driverPayeeInfoService.updateBatchById(driverPayeeInfoList);
|
|
|
|
+
|
|
|
|
+ return driverViewInfo.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 司机管理页面列表
|
|
* 司机管理页面列表
|
|
* @param driverViewInfo
|
|
* @param driverViewInfo
|
|
@@ -88,25 +149,48 @@ public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper,
|
|
* @param id
|
|
* @param id
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public void deleteDriver(String id){
|
|
|
|
|
|
+ public void deleteDriver(String id) {
|
|
//删除司机信息
|
|
//删除司机信息
|
|
DriverViewInfo driverViewInfo = this.selectById(id);
|
|
DriverViewInfo driverViewInfo = this.selectById(id);
|
|
this.deleteById(driverViewInfo.getId());
|
|
this.deleteById(driverViewInfo.getId());
|
|
//删除货车信息
|
|
//删除货车信息
|
|
List<DriverCarInfo> driverCarInfoList = driverCarInfoService.selectList(new EntityWrapper<DriverCarInfo>()
|
|
List<DriverCarInfo> driverCarInfoList = driverCarInfoService.selectList(new EntityWrapper<DriverCarInfo>()
|
|
- .eq("driver_id",id));
|
|
|
|
- if (!CollectionUtils.isEmpty(driverCarInfoList)){
|
|
|
|
- for (DriverCarInfo driverCarInfo : driverCarInfoList){
|
|
|
|
|
|
+ .eq("driver_id", id));
|
|
|
|
+ if (!CollectionUtils.isEmpty(driverCarInfoList)) {
|
|
|
|
+ for (DriverCarInfo driverCarInfo : driverCarInfoList) {
|
|
driverCarInfoService.deleteById(driverCarInfo.getId());
|
|
driverCarInfoService.deleteById(driverCarInfo.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//删除收款账户信息
|
|
//删除收款账户信息
|
|
List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
|
|
List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
|
|
- .eq("driver_id",id));
|
|
|
|
- if (!CollectionUtils.isEmpty(driverPayeeInfoList)){
|
|
|
|
- for (DriverPayeeInfo driverPayeeInfo : driverPayeeInfoList){
|
|
|
|
|
|
+ .eq("driver_id", id));
|
|
|
|
+ if (!CollectionUtils.isEmpty(driverPayeeInfoList)) {
|
|
|
|
+ for (DriverPayeeInfo driverPayeeInfo : driverPayeeInfoList) {
|
|
driverPayeeInfoService.deleteById(driverPayeeInfo.getId());
|
|
driverPayeeInfoService.deleteById(driverPayeeInfo.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 更改状态
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String editDisableInfo(DriverViewInfo driverViewInfo) {
|
|
|
|
+ DriverViewInfo driverViewInfos = this.selectById(driverViewInfo.getId());
|
|
|
|
+ //查询司机信息
|
|
|
|
+ if (driverViewInfos != null) {
|
|
|
|
+ //已禁用状态
|
|
|
|
+ if (StatusEnum.DISABLED.getFlag().equals(driverViewInfo.getDisableStatusFlag())) {
|
|
|
|
+ driverViewInfos.setDisableStatusFlag(StatusEnum.NOT_DISABLE.getFlag());
|
|
|
|
+ }
|
|
|
|
+ //未禁用状态
|
|
|
|
+ else {
|
|
|
|
+ driverViewInfos.setDisableStatusFlag(StatusEnum.DISABLED.getFlag());
|
|
|
|
+ driverViewInfos.setDisableReasons(driverViewInfo.getDisableReasons());
|
|
|
|
+ }
|
|
|
|
+ //更改司机信息
|
|
|
|
+ this.updateById(driverViewInfos);
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+ return "NG";
|
|
|
|
+ }
|
|
}
|
|
}
|