新店装修阶段1.0

This commit is contained in:
shuo.wang
2024-04-28 23:18:52 +08:00
parent 66e1e216c9
commit 757c5b4331
16 changed files with 317 additions and 31 deletions

View File

@@ -0,0 +1,30 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/28/下午7:25
* @Version 1.0
* @注释:
*/
public enum ConstructionPhaseEnum {
NOT_SHOWN(-1,"不显示"),
NOT_START(0,"未开工"),
construction_ING(1,"施工中"),
construction_FINSH(2,"已完工");
private Integer code;
private String message;
ConstructionPhaseEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,41 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/28/下午6:46
* @Version 1.0
* @注释:
*/
public enum DesignPhaseEnum {
//设计阶段
ACCEPTANCE_FAILED(0,"验收未通过"),
ACCEPTANCE_NOT_START(1, "未开始"),
ACCEPTANCE_DESIGNING(2, "设计中"),
ACCEPTED_NOT(3, "未验收"),
AUDIT_WAIT(5,"待审批"),
AUDIT_FAIL(6,"审批驳回"),
AUDIT_ING(7,"审批中"),
AUDIT_DISCARD (8,"审批作废"),
AUDIT_PASS(9,"审批通过"),
ACCEPTANCE_FAIL(10,"审批验收未通过"),
ACCEPTANCE_PASS (11,"验收通过");
private Integer code;
private String message;
DesignPhaseEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -183,6 +183,8 @@ public enum ErrorCodeEnum {
GET_FIRST_ORDER(103021,"获取鲜丰首批订货金失败",null),
YLF_ERROR(110001, "云立方接口异常!", null),
;

View File

@@ -158,5 +158,7 @@ public class ShopInfoDAO {
public List<PreparationDTO> ListByCondition(PreparationRequest request){
return shopInfoMapper.ListByCondition(request);
}
public Long getRegionIdByShopCode(String shopCode){
return shopInfoMapper.getRegionIdByShopCode(shopCode);
}
}

View File

@@ -85,4 +85,5 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
List<PreparationDTO> ListByCondition(@Param("request") PreparationRequest request);
Long getRegionIdByShopCode(@Param("shopCode") String shopCode);
}

View File

@@ -149,6 +149,12 @@
</foreach>
</if>
</select>
<select id="getRegionIdByShopCode" resultType="java.lang.Long">
select r.parent_id
from xfsg_shop_info xsi
join region_${enterpriseId} r on r.id = xsi.region_id
where xsi.shop_code = #{shopCode}
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
package com.cool.store.dto.decoration;
import lombok.Data;
/**
* @Auther: WangShuo
* @Date: 2024/04/28/下午9:33
* @Version 1.0
* @注释:
*/
@Data
public class DecorationModelDTO {
private String totalAmount;
private String payUrl;
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.dto.decoration;
import lombok.Data;
import java.util.List;
/**
* @Auther: WangShuo
* @Date: 2024/04/28/下午8:41
* @Version 1.0
* @注释:
*/
@Data
public class DesignRowsDTO {
private List<ProjectDTO> rows;
}

View File

@@ -0,0 +1,32 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/28/下午9:58
* @Version 1.0
* @注释:
*/
@Data
public class DecorationPayRequest {
@ApiModelProperty("line_info.id")
private Long lineId;
@ApiModelProperty("店铺编码")
private String shopCode;
@ApiModelProperty("加盟商姓名")
private String name;
@ApiModelProperty("支付账户")
private String payAccount;
@ApiModelProperty("开户行code")
private String bankCode;
@ApiModelProperty("支行code")
private String branchBankCode;
@ApiModelProperty("缴纳时间")
private Date payTime;
@ApiModelProperty("付款截图")
private String payPic;
}

View File

@@ -1,5 +1,9 @@
package com.cool.store.vo;
import com.cool.store.dto.decoration.AttachmentsDTO;
import com.cool.store.dto.decoration.BudgetDTO;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.decoration.DesignSchemeDTO;
import com.cool.store.vo.log.DesignLogVo;
import lombok.Data;
@@ -14,9 +18,8 @@ import java.util.List;
@Data
public class DesignInfoVo {
private String name;
private Integer resultType;
private String planTime;
private List<DesignLogVo> logs;
private List<DesignSchemeDTO> designScheme;
private ConstructionScheduleDTO measuringRoom;
private ConstructionScheduleDTO ConstructionDrawings;
private BudgetDTO proposedBookBudget;
}

View File

@@ -16,7 +16,5 @@ public class DesignLogVo {
private String logTime;
private String name;
private String description;
private String planTime;
private String finishTime;
private List<String> attachmentUrl;
}

View File

@@ -1,6 +1,10 @@
package com.cool.store.service;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.decoration.DecorationModelDTO;
import com.cool.store.request.DecorationPayRequest;
import com.cool.store.vo.DesignInfoVo;
import com.cool.store.vo.PartnerUserInfoVO;
import java.util.List;
@@ -22,5 +26,23 @@ public interface DecorationService {
* @Date: 2024/4/28
* @description:设计阶段信息
*/
List<DesignInfoVo> DesignInfo(String shopCode);
DesignInfoVo DesignInfo(String shopCode);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:获取装修款和支付二维码
*/
DecorationModelDTO DecorationModel(String shopCode);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:提交装修款付款凭证
*/
String submitDecorationModel(DecorationPayRequest decorationPayRequest, PartnerUserInfoVO partnerUserInfoVO);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:施工阶段
*/
List<ConstructionScheduleDTO> getConstruction(String shopCode);
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.service;
import com.cool.store.dto.decoration.DecorationDTO;
import com.cool.store.dto.decoration.ProjectDTO;
/**
* @Author suzhuhong
@@ -18,6 +19,6 @@ public interface YlfService {
* @Date: 2024/4/25
* @description:项目列表
*/
String getProjectList(String shopCode);
ProjectDTO getProjectList(String shopCode);
}

View File

@@ -1,16 +1,30 @@
package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.decoration.DecorationDTO;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dao.LinePayDAO;
import com.cool.store.dao.RegionQrcodeConfigDao;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dto.decoration.*;
import com.cool.store.entity.LinePayDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.DecorationPayRequest;
import com.cool.store.service.DecorationService;
import com.cool.store.service.YlfService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.DesignInfoVo;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.log.DesignLogVo;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -22,17 +36,96 @@ import java.util.List;
@Service
public class DecorationServiceImpl implements DecorationService {
private static final Logger log = LoggerFactory.getLogger(DecorationServiceImpl.class);
@Resource
private YlfService ylfService;
@Resource
private RegionQrcodeConfigDao regionQrcodeConfigDao;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private LinePayDAO linePayDAO;
private static String MEASURING_THE_ROOM = "量房";
private static String CONSTRUCTION_DRAWING = "施工图+预算";
@Override
public List<DesignInfoVo> decorations() {
return Collections.emptyList();
}
@Override
public List<DesignInfoVo> DesignInfo(String shopCode) {
String projectId = ylfService.getProjectList(shopCode);
public DesignInfoVo DesignInfo(String shopCode) {
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
List<DesignSchemeDTO> designScheme = decoration.getDesignScheme();
return Collections.emptyList();
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
Map<String, ConstructionScheduleDTO> constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName,
dto -> dto));
//量房
ConstructionScheduleDTO measuringRoom = constructionScheduleMap.get(MEASURING_THE_ROOM);
//施工图
ConstructionScheduleDTO ConstructionDrawings = constructionScheduleMap.get(CONSTRUCTION_DRAWING);
//预算
List<BudgetDTO> proposedBookBudget = decoration.getProposedBookBudget();
Collections.sort(decoration.getProposedBookBudget(),(x1,x2)->x2.getId().compareTo(x1.getId()));
DesignInfoVo designInfoVo = new DesignInfoVo();
designInfoVo.setMeasuringRoom(measuringRoom);
designInfoVo.setConstructionDrawings(ConstructionDrawings);
designInfoVo.setDesignScheme(designScheme);
designInfoVo.setProposedBookBudget(proposedBookBudget.get(0));
return designInfoVo;
}
@Override
public DecorationModelDTO DecorationModel(String shopCode) {
if (StringUtils.isEmpty(shopCode)){
log.error("DecorationModel shopCode is null");
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
//TODO 验证
//预算
List<BudgetDTO> proposedBookBudget = decoration.getProposedBookBudget();
Collections.sort(decoration.getProposedBookBudget(),(x1,x2)->x2.getId().compareTo(x1.getId()));
String totalAmount = proposedBookBudget.get(0).getTotalAmount();
//支付二维码url
Long regionId = shopInfoDAO.getRegionIdByShopCode(shopCode);
String payPic = regionQrcodeConfigDao.getPayPicByRegionId(regionId);
DecorationModelDTO decorationModelDTO = new DecorationModelDTO();
decorationModelDTO.setPayUrl(payPic);
decorationModelDTO.setTotalAmount(totalAmount);
return decorationModelDTO;
}
@Override
public String submitDecorationModel(DecorationPayRequest decorationPayRequest, PartnerUserInfoVO partnerUserInfoVO) {
LinePayDO linePayDO =new LinePayDO();
BeanUtil.copyProperties(decorationPayRequest, linePayDO);
linePayDO.setCreateTime(new Date());
linePayDO.setUpdateTime(new Date());
linePayDO.setLineId(partnerUserInfoVO.getLineId());
linePayDO.setCreateUserId(partnerUserInfoVO.getUsername());
linePayDO.setUpdateUserId(partnerUserInfoVO.getUsername());
linePayDO.setPayBusinessType(2);
linePayDO.setPayType(2);
return "";
}
@Override
public List<ConstructionScheduleDTO> getConstruction(String shopCode) {
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
Map<String, ConstructionScheduleDTO> constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName,
dto -> dto));
constructionScheduleMap.remove(MEASURING_THE_ROOM);
constructionScheduleMap.remove(CONSTRUCTION_DRAWING);
List<ConstructionScheduleDTO> collect = constructionScheduleMap.values().stream().collect(Collectors.toList());
return collect;
}
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.decoration.DecorationDTO;
import com.cool.store.dto.decoration.DesignRowsDTO;
import com.cool.store.dto.decoration.ProjectDTO;
import com.cool.store.dto.decoration.RowsDTO;
import com.cool.store.enums.ErrorCodeEnum;
@@ -59,7 +60,7 @@ public class YlfServiceImpl implements YlfService {
}
@Override
public String getProjectList(String shopCode) {
public ProjectDTO getProjectList(String shopCode) {
log.info("getProjectList param:{}", shopCode);
if (Objects.isNull(shopCode)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
@@ -69,14 +70,17 @@ public class YlfServiceImpl implements YlfService {
try {
String jsonString = httpRestTemplateService.getForObject(url, String.class, new HashMap<>());
JSONObject jsonObject = JSONObject.parseObject(jsonString);
Object data = JSONObject.parseObject(jsonString, JSONObject.class).get("data");
log.info("CoolStoreStartFlowServiceImpl#getOrder,jsonObject:{}", jsonObject);
if (jsonObject.get("status").equals(Constants.SUCCESS)) {
if (jsonObject.get("data").toString() == null) {
if (Objects.isNull(data)) {
return null;
}
List<ProjectDTO> projectDTOS = (List<ProjectDTO>) ((JSONObject) JSONObject.parseObject(jsonString, JSONObject.class).get("data")).get("rows");
return ((ProjectDTO)projectDTOS.get(0)).getProjectId();
DesignRowsDTO designRowsDTO = JSONObject.parseObject(JSONObject.toJSONString(data), DesignRowsDTO.class);
List<ProjectDTO> rows = designRowsDTO.getRows();
if (CollectionUtils.isNotEmpty(rows)) {
return rows.get(0);
}
} else {
log.info("获取云立方装修公司信息失败,shopCode:{}", shopCode);
throw new ServiceException(ErrorCodeEnum.YLF_ERROR);
@@ -87,7 +91,7 @@ public class YlfServiceImpl implements YlfService {
throw new ServiceException(ErrorCodeEnum.XFSG_SERVICE_ERROR);
}
}
return null;}
}

View File

@@ -1,15 +1,23 @@
package com.cool.store.controller.webb;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.decoration.DecorationDTO;
import com.cool.store.dto.decoration.DecorationModelDTO;
import com.cool.store.request.DecorationPayRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.DecorationService;
import com.cool.store.service.YlfService;
import com.cool.store.vo.DesignInfoVo;
import com.cool.store.vo.PartnerUserInfoVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Auther: WangShuo
@@ -23,11 +31,23 @@ import javax.annotation.Resource;
@Slf4j
public class PCDecorationController {
@Resource
private YlfService ylfService;
@GetMapping("/get")
private ResponseResult get(){
String shopCode = "31310383";
return new ResponseResult<>(200,ylfService.getProjectList(shopCode)) ;
private DecorationService decorationService;
@GetMapping("/design")
public ResponseResult<DesignInfoVo> get(@RequestParam String shopCode){
return ResponseResult.success( decorationService.DesignInfo(shopCode)) ;
}
@GetMapping("/getDecorationModel")
public ResponseResult<DecorationModelDTO> getDecorationModel(@RequestParam String shopCode){
return ResponseResult.success(decorationService.DecorationModel(shopCode)) ;
}
@PostMapping("/submitDecorationModel")
public ResponseResult submitDecorationModel(@RequestBody DecorationPayRequest DecorationPayRequest){
PartnerUserInfoVO user = PartnerUserHolder.getUser();
decorationService.submitDecorationModel(DecorationPayRequest, user);
return ResponseResult.success();
}
@GetMapping("/getConstruction")
public ResponseResult<List<ConstructionScheduleDTO>> getConstruction(@RequestParam String shopCode){
return ResponseResult.success(decorationService.getConstruction(shopCode)) ;
}
}