装修阶段

This commit is contained in:
苏竹红
2024-06-25 15:09:16 +08:00
parent 50ae1f4ce4
commit 06666ea419
18 changed files with 313 additions and 331 deletions

View File

@@ -8,6 +8,7 @@ import com.cool.store.request.*;
import com.cool.store.response.ThreeSignResponse;
import com.cool.store.vo.DecorationDesignVO;
import com.cool.store.vo.Fitment.DecorationStageVO;
import com.cool.store.vo.Fitment.DesignInfoVo;
import com.cool.store.vo.LinePayVO;
@@ -117,4 +118,36 @@ public interface DecorationService {
* @description:三方获取验收列表详情
*/
fitmentCheckVO getAcceptanceDetail(Long shopId, LoginUserInfo user);
/**
* 提交设计数据
* @param request
* @param user
* @return
*/
Boolean submitDecorationDesign(DecorationDesignRequest request, LoginUserInfo user);
/**
* 获取设计数据
* @param shopId
* @return
*/
DecorationDesignVO getDecorationDesign(Long shopId);
/**
* 确认设计数据方案
* @param request
* @param user
* @return
*/
Boolean confirmDesign(DecorationDesignRequest request, LoginUserInfo user);
/**
* 装修阶段确认完成
* @param shopId
* @param user
* @return
*/
Boolean confirmComplete(Long shopId, LoginUserInfo user);
}

View File

