门店转让记录,修改门店招商专员/督导接口

This commit is contained in:
shuo.wang
2025-01-08 17:32:54 +08:00
parent 96f8ad4a7e
commit 4acd471fbd
19 changed files with 332 additions and 94 deletions

View File

@@ -229,7 +229,8 @@ public enum ErrorCodeEnum {
UPDATE_FAIL(131000,"修改失败,表单不存在!",null), UPDATE_FAIL(131000,"修改失败,表单不存在!",null),
LICENSE_LEGAL_STAGE_FAIL(131001,"营业执照阶段未上传!",null), LICENSE_LEGAL_STAGE_FAIL(131001,"营业执照阶段未上传!",null),
GET_JURIDICAL_ID_CARD_NO_FAIL(131002,"获取法人身份证信息失败!",null) GET_JURIDICAL_ID_CARD_NO_FAIL(131002,"获取法人身份证信息失败!",null),
UPDATE_INVESTMENT_MANAGER_FAIL(131005,"当前用户已经为该门店招商经理",null)
; ;

View File

@@ -9,7 +9,8 @@ public enum OperationLogTypeEnum {
TRANSFER_INVESTMENT_MANAGER(1, "转让招商经理_线索"), TRANSFER_INVESTMENT_MANAGER(1, "转让招商经理_线索"),
ENTRUST_INTERVIEW(2, "委托面试"), ENTRUST_INTERVIEW(2, "委托面试"),
TRANSFER_INVESTMENT_MANAGER_3(3, "转让招商经理_加盟商"); TRANSFER_INVESTMENT_MANAGER_3(3, "转让招商经理_加盟商"),
TRANSFER_INVESTMENT_MANAGER_4(4, "转让招商经理_门店");
private final int code; private final int code;
private final String description; private final String description;

View File

@@ -24,11 +24,11 @@ public class TransferLogDAO {
} }
public List<TransferLogDTO> getTransferLogList(Long lindId){ public List<TransferLogDTO> getTransferLogList(Long lindId,Integer lineShopType){
if (lindId == null){ if (lindId == null){
return null; return null;
} }
return transferLogMapper.getTransferLogList(lindId); return transferLogMapper.getTransferLogList(lindId,lineShopType);
} }

View File

@@ -14,7 +14,7 @@ public interface TransferLogMapper extends Mapper<TransferLogDO> {
* @param lindId * @param lindId
* @return * @return
*/ */
List<TransferLogDTO> getTransferLogList(@Param("lindId") Long lindId); List<TransferLogDTO> getTransferLogList(@Param("lindId") Long lindId,@Param("lineShopType")Integer lineShopType);
} }

View File

@@ -26,13 +26,15 @@
<result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/> <result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/>
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/> <result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/>
<result column="shop_status" jdbcType="TINYINT" property="shopStatus"/> <result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
</resultMap> </resultMap>
<sql id="allColumn"> <sql id="allColumn">
id, region_id, line_id, partner_id, point_id, shop_name, id, region_id, line_id, partner_id, point_id, shop_name,
shop_code, store_num, shop_manager_user_id, supervisor_user_id, 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, 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 join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id
</sql> </sql>
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> <insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">

View File

