@@ -2,6 +2,8 @@ package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil ;
import com.cool.store.constants.CommonConstants ;
import com.cool.store.context.CurrentUserHolder ;
import com.cool.store.context.LoginUserInfo ;
import com.cool.store.dao.* ;
import com.cool.store.dto.decoration.* ;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO ;
@@ -75,7 +77,7 @@ public class DecorationServiceImpl implements DecorationService {
public DesignInfoVo DesignInfo ( Long shopId ) {
DecorationDTO decoration = getDecorationDTO ( shopId ) ;
if ( decoration = = null ) {
log . error ( " DecorationModel storeNum is null " ) ;
log . error ( " 拉取云立方接口获取数据为空 " ) ;
return null ;
}
AtomicInteger flag = new AtomicInteger ( 0 ) ;
@@ -88,7 +90,7 @@ public class DecorationServiceImpl implements DecorationService {
DesignSchemeDTO planeGraph = designSchemeMap . get ( CommonConstants . FLOOR_PLAN ) ;
if ( Objects . nonNull ( planeGraph ) ) {
designSchemeDTOS . add ( planeGraph ) ;
if ( DesignPhaseEnum . DESIGN_PHASE_ACCEPTANCE_PASS . getCode ( ) . equals ( planeGraph . getStatus ( ) ) ) {
if ( DesignPhaseEnum . DESIGN_PHASE_ACCEPTANCE_PASS . getCode ( ) . equals ( planeGraph . getStatus ( ) ) ) {
flag . incrementAndGet ( ) ;
}
}
@@ -96,7 +98,7 @@ public class DecorationServiceImpl implements DecorationService {
DesignSchemeDTO constructionDrawing = designSchemeMap . get ( CommonConstants . CONSTRUCTION_DRAWING ) ;
if ( Objects . nonNull ( constructionDrawing ) ) {
designSchemeDTOS . add ( designSchemeMap . get ( CommonConstants . CONSTRUCTION_DRAWING ) ) ;
if ( DesignPhaseEnum . DESIGN_PHASE_ACCEPTANCE_PASS . getCode ( ) . equals ( constructionDrawing . getStatus ( ) ) ) {
if ( DesignPhaseEnum . DESIGN_PHASE_ACCEPTANCE_PASS . getCode ( ) . equals ( constructionDrawing . getStatus ( ) ) ) {
flag . incrementAndGet ( ) ;
}
}
@@ -112,18 +114,16 @@ public class DecorationServiceImpl implements DecorationService {
ConstructionScheduleDTO measuringRoom = constructionScheduleMap . get ( CommonConstants . MEASURING_THE_ROOM ) ;
if ( Objects . nonNull ( measuringRoom ) ) {
designInfoVo . setMeasuringRoom ( measuringRoom ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( measuringRoom . getState ( ) ) ) {
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( measuringRoom . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
}
}
}
//预算
List < BudgetDTO > proposedBookBudget = decoration . getProposedBookBudget ( ) ;
Collections . sort ( decoration . getProposedBookBudget ( ) , ( x1 , x2 ) - > x2 . getId ( ) . compareTo ( x1 . getId ( ) ) ) ;
if ( ! proposedBookBudget . isEmpty ( ) ) {
if ( ! proposedBookBudget . isEmpty ( ) ) {
BudgetDTO budgetDTO = proposedBookBudget . get ( CommonConstants . ZERO ) ;
designInfoVo . setProposedBookBudget ( budgetDTO ) ;
flag . incrementAndGet ( ) ;
@@ -131,9 +131,18 @@ public class DecorationServiceImpl implements DecorationService {
if ( flag . get ( ) = = CommonConstants . FOUR ) {
//如果设计阶段未完成
if ( ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_91 . getShopSubStageStatus ( ) .
equals ( shopStageInfoDAO . getShopSubStageInfo ( shopId , ShopSubStageEnum . SHOP_STAGE_9 ) . getShopSubStageStatus ( ) ) )
//更新设计阶段状态
shopStageInfoDAO . batchU pdateShopStageStatus ( shopId , Arrays . asList ( ShopSubStageStatusEnum. SHOP_SUB_STAGE_STATUS_91 ) ) ;
equals ( shopStageInfoDAO . getShopSubStageInfo ( shopId , ShopSubStageEnum . SHOP_STAGE_9 ) . getShopSubStageStatus ( ) ) ) {
//更新设计阶段状态完成
shopStageInfoDAO . u pdateShopStageInfo ( shopId , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_91 ) ;
//初始化装修款阶段
List < ShopStageInfoDO > list = new ArrayList < > ( ) ;
List < ShopStageInfoDO > shopStageInfo = shopStageInfoDAO . getShopStageInfo ( shopId , null ) ;
Map < Integer , ShopStageInfoDO > shopStageInfoDOMap = shopStageInfo . stream ( ) . collect ( Collectors . toMap ( ShopStageInfoDO : : getShopSubStage , data - > data ) ) ;
ShopStageInfoDO data = shopStageInfoDOMap . get ( ShopSubStageEnum . SHOP_STAGE_10 . getShopSubStage ( ) ) ;
data . setShopSubStageStatus ( ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_100 . getShopSubStageStatus ( ) ) ;
list . add ( data ) ;
shopStageInfoDAO . batchUpdate ( list ) ;
}
}
return designInfoVo ;
@@ -143,6 +152,7 @@ public class DecorationServiceImpl implements DecorationService {
public DecorationModeStageVO getDecorationModeStage ( Long shopId ) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO . getShopSubStageInfo ( shopId , ShopSubStageEnum . SHOP_STAGE_10 ) ;
if ( Objects . isNull ( shopSubStageInfo ) ) {
log . error ( " getDecorationModeStage , shopSubStageInfo is null " ) ;
return null ;
}
DecorationModeStageVO decorationModeStageVO = new DecorationModeStageVO ( ) ;
@@ -157,12 +167,16 @@ public class DecorationServiceImpl implements DecorationService {
public DecorationModelDTO DecorationModel ( Long shopId ) {
DecorationDTO decoration = getDecorationDTO ( shopId ) ;
if ( decoration = = null ) {
log . error ( " DecorationModel storeNum is null " ) ;
log . error ( " 拉取云立方接口获取数据为空 " ) ;
return null ;
}
//预算
List < BudgetDTO > proposedBookBudget = decoration . getProposedBookBudget ( ) ;
Collections . sort ( decoration . getProposedBookBudget ( ) , ( x1 , x2 ) - > x2 . getId ( ) . compareTo ( x1 . getId ( ) ) ) ;
if ( proposedBookBudget . isEmpty ( ) ) {
log . error ( " 云立方获取预算 is null " ) ;
return null ;
}
String totalAmount = proposedBookBudget . get ( 0 ) . getTotalAmount ( ) ;
//支付二维码url
Long regionId = shopInfoDAO . getRegionIdByid ( shopId ) ;
@@ -178,10 +192,10 @@ public class DecorationServiceImpl implements DecorationService {
public String submitDecorationModel ( LinePaySubmitRequest request , PartnerUserInfoVO partnerUserInfoVO ) {
DecorationDTO decoration = getDecorationDTO ( request . getShopId ( ) ) ;
if ( decoration = = null ) {
log . error ( " DecorationModel storeNum is null " ) ;
log . error ( " 拉取云立方接口获取数据为空 " ) ;
return null ;
}
if ( decoration . getPayment ( ) ! = null & & decoration . getPayment ( ) . size ( ) > 0 ) {
if ( ! decoration . getPayment ( ) . isEmpty ( ) ) {
request . setPayStatus ( WorkflowSubStageStatusEnum . PAY_DEPOSIT_50 . getCode ( ) ) ;
} else {
request . setPayStatus ( WorkflowSubStageStatusEnum . PAY_DEPOSIT_45 . getCode ( ) ) ;
@@ -192,26 +206,45 @@ public class DecorationServiceImpl implements DecorationService {
@Override
public DecorationModelVO getDecorationModel ( Long shopId , PartnerUserInfoVO partnerUserInfoVO ) {
//获取支付信息
ShopInfoDO shopInfo = shopInfoDAO . getShopInfo ( shopId ) ;
Long lineId = shopInfo . getLineId ( ) ;
LinePayVO linePayInfo = linePayService . getLinePayInfo ( lineId ) ;
if ( Objects . isNull ( linePayInfo ) ) {
log . error ( " LinePayInfo is null " ) ;
return null ;
}
//获取装修款阶段状态
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO . getShopSubStageInfo ( shopId , ShopSubStageEnum . SHOP_STAGE_10 ) ;
if ( Objects . isNull ( shopSubStageInfo ) ) {
log . error ( " getDecorationModel , shopSubStageInfo is null " ) ;
return null ;
}
//已缴费直接返回支付信息
if ( ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_102 . getShopSubStageStatus ( ) . equals ( shopSubStageInfo . getShopSubStageStatus ( ) ) ) {
DecorationModelVO decorationModelVO = new DecorationModelVO ( ) ;
BeanUtil . copyProperties ( linePayInfo , decorationModelVO ) ;
return decorationModelVO ;
}
//PC端不传partnerUserInfoVO, 直接取region
if ( Objects . isNull ( partnerUserInfoVO ) ) {
partnerUserInfoVO = new PartnerUserInfoVO ( ) ;
BeanUtil . copyProperties ( shopInfo , partnerUserInfoVO ) ;
}
//云立方
DecorationDTO decoration = getDecorationDTO ( shopId ) ;
if ( decoration = = null ) {
log . error ( " DecorationModel storeNum is null " ) ;
log . error ( " 拉取云立方接口获取数据为空 " ) ;
return null ;
}
List < BudgetDTO > proposedBookBudget = decoration . getProposedBookBudget ( ) ;
Collections . sort ( decoration . getProposedBookBudget ( ) , ( x1 , x2 ) - > x2 . getId ( ) . compareTo ( x1 . getId ( ) ) ) ;
if ( proposedBookBudget . isEmpty ( ) ) {
log . error ( " 拉取云立方接口获取缴费信息为空 " ) ;
return null ;
}
String totalAmount = proposedBookBudget . get ( 0 ) . getTotalAmount ( ) ;
if ( decoration . getPayment ( ) ! = null & & decoration . getPayment ( ) . size ( ) > 0
& & ( byte ) WorkflowSubStageStatusEnum . PAY_DEPOSIT_50 . getCode ( ) . intValue ( ) = = linePayInfo . getPayStatus ( ) ) {
if ( ! decoration . getPayment ( ) . isEmpty ( ) ) {
linePayInfo . setPayStatus ( ( byte ) WorkflowSubStageStatusEnum . PAY_DEPOSIT_50 . getCode ( ) . intValue ( ) ) ;
LinePaySubmitRequest submitRequest = new LinePaySubmitRequest ( ) ;
BeanUtil . copyProperties ( linePayInfo , submitRequest ) ;
@@ -230,21 +263,58 @@ public class DecorationServiceImpl implements DecorationService {
log . error ( " DecorationModel storeNum is null " ) ;
return null ;
}
AtomicInteger flag = new AtomicInteger ( 0 ) ;
List < ConstructionScheduleDTO > constructionSchedule = decoration . getConstructionSchedule ( ) ;
Map < String , ConstructionScheduleDTO > constructionScheduleMap = constructionSchedule . stream ( ) . collect ( Collectors . toMap ( ConstructionScheduleDTO : : getName ,
dto - > dto ) ) ;
List < ConstructionScheduleDTO > collect = new ArrayList < > ( ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . APPROACH ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . APPROACH ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . ONE_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . ONE_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . TWO_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . TWO_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . THREE_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . THREE_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . FOUR_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . FOUR_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . FIVE_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . FIVE_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . SIX_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . SIX_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . SEVEN_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . SEVEN_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . EIGHT_DAY ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . EIGHT_DAY ) ) ;
if ( ConstructionPhaseEnum . construction_FINSH . getCode ( ) . equals ( constructionScheduleMap . get ( CommonConstants . WITHDRAWAL ) . getState ( ) ) ) {
flag . incrementAndGet ( ) ;
}
collect . add ( constructionScheduleMap . get ( CommonConstants . WITHDRAWAL ) ) ;
collect . sort ( Comparator . comparing ( ConstructionScheduleDTO : : getId ) ) ;
//更新施工阶段状态
if ( flag . get ( ) = = CommonConstants . TEN ) {
shopStageInfoDAO . updateShopStageInfo ( shopId , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_112 ) ;
} else {
shopStageInfoDAO . updateShopStageInfo ( shopId , ShopSubStageStatusEnum . SHOP_SUB_STAGE_STATUS_111 ) ;
}
return collect ;
}