|
@@ -1,10 +1,23 @@
|
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
+import com.baomidou.mybatisplus.plugins.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.DriverCarInfo;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.DriverPayeeInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.DriverViewInfoMapper;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IDriverCarInfoService;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IDriverPayeeInfoService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverViewInfoService;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -17,4 +30,83 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper, DriverViewInfo> implements IDriverViewInfoService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IDriverCarInfoService driverCarInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IDriverPayeeInfoService driverPayeeInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 司机管理页面列表
|
|
|
+ * @param driverViewInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<DriverViewInfo> selectDriverInfoPage(DriverViewInfo driverViewInfo){
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
+ pageView.put("startRecord", (driverViewInfo.getCurrentPage() - 1)
|
|
|
+ * driverViewInfo.getPageSize());
|
|
|
+ //公司id
|
|
|
+ pageView.put("compId",driverViewInfo.getCompId());
|
|
|
+ pageView.put("residentCityProvincial",driverViewInfo.getResidentCityProvincial());
|
|
|
+ pageView.put("residentCityMunicipal",driverViewInfo.getResidentCityMunicipal());
|
|
|
+ pageView.put("searchKeyWord",driverViewInfo.getSearchKeyWord());
|
|
|
+ pageView.put("pageSize",driverViewInfo.getPageSize());
|
|
|
+ pageView.put("currentPage",driverViewInfo.getCurrentPage());
|
|
|
+ // 查询司机总数
|
|
|
+ Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
|
+ List<DriverViewInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
+ Page<DriverViewInfo> page = new Page<>();
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
+ page.setCurrent(driverViewInfo.getCurrentPage());
|
|
|
+ page.setSize(driverViewInfo.getPageSize());
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查看司机信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public DriverViewInfo getDriver (String id){
|
|
|
+ //查看司机信息
|
|
|
+ DriverViewInfo driverViewInfo = this.selectById(id);
|
|
|
+ //查看货车信息
|
|
|
+ List<DriverCarInfo> driverCarInfoList = driverCarInfoService.selectList(new EntityWrapper<DriverCarInfo>()
|
|
|
+ .eq("driver_id",id));
|
|
|
+ driverViewInfo.setDriverCarInfoList(driverCarInfoList);
|
|
|
+ //查看收款账户信息
|
|
|
+ List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
|
|
|
+ .eq("driver_id",id));
|
|
|
+ driverViewInfo.setDriverPayeeInfoList(driverPayeeInfoList);
|
|
|
+ return driverViewInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除司机信息
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void deleteDriver(String id){
|
|
|
+ //删除司机信息
|
|
|
+ DriverViewInfo driverViewInfo = this.selectById(id);
|
|
|
+ this.deleteById(driverViewInfo.getId());
|
|
|
+ //删除货车信息
|
|
|
+ List<DriverCarInfo> driverCarInfoList = driverCarInfoService.selectList(new EntityWrapper<DriverCarInfo>()
|
|
|
+ .eq("driver_id",id));
|
|
|
+ if (!CollectionUtils.isEmpty(driverCarInfoList)){
|
|
|
+ for (DriverCarInfo driverCarInfo : driverCarInfoList){
|
|
|
+ driverCarInfoService.deleteById(driverCarInfo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //删除收款账户信息
|
|
|
+ List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
|
|
|
+ .eq("driver_id",id));
|
|
|
+ if (!CollectionUtils.isEmpty(driverPayeeInfoList)){
|
|
|
+ for (DriverPayeeInfo driverPayeeInfo : driverPayeeInfoList){
|
|
|
+ driverPayeeInfoService.deleteById(driverPayeeInfo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|