@@ -1,36 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.TransferLogMapper"> <mapper namespace="com.cool.store.mapper.TransferLogMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.TransferLogDO"> <resultMap id="BaseResultMap" type="com.cool.store.entity.TransferLogDO">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id"/>
<result column="line_id" jdbcType="BIGINT" property="lineId" /> <result column="line_id" jdbcType="BIGINT" property="lineId"/>
<result column="partner_id" jdbcType="BIGINT" property="partnerId" /> <result column="partner_id" jdbcType="BIGINT" property="partnerId"/>
<result column="from_user_id" jdbcType="VARCHAR" property="fromUserId" /> <result column="from_user_id" jdbcType="VARCHAR" property="fromUserId"/>
<result column="to_user_id" jdbcType="VARCHAR" property="toUserId" /> <result column="to_user_id" jdbcType="VARCHAR" property="toUserId"/>
<result column="type" jdbcType="TINYINT" property="type" /> <result column="type" jdbcType="TINYINT" property="type"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" /> <result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" /> <result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
</resultMap> <result column="line_shop_type" jdbcType="TINYINT" property="lineShopType"/>
</resultMap>
<select id="getTransferLogList" resultType="com.cool.store.dto.TransferLogDTO"> <select id="getTransferLogList" resultType="com.cool.store.dto.TransferLogDTO">
select select b.user_id as fromUserId,
b.user_id as fromUserId , b.name as fromUserName,
b.name as fromUserName , b.mobile as fromUserMobile,
b.mobile as fromUserMobile , c.user_id as toUserId,
c.user_id as toUserId , c.name as toUserName,
c.name as toUserName , c.mobile as toUserMobile,
c.mobile as toUserMobile , a.type as type,
a.type as type a.line_shop_type as lineShopType
from from xfsg_transfer_log a
xfsg_transfer_log a left join enterprise_user_${enterpriseId} b on b.user_id = a.from_user_id
left join enterprise_user_${enterpriseId} b on b.user_id = a.from_user_id left join enterprise_user_${enterpriseId} c on c.user_id = a.to_user_id
left join enterprise_user_${enterpriseId} c on c.user_id = a.to_user_id where a.line_id = #{lindId} where a.line_id = #{lindId} and a.line_shop_type = #{lineShopType}
</select> </select>
</mapper> </mapper>

View File

@@ -1,5 +1,6 @@
package com.cool.store.dto; package com.cool.store.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
@@ -9,19 +10,20 @@ import lombok.Data;
*/ */
@Data @Data
public class TransferLogDTO { public class TransferLogDTO {
@ApiModelProperty("操作人id")
private String fromUserId; private String fromUserId;
@ApiModelProperty("被分配人ID")
private String toUserId; private String toUserId;
@ApiModelProperty("操作人")
private String fromUserName; private String fromUserName;
@ApiModelProperty("被分配人")
private String toUserName; private String toUserName;
@ApiModelProperty("")
private String fromUserMobile; private String fromUserMobile;
@ApiModelProperty("")
private String toUserMobile; private String toUserMobile;
@ApiModelProperty("")
private Integer type; private Integer type;
@ApiModelProperty("'1-线索2-门店'")
private Integer lineShopType;
} }

View File

