diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/DecorationServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/DecorationServiceImpl.java index 86e46ead0..f7f69a9ba 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/DecorationServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/DecorationServiceImpl.java @@ -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 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.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91)); + equals(shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_9).getShopSubStageStatus())) { + //更新设计阶段状态完成 + shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91); + //初始化装修款阶段 + List list = new ArrayList<>(); + List shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null); + Map 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 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 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 constructionSchedule = decoration.getConstructionSchedule(); Map constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName, dto -> dto)); List 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; } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PreparationServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PreparationServiceImpl.java index eaffe2d0f..79d83d5d3 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PreparationServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PreparationServiceImpl.java @@ -62,10 +62,7 @@ public class PreparationServiceImpl implements PreparationService { LineInfoDAO lineInfoDAO; @Resource private AcceptanceInfoDAO acceptanceInfoDAO; - @Resource - private YlfService ylfService; - @Resource - private DecorationService decorationService; + @Override public PageInfo getPreparationSchedule(PreparationRequest request) { diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCDecorationController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCDecorationController.java index 1349953ef..1fc7e2d6e 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCDecorationController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCDecorationController.java @@ -47,8 +47,7 @@ public class PCDecorationController { @ApiOperation("获取装修款信息") @GetMapping("/getDecorationModelInfo") public ResponseResult getDecorationModelInfo(@RequestParam Long shopId){ - PartnerUserInfoVO user = null; - return ResponseResult.success(decorationService.getDecorationModel(shopId,user)); + return ResponseResult.success(decorationService.getDecorationModel(shopId,null)); } @ApiOperation("查看三方验收") @GetMapping("/getThreeAcceptance") diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDecorationController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDecorationController.java index 462ea006c..2cff908d0 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDecorationController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniDecorationController.java @@ -33,12 +33,7 @@ import java.util.List; public class MiniDecorationController { @Resource private DecorationService decorationService; - @PostMapping("/submitDecorationModel") - @ApiOperation("提交装修款") - public ResponseResult submitDecorationModel(@RequestBody LinePaySubmitRequest linePaySubmitRequest){ - PartnerUserInfoVO user = PartnerUserHolder.getUser(); - return ResponseResult.success(decorationService.submitDecorationModel(linePaySubmitRequest, user)); - } + @ApiOperation("获取设计阶段信息") @GetMapping("/design") public ResponseResult get(@RequestParam Long shopId){ @@ -49,6 +44,11 @@ public class MiniDecorationController { public ResponseResult> getConstruction(@RequestParam Long shopId){ return ResponseResult.success(decorationService.getConstruction(shopId)) ; } + @PostMapping("/submitDecorationModel") + @ApiOperation("提交装修款") + public ResponseResult submitDecorationModel(@RequestBody LinePaySubmitRequest linePaySubmitRequest){ + return ResponseResult.success(decorationService.submitDecorationModel(linePaySubmitRequest, PartnerUserHolder.getUser())); + } @ApiOperation("获取装修款信息,和二维码") @GetMapping("/getDecorationModel") public ResponseResult getDecorationModel(@RequestParam Long shopId){