开业运营方案

This commit is contained in:
shuo.wang
2024-04-24 22:22:33 +08:00
parent e5a07a3512
commit dd4a6a5bcf
33 changed files with 307 additions and 55 deletions

View File

@@ -176,7 +176,7 @@ public enum ErrorCodeEnum {
UPDATE_PLAN_FALSE(103008,"修改PLAN失败",null),
UPDATE_SHOP_SUB_STAGE_STATUS_FALSE(103009,"修改开业运营方案阶段状态失败",null),
SHOP_ID_NOT_EXIST(103010,"shopId不存在",null),
FIRST_ORDER_PARAM_NULL(103020,"首批订货金参数为空",null)
;

View File

@@ -13,15 +13,15 @@ public enum ShopAuditInfoTypeEnum {
OPENING_OPERATION_PLAN(2,"开业运营方案"),
LICENSE_APPROVAL(3,"证照审批");
private Byte code;
private Integer code;
private String msg;
ShopAuditInfoTypeEnum(int code, String msg) {
this.code = (byte) code;
this.code = code;
this.msg = msg;
}
public Byte getCode() {
public Integer getCode() {
return code;
}

View File

@@ -1,7 +1,7 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.openPlan.UserInfoDTO;
import com.cool.store.dto.openPreparation.UserInfoDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.mapper.EnterpriseUserMapper;
import com.cool.store.utils.StringUtil;

View File

@@ -0,0 +1,31 @@
package com.cool.store.dao;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.mapper.FirstOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午8:32
* @Version 1.0
* @注释:首批订货金
*/
@Repository
public class FirstOrderDAO {
@Resource
private FirstOrderMapper firstOrderMapper;
public Integer insertFirstOrder(FirstOrderDO firstOrderDO) {
return firstOrderMapper.insertSelective(firstOrderDO);
}
public FirstOrderDTO selectFirstOrderByShopId(Long shopId) {
return firstOrderMapper.selectByShopId(shopId);
}
}

View File

@@ -1,10 +1,9 @@
package com.cool.store.dao;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPlan.PlanLineDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowStageEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
@@ -13,14 +12,11 @@ import com.cool.store.request.LineListRequest;
import com.cool.store.request.PartnerRequest;
import com.cool.store.request.PointLinePageRequest;
import com.cool.store.request.PublicLineListRequest;
import com.cool.store.vo.PublicLineListVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;

View File

@@ -1,15 +1,13 @@
package com.cool.store.dao;
import com.cool.store.dto.openPlan.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.request.PlanListRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**

View File

@@ -1,19 +1,16 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.openPlan.OpenPlanShopInfoDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ShopInfoMapper;
import com.cool.store.utils.NumberConverter;
import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;

View File

@@ -1,6 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.UserInfoDTO;
import com.cool.store.dto.openPreparation.UserInfoDTO;
import com.cool.store.entity.EnterpriseUserDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@@ -1,7 +1,11 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
public interface FirstOrderMapper extends Mapper<FirstOrderDO> {
FirstOrderDTO selectByShopId (@Param("shopId") Long shopId);
}

View File

@@ -1,9 +1,8 @@
package com.cool.store.mapper;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPlan.PlanLineDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.request.LineListRequest;
import com.cool.store.request.PartnerRequest;
import com.cool.store.request.PointLinePageRequest;

View File

@@ -1,12 +1,10 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.request.PlanListRequest;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.time.LocalDate;
import java.util.List;
public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanDO> {

View File

@@ -1,6 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.Page;

View File

@@ -132,7 +132,7 @@
<include refid="Base_Column_List"/>
FROM enterprise_user_${enterpriseId} WHERE ( mobile = #{investmentManager} or `name` = #{investmentManager} ) and active = true LIMIT 1
</select>
<select id="selectNameByUserId" resultType="com.cool.store.dto.openPlan.UserInfoDTO">
<select id="selectNameByUserId" resultType="com.cool.store.dto.openPreparation.UserInfoDTO">
select user_id as userId ,name ,
from enterprise_user_${enterpriseId}
where user_id in

View File

@@ -16,4 +16,11 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<select id="selectByShopId" resultType="com.cool.store.dto.openPreparation.FirstOrderDTO">
select total_order_deposit as totalOrderDeposit,latest_payment_date as latestPaymentDate
estimated_cost as estimatedCost ,fruits_cost as fruitsCost
from xfsg_first_order
where shop_id = #{shopId}
</select>
</mapper>

View File

@@ -479,7 +479,7 @@
and (username like #{request.keyword} or mobile like #{request.keyword})
</if>
</select>
<select id="getLines" resultType="com.cool.store.dto.openPlan.PlanLineDTO">
<select id="getLines" resultType="com.cool.store.dto.openPreparation.PlanLineDTO">
select xli.id as lineId, xli.mobile as mobile, xli.username as username, eu.name as name
from xfsg_line_info xli
join enterprise_user_${enterpriseId} eu on xli.investment_manager = eu.user_id

View File

@@ -38,7 +38,7 @@
and
deleted = 0
</select>
<select id="selectPlanListByShopId" resultType="com.cool.store.dto.openPlan.OpeningOperationPlanDTO">
<select id="selectPlanListByShopId" resultType="com.cool.store.dto.openPreparation.OpeningOperationPlanDTO">
SELECT op.shop_id AS shopId, op.update_time AS updateTime, op.result_type AS resultType
FROM xfsg_opening_operation_plan op
JOIN xfsg_shop_info si ON op.shop_id = si.id

View File

@@ -72,7 +72,7 @@
#{shopId}
</foreach>
</select>
<select id="getOpenPlanShopListByShopName" resultType="com.cool.store.dto.openPlan.OpenPlanShopInfoDTO">
<select id="getOpenPlanShopListByShopName" resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
select si.id as shopId, si.line_id as lineId, si.shop_name as shopName,
si.shop_code as shopCode, si.shop_manager_user_id as shopManagerUserId,si.shop_manager_user_id as shopManagerUserId

View File

@@ -0,0 +1,37 @@
package com.cool.store.dto.openPreparation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午8:42
* @Version 1.0
* @注释:
*/
@Data
public class FirstOrderDTO {
@ApiModelProperty("店铺Id")
private Long shopId;
@ApiModelProperty("首批订货金总额")
private String totalOrderDeposit;
@ApiModelProperty("最晚打款时间")
private Date latestPaymentDate;
@ApiModelProperty("物料预计费用")
private String estimatedCost;
@ApiModelProperty("水果预计费用")
private String fruitsCost;
@ApiModelProperty("创建人")
private String createUserId;
@ApiModelProperty("更新人")
private String updateUserId;
}

View File

@@ -1,4 +1,4 @@
package com.cool.store.dto.openPlan;
package com.cool.store.dto.openPreparation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.cool.store.dto.openPlan;
package com.cool.store.dto.openPreparation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.cool.store.dto.openPlan;
package com.cool.store.dto.openPreparation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@@ -1,7 +1,5 @@
package com.cool.store.dto.openPlan;
package com.cool.store.dto.openPreparation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**

View File

@@ -104,23 +104,25 @@ public class OpeningOperationPlanDO {
@Column(name = "audit_id")
private Long auditId;
public Integer getResultType() {
return resultType;
}
public void setResultType(Integer resultType) {
this.resultType = resultType;
}
/**
* 审核结果状态0.待审核 1. 通过 2. 拒绝
*/
@Column(name = "result_type")
private Byte resultType;
private Integer resultType;
public Byte getResultType() {
return resultType;
}
public void setResultType(Byte resultType) {
this.resultType = resultType;
}
/**
* @return id

View File

@@ -0,0 +1,29 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午9:12
* @Version 1.0
* @注释:
*/
@Data
public class FirstOrderRequest {
@ApiModelProperty("店铺Id")
private Long shopId;
@ApiModelProperty("首批订货金总额")
private String totalOrderDeposit;
@ApiModelProperty("最晚打款时间")
private Date latestPaymentDate;
@ApiModelProperty("物料预计费用")
private String estimatedCost;
@ApiModelProperty("水果预计费用")
private String fruitsCost;
}

View File

@@ -22,7 +22,7 @@ public class OpeningOperationPlanAuditRequest {
private Long shopId;
@ApiModelProperty("2-开业运营方案")
private Byte auditType;
private Integer auditType;
@ApiModelProperty("提交人ID")
private String submittedUserId;
@@ -31,7 +31,7 @@ public class OpeningOperationPlanAuditRequest {
private String submittedUserName;
@ApiModelProperty("结果类型 0通过,1拒绝")
private Byte resultType;
private Integer resultType;
@ApiModelProperty("通过原因")
private String passReason;

View File

@@ -44,7 +44,7 @@ public class OpeningOperationPlanRequest {
private Boolean deleted;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private Byte resultType;
private Integer resultType;

View File

@@ -0,0 +1,17 @@
package com.cool.store.service;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午8:52
* @Version 1.0
* @注释:
*/
public interface FirstOrderService {
Integer saveOrder(FirstOrderDO order);
FirstOrderDTO getOrder(Long shopId);
}

View File

@@ -0,0 +1,58 @@
package com.cool.store.service.impl;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.FirstOrderDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.FirstOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午8:53
* @Version 1.0
* @注释:
*/
@Service
@Slf4j
public class FirstOrderServiceImp implements FirstOrderService {
@Resource
private FirstOrderDAO firstOrderDAO;
@Override
public Integer saveOrder(FirstOrderDO order) {
String userId = CurrentUserHolder.getUserId();
log.info("save order:{}",order);
if (order == null ) {
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
}
FirstOrderDTO firstOrderDTO = firstOrderDAO.selectFirstOrderByShopId(order.getShopId());
if (firstOrderDTO == null) {
order.setCreateTime(new Date());
order.setUpdateTime(new Date());
order.setCreateUserId(userId);
order.setUpdateUserId(userId);
} else {
order.setUpdateTime(new Date());
order.setUpdateUserId(userId);
}
firstOrderDAO.insertFirstOrder(order);
return 0;
}
@Override
public FirstOrderDTO getOrder(Long shopId) {
log.info("get order:{}",shopId);
if (shopId == null) {
log.error("shopId is null");
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
}
return firstOrderDAO.selectFirstOrderByShopId(shopId);
}
}

View File

@@ -72,12 +72,20 @@ public class OpeningOperationPlanAuditImpl implements OpeningOperationPlanAuditS
throw new ServiceException(ErrorCodeEnum.UPDATE_PLAN_FALSE);
}
if (request.getResultType().equals(OpeningOperationPlanResultTypeEnum.PASS_AUDIT.getCode().byteValue())){
Integer Stage = shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_141, request.getId());
if (request.getResultType().equals(OpeningOperationPlanResultTypeEnum.PASS_AUDIT.getCode())){
Integer Stage = shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_143, request.getShopId());
if (Objects.isNull(Stage)){
log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
}
}else {
if (request.getResultType().equals(OpeningOperationPlanResultTypeEnum.REJECT_AUDIT.getCode())){
Integer Stage = shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_142, request.getShopId());
if (Objects.isNull(Stage)){
log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
}
}
}
return Boolean.TRUE;
}

View File

@@ -3,16 +3,14 @@ package com.cool.store.service.impl;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.*;
import com.cool.store.dto.openPlan.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPlan.OpeningOperationPlanDTO;
import com.cool.store.dto.openPlan.PlanLineDTO;
import com.cool.store.dto.openPlan.UserInfoDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.dto.openPreparation.UserInfoDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OpeningOperationPlanResultTypeEnum;
import com.cool.store.enums.ShopAuditInfoDeletedEnum;
import com.cool.store.enums.ShopAuditInfoTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
@@ -30,10 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Auther: WangShuo
@@ -57,6 +53,8 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
private ShopInfoDAO shopInfoDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -110,6 +108,12 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
log.error("addNewPlan PlanId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_FALSE);
}
Integer Stage = shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_141, request.getShopId());
if (Objects.isNull(Stage)){
log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
}
return planId;
}catch (Exception e) {
log.error("addNewPlan Exception:{}", e);

View File

@@ -0,0 +1,48 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.request.FirstOrderRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.FirstOrderService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午9:22
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/pc/firstOrder")
@Api(tags = "PC首批订货金")
@Slf4j
public class FirstOrderController {
@Resource
private FirstOrderService firstOrderService;
@GetMapping("/get")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId);
return ResponseResult.success(order);
}
@PostMapping("/submit")
public ResponseResult getSubmit(@RequestBody FirstOrderRequest request) {
FirstOrderDO firstOrderDO = new FirstOrderDO();
try {
BeanUtils.copyProperties(firstOrderDO,request );
firstOrderService.saveOrder(firstOrderDO);
return ResponseResult.success();
} catch (IllegalAccessException |InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -56,4 +56,5 @@ public class OpeningOperationPlanController {
openingOperationPlanService.getPlanListPage(request);
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
}
}

View File

@@ -0,0 +1,20 @@
package com.cool.store.controller.webc;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午7:32
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/mini/openingOperationPlan")
@Api(tags = "开业运营方案操作")
@Slf4j
public class MiniOpeningOperationPlanController {
}