@@ -104,7 +104,10 @@ public class ShopInfoDO {
*/ */
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@Column(name = "create_user_id")
private String createUserId;
@Column(name = "update_user_id")
private String updateUserId;
/** /**
* 更新时间 * 更新时间
*/ */
@@ -115,7 +118,7 @@ public class ShopInfoDO {
private Integer joinMode; private Integer joinMode;
@Column(name = "franchise_brand") @Column(name = "franchise_brand")
private String franchiseBrand; private Integer franchiseBrand;
@Column(name = "development_manager") @Column(name = "development_manager")
private String developmentManager; private String developmentManager;

View File

@@ -11,7 +11,7 @@ public class TransferLogDO {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;
// line_info.id/shop_id',
@Column(name = "line_id") @Column(name = "line_id")
private Long lineId; private Long lineId;
@@ -58,6 +58,9 @@ public class TransferLogDO {
*/ */
@Column(name = "update_user_id") @Column(name = "update_user_id")
private String updateUserId; private String updateUserId;
//'1-线索2-门店'
@Column(name = "line_shop_type")
private String lineShopType;
/** /**
* @return id * @return id
@@ -110,7 +113,6 @@ public class TransferLogDO {
} }
/** /**
* 获取创建时间 * 获取创建时间
* *

View File

@@ -32,9 +32,13 @@ public class AddBranchShopRequest {
@NotNull @NotNull
@Min(1) @Min(1)
@Max(3) @Max(3)
@ApiModelProperty(" //'1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店',") @ApiModelProperty(" 加盟模式//'1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店',")
private Integer joinMode; private Integer joinMode;
@NotNull
@Min(1)
@Max(6)
@ApiModelProperty("'加盟品牌1,\"正新鸡排\"2,\"正新三明治\"3,\"正烧记\"4,\"大鼓米线\"5,\"串小妹\"6,\"茂掌柜\"'")
private Integer franchiseBrand;
@ApiModelProperty("督导") @ApiModelProperty("督导")
private String investmentManagerUserId; private String investmentManagerUserId;
@NotNull @NotNull
@@ -56,6 +60,7 @@ public class AddBranchShopRequest {
shopInfoDO.setShopStatus(ShopStatusEnum.ING.getCode()); shopInfoDO.setShopStatus(ShopStatusEnum.ING.getCode());
shopInfoDO.setShopStage(ShopStageEnum.SHOP_STAGE_1.getShopStage()); shopInfoDO.setShopStage(ShopStageEnum.SHOP_STAGE_1.getShopStage());
shopInfoDO.setPartnerId(partnerId); shopInfoDO.setPartnerId(partnerId);
shopInfoDO.setFranchiseBrand(request.getFranchiseBrand());
return shopInfoDO; return shopInfoDO;
} }
} }

View File

@@ -0,0 +1,32 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author: WangShuo
* @Date: 2025/01/08/下午4:49
* @Version 1.0
* @注释:
*/
@Data
public class BranchShopDetailRequest {
private Long shopId;
@ApiModelProperty("加盟意向区域")
private Long wantShopAreaId;
@ApiModelProperty("所属区域")
private Long regionId;
@NotNull
@Min(1)
@Max(3)
@ApiModelProperty("加盟模式 1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店")
private Integer joinMode;
@NotNull
@ApiModelProperty("加盟品牌")
private Integer franchiseBrand;
}

View File

@@ -26,8 +26,8 @@ public class UpdateLineRequest {
private Long regionId; private Long regionId;
@NotNull @NotNull
@Min(1) @Min(1)
@Max(2) @Max(3)
@ApiModelProperty("加盟模式 1-社会加盟 2-强加盟") @ApiModelProperty("加盟模式 1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店")
private Integer joinMode; private Integer joinMode;
@NotNull @NotNull
@ApiModelProperty("加盟品牌") @ApiModelProperty("加盟品牌")

View File

@@ -0,0 +1,59 @@
package com.cool.store.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.temporal.ChronoUnit;
import java.util.Date;
/**
* @Author: WangShuo
* @Date: 2025/01/08/下午4:11
* @Version 1.0
* @注释:
*/
@Data
public class BranchShopDetailResponse {
@ApiModelProperty("加盟商名称")
private String username;
@ApiModelProperty("加盟手机号")
private String mobile;
@ApiModelProperty(" 加盟模式//'1-社会加盟模式/加盟部加盟店 2-强加盟模式/加盟公司加盟店 3-加盟公司自有店'")
private Integer joinMode;
private Long shopId;
@ApiModelProperty("门店编号")
private String shopCode;
@ApiModelProperty("门店名称")
private String shopName;
@ApiModelProperty("总项数")
private Integer totalColumn;
@ApiModelProperty("完成项")
private Integer completionColumn;
@ApiModelProperty("所属品牌 1,\"正新鸡排\"2,\"正新三明治\"3,\"正烧记\"4,\"大鼓米线\"5,\"串小妹\"6,\"茂掌柜\"")
private Integer franchiseBrand;
@ApiModelProperty("预估完成时间")
private Date planCompletionTime;
@ApiModelProperty("招商经理名称")
private String investmentManagerName;
@ApiModelProperty("招商经理userId")
private String investmentManagerId;
@ApiModelProperty("所属大区")
private String regionName;
@ApiModelProperty("意向开店区域")
private String wantRegionName;
}

View File

@@ -2,10 +2,8 @@ package com.cool.store.service;
import com.cool.store.entity.LineInfoDO; import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO; import com.cool.store.entity.ShopInfoDO;
import com.cool.store.request.AddBranchShopRequest; import com.cool.store.request.*;
import com.cool.store.request.AddShopRequest; import com.cool.store.response.BranchShopDetailResponse;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.request.UpdateShopCodeRequest;
import com.cool.store.vo.shop.MiniShopPageVO; import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.RentInfoToDoVO; import com.cool.store.vo.shop.RentInfoToDoVO;
import com.cool.store.vo.shop.ShopStageInfoVO; import com.cool.store.vo.shop.ShopStageInfoVO;
@@ -75,4 +73,10 @@ public interface ShopService {
//新建分店 //新建分店
Long addBranchShop(AddBranchShopRequest request,String userId); Long addBranchShop(AddBranchShopRequest request,String userId);
//开店详情/左边小窗
BranchShopDetailResponse getBranchShopDetail(Long shopId);
//修改开店详情/左边小窗
Integer updateBranchShopDetail(BranchShopDetailRequest request,String userId);
//修改门店招商专员/督导
Integer updateShopInvestment(Long shopId,String updateUserId,String userId);
} }

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.dto.TransferLogDTO; import com.cool.store.dto.TransferLogDTO;
import com.cool.store.entity.LineInfoDO; import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.OperationLogTypeEnum; import com.cool.store.enums.OperationLogTypeEnum;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@@ -21,6 +22,7 @@ public interface TransferLogService {
*/ */
void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum); void addLog(LineInfoDO lineInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum);
void addLog(ShopInfoDO shopInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum);
PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId); PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId,Integer lineShopType);
} }

