Merge #99 into master from cc_20260408_close_up
feat:歇业管理
* cc_20260408_close_up: (18 commits squashed)
- fix:歇业管理(部分)
- fix:歇业管理(部分)
- fix:审批逻辑修改;拒绝审批实现
- fix:恢复开业申请及审批
- fix:主流程补充
- fix:主流程补充
- fix:字段补充及逻辑修改
- fix:字段补充
- fix
- fix:平台处理新增字段
- fix
- Merge remote-tracking branch 'origin/cc_20260408_close_up' into cc_20260408_close_up
- fix:歇业营业发送短信
- fix:排序
- fix:详情接口新增加盟商手机号字段;申请单日期和已有申请单存在交集时申请失败
- fix:申请单详情接口新增品牌字段
- fix:新增列表筛选条件;审批单状态校验
- Merge branch 'master' into cc_20260408_close_up
# Conflicts:
#	coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java
Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/99
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.dto.store.StoreAddressDTO;
|
||||
import com.cool.store.dto.store.StoreOrderTimeDTO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.enums.StoreStatusEnum;
|
||||
import com.cool.store.mapper.StoreMapper;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -176,6 +177,26 @@ public class StoreDao {
|
||||
storeMapper.updateStoreStatus(storeId,storeStatus,actualOpenDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停营业
|
||||
* @param storeId 门店id
|
||||
* @param closeUpReason 暂停营业原因
|
||||
*/
|
||||
public void closeUp(String storeId, String closeUpReason) {
|
||||
if (storeMapper.updateStatus(storeId, StoreStatusEnum.CLOSE_UP.getValue()) > 0) {
|
||||
storeMapper.insertOrUpdateCloseUpReason(storeId, closeUpReason);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停营业门店转在营
|
||||
*/
|
||||
public void closeUpToOpen(String storeId) {
|
||||
if (storeMapper.updateStatus(storeId, StoreStatusEnum.OPEN.getValue()) > 0) {
|
||||
storeMapper.insertOrUpdateCloseUpReason(storeId, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店状态改为闭店
|
||||
* @param storeId 门店id
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.cool.store.dao.closeup;
|
||||
|
||||
import com.cool.store.entity.closeup.CloseUpApplyFormDO;
|
||||
import com.cool.store.mapper.closeup.CloseUpApplyFormMapper;
|
||||
import com.cool.store.request.closeup.CloseUpQueryRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cool.store.enums.closeup.CloseUpStatusEnum.APPROVAL;
|
||||
import static com.cool.store.enums.closeup.CloseUpStatusEnum.REJECTED;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业开业申请单DAO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CloseUpApplyFormDAO {
|
||||
private final CloseUpApplyFormMapper closeUpApplyFormMapper;
|
||||
|
||||
public void insertOrUpdate(CloseUpApplyFormDO record) {
|
||||
closeUpApplyFormMapper.insertOrUpdate(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在进行中的申请
|
||||
*/
|
||||
public boolean existOngoingRecord(String storeId, Integer type) {
|
||||
Example example = new Example(CloseUpApplyFormDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("storeId", storeId)
|
||||
.andEqualTo("type", type)
|
||||
.andEqualTo("status", APPROVAL.getStatus());
|
||||
return closeUpApplyFormMapper.selectCountByExample(example) > 0;
|
||||
}
|
||||
|
||||
public CloseUpApplyFormDO getById(Long id) {
|
||||
return closeUpApplyFormMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<CloseUpApplyFormDO> getByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Example example = new Example(CloseUpApplyFormDO.class);
|
||||
example.createCriteria().andIn("id", ids);
|
||||
return closeUpApplyFormMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public void updateByPrimaryKeySelective(CloseUpApplyFormDO record) {
|
||||
closeUpApplyFormMapper.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
public List<CloseUpApplyFormDO> getList(Long lineId, Integer type, String storeId) {
|
||||
Example example = new Example(CloseUpApplyFormDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("lineId", lineId)
|
||||
.andEqualTo("type", type)
|
||||
.andEqualTo("storeId", storeId);
|
||||
example.setOrderByClause("create_time DESC");
|
||||
return closeUpApplyFormMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<CloseUpApplyFormDO> getList(CloseUpQueryRequest request) {
|
||||
return closeUpApplyFormMapper.getList(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 歇业申请单存在开业申请
|
||||
*/
|
||||
public boolean existOpenApply(Long sourceApplyId) {
|
||||
Example example = new Example(CloseUpApplyFormDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("sourceApplyId", sourceApplyId)
|
||||
.andNotEqualTo("status", REJECTED.getStatus());
|
||||
return closeUpApplyFormMapper.selectCountByExample(example) > 0;
|
||||
}
|
||||
|
||||
public CloseUpApplyFormDO getBySourceApplyId(Long sourceApplyId) {
|
||||
return closeUpApplyFormMapper.selectOne(CloseUpApplyFormDO.builder().sourceApplyId(sourceApplyId).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在时间交集的歇业申请单(非审批拒绝状态)
|
||||
*/
|
||||
public boolean existsTimeOverlap(String storeId, Date planCloseDate, Date planOpenDate) {
|
||||
return closeUpApplyFormMapper.existsTimeOverlap(storeId, planCloseDate, planOpenDate) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.cool.store.dao.closeup;
|
||||
|
||||
import com.cool.store.entity.closeup.CloseUpAuditRecordDO;
|
||||
import com.cool.store.enums.close.CloseStoreAuditStatusEnum;
|
||||
import com.cool.store.enums.close.RecordTypeEnum;
|
||||
import com.cool.store.mapper.closeup.CloseUpAuditRecordMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业开业审批记录DAO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CloseUpAuditRecordDAO {
|
||||
private final CloseUpAuditRecordMapper closeUpAuditRecordMapper;
|
||||
|
||||
/**
|
||||
* 提交新增记录
|
||||
*/
|
||||
public void addSubmitRecord(Long applyId, Integer applyType, String userId, String userName) {
|
||||
CloseUpAuditRecordDO recordDO = CloseUpAuditRecordDO.builder()
|
||||
.applyId(applyId)
|
||||
.applyType(applyType)
|
||||
.recordType(RecordTypeEnum.CLOSE_STORE_RECORD_TYPE_10.getRecordType())
|
||||
.actionRemark("")
|
||||
.finishTaskTime(new Date())
|
||||
.receiveTaskTime(new Date())
|
||||
.handlerUserId(userId)
|
||||
.handlerUserName(userName)
|
||||
.auditStatus(CloseStoreAuditStatusEnum.PASS.getStatus())
|
||||
.handlerUserIds(getUserIds(Collections.singletonList(userId)))
|
||||
.build();
|
||||
closeUpAuditRecordMapper.insertSelective(recordDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审批记录
|
||||
*/
|
||||
public void addApproveRecord(Long applyId, Integer applyType, List<String> userIdList) {
|
||||
CloseUpAuditRecordDO recordDO = CloseUpAuditRecordDO.builder()
|
||||
.applyId(applyId)
|
||||
.applyType(applyType)
|
||||
.recordType(RecordTypeEnum.CLOSE_STORE_RECORD_TYPE_20.getRecordType())
|
||||
.receiveTaskTime(new Date())
|
||||
.handlerUserIds(getUserIds(userIdList))
|
||||
.auditStatus(CloseStoreAuditStatusEnum.PENDING.getStatus())
|
||||
.build();
|
||||
closeUpAuditRecordMapper.insertSelective(recordDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次发起流程 添加审批记录
|
||||
*/
|
||||
public void addRecord(Long applyId, Integer applyType, String userId, String userName, List<String> userIdList) {
|
||||
//新增提交审批
|
||||
addSubmitRecord(applyId, applyType, userId, userName);
|
||||
//新增审批记录
|
||||
addApproveRecord(applyId, applyType, userIdList);
|
||||
}
|
||||
|
||||
private String getUserIds(List<String> userIds) {
|
||||
String userIdStr = userIds.stream()
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.joining(","));
|
||||
return "," + userIdStr + ",";
|
||||
}
|
||||
|
||||
public CloseUpAuditRecordDO getById(Long id) {
|
||||
CloseUpAuditRecordDO recordDO = closeUpAuditRecordMapper.selectByPrimaryKey(id);
|
||||
if (Objects.nonNull(recordDO) && recordDO.getDeleted().equals(0)) {
|
||||
return recordDO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CloseUpAuditRecordDO getOngoingRecordByApplyId(Long applyId) {
|
||||
Example example = new Example(CloseUpAuditRecordDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("applyId", applyId)
|
||||
.andEqualTo("auditStatus", CloseStoreAuditStatusEnum.PENDING.getStatus());
|
||||
example.setOrderByClause("create_time desc limit 1");
|
||||
return closeUpAuditRecordMapper.selectOneByExample(example);
|
||||
}
|
||||
|
||||
public CloseUpAuditRecordDO getLatestRecordByStatus(Long applyId, Integer auditStatus) {
|
||||
Example example = new Example(CloseUpAuditRecordDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("applyId", applyId)
|
||||
.andEqualTo("auditStatus", auditStatus);
|
||||
example.setOrderByClause("create_time desc limit 1");
|
||||
return closeUpAuditRecordMapper.selectOneByExample(example);
|
||||
}
|
||||
|
||||
public void updateByPrimaryKeySelective(CloseUpAuditRecordDO recordDO) {
|
||||
closeUpAuditRecordMapper.updateByPrimaryKeySelective(recordDO);
|
||||
}
|
||||
|
||||
public List<CloseUpAuditRecordDO> getList(String userId, Integer applyType, Integer auditStatus) {
|
||||
Example example = new Example(CloseUpAuditRecordDO.class);
|
||||
example.createCriteria()
|
||||
.andLike("handlerUserIds", "%," + userId + ",%")
|
||||
.andEqualTo("applyType", applyType)
|
||||
.andEqualTo("auditStatus", auditStatus);
|
||||
example.setOrderByClause("create_time desc");
|
||||
return closeUpAuditRecordMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据申请id查询审批记录
|
||||
* @param applyId 申请id
|
||||
* @return 审批记录列表
|
||||
*/
|
||||
public List<CloseUpAuditRecordDO> getListByApplyId(Long applyId) {
|
||||
Example example = new Example(CloseUpAuditRecordDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("applyId", applyId)
|
||||
.andEqualTo("deleted", 0);
|
||||
example.setOrderByClause("id ASC");
|
||||
return closeUpAuditRecordMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.cool.store.dao.closeup;
|
||||
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.cool.store.entity.closeup.CloseUpPlatformDO;
|
||||
import com.cool.store.enums.closeup.CloseUpPlatformEnum;
|
||||
import com.cool.store.mapper.closeup.CloseUpPlatformMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业开业平台账号DAO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CloseUpPlatformDAO {
|
||||
private final CloseUpPlatformMapper closeUpPlatformMapper;
|
||||
|
||||
public List<CloseUpPlatformDO> init(Long applyId, Integer applyType, Date taskStartDate) {
|
||||
List<CloseUpPlatformDO> list = Arrays.stream(CloseUpPlatformEnum.values())
|
||||
.map(v -> CloseUpPlatformDO.builder()
|
||||
.applyId(applyId)
|
||||
.applyType(applyType)
|
||||
.code(v.getCode())
|
||||
.name(v.getName())
|
||||
.status(0)
|
||||
.type(v.getType())
|
||||
.icon(v.getIcon())
|
||||
.taskStartDate(taskStartDate)
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
closeUpPlatformMapper.insertBatch(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<CloseUpPlatformDO> getList(Long applyId, Integer status, Integer type) {
|
||||
Example example = new Example(CloseUpPlatformDO.class);
|
||||
Example.Criteria criteria = example.createCriteria()
|
||||
.andEqualTo("applyId", applyId);
|
||||
if (Objects.nonNull(status)) {
|
||||
criteria.andEqualTo("status", status);
|
||||
}
|
||||
if (Objects.nonNull(type)) {
|
||||
criteria.andEqualTo("type", type);
|
||||
}
|
||||
return closeUpPlatformMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*/
|
||||
public void updateStatusByIds(List<Long> ids, Integer status) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
Example example = new Example(CloseUpPlatformDO.class);
|
||||
example.createCriteria()
|
||||
.andIn("id", ids);
|
||||
CloseUpPlatformDO update = CloseUpPlatformDO.builder().status(status).build();
|
||||
closeUpPlatformMapper.updateByExampleSelective(update, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据申请单id删除
|
||||
*/
|
||||
public void deleteByApplyId(Long applyId) {
|
||||
closeUpPlatformMapper.delete(CloseUpPlatformDO.builder().applyId(applyId).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待处理的申请单id
|
||||
*/
|
||||
public List<Long> selectTodoApplyIds(Integer applyType, String storeKeyword) {
|
||||
return closeUpPlatformMapper.selectTodoApplyIds(applyType, storeKeyword);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,9 @@ public interface StoreMapper {
|
||||
@Param("storeStatus") String storeStatus,
|
||||
@Param("actualOpenDate") Date actualOpenDate);
|
||||
|
||||
int updateStatus(@Param("storeId") String storeId,
|
||||
@Param("storeStatus") String storeStatus);
|
||||
|
||||
/**
|
||||
* 门店状态改为闭店
|
||||
* @param storeId 门店id
|
||||
@@ -113,6 +116,8 @@ public interface StoreMapper {
|
||||
*/
|
||||
int insertOrUpdateCloseInfo(@Param("storeId") String storeId, @Param("closeReason") Integer closeReason, @Param("closeNature") Integer closeNature);
|
||||
|
||||
int insertOrUpdateCloseUpReason(@Param("storeId") String storeId, @Param("closeUpReason") String closeUpReason);
|
||||
|
||||
/**
|
||||
* 查询最近没有订货记录的门店
|
||||
* @param latestDate 最近订货时间
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.cool.store.mapper.closeup;
|
||||
|
||||
import com.cool.store.entity.closeup.CloseUpApplyFormDO;
|
||||
import com.cool.store.request.closeup.CloseUpQueryRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface CloseUpApplyFormMapper extends Mapper<CloseUpApplyFormDO> {
|
||||
|
||||
List<CloseUpApplyFormDO> getList(CloseUpQueryRequest request);
|
||||
|
||||
/**
|
||||
* 新增或编辑,使用 ON DUPLICATE KEY UPDATE
|
||||
*/
|
||||
int insertOrUpdate(CloseUpApplyFormDO record);
|
||||
|
||||
/**
|
||||
* 判断是否存在时间交集的申请单(非审批拒绝状态)
|
||||
*/
|
||||
int existsTimeOverlap(@Param("storeId") String storeId, @Param("planCloseDate") Date planCloseDate, @Param("planOpenDate") Date planOpenDate);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.mapper.closeup;
|
||||
|
||||
import com.cool.store.entity.closeup.CloseUpAuditRecordDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface CloseUpAuditRecordMapper extends Mapper<CloseUpAuditRecordDO> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cool.store.mapper.closeup;
|
||||
|
||||
import com.cool.store.entity.closeup.CloseUpPlatformDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CloseUpPlatformMapper extends Mapper<CloseUpPlatformDO> {
|
||||
|
||||
int insertBatch(List<CloseUpPlatformDO> list);
|
||||
|
||||
/**
|
||||
* 查询待处理的申请单id
|
||||
*/
|
||||
List<Long> selectTodoApplyIds(@Param("applyType") Integer applyType, @Param("storeKeyword") String storeKeyword);
|
||||
}
|
||||
Reference in New Issue
Block a user