feat:装修阶段调整

This commit is contained in:
苏竹红
2024-10-10 13:50:21 +08:00
parent 5be4014d16
commit 4c0493df10
6 changed files with 170 additions and 32 deletions

View File

@@ -0,0 +1,25 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author suzhuhong
* @Date 2024/10/10 10:37
* @Version 1.0
*/
@Data
public class ConstructionRequest {
private Long shopId;
@ApiModelProperty("装修计划开始时间")
private Long planStartTime;
@ApiModelProperty("装修计划结束时间")
private Long planEndTime;
@ApiModelProperty("装修附件")
private String constructionAnnex;
@ApiModelProperty("装修备注")
private String constructionRemark;
}

View File

@@ -0,0 +1,52 @@
package com.cool.store.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author suzhuhong
* @Date 2024/10/10 11:13
* @Version 1.0
*/
@Data
public class ConstructionDataVO {
@ApiModelProperty("预计开工时间")
private Long constructionPlanStartTime;
/**
* 预计完工时间
*/
@ApiModelProperty("预计完工时间")
private Long constructionPlanEndTime;
/**
* 附件
*/
@ApiModelProperty("附件")
private String constructionAnnex;
/**
* 备注
*/
@ApiModelProperty("备注")
private String constructionRemark;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Long constructionCreateTime;
/**
* 创建人
*/
@ApiModelProperty("创建人")
private String constructionCreateUser;
@ApiModelProperty("创建人")
private String constructionCreateUserName;
}

View File

