新建分店接口

This commit is contained in:
shuo.wang
2025-01-08 16:08:56 +08:00
parent 3579bb5f7c
commit 96f8ad4a7e
8 changed files with 144 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
package com.cool.store.enums.point;
/**
* @Author: WangShuo
* @Date: 2025/01/08/下午3:54
* @Version 1.0
* @注释:
*/
public enum ShopStatusEnum {
ING(0,"跟进中"),
DONE(1,"已完成"),
ABANDON(2,"已放弃");
private int code;
private String desc;
private ShopStatusEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -594,7 +594,7 @@
username,
mobile
from xfsg_line_info
where workflow_sub_stage_status >= 45
where workflow_sub_stage > 1
<if test="keyword !=null and keyword != ''">
and (mobile like CONCAT('%', #{keyword} ,'%')
or username like CONCAT('%', #{keyword} ,'%'))

View File

@@ -19,10 +19,20 @@
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="join_mode" jdbcType="TINYINT" property="joinMode"/>
<result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
<result column="franchise_brand" jdbcType="VARCHAR" property="franchiseBrand"/>
<result column="development_manager" jdbcType="VARCHAR" property="developmentManager"/>
<result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/>
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/>
<result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
</resultMap>
<sql id="allColumn">
id, region_id, line_id, partner_id, point_id, shop_name, shop_code, store_num, shop_manager_user_id, supervisor_user_id, plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time
id, region_id, line_id, partner_id, point_id, shop_name,
shop_code, store_num, shop_manager_user_id, supervisor_user_id,
plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time,
join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status
</sql>
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">

View File

@@ -111,4 +111,20 @@ public class ShopInfoDO {
@Column(name = "update_time")
private Date updateTime;
@Column(name = "join_mode")
private Integer joinMode;
@Column(name = "franchise_brand")
private String franchiseBrand;
@Column(name = "development_manager")
private String developmentManager;
@Column(name = "want_shop_area_id")
private Long wantShopAreaId;
@Column(name = "investment_manager")
private String investmentManager;
@Column(name = "shop_status")
private Integer shopStatus;
}

View File

@@ -0,0 +1,61 @@
package com.cool.store.request;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @Author: WangShuo
* @Date: 2025/01/08/下午2:20
* @Version 1.0
* @注释:
*/
@Data
public class AddBranchShopRequest {
@NotNull
private Long lineId;
@ApiModelProperty("门店名称")
@NotBlank
private String shopName;
@ApiModelProperty("意向开店区域")
@NotNull
private Long wantShopAreaId;
@NotNull
@Min(1)
@Max(3)
@ApiModelProperty(" //'1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店',")
private Integer joinMode;
@ApiModelProperty("督导")
private String investmentManagerUserId;
@NotNull
@ApiModelProperty("所属大区")
private Long regionId;
public ShopInfoDO toDO(AddBranchShopRequest request,String partnerId){
ShopInfoDO shopInfoDO = new ShopInfoDO();
shopInfoDO.setLineId(request.getLineId());
shopInfoDO.setShopName(request.getShopName());
shopInfoDO.setRegionId(request.getRegionId());
shopInfoDO.setShopName(request.getShopName());
shopInfoDO.setWantShopAreaId(request.getWantShopAreaId());
shopInfoDO.setJoinMode(request.getJoinMode());
shopInfoDO.setInvestmentManager(request.getInvestmentManagerUserId());
shopInfoDO.setDevelopmentManager(request.getInvestmentManagerUserId());
shopInfoDO.setSupervisorUserId(request.getInvestmentManagerUserId());
shopInfoDO.setCreateTime(new Date());
shopInfoDO.setShopStatus(ShopStatusEnum.ING.getCode());
shopInfoDO.setShopStage(ShopStageEnum.SHOP_STAGE_1.getShopStage());
shopInfoDO.setPartnerId(partnerId);
return shopInfoDO;
}
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.request.AddBranchShopRequest;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
@@ -71,4 +72,7 @@ public interface ShopService {
ShopInfoDO getShopInfo(Long shopId);
Integer updateShopCode(UpdateShopCodeRequest request);
//新建分店
Long addBranchShop(AddBranchShopRequest request,String userId);
}

View File

@@ -8,6 +8,7 @@ import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.point.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.AddBranchShopRequest;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
@@ -15,6 +16,7 @@ import com.cool.store.service.ShopService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.NumberConverter;
import com.cool.store.utils.RandomEightCharCodeUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.ShopStageInfoVO;
import com.cool.store.vo.shop.StageShopCountVO;
@@ -194,4 +196,20 @@ public class ShopServiceImpl implements ShopService {
shopInfo.setRegionId(request.getRegionId());
return shopInfoDAO.updateShopInfo(shopInfo);
}
@Override
@Transactional(rollbackFor = Exception.class )
public Long addBranchShop(AddBranchShopRequest request,String userId) {
if (StringUtils.isBlank(request.getInvestmentManagerUserId())){
request.setInvestmentManagerUserId(userId);
}
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
Integer wantShopNum = lineInfo.getWantShopNum()+1;
lineInfo.setWantShopNum(wantShopNum);
lineInfoDAO.updateLineInfo(lineInfo);
ShopInfoDO shopInfoDO = request.toDO(request, lineInfo.getPartnerId());
Long shopId = shopInfoDAO.addShopInfo(shopInfoDO);
shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId));
return shopId;
}
}

View File

@@ -1,5 +1,7 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.request.AddBranchShopRequest;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
@@ -65,5 +67,11 @@ public class PCShopController {
public ResponseResult<Integer> updateShopCode(@RequestBody @Validated UpdateShopCodeRequest request) {
return ResponseResult.success(shopService.updateShopCode(request));
}
@ApiOperation("新建分店")
@PostMapping("/addBranchShop")
public ResponseResult<Long> addBranchShop(@RequestBody @Validated AddBranchShopRequest request) {
String userId = CurrentUserHolder.getUserId();
return ResponseResult.success(shopService.addBranchShop(request,userId));
}
}