@@ -22,14 +22,12 @@ import com.cool.store.request.*;
import com.cool.store.response.ThreeSignResponse;
import com.cool.store.service.*;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.AssessmentTemplateVO;
import com.cool.store.vo.*;
import com.cool.store.vo.Fitment.DecorationStageVO;
import com.cool.store.vo.Fitment.DesignInfoVo;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.fitmentCheckVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
@@ -97,53 +95,14 @@ public class DecorationServiceImpl implements DecorationService {
private CommonService commonService;
@Resource
private AssessmentTemplateService assessmentTemplateService;
@Resource
RedisUtilPool redisUtilPool;
@Resource
DecorationDesignInfoDAO decorationDesignInfoDAO;
@Override
public DesignInfoVo DesignInfo(Long shopId) {
DecorationDTO decoration = getDecorationDTO(shopId);
if (decoration == null) {
log.error("拉取云立方接口获取数据为空");
return null;
}
Long flag;
DesignInfoVo designInfoVo = new DesignInfoVo();
//平面图和施工
List<DesignSchemeDTO> designScheme = decoration.getDesignScheme();
long count = designScheme.stream().filter(design -> DesignPhaseEnum.DESIGN_PHASE_ACCEPTANCE_PASS.getCode().equals(design.getStatus())).count();
flag = count;
designInfoVo.setDesignScheme(designScheme);
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
if (CollectionUtils.isNotEmpty(constructionSchedule)) {
Map<String, ConstructionScheduleDTO> constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName,
Function.identity(), (a, b) -> b));
if (CollectionUtils.isNotEmpty(constructionSchedule)) {
//量房
ConstructionScheduleDTO measuringRoom = constructionScheduleMap.get(CommonConstants.MEASURING_THE_ROOM);
if (Objects.nonNull(measuringRoom)) {
designInfoVo.setMeasuringRoom(measuringRoom);
if (ConstructionPhaseEnum.construction_FINSH.getCode().equals(measuringRoom.getState())) {
flag++;
}
}
}
}
//获取最新预算
BudgetDTO proposedBookBudget = getBudgetDTOS(decoration);
if (Objects.nonNull(proposedBookBudget)) {
designInfoVo.setProposedBookBudget(proposedBookBudget);
flag++;
}
if (flag == CommonConstants.FOUR) {
//如果设计阶段进行中
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_9);
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())) {
//更新设计阶段状态完成//初始化装修款阶段
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91));
LineInfoDO lineInfo = lineInfoMapper.getByLineId(shopSubStageInfo.getLineId());
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.DECORATION_MODEL_PAY, null);
}
}
return designInfoVo;
return null;
}
@Override
@@ -318,41 +277,18 @@ public class DecorationServiceImpl implements DecorationService {
//如果完成更新施工阶段状态
if (ConstructionPhaseEnum.construction_FINSH.getCode().equals(constructionSage.getState())) {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
} else {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111);
}
// if (ConstructionPhaseEnum.construction_FINSH.getCode().equals(constructionSage.getState())) {
// shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
// } else {
// shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111);
// }
return collect;
}
@Transactional(rollbackFor = Exception.class)
@Override
public ConstructionScheduleDTO getConstructionInfo(Long shopId) {
DecorationDTO decoration = getDecorationDTO(shopId);
if (decoration == null) {
log.error("DecorationModel storeNum is null");
return null;
}
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
Map<String, ConstructionScheduleDTO> constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName,
dto -> dto));
ConstructionScheduleDTO constructionScheduleDTO = constructionScheduleMap.get(CommonConstants.CONSTRUCTION_PHASE);
//如果完成更新阶段状态
if (ConstructionPhaseEnum.construction_FINSH.getCode().equals(constructionScheduleMap.get(CommonConstants.CONSTRUCTION_PHASE).getState())) {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_11);
shopSubStageInfo.setPlanCompleteTime(constructionScheduleDTO.getPlanEndDate());
shopSubStageInfo.setActualCompleteTime(constructionScheduleDTO.getActualEndDate());
shopStageInfoDAO.updateByShopId(shopSubStageInfo);
} else {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111);
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_11);
shopSubStageInfo.setPlanCompleteTime(constructionScheduleDTO.getPlanEndDate());
shopSubStageInfo.setActualCompleteTime(constructionScheduleDTO.getActualEndDate());
shopStageInfoDAO.updateByShopId(shopSubStageInfo);
}
return constructionScheduleDTO;
return null;
}
@Override
@@ -582,6 +518,85 @@ public class DecorationServiceImpl implements DecorationService {
return fitmentCheckVO;
}
@Override
public Boolean submitDecorationDesign(DecorationDesignRequest request, LoginUserInfo user) {
//重复提交校验 3秒内不能重复提交
String lockKey = "submitDecorationDesign:" + request.getShopId();
String lockValue = UUID.randomUUID().toString();
boolean acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.THREE*CommonConstants.ONE_SECONDS);
if (!acquired){
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}
//校验参数
if (Objects.isNull(request)||request.getShopId()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
//必须是待提交状态才能提交
ShopStageInfoDO shopStageInfo = shopStageInfoDAO.getByShopIdAndSubStage(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
if (Objects.isNull(shopStageInfo)) {
throw new ServiceException(ErrorCodeEnum.STATUS_NOT_SUPPORT_SUMMIT);
}
DecorationDesignInfoDO decorationDesignInfoDO = request.toDecorationDesignInfoDO();
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(request.getShopId());
if (Objects.nonNull(decoration)){
decorationDesignInfoDO.setId(decoration.getId());
decorationDesignInfoDAO.updateByPrimaryKey(decorationDesignInfoDO);
}else {
decorationDesignInfoDAO.insertSelective(decorationDesignInfoDO);
}
//更新装修设计状态
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_92);
return Boolean.TRUE;
}
@Override
public DecorationDesignVO getDecorationDesign(Long shopId) {
if (shopId==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(shopId);
if (!Objects.isNull(decoration)){
DecorationDesignVO decorationDesignVO = new DecorationDesignVO();
decorationDesignVO.setDesignUrl(decoration.getDesignUrl());
decorationDesignVO.setRemark(decoration.getRemark());
decorationDesignVO.setQuotationUrl(decoration.getQuotationUrl());
decorationDesignVO.setShopId(decoration.getShopId());
decorationDesignVO.setPartnerAcceptanceSignatures(decoration.getPartnerAcceptanceSignatures());
return decorationDesignVO;
}
return null;
}
@Override
public Boolean confirmDesign(DecorationDesignRequest request, LoginUserInfo user) {
//重复提交校验 3秒内不能重复提交
String lockKey = "confirmDesign:" + request.getShopId();
String lockValue = UUID.randomUUID().toString();
boolean acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.THREE*CommonConstants.ONE_SECONDS);
if (!acquired){
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}
DecorationDesignInfoDO decorationDesignInfoDO = request.toDecorationDesignInfoDO();
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(request.getShopId());
if (Objects.nonNull(decoration)){
decorationDesignInfoDO.setId(decoration.getId());
decorationDesignInfoDAO.updateByPrimaryKey(decorationDesignInfoDO);
}
//更新装修设计状态
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_93, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111));
return Boolean.TRUE;
}
@Override
public Boolean confirmComplete(Long shopId, LoginUserInfo user) {
ShopStageInfoDO shopStageInfoDO = shopStageInfoDAO.getByShopIdAndSubStage(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_93.getShopSubStageStatus());
if (Objects.isNull(shopStageInfoDO)){
throw new ServiceException(ErrorCodeEnum.DESIGN_NO_COMPLETE);
}
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120));
return Boolean.TRUE;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean pcSubmitAcceptanceSign(ThreeAcceptanceRequest request) {

View File

@@ -191,26 +191,14 @@ public class PreparationServiceImpl implements PreparationService {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)) {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean buildStoreCompletionFlag = Boolean.TRUE;
Boolean contractCompletionFlag = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage()).getShopSubStageStatus());
//都完成了 初始化后续流程数据
if (buildStoreCompletionFlag && contractCompletionFlag) {
if (contractCompletionFlag) {
//初始化后续流程数据 设计阶段 装修阶段 开业运营方案 首批订货清单
List<ShopStageInfoDO> list = new ArrayList<>();
ShopStageInfoDO data1 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage());
data1.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
list.add(data1);
// ShopStageInfoDO data2 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
// data2.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus());
// list.add(data2);
//初始化xfsg_acceptance_info表
// AcceptanceInfoDO acceptanceInfoDO1 = acceptanceInfoDAO.selectByShopId(shopId);
// AcceptanceInfoDO acceptanceInfoDO = new AcceptanceInfoDO();
// acceptanceInfoDO.setShopId(shopId);
// acceptanceInfoDO.setCreateTime(new Date());
// if(Objects.isNull(acceptanceInfoDO1)) {
// acceptanceInfoDAO.insertSelectiveAcceptanceInfo(acceptanceInfoDO);
// }
ShopStageInfoDO data3 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_14.getShopSubStage());
data3.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus());
list.add(data3);
@@ -234,25 +222,7 @@ public class PreparationServiceImpl implements PreparationService {
@Override
public Boolean decorationFlush(Long shopId) {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, ShopStageEnum.SHOP_STAGE_2.getShopStage());
Map<Integer, ShopStageInfoDO> collect = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, Function.identity()));
//设计
Boolean flushFlag = Boolean.FALSE;
Integer Status900 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus();
Integer Design = collect.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage()).getShopSubStageStatus();
if (Status900.equals(Design)) {
decorationService.DesignInfo(shopId);
flushFlag = Boolean.TRUE;
}
//装修款
Integer Status1000 = 1000;
Integer Status1010 = 1010;
Integer DecorationModel = collect.get(100).getShopSubStageStatus();
if (Status1000.equals(DecorationModel) || Status1010.equals(DecorationModel)) {
decorationService.getDecorationModel(shopId, null);
flushFlag = Boolean.TRUE;
}
return flushFlag;
return Boolean.TRUE;
}