@@ -111,6 +111,9 @@ public class DataHandlerServerImpl implements DataHandlerServer {
Map < String , ShopInfoDO > shopInfoByCodeMap = shopInfoList . stream ( ) . collect ( Collectors . toMap ( ShopInfoDO : : getShopCode , item - > item ) ) ;
Map < String , ShopInfoDO > shopInfoByCodeMap = shopInfoList . stream ( ) . collect ( Collectors . toMap ( ShopInfoDO : : getShopCode , item - > item ) ) ;
List < Long > shopIds = shopInfoList . stream ( ) . map ( ShopInfoDO : : getId ) . collect ( Collectors . toList ( ) ) ;
List < Long > shopIds = shopInfoList . stream ( ) . map ( ShopInfoDO : : getId ) . collect ( Collectors . toList ( ) ) ;
List < Long > lineIdList = shopInfoList . stream ( ) . map ( ShopInfoDO : : getLineId ) . collect ( Collectors . toList ( ) ) ;
List < Long > lineIdList = shopInfoList . stream ( ) . map ( ShopInfoDO : : getLineId ) . collect ( Collectors . toList ( ) ) ;
//装修验收数据
List < AcceptanceInfoDO > acceptanceInfoDOList = acceptanceInfoDAO . selectByShopIds ( shopIds ) ;
Map < Long , AcceptanceInfoDO > acceptanceInfoMap = acceptanceInfoDOList . stream ( ) . collect ( Collectors . toMap ( AcceptanceInfoDO : : getShopId , item - > item ) ) ;
//手机号
//手机号
Map < Long , String > lineMobileMap = lineInfoDAO . getLineMobileMap ( lineIdList ) ;
Map < Long , String > lineMobileMap = lineInfoDAO . getLineMobileMap ( lineIdList ) ;
@@ -160,6 +163,8 @@ public class DataHandlerServerImpl implements DataHandlerServer {
List < Long > fitmentFhopIdList = new ArrayList < > ( ) ;
List < Long > fitmentFhopIdList = new ArrayList < > ( ) ;
//建店阶段完成时间
//建店阶段完成时间
List < BuildStageDTO > updateBuildStageList = new ArrayList < > ( ) ;
List < BuildStageDTO > updateBuildStageList = new ArrayList < > ( ) ;
//装修验收表需要初始化的门店
List < Long > initFitmentShopIdList = new ArrayList < > ( ) ;
for ( ImportOaOldShopDataDTO dto : list ) {
for ( ImportOaOldShopDataDTO dto : list ) {
if ( ! check ( dto , errorList ) ) {
if ( ! check ( dto , errorList ) ) {
continue ;
continue ;
@@ -248,7 +253,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
signFranchiseDO . setProtectiveDistance ( ( int ) Double . parseDouble ( dto . getProtectionDistance ( ) . trim ( ) ) ) ;
signFranchiseDO . setProtectiveDistance ( ( int ) Double . parseDouble ( dto . getProtectionDistance ( ) . trim ( ) ) ) ;
}
}
ShopStageInfoDO buildStage = bulidStageMap . get ( shopId ) ;
ShopStageInfoDO buildStage = bulidStageMap . get ( shopId ) ;
//建店资料未 完成
//建店资料完成时间
BuildStageDTO buildStageDTO = new BuildStageDTO ( ) ;
BuildStageDTO buildStageDTO = new BuildStageDTO ( ) ;
buildStageDTO . setShopId ( shopId ) ;
buildStageDTO . setShopId ( shopId ) ;
buildStageDTO . setEndTime ( dto . getBuildEndTime ( ) + " 00:00:00 " ) ;
buildStageDTO . setEndTime ( dto . getBuildEndTime ( ) + " 00:00:00 " ) ;
@@ -336,6 +341,10 @@ public class DataHandlerServerImpl implements DataHandlerServer {
posDO . setCreateTime ( new Date ( ) ) ;
posDO . setCreateTime ( new Date ( ) ) ;
addPosAndOrderInfoList . add ( posDO ) ;
addPosAndOrderInfoList . add ( posDO ) ;
}
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap . get ( shopId ) ;
if ( Objects . isNull ( acceptanceInfoDO ) ) {
initFitmentShopIdList . add ( shopId ) ;
}
}
}
shopInfoDAO . updateShopCity ( shopInfoList ) ;
shopInfoDAO . updateShopCity ( shopInfoList ) ;
pointInfoDAO . updateAddress ( pointListByIds ) ;
pointInfoDAO . updateAddress ( pointListByIds ) ;
@@ -346,15 +355,16 @@ public class DataHandlerServerImpl implements DataHandlerServer {
orderSysInfoDAO . batchInsertSpecific ( addOrderSysInfoList ) ;
orderSysInfoDAO . batchInsertSpecific ( addOrderSysInfoList ) ;
franchiseFeeDAO . updateBill ( franchiseFeeByShopIds ) ;
franchiseFeeDAO . updateBill ( franchiseFeeByShopIds ) ;
buildInformationDAO . batchInsertSpecific ( addBuildList ) ;
buildInformationDAO . batchInsertSpecific ( addBuildList ) ;
if ( CollectionUtils . isNotEmpty ( updateBuildStageList ) ) {
//装修表初始化
List < Long > updateStageShopIds = updateBuildStageList . stream ( ) . map ( BuildStageDTO : : getShopId ) . collect ( Collectors . toList ( ) ) ;
acceptanceInfoDAO . initAcceptanceInfo ( initFitmentShopIdList ) ;
//pos阶段完成
List < Long > updateStageShopIds = updateBuildStageList . stream ( ) . map ( BuildStageDTO : : getShopId ) . collect ( Collectors . toList ( ) ) ;
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_163 ) ;
//pos阶段完成
// 订货阶段 完成
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_163 ) ;
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_173 ) ;
// 订货阶段 完成
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_173 ) ;
shopAccountDAO . updateStatusDataHandle ( updateStageShopIds ) ;
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
}
shopAccountDAO . updateStatusDataHandle ( updateStageShopIds ) ;
//表中4月20号后的数据, 数据录入系统, 新店装修阶段状态不变更 其他时间的数据状态改为已完成 不包括装修验收
//表中4月20号后的数据, 数据录入系统, 新店装修阶段状态不变更 其他时间的数据状态改为已完成 不包括装修验收
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_863 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_863 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_91 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_91 ) ;
@@ -548,20 +558,359 @@ public class DataHandlerServerImpl implements DataHandlerServer {
List < Long > allShopIds = acceptanceInfoDAO . getAllShopIds ( ) ;
List < Long > allShopIds = acceptanceInfoDAO . getAllShopIds ( ) ;
//需要处理的门店
//需要处理的门店
List < Long > addShopIds = new ArrayList < > ( ) ;
List < Long > addShopIds = new ArrayList < > ( ) ;
for ( ShopStageInfoDO subStage : subStages ) {
for ( ShopStageInfoDO subStage : subStages ) {
if ( ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_112 . getShopSubStageStatus ( ) . equals ( subStage . getShopSubStageStatus ( ) ) ) {
if ( ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_112 . getShopSubStageStatus ( ) . equals ( subStage . getShopSubStageStatus ( ) ) ) {
if ( ! allShopIds . contains ( subStage . getShopId ( ) ) ) {
if ( ! allShopIds . contains ( subStage . getShopId ( ) ) ) {
addShopIds . add ( subStage . getShopId ( ) ) ;
addShopIds . add ( subStage . getShopId ( ) ) ;
}
}
}
}
}
}
if ( CollectionUtils . isEmpty ( addShopIds ) ) {
if ( CollectionUtils . isEmpty ( addShopIds ) ) {
throw new ServiceException ( ErrorCodeEnum . PARAMS_VALIDATE_ERROR ) ;
throw new ServiceException ( ErrorCodeEnum . PARAMS_VALIDATE_ERROR ) ;
}
}
acceptanceInfoDAO . initAcceptanceInfo ( addShopIds ) ;
acceptanceInfoDAO . initAcceptanceInfo ( addShopIds ) ;
return true ;
return true ;
}
}
@Override
@Transactional ( rollbackFor = Exception . class )
public Boolean dataHandlerV20241012 ( List < Map < String , Object > > dataMapList , String originalFilename , LoginUserInfo user , ImportTaskDO task ) {
List < ImportOaOldShopDataDTO > list = new ArrayList < > ( ) ;
List < ImportOaOldShopDataErrorDTO > errorList = new ArrayList < > ( ) ;
ListUtils . emptyIfNull ( dataMapList )
. forEach ( data - > {
try {
ImportOaOldShopDataDTO dto = buildColumn ( data ) ;
list . add ( dto ) ;
} catch ( Exception e ) {
log . info ( " dataHandlerV20241012 转化dto error:{} " , JSONObject . toJSONString ( data ) ) ;
}
} ) ;
log . info ( " 导入数据条数:{} " , list . size ( ) ) ;
if ( CollectionUtils . isEmpty ( list ) ) {
log . info ( " 导入数据转化为空 " ) ;
return false ;
}
List < String > shopCodeList = list . stream ( ) . map ( ImportOaOldShopDataDTO : : getShopCode ) . collect ( Collectors . toList ( ) ) ;
Map < String , ImportOaOldShopDataDTO > dotMap = list . stream ( ) . collect ( Collectors . toMap ( ImportOaOldShopDataDTO : : getShopCode , item - > item ) ) ;
List < ShopInfoDO > shopInfoList = shopInfoDAO . selectByShopCodeList ( shopCodeList ) ;
if ( CollectionUtils . isEmpty ( shopInfoList ) ) {
log . info ( " 导入数据根据shopCode 未找到数据 " ) ;
}
Map < String , ShopInfoDO > shopInfoByCodeMap = shopInfoList . stream ( ) . collect ( Collectors . toMap ( ShopInfoDO : : getShopCode , item - > item ) ) ;
List < Long > shopIds = shopInfoList . stream ( ) . map ( ShopInfoDO : : getId ) . collect ( Collectors . toList ( ) ) ;
List < Long > lineIdList = shopInfoList . stream ( ) . map ( ShopInfoDO : : getLineId ) . collect ( Collectors . toList ( ) ) ;
//装修验收数据
List < AcceptanceInfoDO > acceptanceInfoDOList = acceptanceInfoDAO . selectByShopIds ( shopIds ) ;
Map < Long , AcceptanceInfoDO > acceptanceInfoMap = acceptanceInfoDOList . stream ( ) . collect ( Collectors . toMap ( AcceptanceInfoDO : : getShopId , item - > item ) ) ;
//手机号
Map < Long , String > lineMobileMap = lineInfoDAO . getLineMobileMap ( lineIdList ) ;
//铺位列表
List < Long > pointIds = shopInfoList . stream ( ) . map ( ShopInfoDO : : getPointId ) . filter ( Objects : : nonNull ) . collect ( Collectors . toList ( ) ) ;
List < PointInfoDO > pointListByIds = pointInfoDAO . getPointListByIds ( pointIds ) ;
Map < Long , PointInfoDO > pointMap = pointListByIds . stream ( ) . collect ( Collectors . toMap ( PointInfoDO : : getId , Function . identity ( ) ) ) ;
//铺位详情
List < PointDetailInfoDO > pointDetailInfoDOList = pointDetailInfoDAO . getByPointIdList ( pointIds ) ;
Map < Long , PointDetailInfoDO > pointDetailMap = pointDetailInfoDOList . stream ( ) . collect ( Collectors . toMap ( PointDetailInfoDO : : getPointId , Function . identity ( ) ) ) ;
//合同列表
List < SignFranchiseDO > signFranchiseDOS = signFranchiseMapper . selectAllByShopIds ( shopIds ) ;
Map < Long , SignFranchiseDO > signFranchiseMap = signFranchiseDOS . stream ( ) . collect ( Collectors . toMap ( SignFranchiseDO : : getShopId , Function . identity ( ) ) ) ;
//订货信息和总部订货收款账户表
List < OrderSysInfoDO > orderSysInfoDOS = orderSysInfoDAO . selectByShopIdList ( shopIds ) ;
Map < Long , OrderSysInfoDO > orderSysInfoMap = orderSysInfoDOS . stream ( ) . collect ( Collectors . toMap ( OrderSysInfoDO : : getShopId , Function . identity ( ) ) ) ;
//合同阶段
List < ShopStageInfoDO > signFranchiseStageList = shopStageInfoDAO . getSubStageList ( shopIds , ShopSubStageEnum . SHOP_STAGE_8 . getShopSubStage ( ) ) ;
Map < Long , ShopStageInfoDO > signFranchiseStageMap = signFranchiseStageList . stream ( ) . collect ( Collectors . toMap ( ShopStageInfoDO : : getShopId , Function . identity ( ) ) ) ;
//建店资料收集阶段
List < ShopStageInfoDO > bulidStageList = shopStageInfoDAO . getSubStageList ( shopIds , ShopSubStageEnum . SHOP_STAGE_15 . getShopSubStage ( ) ) ;
Map < Long , ShopStageInfoDO > bulidStageMap = bulidStageList . stream ( ) . collect ( Collectors . toMap ( ShopStageInfoDO : : getShopId , Function . identity ( ) ) ) ;
//加盟费阶段
List < ShopStageInfoDO > franchiseFeeStageList = shopStageInfoDAO . getSubStageList ( shopIds , ShopSubStageEnum . SHOP_STAGE_7 . getShopSubStage ( ) ) ;
Map < Long , ShopStageInfoDO > franchiseFeeStageMap = franchiseFeeStageList . stream ( ) . collect ( Collectors . toMap ( ShopStageInfoDO : : getShopId , Function . identity ( ) ) ) ;
//加盟费账单
List < FranchiseFeeDO > franchiseFeeByShopIds = franchiseFeeMapper . getFranchiseFeeByShopIds ( shopIds ) ;
Map < Long , FranchiseFeeDO > franchiseFeeMap = franchiseFeeByShopIds . stream ( ) . collect ( Collectors . toMap ( FranchiseFeeDO : : getShopId , Function . identity ( ) ) ) ;
//建店资料
List < BuildInformationDO > buildInformationDOList = buildInformationDAO . getSpecificByShopIdList ( shopIds ) ;
Map < Long , BuildInformationDO > buildInformationMap = buildInformationDOList . stream ( ) . collect ( Collectors . toMap ( BuildInformationDO : : getShopId , Function . identity ( ) ) ) ;
//初始化建店资料
List < Long > addBuildList = new ArrayList < > ( ) ;
//初始化订货信息和总部订货收款账户表
List < OrderSysInfoDO > addOrderSysInfoList = new ArrayList < > ( ) ;
//报货仓库
List < WarehouseInfoDO > warehouseInfoMapperAll = warehouseInfoMapper . getAll ( ) ;
Map < String , String > warehouseInfoMap = warehouseInfoMapperAll . stream ( ) . collect ( Collectors . toMap ( WarehouseInfoDO : : getWarehouseName , WarehouseInfoDO : : getWarehouseCode ) ) ;
//订货系统
List < PosAndOrderInfoDO > orderSysInfoDOList = posAndOrderInfoDAO . selectListByShopIdAndType ( shopIds , PosAndOrderEnum . ORDER . getCode ( ) ) ;
Map < Long , PosAndOrderInfoDO > orderSysInfoDOMap = orderSysInfoDOList . stream ( ) . collect ( Collectors . toMap ( PosAndOrderInfoDO : : getShopId , Function . identity ( ) ) ) ;
List < PosAndOrderInfoDO > addPosAndOrderInfoList = new ArrayList < > ( ) ;
//pos系统
List < PosAndOrderInfoDO > posSysInfoDOList = posAndOrderInfoDAO . selectListByShopIdAndType ( shopIds , PosAndOrderEnum . POS . getCode ( ) ) ;
Map < Long , PosAndOrderInfoDO > posSysInfoDOMap = posSysInfoDOList . stream ( ) . collect ( Collectors . toMap ( PosAndOrderInfoDO : : getShopId , Function . identity ( ) ) ) ;
//新发系统
List < PosAndOrderInfoDO > xfSysDOList = posAndOrderInfoDAO . selectListByShopIdAndType ( shopIds , PosAndOrderEnum . XIN_FA_SYS . getCode ( ) ) ;
Map < Long , PosAndOrderInfoDO > xfSysInfoDOMap = xfSysDOList . stream ( ) . collect ( Collectors . toMap ( PosAndOrderInfoDO : : getShopId , Function . identity ( ) ) ) ;
//营帐通系统
List < PosAndOrderInfoDO > tentPassInfoDOList = posAndOrderInfoDAO . selectListByShopIdAndType ( shopIds , PosAndOrderEnum . TENT_PASS . getCode ( ) ) ;
Map < Long , PosAndOrderInfoDO > tentPassInfoDOMap = tentPassInfoDOList . stream ( ) . collect ( Collectors . toMap ( PosAndOrderInfoDO : : getShopId , Function . identity ( ) ) ) ;
//装修阶段需要变更的shopId
List < Long > fitmentFhopIdList = new ArrayList < > ( ) ;
//建店阶段完成时间
List < BuildStageDTO > updateBuildStageList = new ArrayList < > ( ) ;
//装修验收表需要初始化的门店
List < Long > initFitmentShopIdList = new ArrayList < > ( ) ;
for ( ImportOaOldShopDataDTO dto : list ) {
if ( ! check ( dto , errorList ) ) {
continue ;
}
ShopInfoDO shopInfoDO = shopInfoByCodeMap . get ( dto . getShopCode ( ) . trim ( ) ) ;
if ( Objects . isNull ( shopInfoDO ) ) {
log . info ( " 门店不存在,门店编码:{} " , dto . getShopCode ( ) ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 门店编码不存在 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
Long shopId = shopInfoDO . getId ( ) ;
ShopStageInfoDO franchiseFeeStage = franchiseFeeStageMap . get ( shopId ) ;
if ( ! franchiseFeeStage . getIsTerminated ( ) ) {
log . info ( " 门店未完成加盟费阶段,门店编码:{} " , dto . getShopCode ( ) ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 门店未完成加盟费阶段 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
ShopStageInfoDO signStage = signFranchiseStageMap . get ( shopId ) ;
if ( ! ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_84 . getShopSubStageStatus ( ) . equals ( signStage . getShopSubStageStatus ( ) ) ) {
log . info ( " 门店未完成合同签约,门店编码:{} " , dto . getShopCode ( ) ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 门店未完成合同签约 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
Date buildEndTime = DateUtils . toDate ( YYYY_MM_DD , dto . getBuildEndTime ( ) ) ;
if ( Objects . isNull ( buildEndTime ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 建店资料时间转化失败 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
//合同
SignFranchiseDO signFranchiseDO = signFranchiseMap . get ( shopId ) ;
if ( signFranchiseDO = = null ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 合同DO不存在 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMap . get ( shopId ) ;
if ( franchiseFeeDO = = null ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 加盟费DO不存在 " ) ;
errorList . add ( errorDTO ) ;
continue ;
}
if ( StringUtil . isNotBlank ( dto . getPartnershipSignatorySecond ( ) ) ) {
signFranchiseDO . setPartnershipSignatorySecond ( dto . getPartnershipSignatorySecond ( ) . trim ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getPartnershipSignatorySecondMobile ( ) ) ) {
signFranchiseDO . setPartnershipSignatorySecondMobile ( dto . getPartnershipSignatorySecondMobile ( ) . trim ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getPartnershipSignatorySecondIdNumber ( ) ) ) {
signFranchiseDO . setPartnershipSignatorySecondIdNumber ( dto . getPartnershipSignatorySecondIdNumber ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getContractStartDate ( ) ) ) {
signFranchiseDO . setContractStartTime ( DateUtils . toDate ( YYYY_MM_DD , dto . getContractStartDate ( ) . trim ( ) ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getContractEndDate ( ) ) ) {
signFranchiseDO . setContractEndTime ( DateUtils . toDate ( YYYY_MM_DD , dto . getContractEndDate ( ) . trim ( ) ) ) ;
}
if ( ( StringUtil . isNotBlank ( dto . getIntroducer ( ) ) & & ! " 0 " . equals ( dto . getIntroducer ( ) ) ) ) {
signFranchiseDO . setIntroducer ( dto . getIntroducer ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getIntroduceStore ( ) ) & & ! " 0 " . equals ( dto . getIntroduceStore ( ) ) ) {
signFranchiseDO . setIntroduceStore ( dto . getIntroduceStore ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getIntroductionAward ( ) ) ) {
signFranchiseDO . setIntroductionAward ( dto . getIntroductionAward ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getContractCode ( ) ) & & dto . getContractCode ( ) . trim ( ) . startsWith ( " ZX " ) & & ! " 0 " . equals ( dto . getContractCode ( ) . trim ( ) ) ) {
signFranchiseDO . setContractCode ( dto . getContractCode ( ) . trim ( ) ) ;
}
if ( StringUtil . isNotBlank ( dto . getProtectionDistance ( ) ) ) {
signFranchiseDO . setProtectiveDistance ( ( int ) Double . parseDouble ( dto . getProtectionDistance ( ) . trim ( ) ) ) ;
}
ShopStageInfoDO buildStage = bulidStageMap . get ( shopId ) ;
//建店资料未完成
BuildStageDTO buildStageDTO = new BuildStageDTO ( ) ;
buildStageDTO . setShopId ( shopId ) ;
buildStageDTO . setEndTime ( dto . getBuildEndTime ( ) + " 00:00:00 " ) ;
updateBuildStageList . add ( buildStageDTO ) ;
//建店资料阶段处理
shopStageInfoDAO . dataUpdateShopStageInfo ( Collections . singletonList ( buildStageDTO ) , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_156 ) ;
if ( ! ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_156 . getShopSubStageStatus ( ) . equals ( buildStage . getShopSubStageStatus ( ) ) ) {
//初始化数据
preparationService . licenseCompleted ( shopId ) ;
preparationService . sysStoreCompleted ( shopId ) ;
preparationService . buildStoreAndDecorationComplete ( shopId ) ;
preparationService . selectSiteAndBuildStoreComplete ( shopId ) ;
preparationService . buildStoreComplete ( shopId ) ;
}
fitmentFhopIdList . add ( shopId ) ;
BuildInformationDO buildInformationDO = buildInformationMap . get ( shopId ) ;
if ( Objects . isNull ( buildInformationDO ) ) {
addBuildList . add ( shopId ) ;
}
OrderSysInfoDO orderSysInfoDO = orderSysInfoMap . get ( shopId ) ;
//报货物流仓库
String warehouseCode = warehouseInfoMap . get ( dto . getDeclareGoodsLogisticsWarehouseName ( ) . trim ( ) ) ;
if ( Objects . isNull ( orderSysInfoDO ) ) {
orderSysInfoDO = new OrderSysInfoDO ( ) ;
orderSysInfoDO . setShopId ( shopId ) ;
orderSysInfoDO . setOrderCreateTime ( new Date ( ) ) ;
orderSysInfoDO . setReceivingCreateTime ( new Date ( ) ) ;
setOrderInfo ( dto , orderSysInfoDO , warehouseCode ) ;
addOrderSysInfoList . add ( orderSysInfoDO ) ;
} else {
setOrderInfo ( dto , orderSysInfoDO , warehouseCode ) ;
}
//shopInfo
shopInfoDO . setShopName ( dto . getShopName ( ) . trim ( ) ) ;
shopInfoDO . setProvince ( dto . getProvince ( ) . trim ( ) ) ;
shopInfoDO . setCity ( dto . getCity ( ) . trim ( ) ) ;
shopInfoDO . setDistrict ( dto . getDistrict ( ) . trim ( ) ) ;
shopInfoDO . setDetailAddress ( dto . getShopAddress ( ) . trim ( ) ) ;
//point
PointInfoDO pointInfoDO = pointMap . get ( shopInfoDO . getPointId ( ) ) ;
if ( pointInfoDO ! = null ) {
pointInfoDO . setProvince ( dto . getProvince ( ) . trim ( ) ) ;
pointInfoDO . setCity ( dto . getCity ( ) . trim ( ) ) ;
pointInfoDO . setDistrict ( dto . getDistrict ( ) . trim ( ) ) ;
pointInfoDO . setAddress ( dto . getShopAddress ( ) . trim ( ) ) ;
pointInfoDO . setPointArea ( dto . getPointArea ( ) . trim ( ) ) ;
}
PointDetailInfoDO pointDetailInfoDO = pointDetailMap . get ( shopInfoDO . getPointId ( ) ) ;
if ( pointDetailInfoDO ! = null ) {
if ( StringUtil . isNotBlank ( dto . getMonthRent ( ) ) ) {
pointDetailInfoDO . setMonthRent ( dto . getMonthRent ( ) . trim ( ) ) ;
}
}
// 更新加盟费账单
franchiseFeeDO . setYearFranchiseFee ( dto . getYearFranchiseFee ( ) . trim ( ) ) ;
franchiseFeeDO . setLoanMargin ( dto . getLoanMargin ( ) . trim ( ) ) ;
franchiseFeeDO . setFirstYearFee ( dto . getFirstYearFee ( ) . trim ( ) ) ;
franchiseFeeDO . setFirstYearManageFee ( dto . getFirstYearManageFee ( ) . trim ( ) ) ;
franchiseFeeDO . setPerformanceBond ( dto . getPerformanceBond ( ) . trim ( ) ) ;
franchiseFeeDO . setDiscountReason ( dto . getDiscountReason ( ) . trim ( ) ) ;
//订货系统
PosAndOrderInfoDO order = orderSysInfoDOMap . get ( shopId ) ;
if ( StringUtil . isNotBlank ( dto . getYlsAccount ( ) ) ) {
if ( Objects . isNull ( order ) ) {
order = new PosAndOrderInfoDO ( ) ;
order . setShopId ( shopId ) ;
order . setType ( PosAndOrderEnum . ORDER . getCode ( ) ) ;
order . setRemark ( " 已为您开通订货系统账号和密码, 密码已加密, 初始密码为888888, 可通过加盟小程序修改密码! " ) ;
order . setAccount ( dto . getYlsAccount ( ) . trim ( ) ) ;
order . setPassword ( " 888888 " ) ;
order . setCreateTime ( new Date ( ) ) ;
addPosAndOrderInfoList . add ( order ) ;
}
}
//pos
PosAndOrderInfoDO posDO = posSysInfoDOMap . get ( shopId ) ;
if ( Objects . isNull ( posDO ) ) {
posDO = new PosAndOrderInfoDO ( ) ;
posDO . setShopId ( shopId ) ;
posDO . setType ( PosAndOrderEnum . POS . getCode ( ) ) ;
posDO . setAccount ( lineMobileMap . getOrDefault ( shopInfoDO . getLineId ( ) , " " ) ) ;
posDO . setRemark ( " 已为您开通POS系统账号和密码 " ) ;
posDO . setCreateTime ( new Date ( ) ) ;
addPosAndOrderInfoList . add ( posDO ) ;
}
//xf
PosAndOrderInfoDO xf = xfSysInfoDOMap . get ( shopId ) ;
if ( Objects . isNull ( xf ) ) {
order = new PosAndOrderInfoDO ( ) ;
order . setShopId ( shopId ) ;
order . setType ( PosAndOrderEnum . XIN_FA_SYS . getCode ( ) ) ;
order . setRemark ( " 已为您开通信发系统账号和授权码请妥善保管 " ) ;
order . setAccount ( dto . getShopCode ( ) . trim ( ) ) ;
order . setCreateTime ( new Date ( ) ) ;
addPosAndOrderInfoList . add ( order ) ;
}
//营帐通
PosAndOrderInfoDO yzt = tentPassInfoDOMap . get ( shopId ) ;
if ( Objects . isNull ( yzt ) ) {
order = new PosAndOrderInfoDO ( ) ;
order . setShopId ( shopId ) ;
order . setType ( PosAndOrderEnum . TENT_PASS . getCode ( ) ) ;
order . setRemark ( " 已为您开通营帐通 " ) ;
order . setCreateTime ( new Date ( ) ) ;
addPosAndOrderInfoList . add ( order ) ;
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap . get ( shopId ) ;
if ( Objects . isNull ( acceptanceInfoDO ) ) {
initFitmentShopIdList . add ( shopId ) ;
}
}
shopInfoDAO . updateShopCity ( shopInfoList ) ;
pointInfoDAO . updateAddress ( pointListByIds ) ;
pointDetailInfoDAO . updateMonthRent ( pointDetailInfoDOList ) ;
signFranchiseDAO . updateSpecific ( signFranchiseDOS ) ;
posAndOrderInfoDAO . batchInsert ( addPosAndOrderInfoList ) ;
orderSysInfoDAO . batchUpdateSpecific ( orderSysInfoDOS ) ;
orderSysInfoDAO . batchInsertSpecific ( addOrderSysInfoList ) ;
franchiseFeeDAO . updateBill ( franchiseFeeByShopIds ) ;
buildInformationDAO . batchInsertSpecific ( addBuildList ) ;
List < Long > updateStageShopIds = updateBuildStageList . stream ( ) . map ( BuildStageDTO : : getShopId ) . collect ( Collectors . toList ( ) ) ;
//pos阶段完成
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_163 ) ;
//xf
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_235 ) ;
//yzt
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_245 ) ;
// 订货阶段 完成
shopStageInfoDAO . dataUpdateStatus ( updateStageShopIds , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_173 ) ;
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
shopAccountDAO . updateStatusDataHandle ( updateStageShopIds ) ;
//装修stage
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_863 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_91 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_112 ) ;
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_123 ) ;
//train
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_51 ) ;
//openPlan
shopStageInfoDAO . dataUpdateStatus ( fitmentFhopIdList , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_143 ) ;
//装修表初始化
acceptanceInfoDAO . initAcceptanceInfo ( initFitmentShopIdList ) ;
if ( ! errorList . isEmpty ( ) ) {
task . setStatus ( ImportTaskStatusEnum . ERROR . getCode ( ) ) ;
String url = null ;
try {
url = easyExcelUtil . exportExcel ( ImportOaOldShopDataErrorDTO . class , errorList , null ,
FileTypeEnum . IMPORT_OA_OLD_SHOP_DATA_ERROR . getDesc ( ) + DateUtils . parseDateToStr ( SPECIAL_DATE_START_1 , new Date ( ) ) ,
FileTypeEnum . IMPORT_OA_OLD_SHOP_DATA_ERROR . getDesc ( ) + DateUtils . parseDateToStr ( SPECIAL_DATE_START_1 , new Date ( ) ) ) ;
} catch ( Exception e ) {
log . info ( " 导出失败列表失败 errorList:{} " , JSONObject . toJSONString ( errorList ) ) ;
}
task . setFileUrl ( url ) ;
} else {
task . setStatus ( ImportTaskStatusEnum . SUCCESS . getCode ( ) ) ;
}
task . setTotalNum ( dataMapList . size ( ) ) ;
task . setSuccessNum ( dataMapList . size ( ) - errorList . size ( ) ) ;
importTaskMapper . update ( eid , task ) ;
return null ;
}
private static boolean check ( ImportOaOldShopDataDTO dto , List < ImportOaOldShopDataErrorDTO > errorList ) {
private static boolean check ( ImportOaOldShopDataDTO dto , List < ImportOaOldShopDataErrorDTO > errorList ) {
if ( StringUtil . isBlank ( dto . getShopCode ( ) ) ) {
if ( StringUtil . isBlank ( dto . getShopCode ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
@@ -612,20 +961,6 @@ public class DataHandlerServerImpl implements DataHandlerServer {
errorList . add ( errorDTO ) ;
errorList . add ( errorDTO ) ;
return false ;
return false ;
}
}
if ( StringUtil . isBlank ( dto . getMonthRent ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 租金不能为空 " ) ;
errorList . add ( errorDTO ) ;
return false ;
}
if ( StringUtil . isBlank ( dto . getPointArea ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 场地实际面积不能为空 " ) ;
errorList . add ( errorDTO ) ;
return false ;
}
if ( StringUtil . isBlank ( dto . getContractStartDate ( ) ) ) {
if ( StringUtil . isBlank ( dto . getContractStartDate ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
@@ -675,13 +1010,6 @@ public class DataHandlerServerImpl implements DataHandlerServer {
errorList . add ( errorDTO ) ;
errorList . add ( errorDTO ) ;
return false ;
return false ;
}
}
if ( StringUtil . isBlank ( dto . getDiscountReason ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setErrorReason ( " 加盟费优惠原因不能为空 " ) ;
errorList . add ( errorDTO ) ;
return false ;
}
if ( StringUtil . isBlank ( dto . getDeclareGoodsLogisticsWarehouseName ( ) ) ) {
if ( StringUtil . isBlank ( dto . getDeclareGoodsLogisticsWarehouseName ( ) ) ) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO ( ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;
errorDTO . setShopCode ( dto . getShopCode ( ) ) ;