View File

@@ -1,25 +1,25 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.RegionNode;
import com.cool.store.entity.*; import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.*;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.point.*; import com.cool.store.enums.point.*;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.request.AddBranchShopRequest; import com.cool.store.mapper.RegionMapper;
import com.cool.store.request.AddShopRequest; import com.cool.store.request.*;
import com.cool.store.request.DeleteShopRequest; import com.cool.store.response.BranchShopDetailResponse;
import com.cool.store.request.UpdateShopCodeRequest; import com.cool.store.service.*;
import com.cool.store.service.ShopService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.NumberConverter; import com.cool.store.utils.NumberConverter;
import com.cool.store.utils.RandomEightCharCodeUtils; import com.cool.store.utils.RandomEightCharCodeUtils;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.BaseInfoVO;
import com.cool.store.vo.shop.MiniShopPageVO; import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.ShopStageInfoVO; import com.cool.store.vo.shop.ShopStageInfoVO;
import com.cool.store.vo.shop.StageShopCountVO; import com.cool.store.vo.shop.StageShopCountVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -29,6 +29,8 @@ import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.cool.store.enums.ErrorCodeEnum.UPDATE_INVESTMENT_MANAGER_FAIL;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
* @FileName: ShopServiceImpl * @FileName: ShopServiceImpl
@@ -56,17 +58,25 @@ public class ShopServiceImpl implements ShopService {
UserAuthMappingService userAuthMappingService; UserAuthMappingService userAuthMappingService;
@Autowired @Autowired
private RegionDao regionDao; private RegionDao regionDao;
@Autowired
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
@Autowired
private RegionMapper regionMapper;
@Autowired
private TransferLogService transferLogService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer initShop(LineInfoDO lineInfo) { public Integer initShop(LineInfoDO lineInfo) {
if(Objects.isNull(lineInfo)){ if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
} }
Integer wantShopNum = lineInfo.getWantShopNum(); Integer wantShopNum = lineInfo.getWantShopNum();
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId()); List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
int shopSize = shopList.size(); int shopSize = shopList.size();
if(shopSize >= wantShopNum){ if (shopSize >= wantShopNum) {
return 0; return 0;
} }
List<ShopInfoDO> addShopList = new ArrayList<>(); List<ShopInfoDO> addShopList = new ArrayList<>();
@@ -103,19 +113,19 @@ public class ShopServiceImpl implements ShopService {
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity())); Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
List<Long> regionIds = shopList.stream().map(ShopInfoDO::getRegionId).collect(Collectors.toList()); List<Long> regionIds = shopList.stream().map(ShopInfoDO::getRegionId).collect(Collectors.toList());
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds); Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds);
return MiniShopPageVO.convertList(shopList,stageMap,regionNameMap); return MiniShopPageVO.convertList(shopList, stageMap, regionNameMap);
} }
@Override @Override
public List<ShopStageInfoVO> getShopStageInfo(Long shopId, Integer shopStage) { public List<ShopStageInfoVO> getShopStageInfo(Long shopId, Integer shopStage) {
if(Objects.nonNull(shopStage)){ if (Objects.nonNull(shopStage)) {
ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage); ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage);
if(Objects.isNull(shopStageEnum)){ if (Objects.isNull(shopStageEnum)) {
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR); throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR);
} }
} }
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, shopStage); List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, shopStage);
List<Long> auditIds = shopStageInfo.stream().filter(o->Objects.nonNull(o.getAuditId())).map(ShopStageInfoDO::getAuditId).distinct().collect(Collectors.toList()); List<Long> auditIds = shopStageInfo.stream().filter(o -> Objects.nonNull(o.getAuditId())).map(ShopStageInfoDO::getAuditId).distinct().collect(Collectors.toList());
List<ShopAuditInfoDO> auditList = shopAuditInfoDAO.getAuditInfoList(auditIds); List<ShopAuditInfoDO> auditList = shopAuditInfoDAO.getAuditInfoList(auditIds);
return ShopStageInfoVO.convertList(shopStageInfo, auditList); return ShopStageInfoVO.convertList(shopStageInfo, auditList);
} }
@@ -128,7 +138,7 @@ public class ShopServiceImpl implements ShopService {
@Override @Override
public Integer deleteShop(DeleteShopRequest request) { public Integer deleteShop(DeleteShopRequest request) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if(Objects.nonNull(shopInfo)){ if (Objects.nonNull(shopInfo)) {
//进入选址不允许删除操作 //进入选址不允许删除操作
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
} }
@@ -136,9 +146,9 @@ public class ShopServiceImpl implements ShopService {
// if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){ // if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
// throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); // throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
// } // }
if(Objects.nonNull(shopInfo.getPointId())){ if (Objects.nonNull(shopInfo.getPointId())) {
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId()); PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId());
if(Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ if (Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) {
pointInfoDAO.recyclePoint(pointInfo.getId()); pointInfoDAO.recyclePoint(pointInfo.getId());
} }
pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5));
@@ -153,7 +163,7 @@ public class ShopServiceImpl implements ShopService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long addShop(AddShopRequest request) { public Long addShop(AddShopRequest request) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
if(Objects.isNull(lineInfo)){ if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
} }
List<String> shopNameList = request.getShopNameList(); List<String> shopNameList = request.getShopNameList();
@@ -181,35 +191,96 @@ public class ShopServiceImpl implements ShopService {
@Override @Override
public ShopInfoDO getShopInfo(Long shopId) { public ShopInfoDO getShopInfo(Long shopId) {
return shopInfoDAO.getShopInfo(shopId); return shopInfoDAO.getShopInfo(shopId);
} }
@Override @Override
public Integer updateShopCode(UpdateShopCodeRequest request) { public Integer updateShopCode(UpdateShopCodeRequest request) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if(Objects.isNull(shopInfo)){ if (Objects.isNull(shopInfo)) {
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
} }
shopInfo.setShopCode(request.getShopCode()); shopInfo.setShopCode(request.getShopCode());
shopInfo.setShopName(request.getShopName()); shopInfo.setShopName(request.getShopName());
shopInfo.setUpdateTime(new Date()); shopInfo.setUpdateTime(new Date());
shopInfo.setRegionId(request.getRegionId()); shopInfo.setRegionId(request.getRegionId());
return shopInfoDAO.updateShopInfo(shopInfo); return shopInfoDAO.updateShopInfo(shopInfo);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class ) @Transactional(rollbackFor = Exception.class)
public Long addBranchShop(AddBranchShopRequest request,String userId) { public Long addBranchShop(AddBranchShopRequest request, String userId) {
if (StringUtils.isBlank(request.getInvestmentManagerUserId())){ if (StringUtils.isBlank(request.getInvestmentManagerUserId())) {
request.setInvestmentManagerUserId(userId); request.setInvestmentManagerUserId(userId);
} }
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
Integer wantShopNum = lineInfo.getWantShopNum()+1; Integer wantShopNum = lineInfo.getWantShopNum() + 1;
lineInfo.setWantShopNum(wantShopNum); lineInfo.setWantShopNum(wantShopNum);
lineInfoDAO.updateLineInfo(lineInfo); lineInfoDAO.updateLineInfo(lineInfo);
ShopInfoDO shopInfoDO = request.toDO(request, lineInfo.getPartnerId()); ShopInfoDO shopInfoDO = request.toDO(request, lineInfo.getPartnerId());
shopInfoDO.setCreateUserId(userId);
Long shopId = shopInfoDAO.addShopInfo(shopInfoDO); Long shopId = shopInfoDAO.addShopInfo(shopInfoDO);
shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId)); shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId));
return shopId; return shopId;
} }
@Override
public BranchShopDetailResponse getBranchShopDetail(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
EnterpriseUserDO invest = enterpriseUserDAO.getUserInfoById(shopInfo.getInvestmentManager());
List<ScheduleDTO> shopContractActualCompletionTime = shopStageInfoDAO.getScheduleList(Collections.singletonList(shopId));
RegionNode shopRegion = regionMapper.getRegionByRegionId(shopInfo.getRegionId().toString());
String wantShopArea = hyOpenAreaInfoDAO.selectNameMapById(shopInfo.getWantShopAreaId());
BranchShopDetailResponse response = new BranchShopDetailResponse();
response.setUsername(lineInfo.getUsername());
response.setMobile(lineInfo.getMobile());
response.setShopId(shopId);
response.setShopName(shopInfo.getShopName());
response.setJoinMode(shopInfo.getJoinMode());
response.setShopCode(shopInfo.getShopCode());
response.setFranchiseBrand(shopInfo.getFranchiseBrand());
if (CollectionUtils.isNotEmpty(shopContractActualCompletionTime)) {
ScheduleDTO scheduleDTO = shopContractActualCompletionTime.get(CommonConstants.ZERO);
response.setCompletionColumn(scheduleDTO.getCompletionColumn());
response.setTotalColumn(scheduleDTO.getTotalColumn());
response.setPlanCompletionTime(scheduleDTO.getPlanCompleteTime());
}
response.setInvestmentManagerId(shopInfo.getInvestmentManager());
response.setInvestmentManagerName(invest.getName());
response.setRegionName(shopRegion.getName());
response.setWantRegionName(wantShopArea);
return response;
}
@Override
public Integer updateBranchShopDetail(BranchShopDetailRequest request, String userId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
shopInfo.setUpdateUserId(userId);
shopInfo.setUpdateTime(new Date());
shopInfo.setWantShopAreaId(request.getWantShopAreaId());
shopInfo.setRegionId(request.getRegionId());
shopInfo.setJoinMode(request.getJoinMode());
shopInfo.setFranchiseBrand(request.getFranchiseBrand());
return shopInfoDAO.updateShopInfo(shopInfo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateShopInvestment(Long shopId, String updateUserId, String userId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if(updateUserId.equals(shopInfo.getInvestmentManager())){
throw new ServiceException(UPDATE_INVESTMENT_MANAGER_FAIL);
}
transferLogService.addLog(shopInfo,shopInfo.getInvestmentManager(),updateUserId,OperationLogTypeEnum.TRANSFER_INVESTMENT_MANAGER_4);
shopInfo.setUpdateTime(new Date());
shopInfo.setUpdateUserId(userId);
shopInfo.setInvestmentManager(updateUserId);
shopInfo.setDevelopmentManager(updateUserId);
shopInfo.setSupervisorUserId(updateUserId);
return shopInfoDAO.updateShopInfo(shopInfo);
}
} }