@@ -8,12 +8,9 @@ import com.cool.store.request.*;
import com.cool.store.response.ThreeSignResponse;
import com.cool.store.vo.DecorationDesignVO;
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.PageInfo;
import java.util.List;
@@ -135,6 +132,22 @@ public interface DecorationService {
*/
DecorationDesignVO getDecorationDesign(Long shopId);
/**
* 提交装修数据
* @param request
* @param user
* @return
*/
Boolean submitConstructionData(ConstructionRequest request,LoginUserInfo user);
/**
* 查询装修数据
* @param shopId
* @return
*/
ConstructionDataVO getConstructionData(Long shopId);
/**
* 确认设计数据方案
* @param request

View File

@@ -567,6 +567,57 @@ public class DecorationServiceImpl implements DecorationService {
return null;
}
@Override
public Boolean submitConstructionData(ConstructionRequest request, LoginUserInfo user) {
String lockKey = "submitConstructionData:" + 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(), ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
if (shopStageInfo!=null&&!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus().equals(shopStageInfo.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.STATUS_NOT_SUPPORT_SUMMIT);
}
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(request.getShopId());
decoration.setConstructionAnnex(request.getConstructionAnnex());
decoration.setConstructionRemark(request.getConstructionRemark());
decoration.setConstructionPlanStartTime(new Date(request.getPlanStartTime()));
decoration.setConstructionPlanEndTime(new Date(request.getPlanEndTime()));
decoration.setConstructionCreateTime(new Date());
decoration.setConstructionCreateUser(user.getUserId());
decorationDesignInfoDAO.updateByPrimaryKeySelective(decoration);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_905);
//状态变为施工中
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111));
return Boolean.TRUE;
}
@Override
public ConstructionDataVO getConstructionData(Long shopId) {
ConstructionDataVO constructionDataVO = new ConstructionDataVO();
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(shopId);
if (Objects.isNull(decoration)){
return constructionDataVO;
}
constructionDataVO.setConstructionAnnex(decoration.getConstructionAnnex());
constructionDataVO.setConstructionRemark(decoration.getConstructionRemark());
constructionDataVO.setConstructionPlanStartTime(decoration.getConstructionPlanStartTime()!=null?decoration.getConstructionPlanStartTime().getTime():null);
constructionDataVO.setConstructionPlanEndTime(decoration.getConstructionPlanEndTime()!=null?decoration.getConstructionPlanEndTime().getTime():null);
constructionDataVO.setConstructionCreateTime(decoration.getConstructionCreateTime().getTime());
constructionDataVO.setConstructionCreateUser(decoration.getConstructionCreateUser());
if (StringUtils.isNotEmpty(decoration.getConstructionCreateUser())){
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(decoration.getConstructionCreateUser());
constructionDataVO.setConstructionCreateUserName(user.getName());
}
return null;
}
@Override
public Boolean confirmDesign(DecorationDesignRequest request, LoginUserInfo user) {
//重复提交校验 3秒内不能重复提交
@@ -583,24 +634,18 @@ public class DecorationServiceImpl implements DecorationService {
decorationDesignInfoDAO.updateByPrimaryKeySelective(decorationDesignInfoDO);
}
//更新装修设计状态
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111));
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110));
return Boolean.TRUE;
}
@Override
public Boolean confirmComplete(Long shopId, LoginUserInfo user) {
ShopStageInfoDO shopStageInfoDO = shopStageInfoDAO.getByShopIdAndSubStage(shopId, ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage());
if (shopStageInfoDO!=null && !ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91.getShopSubStageStatus().equals(shopStageInfoDO.getShopSubStageStatus())){
//判断施工阶段是否时施工中 施工中才能施工完成
ShopStageInfoDO shopStageInfoDO = shopStageInfoDAO.getByShopIdAndSubStage(shopId, ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
if (shopStageInfoDO!=null && !ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus().equals(shopStageInfoDO.getShopSubStageStatus())){
throw new ServiceException(ErrorCodeEnum.DESIGN_NO_COMPLETE);
}
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121));
AcceptanceInfoDO acceptance = acceptanceInfoDAO.selectByShopId(shopId);
AcceptanceInfoDO acceptanceInfoDO = new AcceptanceInfoDO();
acceptanceInfoDO.setShopId(shopId);
acceptanceInfoDO.setCreateTime(new Date());
if(Objects.isNull(acceptance)) {
acceptanceInfoDAO.insertSelectiveAcceptanceInfo(acceptanceInfoDO);
}
return Boolean.TRUE;
}
@@ -666,19 +711,6 @@ public class DecorationServiceImpl implements DecorationService {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean bookingAcceptance(BookingAcceptanceRequest request, LoginUserInfo user) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121);
ShopStageInfoDO newShopStageInfoDO = new ShopStageInfoDO();
SimpleDateFormat sdf = new SimpleDateFormat(CoolDateUtils.DATE_FORMAT_SEC);
String date = sdf.format(request.getBookingAcceptanceTime());
newShopStageInfoDO.setPlanCompleteTime(date);
newShopStageInfoDO.setShopSubStage(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage());
newShopStageInfoDO.setShopId(request.getShopId());
shopStageInfoDAO.updateByShopId(newShopStageInfoDO);
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoDAO.selectByShopId(request.getShopId());
acceptanceInfoDO.setBookingUser(user.getUserId());
acceptanceInfoDO.setUpdateTime(new Date());
acceptanceInfoDO.setPlanAcceptanceTime(request.getBookingAcceptanceTime());
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO);
return Boolean.TRUE;
}

View File

@@ -11,6 +11,7 @@ import com.cool.store.response.ThreeSignResponse;
import com.cool.store.service.DecorationService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.SeeAcceptanceService;
import com.cool.store.vo.ConstructionDataVO;
import com.cool.store.vo.DecorationDesignVO;
import com.cool.store.vo.Fitment.DesignInfoVo;
import com.cool.store.vo.LinePayVO;
@@ -127,7 +128,7 @@ public class PCDecorationController {
@ApiOperation("提交设计方案")
@PostMapping("/submitDecorationDesign")
public ResponseResult<Boolean> submitBookingAcceptance(@RequestBody DecorationDesignRequest request){
public ResponseResult<Boolean> submitDecorationDesign(@RequestBody DecorationDesignRequest request){
return ResponseResult.success(decorationService.submitDecorationDesign(request,CurrentUserHolder.getUser()));
}
@@ -137,6 +138,18 @@ public class PCDecorationController {
return ResponseResult.success(decorationService.getDecorationDesign(shopId));
}
@ApiOperation("提交施工方案")
@PostMapping("/submitConstructionData")
public ResponseResult<Boolean> submitConstructionData(@RequestBody ConstructionRequest request){
return ResponseResult.success(decorationService.submitConstructionData(request,CurrentUserHolder.getUser()));
}
@ApiOperation("查询施工方案")
@GetMapping("/getConstructionData")
public ResponseResult<ConstructionDataVO> getConstructionData(@RequestParam Long shopId){
return ResponseResult.success(decorationService.getConstructionData(shopId));
}
@ApiOperation("装修阶段完成")
@PostMapping("/confirmComplete")
public ResponseResult<Boolean> confirmComplete(@RequestBody DecorationDesignRequest request){

View File

@@ -16,13 +16,10 @@ import com.cool.store.response.ThreeSignResponse;
import com.cool.store.service.AssessmentTemplateService;
import com.cool.store.service.DecorationService;
import com.cool.store.service.SeeAcceptanceService;
import com.cool.store.vo.AssessmentTemplateVO;
import com.cool.store.vo.DecorationDesignVO;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -122,6 +119,12 @@ public class MiniDecorationController {
return ResponseResult.success(decorationService.getDecorationDesign(shopId));
}
@ApiOperation("查询施工方案")
@GetMapping("/getConstructionData")
public ResponseResult<ConstructionDataVO> getConstructionData(@RequestParam Long shopId){
return ResponseResult.success(decorationService.getConstructionData(shopId));
}
@ApiOperation("加盟商确定设计方案")
@PostMapping("/confirmDesign")
public ResponseResult<Boolean> confirmDesign(@RequestBody DecorationDesignRequest request){