@ -17,7 +17,9 @@
package com.logpm.basicdata.service.impl ;
package com.logpm.basicdata.service.impl ;
import com.alibaba.fastjson.JSONObject ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.logpm.basicdata.dto.BasicdataStorageServicesDTO ;
import com.logpm.basicdata.entity.BasicdataStorageServicesEntity ;
import com.logpm.basicdata.entity.BasicdataStorageServicesEntity ;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
import com.logpm.basicdata.service.IBasicdataWarehouseService ;
import com.logpm.basicdata.service.IBasicdataWarehouseService ;
@ -25,13 +27,14 @@ import com.logpm.basicdata.vo.BasicdataStorageServicesVO;
import com.logpm.basicdata.excel.BasicdataStorageServicesExcel ;
import com.logpm.basicdata.excel.BasicdataStorageServicesExcel ;
import com.logpm.basicdata.mapper.BasicdataStorageServicesMapper ;
import com.logpm.basicdata.mapper.BasicdataStorageServicesMapper ;
import com.logpm.basicdata.service.IBasicdataStorageServicesService ;
import com.logpm.basicdata.service.IBasicdataStorageServicesService ;
import org.checkerframework.checker.units.qual.A ;
import org.springframework.beans.BeanUtils ;
import org.springframework.beans.BeanUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import com.baomidou.mybatisplus.core.conditions.Wrapper ;
import com.baomidou.mybatisplus.core.conditions.Wrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import org.springblade.core.mp.base.BaseServiceImpl ;
import org.springblade.core.mp.base.BaseServiceImpl ;
import java.util.ArrayList ;
import java.util.List ;
import java.util.List ;
import java.util.Map ;
import java.util.Map ;
@ -64,28 +67,34 @@ public class BasicdataStorageServicesServiceImpl extends BaseServiceImpl<Basicda
}
}
@Override
@Override
public boolean submitSave ( BasicdataStorageServicesEntity basicdataStorageServices ) {
public boolean submitSave ( BasicdataStorageServicesDTO basicdataStorageServices ) {
List < BasicdataStorageServicesEntity > basicdataStorageServicesEntities = baseMapper . selectList ( Wrappers . < BasicdataStorageServicesEntity > query ( ) . lambda ( ) .
if ( ObjectUtils . isNotNull ( basicdataStorageServices . getId ( ) ) ) {
eq ( BasicdataStorageServicesEntity : : getClientId , basicdataStorageServices . getClientId ( ) ) .
eq ( BasicdataStorageServicesEntity : : getSendWarehouseId , basicdataStorageServices . getSendWarehouseId ( ) ) .
// 获取仓库名称
eq ( BasicdataStorageServicesEntity : : getSendWarehouseId , basicdataStorageServices . getSendWarehouseId ( ) )
BasicdataWarehouseEntity sendBasicdataWarehouseEntity = basicdataWarehouseService . getById ( basicdataStorageServices . getSendWarehouseId ( ) ) ;
) ;
basicdataStorageServices . setSendWarehouseName ( sendBasicdataWarehouseEntity . getName ( ) ) ;
if ( basicdataStorageServicesEntities . size ( ) > 0 ) {
BasicdataWarehouseEntity serveBasicdataWarehouseEntity = basicdataWarehouseService . getById ( basicdataStorageServices . getServeWarehouseId ( ) ) ;
throw new RuntimeException ( "存在重复数据!已拒绝!!" ) ;
basicdataStorageServices . setServeWarehouseName ( serveBasicdataWarehouseEntity . getName ( ) ) ;
this . updateById ( basicdataStorageServices ) ;
return true ;
} else {
List < BasicdataStorageServicesEntity > servicesEntities = new ArrayList < > ( ) ;
basicdataStorageServices . getSendWarehouseIds ( ) . forEach ( i - > {
BasicdataStorageServicesEntity basicdataStorageServicesEntity = new BasicdataStorageServicesEntity ( ) ;
BeanUtils . copyProperties ( basicdataStorageServices , basicdataStorageServicesEntity ) ;
// 获取仓库名称
BasicdataWarehouseEntity sendBasicdataWarehouseEntity = basicdataWarehouseService . getById ( i ) ;
basicdataStorageServicesEntity . setSendWarehouseName ( sendBasicdataWarehouseEntity . getName ( ) ) ;
BasicdataWarehouseEntity serveBasicdataWarehouseEntity = basicdataWarehouseService . getById ( basicdataStorageServices . getServeWarehouseId ( ) ) ;
basicdataStorageServicesEntity . setServeWarehouseName ( serveBasicdataWarehouseEntity . getName ( ) ) ;
basicdataStorageServicesEntity . setSendWarehouseId ( i ) ;
servicesEntities . add ( basicdataStorageServicesEntity ) ;
} ) ;
this . saveBatch ( servicesEntities ) ;
return true ;
}
}
// return this.saveOrUpdate(basicdataStorageServices);
// 获取仓库名称
BasicdataWarehouseEntity sendBasicdataWarehouseEntity = basicdataWarehouseService . getById ( basicdataStorageServices . getSendWarehouseId ( ) ) ;
basicdataStorageServices . setSendWarehouseName ( sendBasicdataWarehouseEntity . getName ( ) ) ;
BasicdataWarehouseEntity serveBasicdataWarehouseEntity = basicdataWarehouseService . getById ( basicdataStorageServices . getServeWarehouseId ( ) ) ;
basicdataStorageServices . setServeWarehouseName ( serveBasicdataWarehouseEntity . getName ( ) ) ;
return this . saveOrUpdate ( basicdataStorageServices ) ;
}
}
@Override
@Override