View File

@@ -3,6 +3,7 @@ package com.cool.store.service.impl;
import com.cool.store.dao.TransferLogDAO; import com.cool.store.dao.TransferLogDAO;
import com.cool.store.dto.TransferLogDTO; import com.cool.store.dto.TransferLogDTO;
import com.cool.store.entity.LineInfoDO; import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.TransferLogDO; import com.cool.store.entity.TransferLogDO;
import com.cool.store.enums.OperationLogTypeEnum; import com.cool.store.enums.OperationLogTypeEnum;
import com.cool.store.service.TransferLogService; import com.cool.store.service.TransferLogService;
@@ -39,9 +40,23 @@ public class TransferLogServiceImpl implements TransferLogService {
} }
@Override @Override
public PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId) { public void addLog(ShopInfoDO shopInfoDO, String formUserId, String toUserId, OperationLogTypeEnum operationLogTypeEnum) {
TransferLogDO transferLogDO = new TransferLogDO();
transferLogDO.setLineId(shopInfoDO.getId());
transferLogDO.setPartnerId(shopInfoDO.getPartnerId());
transferLogDO.setFromUserId(formUserId);
transferLogDO.setToUserId(toUserId);
transferLogDO.setType(operationLogTypeEnum.getCode());
transferLogDO.setCreateUserId("create");
transferLogDO.setUpdateUserId("update");
// 添加操作日志
transferLogDAO.add(transferLogDO);
}
@Override
public PageInfo<TransferLogDTO> getTransferLogPage(Integer pageNum, Integer pageSize, Long lineId,Integer lineShopType) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<TransferLogDTO> transferLogList = transferLogDAO.getTransferLogList(lineId); List<TransferLogDTO> transferLogList = transferLogDAO.getTransferLogList(lineId,lineShopType);
PageInfo<TransferLogDTO> transferLogDTOPageInfo = new PageInfo<>(transferLogList); PageInfo<TransferLogDTO> transferLogDTOPageInfo = new PageInfo<>(transferLogList);
return transferLogDTOPageInfo; return transferLogDTOPageInfo;
} }

