开业运营方案

This commit is contained in:
shuo.wang
2024-04-24 19:02:58 +08:00
parent 377873d8f1
commit 4404d250d6
39 changed files with 1238 additions and 7 deletions

View File

@@ -155,4 +155,9 @@ public class CommonConstants {
public static final String DEAULT_SELECT_SITE_MANAGER = "020125244825417786";
//开业运营方案审核0通过
public static final Byte opening_Operation_Plan_PASS = Byte.valueOf((byte)0);
//开业运营方案审核1拒绝
public static final Byte opening_Operation_Plan_REJECT = Byte.valueOf((byte)1);
public static final int MAX_LENGTH_ONE_HUNDRED = 100;
}

View File

@@ -164,6 +164,17 @@ public enum ErrorCodeEnum {
LINE_PAY_FALSE(109005, "付款信息查询失败",null),
INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE(103001,"插入运营方案审核信息失败",null),
INSERT_OPENING_OPERATION_PLAN_FALSE(103002,"插入运营方案失败",null),
SHOP_ID_IS_NULL(103003,"验参shopId失败为空",null),
ACTIVITY_THEME_LENGTH_FALSE(103004,"活动主题长度大于100",null),
SURVEYRESULT_LENGTH_FALSE(103005,"调研结果长度大于100",null),
ID_IS_NULL(103006,"验参Id失败为空",null),
UPDATE_AUDIT_PLAN_FALSE(103007,"修改AUDIT_PLAN失败",null),
UPDATE_PLAN_FALSE(103008,"修改PLAN失败",null),
UPDATE_SHOP_SUB_STAGE_STATUS_FALSE(103009,"修改开业运营方案阶段状态失败",null),
SHOP_ID_NOT_EXIST(103010,"shopId不存在",null),
;

View File

@@ -0,0 +1,28 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/23/下午2:50
* @Version 1.0
* @注释:
*/
public enum OpeningOperationPlanResultTypeEnum {
WAIT_AUDIT(0,"待审核"),
PASS_AUDIT(1,"审核通过"),
REJECT_AUDIT(2,"审核未通过");
private Integer code;
private String desc;
OpeningOperationPlanResultTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -0,0 +1,28 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午5:15
* @Version 1.0
* @注释:
*/
public enum OpeningOperationPlanSourceEnum {
NEW(0,"新增"),
SYNCHRONIZATION(1,"同步");
private Integer code;
private String desc;
OpeningOperationPlanSourceEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -0,0 +1,27 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午5:04
* @Version 1.0
* @注释:
*/
public enum ShopAuditInfoDeletedEnum {
NO_DELETED(0,"不删除"),
DELETED(1,"删除");
private Byte code;
private String desc;
ShopAuditInfoDeletedEnum(Integer code, String desc) {
this.code = code.byteValue();
this.desc = desc;
}
public Byte getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -0,0 +1,32 @@
package com.cool.store.enums;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午4:42
* @Version 1.0
* @注释:
*/
public enum ShopAuditInfoTypeEnum {
VISUAL_ACCEPTANCE(0,"视觉审批"),
TRAINING_REGISTRATION_APPROVAL(1,"培训登记审批 "),
OPENING_OPERATION_PLAN(2,"开业运营方案"),
LICENSE_APPROVAL(3,"证照审批");
private Byte code;
private String msg;
ShopAuditInfoTypeEnum(int code, String msg) {
this.code = (byte) code;
this.msg = msg;
}
public Byte getCode() {
return code;
}
public String getMsg() {
return msg;
}
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.openPlan.UserInfoDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.mapper.EnterpriseUserMapper;
import com.cool.store.utils.StringUtil;
@@ -124,4 +125,7 @@ public class EnterpriseUserDAO {
}
return enterpriseUserMapper.selectByInvestmentManager( investmentManager);
}
public List<UserInfoDTO> getNameByUserId(List<String> userIdList){
return enterpriseUserMapper.selectNameByUserId(userIdList);
}
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.dao;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPlan.PlanLineDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowStageEnum;
@@ -147,4 +148,7 @@ public class LineInfoDAO {
PendingCountDTO pendingCount = lineInfoMapper.pendingCount(userId);
return pendingCount;
}
public List<PlanLineDTO> getLines(List<Long> lineIdList){
return lineInfoMapper.getLines(lineIdList);
}
}

View File

@@ -0,0 +1,39 @@
package com.cool.store.dao;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.cool.store.vo.OpeningOperationPlanVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午2:47
* @Version 1.0
* @注释:开业运营方案审核
*/
@Slf4j
@Repository
public class OpeningOperationPlanAuditDAO {
@Resource
private ShopAuditInfoMapper shopAuditInfoMapper;
@Resource
private OpeningOperationPlanMapper openingOperationPlanMapper;
public Long insertSelective(ShopAuditInfoDO shopAuditInfoDO) {
shopAuditInfoMapper.insertSelective(shopAuditInfoDO);
return shopAuditInfoDO.getId();
}
public Integer updateSelective(ShopAuditInfoDO shopAuditInfoDO) {
return shopAuditInfoMapper.updateByPrimaryKeySelective(shopAuditInfoDO);
}
public Byte selectByShopId(Long shopId) {
return shopAuditInfoMapper.selectAuditResultByShopId(shopId);
}
}

View File

@@ -0,0 +1,50 @@
package com.cool.store.dao;
import com.cool.store.dto.openPlan.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;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午2:14
* @Version 1.0
* @注释:开业运营方案
*/
@Slf4j
@Repository
public class OpeningOperationPlanDAO {
@Resource
private OpeningOperationPlanMapper openingOperationPlanMapper;
public Long insertSelective(@Param("openingOperationPlanDO") OpeningOperationPlanDO openingOperationPlanDO){
openingOperationPlanMapper.insertSelective(openingOperationPlanDO);
return openingOperationPlanDO.getId();
}
public OpeningOperationPlanDO selectById(Long Id){
return openingOperationPlanMapper.selectByPrimaryKey(Id);
}
public Long updateSelective( OpeningOperationPlanDO openingOperationPlanDO){
openingOperationPlanMapper.updateByPrimaryKeySelective(openingOperationPlanDO);
return openingOperationPlanDO.getId();
}
public OpeningOperationPlanDO selectByShopId( Long shopId){
return openingOperationPlanMapper.selectByShopId(shopId);
}
//条件关联查询
public List<OpeningOperationPlanDTO> selectConditionPlanList(List<Long> shopIdList, OpeningOperationPlanDTO openingOperationPlanDTO){
return openingOperationPlanMapper.selectPlanListByShopId(shopIdList, openingOperationPlanDTO);
}
}

View File

@@ -1,6 +1,7 @@
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.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
@@ -8,8 +9,11 @@ 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;
@@ -128,4 +132,14 @@ public class ShopInfoDAO {
}
return shopInfoMapper.getShopListByIds(shopIds);
}
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
public Page<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName(String shopName, String bigName, String fightName, Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
return shopInfoMapper.getOpenPlanShopListByShopName(shopName,bigName,fightName);
}
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.UserInfoDTO;
import com.cool.store.entity.EnterpriseUserDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -69,4 +70,10 @@ public interface EnterpriseUserMapper {
EnterpriseUserDO selectByMobile( @Param("mobile") String mobile);
EnterpriseUserDO selectByInvestmentManager( @Param("investmentManager") String investmentManager);
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 根据userid查询名字
*/
List<UserInfoDTO> selectNameByUserId(@Param("userIdList") List<String> userId);
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.mapper;
import com.cool.store.dto.PendingCountDTO;
import com.cool.store.dto.openPlan.PlanLineDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.request.LineListRequest;
@@ -85,4 +86,11 @@ public interface LineInfoMapper extends Mapper<LineInfoDO> {
* @return
*/
Page<LineInfoDO> getLinePageByDevelopmentManager(@Param("request") PointLinePageRequest request);
/**
* @Auther: wangshuo
* @Date: 2024/4/23
* @description: 开业运营方案根据line id join enterprise_user 查询
*/
List<PlanLineDTO> getLines(@Param("lineIdList") List<Long> lineIdList);
}

View File

@@ -1,7 +1,19 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.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> {
OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId);
List<OpeningOperationPlanDTO> selectPlanListByShopId(@Param("shopId") List<Long> shopId,
@Param("openingOperationPlanDTO") OpeningOperationPlanDTO openingOperationPlanDTO );
}

View File

@@ -1,7 +1,14 @@
package com.cool.store.mapper;
import com.cool.store.entity.ShopAuditInfoDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
public interface ShopAuditInfoMapper extends Mapper<ShopAuditInfoDO> {
/**
* @Auther: wangshuo
* @Date: 2024/4/23
* @description:根据店铺id查询审批结果
*/
Byte selectAuditResultByShopId(@Param("shopId") Long shopId);
}

View File

@@ -1,7 +1,9 @@
package com.cool.store.mapper;
import com.cool.store.dto.openPlan.OpenPlanShopInfoDTO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.vo.shop.StageShopCountVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -60,4 +62,11 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
* @return
*/
List<ShopInfoDO> getShopListByIds(@Param("shopIds")List<Long> shopIds);
/**
* @Auther: wangshuo
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
Page<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName(@Param("shopName") String shopName,
@Param("bigName") String bigName, @Param("fightName") String fightName);
}

View File

@@ -132,5 +132,15 @@
<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 user_id as userId ,name ,
from enterprise_user_${enterpriseId}
where user_id in
<foreach item="userId" index="index" collection="userIdList" open="(" separator="," close=")">
#{userId}
</foreach>
</select>
</mapper>

View File

@@ -473,5 +473,19 @@
and (username like #{request.keyword} or mobile like #{request.keyword})
</if>
</select>
<select id="getLines" resultType="com.cool.store.dto.openPlan.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
where deleted = 0 and join_status = 1 and line_status = 1
<if test=" lineIdList != null and lineIdList.size>0">
and id in
<foreach collection="lineIdList" item="lineId" open="(" separator="," close=")">
#{lineId}
</foreach>
</if>
</select>
</mapper>

View File

@@ -22,5 +22,39 @@
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="audit_id" jdbcType="BIGINT" property="auditId" />
<result column="result_type" jdbcType="TINYINT" property="resultType"/>
</resultMap>
<sql id="Base_Column_List">
shop_id,plan_source,submitted_user_id,submission_time,survey_result,survey_result_url,activity_theme,activity_theme_url,preparation_user_ids,
route_completed,deleted,audit_id,result_type
</sql>
<select id="selectByShopId" resultType="com.cool.store.entity.OpeningOperationPlanDO">
select
<include refid="Base_Column_List"/>
from
xfsg_opening_operation_plan
where shop_id = #{shopId}
and
deleted = 0
</select>
<select id="selectPlanListByShopId" resultType="com.cool.store.dto.openPlan.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
where
<if test="shopId != null and shopId.size >0 ">
<foreach item="shopId" index="index" collection="shopIdList" open="(" separator="," close=")">
#{shopId}
</foreach>
</if>
<if test="openingOperationPlanDTO.planStartDate != null">
AND DATE(op.create_time) >= #{openingOperationPlanDTO.planStartDate}
</if>
<if test="openingOperationPlanDTO.planEndDate != null">
<![CDATA[AND DATE(op.create_time) <= #{openingOperationPlanDTO.planEndDate}]]>
</if>
</select>
</mapper>

View File

@@ -18,4 +18,16 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
id,shop_id,audit_type,submitted_user_id,submitted_user_name,result_type,pass_reason,reject_reason,
certify_file,create_time,update_time,deleted
</sql>
<select id="selectAuditResultByShopId" resultType="java.lang.Byte">
select
result_type
from
xfsg_shop_audit_info
where
shop_id = #{shopId} and deleted = 0
</select>
</mapper>

View File

@@ -73,5 +73,26 @@
#{shopId}
</foreach>
</select>
<select id="getOpenPlanShopListByShopName" resultType="com.cool.store.dto.openPlan.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
xsbs.big_name as bigName, xsbs.fight_name as fightName
from xfsg_shop_info si
join xfsg_line_info li on si.line_id = li.id
join xfsg_system_building_shop xsbs on si.id = xsbs.big_name
where 1=1
<if test="shopName != null and shopName != ''">
AND si.shop_name = #{shopName}
</if>
<if test="bigName != null and bigName != ''">
AND xsbs.big_name = #{bigName}
</if>
<if test="fightName != null and fightName != ''">
AND xsbs.fight_name = #{fightName}
</if>
</select>
</mapper>

View File

@@ -1,12 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,50 @@
package com.cool.store.dto.openPlan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/上午9:53
* @Version 1.0
* @注释:
*/
@Data
public class OpenPlanShopInfoDTO {
@ApiModelProperty("店铺Id")
private Long shopId;
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("门店名字")
private String shopName;
@ApiModelProperty("门店代码")
private String shopCode;
@ApiModelProperty("开店负责人id")
private String shopManagerUserId;
@ApiModelProperty("督导id")
private String supervisorUserId;
@ApiModelProperty("加盟商姓名")
private String partnerName;
@ApiModelProperty("手机号码")
private String mobile;
@ApiModelProperty("招商经理id")
private String investmentManagerId;
@ApiModelProperty("所属大区")
private String bigName;
@ApiModelProperty("所属战区")
private String fightName;
}

View File

@@ -0,0 +1,45 @@
package com.cool.store.dto.openPlan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/23/下午10:09
* @Version 1.0
* @注释:
*/
@Data
public class OpeningOperationPlanDTO {
private Long shopId;
@ApiModelProperty("门店名称")
private String shopName;
@ApiModelProperty("门店代码")
private String shopCode;
@ApiModelProperty("开店负责人")
private String shopManagerUserId;
@ApiModelProperty("提交申请时间")
private Date submissionTime;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private String resultType;
@ApiModelProperty("起始日期")
public LocalDate planStartDate;
@ApiModelProperty("结束日期")
public LocalDate planEndDate;
}

View File

@@ -0,0 +1,23 @@
package com.cool.store.dto.openPlan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午5:07
* @Version 1.0
* @注释:
*/
@Data
public class PlanLineDTO {
@ApiModelProperty("线索id")
private Long lineId;
private String mobile;
@ApiModelProperty("加盟商姓名")
private String username;
@ApiModelProperty("招商经理姓名")
private String investmentManagerName;
}

View File

@@ -0,0 +1,23 @@
package com.cool.store.dto.openPlan;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/上午11:42
* @Version 1.0
* @注释:
*/
@Data
public class UserInfoDTO {
private Long userId;
private String name;
}

View File

@@ -130,7 +130,7 @@ public class LineInfoDO {
private Integer joinStatus;
/**
* 0.公海 1.私海 2黑名单
* 0.公海 1.私海 2.黑名单
*/
@Column(name = "line_status")
private Integer lineStatus;

View File

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

View File

@@ -74,6 +74,9 @@ public class ShopAuditInfoDO {
*/
private Boolean deleted;
@Column(name = "data_type")
private Integer dataType;
/**
* @return id
*/

View File

@@ -0,0 +1,60 @@
package com.cool.store.request;
import com.cool.store.entity.ShopAuditInfoDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午3:52
* @Version 1.0
* @注释:
*/
@Data
public class OpeningOperationPlanAuditRequest {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("店铺id")
private Long shopId;
@ApiModelProperty("2-开业运营方案")
private Byte auditType;
@ApiModelProperty("提交人ID")
private String submittedUserId;
@ApiModelProperty("提交人名称")
private String submittedUserName;
@ApiModelProperty("结果类型 0通过,1拒绝")
private Byte resultType;
@ApiModelProperty("通过原因")
private String passReason;
@ApiModelProperty("拒绝原因")
private String rejectReason;
@ApiModelProperty("是否删除0.否 1.是")
private Boolean deleted;
public ShopAuditInfoDO toShopAuditInfoDO() {
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
shopAuditInfoDO.setId(id);
shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(auditType);
shopAuditInfoDO.setResultType(resultType);
shopAuditInfoDO.setPassReason(passReason);
shopAuditInfoDO.setRejectReason(rejectReason);
shopAuditInfoDO.setDeleted(deleted);
shopAuditInfoDO.setSubmittedUserId(submittedUserId);
shopAuditInfoDO.setSubmittedUserName(submittedUserName);
shopAuditInfoDO.setCreateTime(new Date());
shopAuditInfoDO.setUpdateTime(new Date());
return shopAuditInfoDO;
}
}

View File

@@ -0,0 +1,65 @@
package com.cool.store.request;
import com.cool.store.entity.OpeningOperationPlanDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Auther: WangShuo
* @Date: 2024/04/19/下午7:32
* @Version 1.0
* @注释:
*/
@Data
public class OpeningOperationPlanRequest {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("店铺id")
private Long shopId;
@ApiModelProperty("0-新增/1-同步")
private Boolean planSource;
@ApiModelProperty("调研结果")
private String surveyResult;
@ApiModelProperty("调研结果url")
private String surveyResultUrl;
@ApiModelProperty("活动主题")
private String activityTheme;
@ApiModelProperty("活动主题url")
private String activityThemeUrl;
@ApiModelProperty("筹备人员ids")
private String preparationUserIds;
@ApiModelProperty("是否完成排车路线")
private Byte routeCompleted;
@ApiModelProperty("是否删除0.否 1.是")
private Boolean deleted;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private Byte resultType;
public OpeningOperationPlanDO toOpeningOperationPlanDO() {
OpeningOperationPlanDO openingOperationPlanDO = new OpeningOperationPlanDO();
openingOperationPlanDO.setShopId(shopId);
openingOperationPlanDO.setPlanSource(planSource);
openingOperationPlanDO.setSurveyResult(surveyResult);
openingOperationPlanDO.setSurveyResultUrl(surveyResultUrl);
openingOperationPlanDO.setActivityTheme(activityTheme);
openingOperationPlanDO.setActivityThemeUrl(activityThemeUrl);
openingOperationPlanDO.setPreparationUserIds(preparationUserIds);
openingOperationPlanDO.setRouteCompleted(routeCompleted);
openingOperationPlanDO.setDeleted(deleted);
openingOperationPlanDO.setResultType(resultType);
return openingOperationPlanDO;
}
}

View File

@@ -0,0 +1,30 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午2:06
* @Version 1.0
* @注释:
*/
@Data
public class PlanListRequest {
@ApiModelProperty("店铺名称")
private String shopName;
@ApiModelProperty("起始日期")
private LocalDate planStartDate;
@ApiModelProperty("结束日期")
private LocalDate planEndDate;
@ApiModelProperty("大区名称")
private String bigName;
@ApiModelProperty("战区名称")
private String fightName;
@ApiModelProperty("分页数据量")
private Integer pageNum;
@ApiModelProperty("页数")
private Integer pageSize;
}

View File

@@ -0,0 +1,61 @@
package com.cool.store.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/23/上午10:47
* @Version 1.0
* @注释:
*/
@Data
public class OpeningOperationPlanListVO {
@ApiModelProperty("门店id")
private Long shopId;
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("门店名称")
private String shopName;
@ApiModelProperty("门店代码")
private String shopCode;
@ApiModelProperty("开店负责人")
private String shopManagerName;
@ApiModelProperty("开店负责人id")
private String shopManagerUserId;
@ApiModelProperty("加盟商姓名")
private String partnerName;
@ApiModelProperty("手机号码")
private String mobile;
@ApiModelProperty("所属大区")
private String bigName;
@ApiModelProperty("所属战区")
private String fightName;
@ApiModelProperty("招商经理名字")
private String investmentManagerName;
@ApiModelProperty("督导id")
private String supervisorUserId;
@ApiModelProperty("督导")
private String supervisorName;
@ApiModelProperty("提交申请时间")
private Date submissionTime;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private String resultType;
}

View File

@@ -0,0 +1,46 @@
package com.cool.store.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午7:58
* @Version 1.0
* @注释:
*/
@Data
public class OpeningOperationPlanVO {
@ApiModelProperty("调研结果")
private String surveyResult;
@ApiModelProperty("调研结果url")
private String surveyResultUrl;
@ApiModelProperty("活动主题")
private String activityTheme;
@ApiModelProperty("活动主题url")
private String activityThemeUrl;
@ApiModelProperty("筹备人员ids")
private String preparationUsers;
@ApiModelProperty("是否完成排车路线")
private Byte routeCompleted;
@ApiModelProperty("提交时间")
private Date submissionTime;
@ApiModelProperty("提交人")
private String submittedUserId;
@ApiModelProperty("通过原因")
private String passReason;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private String resultType;
}

View File

@@ -0,0 +1,29 @@
package com.cool.store.service;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午3:19
* @Version 1.0
* @注释:
*/
public interface OpeningOperationPlanAuditService {
/**
* @Auther: wangshuo
* @Date: 2024/4/22
* @description: 提交方案至审核表
*/
Long addNewPlanAudit(OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest);
/**
* @Auther: wangshuo
* @Date: 2024/4/23
* @description:审核方案
*/
Boolean auditPlan(OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest);
}

View File

@@ -0,0 +1,33 @@
package com.cool.store.service;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import java.time.LocalDate;
import java.util.List;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午3:10
* @Version 1.0
* @注释:
*/
public interface OpeningOperationPlanService {
/**
* @Auther: wangshuo
* @Date: 2024/4/23
* @description: 提交开业运营方案
*/
Long savePlan(OpeningOperationPlanRequest openingOperationPlanRequest);
OpeningOperationPlanVO getPlanById(Long ShopId);
/**
* @Auther: wangshuo
* @Date: 2024/4/23
* @description: 根据条件查询方案列表
*/
List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request);
}

View File

@@ -0,0 +1,93 @@
package com.cool.store.service.impl;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.OpeningOperationPlanAuditDAO;
import com.cool.store.dao.OpeningOperationPlanDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OpeningOperationPlanResultTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.service.OpeningOperationPlanAuditService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Objects;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午3:19
* @Version 1.0
* @注释:
*/
@Slf4j
@Service
public class OpeningOperationPlanAuditImpl implements OpeningOperationPlanAuditService {
@Resource
private OpeningOperationPlanAuditDAO openingOperationPlanAuditDAO;
@Resource
private OpeningOperationPlanDAO openingOperationPlanDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Override
public Long addNewPlanAudit(OpeningOperationPlanAuditRequest request) {
log.info("addNewPlanAudit request:{}", request);
ShopAuditInfoDO shopAuditInfoDO = request.toShopAuditInfoDO();
return openingOperationPlanAuditDAO.insertSelective(shopAuditInfoDO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean auditPlan(OpeningOperationPlanAuditRequest request) {
log.info("auditPlan request:{}", request);
if (Objects.isNull(request.getId()))
{
log.error("auditPlan request id is null");
throw new ServiceException("auditPlan request id is null");
}
String userId = CurrentUserHolder.getUserId();
try{
Integer audit = openingOperationPlanAuditDAO.updateSelective(request.toShopAuditInfoDO());
if (Objects.isNull(audit)){
log.error("auditPlan audit is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_AUDIT_PLAN_FALSE);
}
OpeningOperationPlanDO openingOperationPlanDO = new OpeningOperationPlanDO();
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setResultType(request.getResultType());
Long plan = openingOperationPlanDAO.updateSelective(openingOperationPlanDO);
if (Objects.isNull(plan)){
log.error("auditPlan plan is null");
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 (Objects.isNull(Stage)){
log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
}
}
return Boolean.TRUE;
}
catch (Exception e) {
log.error("auditPlan Exception:{}", e);
e.printStackTrace();
return Boolean.FALSE;
}
}
}

View File

@@ -0,0 +1,221 @@
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.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.exception.ServiceException;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.service.OpeningOperationPlanAuditService;
import com.cool.store.service.OpeningOperationPlanService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;
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
* @Date: 2024/04/22/下午3:15
* @Version 1.0
* @注释:
*/
@Service
@Slf4j
public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
@Resource
private OpeningOperationPlanDAO openingOperationPlanDAO;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private OpeningOperationPlanAuditDAO openingOperationPlanAuditDAO;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public Long savePlan(OpeningOperationPlanRequest request) {
log.info("addNewPlan request:{}", request);
if (request.getActivityTheme().length() > CommonConstants.MAX_LENGTH_ONE_HUNDRED){
log.error("addNewPlan ActivityTheme length error");
throw new ServiceException(ErrorCodeEnum.ACTIVITY_THEME_LENGTH_FALSE);
}
if (request.getSurveyResult().length() >CommonConstants.MAX_LENGTH_ONE_HUNDRED){
log.error("addNewPlan SurveyResult length error");
throw new ServiceException(ErrorCodeEnum.SURVEYRESULT_LENGTH_FALSE);
}
String userId = CurrentUserHolder.getUserId();
try {
String userName = enterpriseUserDAO.getUserName(userId);
if (StringUtils.isBlank(userName)){
log.error("addNewPlan userName is null");
throw new ServiceException(ErrorCodeEnum.USER_NOT_EXIST);
}
OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest = new OpeningOperationPlanAuditRequest();
openingOperationPlanAuditRequest.setShopId(request.getShopId());
openingOperationPlanAuditRequest.setAuditType(ShopAuditInfoTypeEnum.OPENING_OPERATION_PLAN.getCode());
openingOperationPlanAuditRequest.setSubmittedUserName(userName);
openingOperationPlanAuditRequest.setSubmittedUserId(userId);
Long AuditId = openingOperationPlanAuditService.addNewPlanAudit(openingOperationPlanAuditRequest);
if (Objects.isNull(AuditId) ){
log.error("addNewPlan AuditId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE);
}
OpeningOperationPlanDO selectByShopId = openingOperationPlanDAO.selectByShopId(request.getShopId());
Long planId ;
if (Objects.isNull(selectByShopId)){
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO();
openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setAuditId(AuditId);
planId = openingOperationPlanDAO.updateSelective(openingOperationPlanDO);
}
else {
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO();
openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setCreateTime(new Date());
openingOperationPlanDO.setCreateUserId(userId);
openingOperationPlanDO.setAuditId(AuditId);
planId = openingOperationPlanDAO.insertSelective(openingOperationPlanDO);
}
if (Objects.isNull(planId)){
log.error("addNewPlan PlanId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_FALSE);
}
return planId;
}catch (Exception e) {
log.error("addNewPlan Exception:{}", e);
e.printStackTrace();
return null;
}
}
@Override
public OpeningOperationPlanVO getPlanById(Long Id) {
log.info( "getPlanBy Id:{}", Id );
if (Objects.isNull(Id)){
log.error("getPlanBy Id is null");
throw new ServiceException(ErrorCodeEnum.ID_IS_NULL);
}
OpeningOperationPlanVO openingOperationPlanVO = new OpeningOperationPlanVO();
OpeningOperationPlanDO openingOperationPlanDO = openingOperationPlanDAO.selectById(Id);
try {
String preparationUserIds = openingOperationPlanDO.getPreparationUserIds();
List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList());
List<UserInfoDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream);
List<String> names = nameByUserId.stream()
.map(UserInfoDTO::getName)
.collect(Collectors.toList());
String preparationUserName = String.join(CommonConstants.COMMA, names);
BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO);
openingOperationPlanVO.setPreparationUsers(preparationUserName);
return openingOperationPlanVO;
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
}
@Override
public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) {
log.info("getPlanListPage request:{}", request);
//根据ShopName等查询门店名字1门店代码1开店负责人1督导id1
Page<OpenPlanShopInfoDTO> openPlanShopList = shopInfoDAO.
getOpenPlanShopListByShopName(request.getShopName(), request.getBigName(), request.getFightName(),
request.getPageNum(), request.getPageSize());
log.info("getPlanListPage openPlanShopList:{}", openPlanShopList);
List<OpeningOperationPlanListVO> openingOperationPlanListVOList= openPlanShopList.stream().map(dto -> {
OpeningOperationPlanListVO vO = new OpeningOperationPlanListVO();
vO.setShopId(dto.getShopId());
vO.setLineId(dto.getLineId());
vO.setShopName(dto.getShopName());
vO.setShopManagerUserId(dto.getShopManagerUserId());
vO.setSupervisorUserId(dto.getSupervisorUserId());
vO.setShopCode(dto.getShopCode());
vO.setBigName(dto.getBigName());
vO.setFightName(dto.getFightName());
return vO;
}).collect(Collectors.toList());
log.info("getPlanListPage openingOperationPlanVOList:{}", openingOperationPlanListVOList);
//提交时间,审核状态
List<Long> shopIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getShopId)
.collect(Collectors.toList());
OpeningOperationPlanDTO openingOperationPlanDTO =new OpeningOperationPlanDTO();
openingOperationPlanDTO.setPlanStartDate(request.getPlanStartDate());
openingOperationPlanDTO.setPlanEndDate(request.getPlanEndDate());
List<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.selectConditionPlanList(shopIdList, openingOperationPlanDTO);
log.info("getPlanListPage openingOperationPlanDTOS:{}", openingOperationPlanDTOS);
Map<Long, OpeningOperationPlanDTO> voPlanMap = openingOperationPlanDTOS.stream()
.collect(Collectors.toMap(OpeningOperationPlanDTO::getShopId, vo -> vo));
log.info("getPlanListPage voPlanMap:{}", voPlanMap);
//开店负责人name
List<String> shopManagerUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getShopManagerUserId)
.collect(Collectors.toList());
List<UserInfoDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList);
log.info("getPlanListPage hopManagerList :{}", shopManagerList);
Map<Long,UserInfoDTO> voManagerMap = shopManagerList.stream()
.collect(Collectors.toMap(UserInfoDTO::getUserId, vo -> vo));
log.info("getPlanListPage voManagerMap:{}", voManagerMap);
//督导name
List<String> supervisorUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getSupervisorUserId)
.collect(Collectors.toList());
List<UserInfoDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList);
log.info("getPlanListPage supervisorList :{}", supervisorList);
Map<Long, UserInfoDTO> voSupervisorList = supervisorList.stream()
.collect(Collectors.toMap(UserInfoDTO::getUserId, vo -> vo));
log.info("getPlanListPage openingOperationPlanVOList:{}", openingOperationPlanListVOList);
//加盟商姓名,手机号,招商name
List<Long> lines = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getLineId)
.collect(Collectors.toList());
List<PlanLineDTO> getLines = lineInfoDAO.getLines(lines);
log.info("getPlanListPage getLines:{}", getLines);
Map<Long,PlanLineDTO> linemap = getLines.stream()
.collect(Collectors.toMap(PlanLineDTO::getLineId, vo -> vo));
log.info("getPlanListPage linemap:{}", linemap);
for (OpeningOperationPlanListVO vo:openingOperationPlanListVOList){
vo.setSubmissionTime(voPlanMap.get(vo.getShopId()).getSubmissionTime());
vo.setResultType(voPlanMap.get(vo.getShopId()).getResultType());
vo.setShopManagerName(voManagerMap.get(vo.getShopId()).getName());
vo.setSupervisorName(voSupervisorList.get(vo.getSupervisorUserId()).getName());
vo.setPartnerName(linemap.get(vo.getLineId()).getInvestmentManagerName());
vo.setMobile(linemap.get(vo.getLineId()).getMobile());
vo.setPartnerName(linemap.get(vo.getLineId()).getUsername());
}
return openingOperationPlanListVOList;
}
}

View File

@@ -0,0 +1,59 @@
package com.cool.store.controller.webb;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpeningOperationPlanAuditService;
import com.cool.store.service.OpeningOperationPlanService;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午5:28
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("pc/openingOperationPlan")
@Api(tags = "开业运营方案")
public class OpeningOperationPlanController {
@Resource
private OpeningOperationPlanService openingOperationPlanService;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@PostMapping("/submit")
@ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request){
Long planId = openingOperationPlanService.savePlan(request);
return ResponseResult.success();
}
@GetMapping("/getPlan")
@ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam Long planId){
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanById(planId);
return ResponseResult.success(plan);
}
@PostMapping("/audit")
@ApiOperation("审核运营方案")
public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request){
openingOperationPlanAuditService.auditPlan(request);
return ResponseResult.success();
}
@GetMapping("/planList")
@ApiOperation("查询运营方案列表")
public ResponseResult<List<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request){
openingOperationPlanService.getPlanListPage(request);
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
}
}