@ -18,6 +18,7 @@ package com.logpm.basicdata.service.impl;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.Wrapper ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
@ -31,11 +32,13 @@ import com.logpm.basicdata.vo.BasicdataClientVO;
import com.logpm.basicdata.vo.ClientInfoVO ;
import lombok.extern.slf4j.Slf4j ;
import org.springblade.common.constant.DictBizConstant ;
import org.springblade.core.cache.utils.CacheUtil ;
import org.springblade.core.log.exception.ServiceException ;
import org.springblade.core.mp.base.BaseServiceImpl ;
import org.springblade.core.secure.BladeUser ;
import org.springblade.core.secure.utils.AuthUtil ;
import org.springblade.core.tool.utils.BeanUtil ;
import org.springblade.core.tool.utils.ObjectUtil ;
import org.springblade.system.cache.DictBizCache ;
import org.springblade.system.entity.DictBiz ;
import org.springblade.system.feign.IUserClient ;
@ -47,6 +50,8 @@ import java.security.NoSuchAlgorithmException;
import java.util.* ;
import java.util.stream.Collectors ;
import static org.springblade.common.constant.DictBizConstant.OPEN_ORDER_PAY_WAY ;
/ * *
* 基础客户表 服务实现类
*
@ -59,25 +64,25 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
@Autowired
private IBasicdataHistoricalContractService basicdataHistoricalContractService ;
private IBasicdataHistoricalContractService basicdataHistoricalContractService ;
@Autowired
private IBasicdataStoreContactService basicdataStoreContactService ; //联系人
private IBasicdataStoreContactService basicdataStoreContactService ; //联系人
@Autowired
private IBasicdataStoreBusinessService basicdataStoreBusinessService ;
private IBasicdataStoreBusinessService basicdataStoreBusinessService ;
@Autowired
private IBasicdataTripartiteMallService basicdataTripartiteMallService ; //三方商场
private IBasicdataTripartiteMallService basicdataTripartiteMallService ; //三方商场
@Autowired
private IBasicdataStorageServicesService basicdataStorageServicesService ; //服务仓
private IBasicdataStorageServicesService basicdataStorageServicesService ; //服务仓
@Autowired
private IBasicdataBrandService basicdataBrandService ; //品牌
private IBasicdataBrandService basicdataBrandService ; //品牌
@Autowired
private IBasicdataStoreBrandService basicdataStoreBrandService ; //品牌
private IBasicdataStoreBrandService basicdataStoreBrandService ; //品牌
@Autowired
private IBasicdataWarehouseService warehouseService ;
private IBasicdataWarehouseService warehouseService ;
// private final IBasicdataClientUserService basicdataClientUserService;
@Autowired
private IUserClient userClient ;
private IUserClient userClient ;
@Override
public IPage < BasicdataClientVO > selectBasicdataClientPage ( IPage < BasicdataClientVO > page , BasicdataClientVO basicdataClient ) {
@ -105,7 +110,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
List < BasicdataStoreBusinessEntity > list = basicdataStoreBusinessService . list ( Wrappers . < BasicdataStoreBusinessEntity > query ( ) . lambda ( )
. eq ( BasicdataStoreBusinessEntity : : getClientId , basicdataClient . getId ( ) )
) ;
if ( list . size ( ) > 0 ) {
if ( ! list . isEmpty ( ) ) {
//有数据
List < Long > stringList = new ArrayList < > ( ) ;
list . forEach ( i - > {
@ -158,18 +163,16 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
//查询客户编码和客户名称是否存在
BasicdataClientEntity basicdataClient1 = baseMapper . selectOne ( Wrappers . < BasicdataClientEntity > query ( ) . lambda ( )
. eq ( BasicdataClientEntity : : getClientCode , basicdataClient . getClientCode ( ) )
. or ( )
. or ( )
. eq ( BasicdataClientEntity : : getClientName , basicdataClient . getClientName ( ) )
) ;
if ( ObjectUtils . isNotNull ( basicdataClient1 ) ) {
if ( ObjectUtils . isNotNull ( basicdataClient1 ) ) {
throw new ServiceException ( "客户编码或客户名称已存在" ) ;
}
//添加
this . save ( basicdataClient ) ;
// //绑定客户账号和客户关系
// this.saveCustomerAndAddAcount(phone,linkman,basicdataClient.getId());
//添加联系人
BasicdataStoreContactEntity basicdataStoreContactEntity = new BasicdataStoreContactEntity ( ) ;
@ -181,9 +184,8 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataStoreContactService . save ( basicdataStoreContactEntity ) ;
//添加客户类型
if ( basicdataClient . getTypeServiceList ( ) . size ( ) > 0 ) {
if ( ! basicdataClient . getTypeServiceList ( ) . isEmpty ( ) ) {
for ( String s : basicdataClient . getTypeServiceList ( ) ) {
//添加服务类型
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = new BasicdataStoreBusinessEntity ( ) ;
@ -195,7 +197,6 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataStoreBusinessService . save ( basicdataStoreBusinessEntity ) ;
}
} else {
log . info ( "服务类型没有!!!" ) ;
@ -214,7 +215,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
log . info ( "没有必要的ID了!!!" ) ;
return false ;
}
if ( ObjectUtils . isNotNull ( basicdataClient . getLeaseAccessories ( ) ) ) {
if ( ObjectUtils . isNotNull ( basicdataClient . getLeaseAccessories ( ) ) ) {
//添加历史合同
BasicdataHistoricalContractEntity basicdataHistoricalContract = new BasicdataHistoricalContractEntity ( ) ;
basicdataHistoricalContract . setClientId ( basicdataClient . getId ( ) . toString ( ) ) ;
@ -259,31 +260,32 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
}
/ * *
* 查询客户编码
*
* @param code
* @return
* /
@Override
public List < BasicdataClientEntity > listCode ( String code ) {
return baseMapper . selectList ( Wrappers . < BasicdataClientEntity > query ( ) . lambda ( )
. eq ( BasicdataClientEntity : : getClientCode , code )
. eq ( BasicdataClientEntity : : getClientCode , code )
) ;
}
@Override
public List < BasicdataClientVO > dictList ( ) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseService . getMyCurrentWarehouse ( ) ;
if ( null = = myCurrentWarehouse ) {
if ( null = = myCurrentWarehouse ) {
return new ArrayList < BasicdataClientVO > ( ) ;
}
List < BasicdataClientVO > list = baseMapper . selectListDict ( myCurrentWarehouse . getId ( ) ) ;
List < BasicdataClientVO > list = baseMapper . selectListDict ( myCurrentWarehouse . getId ( ) ) ;
return list ;
}
/ * *
* 导入数据
*
* @param data
* @param isCovered
* /
@ -301,153 +303,165 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
List < DictBiz > dictBizs = DictBizCache . getList ( DictBizConstant . DISTRIBUTION_TYPE ) ; //商 市 自
List < DictBiz > clientBiz = DictBizCache . getList ( DictBizConstant . CLIENT_TYPE ) ; //客 工
List < DictBiz > freightBiz = DictBizCache . getList ( DictBizConstant . BASIC_FREIGHT_TYPE ) ; //客 工
Set < String > set = new HashSet < > ( ) ;
Set < String > set = new HashSet < > ( ) ;
QueryWrapper < BasicdataClientEntity > queryWrapper = new QueryWrapper < > ( ) ;
List < BasicdataClientEntity > basicdataClients = baseMapper . selectList ( queryWrapper ) ;
LambdaQueryWrapper < BasicdataBrandEntity > lambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
lambdaQueryWrapper . eq ( BasicdataBrandEntity : : getIsDeleted , 0 ) ;
List < BasicdataBrandEntity > basicdataBrandEntityList = basicdataBrandService . list ( lambdaQueryWrapper ) ;
for ( BasicdataClientExcel i : data ) {
log . info ( "导入数据《》《》{}" , i ) ;
if ( set . isEmpty ( ) ) {
set . add ( i . getClientCode ( ) ) ;
} else {
boolean b = set . stream ( ) . anyMatch ( a - > a . equals ( i . getClientCode ( ) ) ) ;
if ( b ) {
continue ;
}
// 处理下空格 换行
i . setClientName ( i . getClientName ( ) . trim ( ) ) ;
i . setClientCode ( i . getClientCode ( ) . trim ( ) ) ;
log . info ( "导入数据《》《》{}" , i ) ;
if ( set . isEmpty ( ) ) {
set . add ( i . getClientCode ( ) ) ;
} else {
boolean b = set . stream ( ) . anyMatch ( a - > a . equals ( i . getClientCode ( ) ) ) ;
if ( b ) {
continue ;
}
if ( ObjectUtils . isNull ( i . getClientCode ( ) ) | | ObjectUtils . isNull ( i . getClientName ( ) ) ) {
}
if ( ObjectUtils . isNull ( i . getClientCode ( ) ) | | ObjectUtils . isNull ( i . getClientName ( ) ) ) {
throw new ServiceException ( "客户编码或客户名称不能为空!" ) ;
}
BasicdataClientEntity basicdataClient = new BasicdataClientEntity ( ) ;
BeanUtil . copyProperties ( i , basicdataClient ) ;
log . info ( "比对对象>>>:{}" , basicdataClient ) ;
log . info ( "查询客户信息>>>:{}" , basicdataClients ) ;
BasicdataClientEntity basicdataClient = new BasicdataClientEntity ( ) ;
BeanUtil . copyProperties ( i , basicdataClient ) ;
log . info ( ">>>>>> basicdataClient.getClientCode() {}" , basicdataClient . getClientCode ( ) ) ;
//查询客户编码和客户名称是否存在
boolean b = basicdataClients . stream ( ) . anyMatch ( ii - > ii . getClientCode ( ) . equals ( basicdataClient . getClientCode ( ) )
| | ii . getClientName ( ) . equals ( basicdataClient . getClientName ( ) ) ) ;
| | ii . getClientName ( ) . equals ( basicdataClient . getClientName ( ) . trim ( ) ) ) ;
if ( b ) {
if ( b ) {
List < BasicdataClientEntity > basicdataClientEntities = basicdataClients . stream ( ) . filter ( ii - > ii . getClientCode ( ) . equals ( basicdataClient . getClientCode ( ) )
| | ii . getClientName ( ) . equals ( basicdataClient . getClientName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
log . info ( "###############basicdataClientEntities重复客户:{}" , basicdataClientEntities ) ;
log . info ( "###############basicdataClientEntities重复客户:{}" , basicdataClientEntities ) ;
throw new ServiceException ( "客户编码或客户名称已存在" ) ;
}
// Optional<DictBiz> first = dictBizs.stream().filter(ii -> ii.getDictValue().equals(i.getTypeService())).findFirst();
Optional < DictBiz > clientFirst = clientBiz . stream ( ) . filter ( ii - > ii . getDictValue ( ) . equals ( i . getClientType ( ) ) ) . findFirst ( ) ;
Optional < DictBiz > clientFirst = clientBiz . stream ( ) . filter ( ii - > ii . getDictValue ( ) . equals ( i . getClientType ( ) ) ) . findFirst ( ) ;
// i.setTypeService(first.get().getDictValue());
basicdataClient . setClientType ( clientFirst . get ( ) . getDictKey ( ) ) ;
//查询是不是重复
List < BasicdataClientEntity > basicdataClientEntities = baseMapper . selectList ( Wrappers . < BasicdataClientEntity > query ( ) . lambda ( ) . eq ( BasicdataClientEntity : : getClientCode , i . getClientCode ( ) ) ) ;
if ( basicdataClientEntities . isEmpty ( ) ) {
BladeUser user = AuthUtil . getUser ( ) ;
basicdataClient . setPid ( 0L ) ;
basicdataClient . setCreateUser ( user . getUserId ( ) ) ;
basicdataClient . setCargoControl ( false ) ;
basicdataClient . setStatus ( 0 ) ;
basicdataClient . setIsDeleted ( 0 ) ;
basicdataClient . setCreateTime ( new Date ( ) ) ;
baseMapper . insert ( basicdataClient ) ;
if ( ObjectUtils . isNull ( basicdataClient . getId ( ) ) ) {
throw new ServiceException ( "客户ID不存在" ) ;
}
//添加服务类型
if ( ObjectUtils . isNotNull ( i . getTypeService ( ) ) ) {
BasicdataStoreBusinessEntity storeBusinessEntity = new BasicdataStoreBusinessEntity ( ) ;
storeBusinessEntity . setClientId ( basicdataClient . getId ( ) . toString ( ) ) ;
storeBusinessEntity . setTypeService ( i . getTypeService ( ) ) ;
storeBusinessEntity . setMold ( i . getMold ( ) ) ;
storeBusinessEntities . add ( storeBusinessEntity ) ;
}
//添加服务仓
basicdataClient . setClientType ( clientFirst . get ( ) . getDictKey ( ) ) ;
//查询是不是重复
List < BasicdataClientEntity > basicdataClientEntities = baseMapper . selectList ( Wrappers . < BasicdataClientEntity > query ( ) . lambda ( ) . eq ( BasicdataClientEntity : : getClientCode , i . getClientCode ( ) ) ) ;
if ( basicdataClientEntities . isEmpty ( ) ) {
BladeUser user = AuthUtil . getUser ( ) ;
basicdataClient . setPid ( 0L ) ;
basicdataClient . setCreateUser ( user . getUserId ( ) ) ;
basicdataClient . setCargoControl ( false ) ;
basicdataClient . setStatus ( 0 ) ;
basicdataClient . setIsDeleted ( 0 ) ;
basicdataClient . setCreateTime ( new Date ( ) ) ;
// 默认付款方式
String keyValue = matchDictValue ( DictBizCache . getList ( OPEN_ORDER_PAY_WAY ) , i . getDefaultPaymentMethods ( ) . trim ( ) ) ;
basicdataClient . setDefaultPaymentMethods ( keyValue ) ;
if ( ObjectUtils . isNotNull ( i . getServeWarehouseName ( ) ) ) {
BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity ( ) ;
servicesEntity . setClientId ( basicdataClient . getId ( ) ) ;
servicesEntity . setDistinguish ( 2 ) ;
if ( ObjectUtils . isNotNull ( i . getSendWarehouseName ( ) ) ) {
baseMapper . insert ( basicdataClient ) ;
if ( ObjectUtils . isNull ( basicdataClient . getId ( ) ) ) {
throw new ServiceException ( "客户ID不存在" ) ;
}
//添加服务类型
if ( ObjectUtils . isNotNull ( i . getTypeService ( ) ) ) {
BasicdataStoreBusinessEntity storeBusinessEntity = new BasicdataStoreBusinessEntity ( ) ;
storeBusinessEntity . setClientId ( basicdataClient . getId ( ) . toString ( ) ) ;
storeBusinessEntity . setTypeService ( i . getTypeService ( ) ) ;
storeBusinessEntity . setMold ( i . getMold ( ) ) ;
storeBusinessEntities . add ( storeBusinessEntity ) ;
}
//添加服务仓
if ( ObjectUtils . isNotNull ( i . getServeWarehouseName ( ) ) ) {
BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity ( ) ;
servicesEntity . setClientId ( basicdataClient . getId ( ) ) ;
servicesEntity . setDistinguish ( 2 ) ;
if ( ObjectUtils . isNotNull ( i . getSendWarehouseName ( ) ) ) {
// Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId();
// servicesEntity.setSendWarehouseId(String.valueOf(id));
servicesEntity . setSendWarehouseName ( i . getSendWarehouseName ( ) ) ;
}
Long id = list1 . stream ( ) . filter ( q - > q . getName ( ) . equals ( i . getServeWarehouseName ( ) ) ) . findFirst ( ) . get ( ) . getId ( ) ;
servicesEntity . setServeWarehouseId ( id ) ;
servicesEntity . setServeWarehouseName ( i . getServeWarehouseName ( ) ) ;
storageServicesEntities . add ( servicesEntity ) ;
servicesEntity . setSendWarehouseName ( i . getSendWarehouseName ( ) ) ;
}
//添加品牌
if ( ObjectUtils . isNotNull ( i . getBrandName ( ) ) ) {
BasicdataStoreBrandEntity storeBrandEntity = new BasicdataStoreBrandEntity ( ) ;
Long id = list1 . stream ( ) . filter ( q - > q . getName ( ) . equals ( i . getServeWarehouseName ( ) ) ) . findFirst ( ) . get ( ) . getId ( ) ;
servicesEntity . setServeWarehouseId ( id ) ;
servicesEntity . setServeWarehouseName ( i . getServeWarehouseName ( ) ) ;
storageServicesEntities . add ( servicesEntity ) ;
}
//添加品牌
if ( ObjectUtils . isNotNull ( i . getBrandName ( ) ) ) {
String [ ] ars = i . getBrandName ( ) . split ( "," ) ;
for ( String ar : ars ) {
BasicdataStoreBrandEntity storeBrandEntity = new BasicdataStoreBrandEntity ( ) ;
storeBrandEntity . setClientId ( basicdataClient . getId ( ) ) ;
storeBrandEntity . setShopId ( basicdataClient . getId ( ) . toString ( ) ) ;
BasicdataBrandEntity one = basicdataBrandService . getOne ( Wrappers . < BasicdataBrandEntity > query ( ) . lambda ( ) . eq ( BasicdataBrandEntity : : getBrandName , i . getBrandName ( ) ) ) ;
if ( ObjectUtils . isNull ( one ) ) {
BasicdataBrandEntity one = matchBasicdataBrandEntityListValue ( basicdataBrandEntityList , ar ) ;
if ( ObjectUtils . isNull ( one ) ) {
throw new ServiceException ( "品牌不存在" ) ;
}
storeBrandEntity . setBrandId ( String . valueOf ( one . getId ( ) ) ) ;
storeBrandEntity . setBrandName ( i . getBrandName ( ) ) ;
assert one ! = null ;
storeBrandEntity . setBrandId ( one . getId ( ) ) ;
storeBrandEntity . setBrandName ( one . getBrandName ( ) ) ;
storeBrandEntities . add ( storeBrandEntity ) ;
}
//添加联系人
if ( ObjectUtils . isNotNull ( i . getLinkman ( ) ) ) {
BasicdataStoreContactEntity storeContactEntity = new BasicdataStoreContactEntity ( ) ;
storeContactEntity . setShopId ( basicdataClient . getId ( ) ) ;
storeContactEntity . setPhone ( i . getPhone ( ) ) ;
storeContactEntity . setLinkman ( i . getLinkman ( ) ) ;
storeContactEntities . add ( storeContactEntity ) ;
}
//添加三方商场
if ( ObjectUtils . isNotNull ( i . getTripartiteMall ( ) ) ) {
BasicdataTripartiteMallEntity tripartiteMallEntity = new BasicdataTripartiteMallEntity ( ) ;
tripartiteMallEntity . setClientId ( basicdataClient . getId ( ) ) ;
tripartiteMallEntity . setTripartiteMall ( i . getTripartiteMall ( ) ) ;
tripartiteMallEntity . setTripartiteCoding ( i . getTripartiteCoding ( ) ) ;
tripartiteMallEntities . add ( tripartiteMallEntity ) ;
}
}
}
//添加联系人
if ( ObjectUtils . isNotNull ( i . getLinkman ( ) ) ) {
BasicdataStoreContactEntity storeContactEntity = new BasicdataStoreContactEntity ( ) ;
storeContactEntity . setShopId ( basicdataClient . getId ( ) ) ;
storeContactEntity . setPhone ( i . getPhone ( ) ) ;
storeContactEntity . setLinkman ( i . getLinkman ( ) ) ;
storeContactEntities . add ( storeContactEntity ) ;
//品牌
if ( ! storeBrandEntities . isEmpty ( ) ) {
List < BasicdataStoreBrandEntity > list = new ArrayList < > ( ) ;
storeBrandEntities . stream ( ) . forEach ( i - > {
if ( i . getBrandName ( ) . contains ( "," ) ) {
String [ ] split = i . getBrandName ( ) . split ( "," ) ;
for ( int j = 0 ; j < split . length ; j + + ) {
BasicdataStoreBrandEntity business = new BasicdataStoreBrandEntity ( ) ;
BeanUtil . copyProperties ( i , business ) ;
List < BasicdataBrandEntity > list2 = basicdataBrandService . list ( Wrappers . < BasicdataBrandEntity > query ( ) . lambda ( )
. eq ( BasicdataBrandEntity : : getBrandName , i . getBrandName ( ) )
) ;
business . setBrandName ( split [ j ] ) ;
business . setBrandId ( list2 . g et ( 0 ) . getId ( ) . toString ( ) ) ;
list . add ( business ) ;
}
//添加三方商场
if ( ObjectUtils . isNotNull ( i . getTripartiteMall ( ) ) ) {
BasicdataTripartiteMallEntity tripartiteMallEntity = new BasicdataTripartiteMallEntity ( ) ;
tripartiteMallEntity . setClientId ( basicdataClient . getId ( ) ) ;
tripartiteMallEntity . setTripartiteMall ( i . getTripartiteMall ( ) ) ;
tripartiteMallEntity . setTripartiteCoding ( i . getTripartiteCoding ( ) ) ;
BasicdataBrandEntity one = matchBasicdataBrandEntityListValue ( basicdataBrandEntityList , i . getTripartiteMallBrand ( ) ) ;
if ( ObjectUtil . isNotEmpty ( one ) ) {
//三方名称
assert one ! = null ;
tripartiteMallEntity . setBrandId ( on e. getId ( ) ) ;
tripartiteMallEntity . setBrandName ( one . getBrandName ( ) ) ;
}
} else {
List < BasicdataBrandEntity > list2 = basicdataBrandService . list ( Wrappers . < BasicdataBrandEntity > query ( ) . lambda ( )
. eq ( BasicdataBrandEntity : : getBrandName , i . getBrandName ( ) )
) ;
i . setBrandName ( i . getBrandName ( ) ) ;
i . setBrandId ( list2 . get ( 0 ) . getId ( ) . toString ( ) ) ;
list . add ( i ) ;
tripartiteMallEntities . add ( tripartiteMallEntity ) ;
}
} ) ;
basicdataStoreBrandService . saveBatch ( list ) ;
}
}
//品牌
if ( ! storeBrandEntities . isEmpty ( ) ) {
basicdataStoreBrandService . saveBatch ( storeBrandEntities ) ;
}
//服务类型
if ( ! storeBusinessEntities . isEmpty ( ) ) {
if ( ! storeBusinessEntities . isEmpty ( ) ) {
List < BasicdataStoreBusinessEntity > list = new ArrayList < > ( ) ;
storeBusinessEntities . stream ( ) . forEach ( i - > {
// List<DictBiz> dictBizs = DictBizCache.getList(DictBizConstant.DISTRIBUTION_TYPE);
if ( i . getTypeService ( ) . contains ( "," ) ) {
storeBusinessEntities . stream ( ) . forEach ( i - > {
if ( i . getTypeService ( ) . contains ( "," ) ) {
String [ ] split = i . getTypeService ( ) . split ( "," ) ;
for ( int j = 0 ; j < split . length ; j + + ) {
BasicdataStoreBusinessEntity business = new BasicdataStoreBusinessEntity ( ) ;
BeanUtil . copyProperties ( i , business ) ;
BeanUtil . copyProperties ( i , business ) ;
int finalJ = j ;
if ( split [ j ] . equals ( "配送" ) ) {
switch ( business . getMold ( ) ) {
if ( split [ j ] . equals ( "配送" ) ) {
switch ( business . getMold ( ) ) {
case "商配" :
business . setMold ( "1" ) ;
break ;
@ -462,20 +476,20 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
break ;
}
} else {
} else {
business . setMold ( null ) ;
}
log . info ( "#################split[finalJ]>>>>>>>>>>>>>>:{}" , split [ finalJ ] ) ;
log . info ( "#################split[finalJ]>>>>>>>>>>>>>>:{}" , split [ finalJ ] ) ;
String dictValue = freightBiz . stream ( ) . filter ( q - > q . getDictValue ( ) . equals ( split [ finalJ ] ) ) . findFirst ( ) . get ( ) . getDictKey ( ) ;
business . setTypeService ( dictValue ) ;
list . add ( business ) ;
}
} else {
} else {
String dictValue = freightBiz . stream ( ) . filter ( q - > q . getDictValue ( ) . equals ( i . getTypeService ( ) ) ) . findFirst ( ) . get ( ) . getDictKey ( ) ;
i . setTypeService ( dictValue ) ;
if ( i . getTypeService ( ) . equals ( "配送" ) ) {
if ( i . getTypeService ( ) . equals ( "配送" ) ) {
String mold = i . getMold ( ) ;
switch ( mold ) {
switch ( mold ) {
case "商配" :
i . setMold ( "1" ) ;
break ;
@ -490,7 +504,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
break ;
}
} else {
} else {
i . setMold ( null ) ;
}
list . add ( i ) ;
@ -499,28 +513,28 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataStoreBusinessService . saveBatch ( list ) ;
}
//服务仓
if ( ! storageServicesEntities . isEmpty ( ) ) {
if ( ! storageServicesEntities . isEmpty ( ) ) {
List < BasicdataStorageServicesEntity > servicesEntityList = new ArrayList < > ( ) ;
storageServicesEntities . stream ( ) . forEach ( i - > {
if ( ObjectUtils . isNotNull ( i . getSendWarehouseName ( ) ) ) {
if ( i . getSendWarehouseName ( ) . contains ( "," ) ) {
storageServicesEntities . forEach ( i - > {
if ( ObjectUtils . isNotNull ( i . getSendWarehouseName ( ) ) ) {
if ( i . getSendWarehouseName ( ) . contains ( "," ) ) {
String [ ] split = i . getSendWarehouseName ( ) . split ( "," ) ;
for ( int j = 0 ; j < split . length ; j + + ) {
BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity ( ) ;
Long id = list1 . stream ( ) . filter ( q - > q . getName ( ) . equals ( i . getSendWarehouseName ( ) ) ) . findFirst ( ) . get ( ) . getId ( ) ;
BeanUtil . copyProperties ( i , servicesEntity ) ;
BeanUtil . copyProperties ( i , servicesEntity ) ;
servicesEntity . setSendWarehouseId ( id . toString ( ) ) ;
servicesEntity . setSendWarehouseName ( split [ j ] ) ;
servicesEntityList . add ( servicesEntity ) ;
}
} else {
Long id = list1 . stream ( ) . filter ( q - > q . getName ( ) . equals ( i . getSendWarehouseName ( ) ) ) . findFirst ( ) . get ( ) . getId ( ) ;
} else {
Long id = list1 . stream ( ) . filter ( q - > q . getName ( ) . equals ( i . getSendWarehouseName ( ) ) ) . findFirst ( ) . get ( ) . getId ( ) ;
i . setSendWarehouseId ( id . toString ( ) ) ;
servicesEntityList . add ( i ) ;
}
} else {
} else {
BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity ( ) ;
BeanUtil . copyProperties ( i , servicesEntity ) ;
BeanUtil . copyProperties ( i , servicesEntity ) ;
servicesEntityList . add ( servicesEntity ) ;
}
@ -528,19 +542,49 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataStorageServicesService . saveBatch ( servicesEntityList ) ;
}
//联系人
if ( ! storeContactEntities . isEmpty ( ) ) {
if ( ! storeContactEntities . isEmpty ( ) ) {
basicdataStoreContactService . saveBatch ( storeContactEntities ) ;
}
//三方
if ( ! tripartiteMallEntities . isEmpty ( ) ) {
if ( ! tripartiteMallEntities . isEmpty ( ) ) {
basicdataTripartiteMallService . saveBatch ( tripartiteMallEntities ) ;
}
}
/ * *
* 匹配品牌
*
* @param basicdataBrandEntityList
* @param brandName
* @return
* /
private BasicdataBrandEntity matchBasicdataBrandEntityListValue ( List < BasicdataBrandEntity > basicdataBrandEntityList , String brandName ) {
for ( BasicdataBrandEntity basicdataBrandEntity : basicdataBrandEntityList ) {
if ( basicdataBrandEntity . getBrandName ( ) . equals ( brandName . trim ( ) ) ) {
return basicdataBrandEntity ;
}
}
return null ;
}
private String matchDictValue ( List < DictBiz > list , String defaultPaymentMethods ) {
for ( DictBiz dictBiz : list ) {
if ( defaultPaymentMethods . equals ( dictBiz . getDictValue ( ) ) ) {
return dictBiz . getDictKey ( ) ;
}
}
return null ;
}
@Override
public List < JSONObject > findListByClientName ( String clientName , String linkMan , String linkPhone ) {
public List < JSONObject > findListByClientName ( String clientName , String linkMan , String linkPhone ) {
List < ClientInfoVO > ls = baseMapper . findListByClientName ( clientName , linkMan , linkPhone ) ;
List < ClientInfoVO > ls = baseMapper . findListByClientName ( clientName , linkMan , linkPhone ) ;
List < JSONObject > list = new ArrayList < > ( ) ;
for ( ClientInfoVO clientInfoVO : ls ) {
list . add ( JSONObject . parseObject ( JSONObject . toJSONString ( clientInfoVO ) ) ) ;