View File

@@ -118,12 +118,14 @@ public class LineInfoController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "lineId", value = "线索id", required = true), @ApiImplicitParam(name = "lineId", value = "线索id", required = true),
@ApiImplicitParam(name = "pageNum", value = "页码", required = true), @ApiImplicitParam(name = "pageNum", value = "页码", required = true),
@ApiImplicitParam(name = "pageSize", value = "大小", required = true) @ApiImplicitParam(name = "pageSize", value = "大小", required = true),
@ApiImplicitParam(name = "lineShopType", value = "1-线索2-门店", required = false)
}) })
public ResponseResult<PageInfo<TransferLogDTO>> getTransferLogPage(@RequestParam("lineId")Long lineId, public ResponseResult<PageInfo<TransferLogDTO>> getTransferLogPage(@RequestParam("lineId")Long lineId,
@RequestParam(value = "pageNum" ,defaultValue = "1")Integer pageNum, @RequestParam(value = "pageNum" ,defaultValue = "1")Integer pageNum,
@RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) { @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
return ResponseResult.success(transferLogService.getTransferLogPage(pageNum,pageSize,lineId)); @RequestParam(value = "lineShopType",defaultValue = "1") Integer lineShopType) {
return ResponseResult.success(transferLogService.getTransferLogPage(pageNum,pageSize,lineId,lineShopType));
} }
@ApiOperation("查询意向金详情") @ApiOperation("查询意向金详情")

