流程数据
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.entity.OpenAcceptanceInfoDO;
|
||||||
import com.cool.store.mapper.OpenAcceptanceInfoMapper;
|
import com.cool.store.mapper.OpenAcceptanceInfoMapper;
|
||||||
import com.cool.store.request.OpenAcceptanceRequest;
|
import com.cool.store.request.OpenAcceptanceRequest;
|
||||||
import com.cool.store.vo.OpenAcceptanceInfoListVO;
|
import com.cool.store.vo.OpenAcceptanceInfoListVO;
|
||||||
@@ -23,5 +24,9 @@ public class OpenAcceptanceInfoDAO {
|
|||||||
return openAcceptanceInfoMapper.openAcceptanceList(openAcceptanceRequest);
|
return openAcceptanceInfoMapper.openAcceptanceList(openAcceptanceRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int insertSelective(OpenAcceptanceInfoDO openAcceptanceInfoDO){
|
||||||
|
return openAcceptanceInfoMapper.insertSelective(openAcceptanceInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.cool.store.vo.shop.RentInfoToDoVO;
|
|||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -64,6 +65,13 @@ public class ShopStageInfoDAO {
|
|||||||
return shopStageInfoMapper.batchInsert(addShopStageList);
|
return shopStageInfoMapper.batchInsert(addShopStageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer batchUpdate(List<ShopStageInfoDO> shopStageList) {
|
||||||
|
if(CollectionUtils.isEmpty(shopStageList)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return shopStageInfoMapper.batchUpdate(shopStageList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺阶段信息
|
* 获取店铺阶段信息
|
||||||
* @param shopId
|
* @param shopId
|
||||||
@@ -76,6 +84,13 @@ public class ShopStageInfoDAO {
|
|||||||
return shopStageInfoMapper.getShopStageInfo(shopId, shopStage);
|
return shopStageInfoMapper.getShopStageInfo(shopId, shopStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getAllCompletionCount(Long shopId) {
|
||||||
|
if(Objects.isNull(shopId)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return shopStageInfoMapper.getAllCompletionCount(shopId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子阶段信息
|
* 获取子阶段信息
|
||||||
* @param shopId
|
* @param shopId
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
|
|||||||
*/
|
*/
|
||||||
Integer batchInsert(@Param("addShopStageList") List<ShopStageInfoDO> addShopStageList);
|
Integer batchInsert(@Param("addShopStageList") List<ShopStageInfoDO> addShopStageList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改
|
||||||
|
* @param addShopStageList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer batchUpdate(@Param("addShopStageList") List<ShopStageInfoDO> addShopStageList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺阶段信息
|
* 获取店铺阶段信息
|
||||||
* @param shopId
|
* @param shopId
|
||||||
@@ -26,14 +33,21 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
|
|||||||
List<ShopStageInfoDO> getShopStageInfo(@Param("shopId") Long shopId, @Param("shopStage") Integer shopStage);
|
List<ShopStageInfoDO> getShopStageInfo(@Param("shopId") Long shopId, @Param("shopStage") Integer shopStage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟新店铺阶段信息
|
* 查询结束阶段的数量
|
||||||
* @param shopId
|
* @param shopId
|
||||||
* @param shopSubStage
|
|
||||||
* @param shopSubStageStatus
|
|
||||||
* @param isTerminated
|
|
||||||
* @param remark
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
Integer getAllCompletionCount(@Param("shopId") Long shopId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟新店铺阶段信息
|
||||||
|
* @param shopId
|
||||||
|
* @param shopSubStage
|
||||||
|
* @param shopSubStageStatus
|
||||||
|
* @param isTerminated
|
||||||
|
* @param remark
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Integer updateShopStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
|
Integer updateShopStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
|
||||||
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
|
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,23 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="batchUpdate">
|
||||||
|
update xfsg_shop_stage_info
|
||||||
|
<set>
|
||||||
|
shop_sub_stage_status = CASE id
|
||||||
|
<foreach collection="addShopStageList" separator=" " item="item">
|
||||||
|
WHEN #{item.id} THEN IFNULL(#{item.shopSubStageStatus},shop_sub_stage_status)
|
||||||
|
</foreach>
|
||||||
|
END
|
||||||
|
</set>
|
||||||
|
where id in (
|
||||||
|
<foreach collection="addShopStageList" item="item" separator=",">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="getShopStageInfo" resultMap="BaseResultMap">
|
<select id="getShopStageInfo" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="allColumn"/>
|
<include refid="allColumn"/>
|
||||||
@@ -41,6 +58,22 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllCompletionCount" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="allColumn"/>
|
||||||
|
from
|
||||||
|
xfsg_shop_stage_info
|
||||||
|
where
|
||||||
|
shop_id = #{shopId} and deleted = 0
|
||||||
|
and
|
||||||
|
(( shop_sub_stage = 60 AND shop_sub_stage_status = 610 )
|
||||||
|
OR ( shop_sub_stage = 40 AND shop_sub_stage_status = 430 )
|
||||||
|
OR ( shop_sub_stage = 120 AND shop_sub_stage_status = 1230 )
|
||||||
|
OR ( shop_sub_stage = 130 AND shop_sub_stage_status = 1320 )
|
||||||
|
OR ( shop_sub_stage = 140 AND shop_sub_stage_status = 1410 )
|
||||||
|
OR ( shop_sub_stage = 150 AND shop_sub_stage_status = 1510 ))
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateShopStageInfo">
|
<update id="updateShopStageInfo">
|
||||||
update
|
update
|
||||||
xfsg_shop_stage_info
|
xfsg_shop_stage_info
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class OpenAcceptanceInfoDO {
|
|||||||
* 验收状态
|
* 验收状态
|
||||||
*/
|
*/
|
||||||
@Column(name = "acceptance_status")
|
@Column(name = "acceptance_status")
|
||||||
private Byte acceptanceStatus;
|
private Integer acceptanceStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验收人
|
* 验收人
|
||||||
@@ -182,7 +182,7 @@ public class OpenAcceptanceInfoDO {
|
|||||||
*
|
*
|
||||||
* @return acceptance_status - 验收状态
|
* @return acceptance_status - 验收状态
|
||||||
*/
|
*/
|
||||||
public Byte getAcceptanceStatus() {
|
public Integer getAcceptanceStatus() {
|
||||||
return acceptanceStatus;
|
return acceptanceStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ public class OpenAcceptanceInfoDO {
|
|||||||
*
|
*
|
||||||
* @param acceptanceStatus 验收状态
|
* @param acceptanceStatus 验收状态
|
||||||
*/
|
*/
|
||||||
public void setAcceptanceStatus(Byte acceptanceStatus) {
|
public void setAcceptanceStatus(Integer acceptanceStatus) {
|
||||||
this.acceptanceStatus = acceptanceStatus;
|
this.acceptanceStatus = acceptanceStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/22 16:10
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface PreparationService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验建店与加盟签约合同是否完成 并初始化后续流程数据
|
||||||
|
* @param shopId
|
||||||
|
*/
|
||||||
|
void contractAndBuildStoreCompletion(Long shopId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开业验收 改走的流程都已经完成 ->初始化开业验收数据
|
||||||
|
* @param shopId
|
||||||
|
*/
|
||||||
|
void whetherToOpenForAcceptance(Long shopId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dao.OpenAcceptanceInfoDAO;
|
||||||
|
import com.cool.store.dao.ShopStageInfoDAO;
|
||||||
|
import com.cool.store.entity.OpenAcceptanceInfoDO;
|
||||||
|
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.service.PreparationService;
|
||||||
|
import com.cool.store.utils.poi.constant.Constants;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/22 16:21
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PreparationServiceImpl implements PreparationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopStageInfoDAO shopStageInfoDAO;
|
||||||
|
@Resource
|
||||||
|
private OpenAcceptanceInfoDAO openAcceptanceInfoDAO;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contractAndBuildStoreCompletion(Long shopId) {
|
||||||
|
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
|
||||||
|
if (CollectionUtils.isNotEmpty(shopStageInfo)){
|
||||||
|
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
|
||||||
|
Boolean buildStoreCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatusName().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus());
|
||||||
|
Boolean contractCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatusName().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage()).getShopSubStageStatus());
|
||||||
|
|
||||||
|
//都完成了 初始化后续流程数据
|
||||||
|
if (buildStoreCompletionFlag && contractCompletionFlag){
|
||||||
|
//初始化后续流程数据 设计阶段 装修阶段 开业运营方案 首批订货清单
|
||||||
|
List<ShopStageInfoDO> list = new ArrayList<>();
|
||||||
|
ShopStageInfoDO data1 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_9.getShopSubStage());
|
||||||
|
data1.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
|
||||||
|
list.add(data1);
|
||||||
|
ShopStageInfoDO data2 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
|
||||||
|
data2.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_110.getShopSubStageStatus());
|
||||||
|
list.add(data2);
|
||||||
|
ShopStageInfoDO data3 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_14.getShopSubStage());
|
||||||
|
data3.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_140.getShopSubStageStatus());
|
||||||
|
list.add(data3);
|
||||||
|
ShopStageInfoDO data4 = shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage());
|
||||||
|
data4.setShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_150.getShopSubStageStatus());
|
||||||
|
list.add(data4);
|
||||||
|
shopStageInfoDAO.batchUpdate(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void whetherToOpenForAcceptance(Long shopId) {
|
||||||
|
Integer allCompletionCount = shopStageInfoDAO.getAllCompletionCount(shopId);
|
||||||
|
//如果等于5 表示前面阶段都已经完成 初始化开业验收数据
|
||||||
|
if (allCompletionCount.equals(CommonConstants.FIVE)){
|
||||||
|
OpenAcceptanceInfoDO openAcceptanceInfoDO = new OpenAcceptanceInfoDO();
|
||||||
|
openAcceptanceInfoDO.setShopId(shopId);
|
||||||
|
openAcceptanceInfoDO.setAcceptanceStatus(CommonConstants.ZERO);
|
||||||
|
openAcceptanceInfoDAO.insertSelective(openAcceptanceInfoDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user