|
@@ -8,6 +8,8 @@ import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
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.exception.YException;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.DriverViewInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverCarInfoService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IDriverPayeeInfoService;
|
|
@@ -49,6 +51,22 @@ public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper,
|
|
|
public String addInfo(DriverViewInfo driverViewInfo) {
|
|
|
//新增主键id
|
|
|
driverViewInfo.setId(IdGenerator.generateUUID());
|
|
|
+ //判断司机电话是否唯一
|
|
|
+ List<DriverViewInfo> driverViewInfos =
|
|
|
+ this.selectList(new EntityWrapper<DriverViewInfo>()
|
|
|
+ .eq(DriverViewInfo.QueryFiles.DRIVER_NAME, driverViewInfo.getDriverPhone())
|
|
|
+ .eq(DriverViewInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
+ if (driverViewInfos.size() > 0) {
|
|
|
+ throw new YException(YExceptionEnum.DRIVER_PHONE_ERROR);
|
|
|
+ }
|
|
|
+ //判断司机身份证号是否唯一
|
|
|
+ List<DriverViewInfo> driverViewInfoList =
|
|
|
+ this.selectList(new EntityWrapper<DriverViewInfo>()
|
|
|
+ .eq(DriverViewInfo.QueryFiles.NUMBER_CARD, driverViewInfo.getNumberCard())
|
|
|
+ .eq(DriverViewInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
+ if (driverViewInfoList.size() > 0) {
|
|
|
+ throw new YException(YExceptionEnum.DRIVER_NUMBER_ERROR);
|
|
|
+ }
|
|
|
//货车信息新增
|
|
|
List<DriverCarInfo> driverCarInfoList = driverViewInfo.getDriverCarInfoList();
|
|
|
if (!CollectionUtils.isEmpty(driverCarInfoList)) {
|
|
@@ -63,6 +81,14 @@ public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper,
|
|
|
for (DriverPayeeInfo driverPayeeInfo : driverPayeeInfoList) {
|
|
|
driverPayeeInfo.setId(IdGenerator.generateUUID());
|
|
|
driverPayeeInfo.setDriverId(driverViewInfo.getId());
|
|
|
+ //判断收款人身份证号是否唯一
|
|
|
+ List<DriverPayeeInfo> driverPayeeInfos =
|
|
|
+ driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
|
|
|
+ .eq(DriverPayeeInfo.QueryFiles.PAYEE_NUMBER_CARD, driverPayeeInfo.getPayeeNumberCard())
|
|
|
+ .eq(DriverPayeeInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
+ if (driverPayeeInfos.size() > 0) {
|
|
|
+ throw new YException(YExceptionEnum.PAYEE_NUMBER_ERROR);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boolean one = this.insert(driverViewInfo);
|
|
@@ -83,7 +109,6 @@ public class DriverViewInfoServiceImpl extends ServiceImpl<DriverViewInfoMapper,
|
|
|
@Override
|
|
|
public String editInfo(DriverViewInfo driverViewInfo) {
|
|
|
//主表信息编辑
|
|
|
-
|
|
|
this.updateById(driverViewInfo);
|
|
|
//货车信息编辑
|
|
|
List<DriverCarInfo> driverCarInfoList = driverViewInfo.getDriverCarInfoList();
|