View File

@@ -1,16 +1,19 @@
package com.cool.store.controller.webb; package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.CurrentUserHolder;
import com.cool.store.request.AddBranchShopRequest; import com.cool.store.dto.TransferLogDTO;
import com.cool.store.request.AddShopRequest; import com.cool.store.request.*;
import com.cool.store.request.DeleteShopRequest; import com.cool.store.response.BranchShopDetailResponse;
import com.cool.store.request.UpdateShopCodeRequest;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.ShopService; import com.cool.store.service.ShopService;
import com.cool.store.service.TransferLogService;
import com.cool.store.vo.shop.MiniShopPageVO; import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.ShopStageInfoVO; import com.cool.store.vo.shop.ShopStageInfoVO;
import com.cool.store.vo.shop.StageShopCountVO; import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -31,7 +34,8 @@ public class PCShopController {
@Resource @Resource
private ShopService shopService; private ShopService shopService;
@Resource
private TransferLogService transferLogService;
@ApiOperation("获取店铺列表") @ApiOperation("获取店铺列表")
@GetMapping("/getShopList") @GetMapping("/getShopList")
public ResponseResult<List<MiniShopPageVO>> getShopList(@RequestParam("lineId")Long lineId) { public ResponseResult<List<MiniShopPageVO>> getShopList(@RequestParam("lineId")Long lineId) {
@@ -74,4 +78,36 @@ public class PCShopController {
return ResponseResult.success(shopService.addBranchShop(request,userId)); return ResponseResult.success(shopService.addBranchShop(request,userId));
} }
@ApiOperation("开店详情/左边小窗")
@GetMapping("/getBranchShopDetail")
public ResponseResult<BranchShopDetailResponse> getBranchShopDetail(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(shopService.getBranchShopDetail(shopId));
}
@ApiOperation("修改开店详情/左边小窗")
@PostMapping("/updateBranchShopDetail")
public ResponseResult<Integer> updateBranchShopDetail(@RequestBody @Validated BranchShopDetailRequest request) {
String userId = CurrentUserHolder.getUserId();
return ResponseResult.success(shopService.updateBranchShopDetail(request,userId));
}
@ApiOperation("修改门店招商专员/督导")
@GetMapping("/updateShopInvestment")
public ResponseResult<Integer> updateShopInvestment(@RequestParam("shopId") Long shopId,@RequestParam("updateUserId") String updateUserId) {
String userId = CurrentUserHolder.getUserId();
return ResponseResult.success(shopService.updateShopInvestment(shopId,updateUserId,userId));
}
@ApiOperation("门店转让记录")
@GetMapping("/getTransferLogPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineId", value = "线索id", required = true),
@ApiImplicitParam(name = "pageNum", value = "页码", required = true),
@ApiImplicitParam(name = "pageSize", value = "大小", required = true),
@ApiImplicitParam(name = "lineShopType", value = "1-线索2-门店", required = true)
})
public ResponseResult<PageInfo<TransferLogDTO>> getTransferLogPage(@RequestParam("lineId")Long lineId,
@RequestParam(value = "pageNum" ,defaultValue = "1")Integer pageNum,
@RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
@RequestParam(value = "lineShopType",defaultValue = "1") Integer lineShopType) {
return ResponseResult.success(transferLogService.getTransferLogPage(pageNum,pageSize,lineId,lineShopType));
}
} }