选址阶段

This commit is contained in:
zhangchenbiao
2024-04-11 14:07:33 +08:00
parent dff0042b54
commit 8bf8de1cd9
19 changed files with 721 additions and 54 deletions

View File

@@ -1,9 +1,11 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.mapper.ShopInfoMapper;
import com.cool.store.utils.NumberConverter;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -24,23 +26,11 @@ public class ShopInfoDAO {
private ShopInfoMapper shopInfoMapper;
/**
* 初始化店铺
* @param lineInfo
* @return
*/
public Integer initShop(LineInfoDO lineInfo){
Integer wantShopNum = lineInfo.getWantShopNum();
List<ShopInfoDO> shopList = new ArrayList<>();
for (int i = 0; i < wantShopNum; i++) {
ShopInfoDO shopInfo = new ShopInfoDO();
shopInfo.setRegionId(lineInfo.getRegionId());
shopInfo.setLineId(lineInfo.getId());
shopInfo.setPartnerId(lineInfo.getPartnerId());
shopInfo.setShopName("店铺" + NumberConverter.convertArabicToChinese(i + 1));
shopList.add(shopInfo);
public Integer batchAddShop(List<ShopInfoDO> shopInfoList){
if(CollectionUtils.isEmpty(shopInfoList)){
return CommonConstants.ZERO;
}
return shopInfoMapper.batchAddShop(shopList);
return shopInfoMapper.batchAddShop(shopInfoList);
}
/**
@@ -57,6 +47,9 @@ public class ShopInfoDAO {
}
public List<ShopInfoDO> getShopList(Long lineId){
if(Objects.isNull(lineId)){
return new ArrayList<>();
}
return shopInfoMapper.getShopList(lineId);
}

View File

@@ -0,0 +1,85 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.mapper.ShopStageInfoMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: ShopStageInfoDAO
* @Description:
* @date 2024-04-10 17:33
*/
@Repository
public class ShopStageInfoDAO {
@Resource
private ShopStageInfoMapper shopStageInfoMapper;
/**
* 初始化店铺阶段信息
* @param lineId
* @param shopIds
* @param shopStageEnum
* @return
*/
public Integer initShopStageInfo(Long lineId, List<Long> shopIds, ShopStageEnum shopStageEnum) {
if(CollectionUtils.isEmpty(shopIds) || Objects.isNull(shopStageEnum)){
return CommonConstants.ZERO;
}
Integer shopStage = shopStageEnum.getShopStage();
List<ShopSubStageEnum> shopStageEnumList = ShopSubStageEnum.getShopStageEnum(shopStage);
List<ShopStageInfoDO> addShopStageList = new ArrayList<>();
for (Long shopId : shopIds) {
for (ShopSubStageEnum shopSubStageEnum : shopStageEnumList) {
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
shopStageInfo.setLineId(lineId);
shopStageInfo.setShopId(shopId);
shopStageInfo.setShopStage(shopStage);
shopStageInfo.setShopSubStage(shopSubStageEnum.getShopSubStage());
shopStageInfo.setShopSubStageStatus(shopSubStageEnum.getInitStatus().getShopSubStageStatus());
shopStageInfo.setRemark(shopSubStageEnum.getShopSubStageName() + CommonConstants.PATH_BAR +shopSubStageEnum.getInitStatus().getShopSubStageStatusName());
addShopStageList.add(shopStageInfo);
}
}
return shopStageInfoMapper.batchInsert(addShopStageList);
}
/**
* 获取店铺阶段信息
* @param shopId
* @return
*/
public List<ShopStageInfoDO> getShopStageInfo(Long shopId) {
if(Objects.isNull(shopId)){
return Lists.newArrayList();
}
return shopStageInfoMapper.getShopStageInfo(shopId);
}
/**
* 更新店铺阶段状态
* @param shopId
* @param shopStageInfo
* @return
*/
public Integer updateShopStageInfo(Long shopId, ShopSubStageStatusEnum shopStageInfo) {
if(Objects.isNull(shopId) || Objects.isNull(shopStageInfo)){
return CommonConstants.ZERO;
}
String remark = shopStageInfo.getShopSubStageName() + CommonConstants.PATH_BAR +shopStageInfo.getShopSubStageStatusName();
return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), remark);
}
}

View File

@@ -0,0 +1,34 @@
package com.cool.store.mapper;
import com.cool.store.entity.ShopStageInfoDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
/**
* 批量插入店铺阶段信息
* @param addShopStageList
* @return
*/
Integer batchInsert(@Param("addShopStageList") List<ShopStageInfoDO> addShopStageList);
/**
* 获取店铺阶段信息
* @param shopId
* @return
*/
List<ShopStageInfoDO> getShopStageInfo(@Param("shopId") Long shopId);
/**
* 跟新店铺阶段信息
* @param shopId
* @param shopSubStage
* @param shopSubStageStatus
* @param remark
* @return
*/
Integer updateShopStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus, @Param("remark") String remark);
}

View File

@@ -0,0 +1,41 @@
<?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">
<mapper namespace="com.cool.store.mapper.ShopStageInfoMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopStageInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="line_id" jdbcType="BIGINT" property="lineId" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="shop_stage" jdbcType="TINYINT" property="shopStage" />
<result column="shop_sub_stage" jdbcType="TINYINT" property="shopSubStage" />
<result column="shop_sub_stage_status" jdbcType="TINYINT" property="shopSubStageStatus" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="allColumn">
id, line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, remark, deleted, create_time, update_time
</sql>
<insert id="batchInsert">
<foreach collection="addShopStageList" separator=";" item="shop">
INSERT INTO xfsg_shop_stage_info(line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, remark)
VALUES(#{shop.lineId}, #{shop.shopId}, #{shop.shopStage}, #{shop.shopSubStage}, #{shop.shopSubStageStatus}, #{shop.remark})
</foreach>
</insert>
<select id="getShopStageInfo" resultMap="BaseResultMap">
select
<include refid="allColumn"/>
from
xfsg_shop_stage_info
where
shop_id = #{shopId} and deleted = 0
</select>
<update id="updateShopStageInfo">
update xfsg_shop_stage_info set shop_sub_stage_status = #{shopSubStageStatus}, remark = #{remark} where shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
</mapper>

View File

@@ -1,8 +1,8 @@
jdbc.driver = com.mysql.cj.jdbc.Driver
jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_36?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_69?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT
table.name = xfsg_point_deal_record
table.object.class = PointDealRecordDO
table.mapper = PointDealRecordMapper
table.name = xfsg_shop_stage_info
table.object.class = ShopStageInfoDO
table.mapper = ShopStageInfoMapper