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:
@@ -478,6 +478,18 @@ public enum ErrorCodeEnum {
|
||||
|
||||
IP_LIMIT(1840000, "IP访问次数超限", null),
|
||||
|
||||
|
||||
CLOSE_UP_CLOSED_DOWN(1840000, "门店已歇业", null),
|
||||
CLOSE_UP_ONLY_SUPPORT_OPEN(1840001, "仅支持在营门店发起歇业申请", null),
|
||||
CLOSE_UP_EXIST_ONGOING_RECORD(18400002,"该日期下当前门店有进行中的申请,请确认!",null),
|
||||
CLOSE_UP_AUDIT_RECORD_NOT_EXIST(1840003, "审批记录不存在", null),
|
||||
CLOSE_UP_FORM_NOT_EXIST(1840004, "申请单不存在", null),
|
||||
CLOSE_UP_AUDIT_ACCESS_DENIED(1840005, "无权限审批", null),
|
||||
CLOSE_UP_STORE_OPEN(1840006, "门店已营业", null),
|
||||
CLOSE_UP_ONLY_SUPPORT_CLOSE_UP(1840007, "仅支持歇业门店发起营业申请", null),
|
||||
CLOSE_UP_CLOSED_AUDIT_NOT_PASS(1840008, "歇业申请未通过", null),
|
||||
CLOSE_UP_EXIST_OPEN_APPLY(1840009, "该歇业申请单已存在开业申请", null),
|
||||
CLOSE_UP_APPROVED(1840010, "该申请单已审批", null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public enum RocketMqGroupEnum {
|
||||
STORE_MASTER_ISSUE("store_master_issue", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_MASTER_ISSUE))),
|
||||
VISIT_RECORD_INVALID("visit_record_invalid", new ArrayList<>(Arrays.asList(RocketMqTagEnum.VISIT_RECORD_INVALID))),
|
||||
TP_PENALTY_APPEAL_OVERDUE("tp_penalty_appeal_overdue", new ArrayList<>(Arrays.asList(RocketMqTagEnum.TP_PENALTY_APPEAL_OVERDUE))),
|
||||
CLOSE_UP_APPLY_STORE_UPDATE("close_up_apply_store_update", new ArrayList<>(Arrays.asList(RocketMqTagEnum.CLOSE_UP_APPLY_STORE_UPDATE))),
|
||||
;
|
||||
|
||||
private final String group;
|
||||
|
||||
@@ -23,6 +23,7 @@ public enum RocketMqTagEnum {
|
||||
STORE_MASTER_ISSUE("store_master_issue","门店主数据下发"),
|
||||
VISIT_RECORD_INVALID("visit_record_invalid", "拜访记录失效"),
|
||||
TP_PENALTY_APPEAL_OVERDUE("tp_penalty_appeal_overdue", "十二分惩处单复议逾期"),
|
||||
CLOSE_UP_APPLY_STORE_UPDATE("close_up_apply_store_update", "歇业申请修改门店状态"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 短信通知模板
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/13
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SmsNoticeTypeEnum {
|
||||
CLOSE_UP_CLOSE_NOTICE("SMS_504775487", "歇业通知", SmsSignEnum.ZHENGXIN),
|
||||
CLOSE_UP_OPEN_NOTICE("SMS_504845455", "恢复营业通知", SmsSignEnum.ZHENGXIN),
|
||||
|
||||
;
|
||||
|
||||
private final String templateCode;
|
||||
|
||||
private final String message;
|
||||
|
||||
private final SmsSignEnum smsSign;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 短信签名
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/13
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SmsSignEnum {
|
||||
|
||||
ZHENGXIN("正新", "正新"),
|
||||
;
|
||||
|
||||
private final String signName;
|
||||
|
||||
private final String message;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cool.store.enums.closeup;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业开业平台账号
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CloseUpPlatformEnum {
|
||||
DOUYINTG("douyintg", "抖音", 0, "https://ossfilezx.coolstore.cn/icon/closeup/douyin.png"),
|
||||
ELEMEWM("elemewm", "饿了么", 0, "https://ossfilezx.coolstore.cn/icon/closeup/ele.png"),
|
||||
HUOMA("huoma", "火码POS", 0, "https://ossfilezx.coolstore.cn/icon/closeup/huoma.png"),
|
||||
JINGDONGWM("jingdongwm", "京东外卖", 0, "https://ossfilezx.coolstore.cn/icon/closeup/jingdong.png"),
|
||||
KUAISHOUTG("kuaishoutg", "快手团购", 0, "https://ossfilezx.coolstore.cn/icon/closeup/kuaishou.png"),
|
||||
MEITUANTG("meituantg", "美团团购", 0, "https://ossfilezx.coolstore.cn/icon/closeup/meituan.png"),
|
||||
MEITUANWM("meituanwm", "美团外卖", 0, "https://ossfilezx.coolstore.cn/icon/closeup/meituanwx.png"),
|
||||
ZHIFUBAO("zhifubao", "支付宝团购", 0, "https://ossfilezx.coolstore.cn/icon/closeup/zhifubao.png"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private final String code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
/**
|
||||
* 关闭类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 图标地址
|
||||
*/
|
||||
private final String icon;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.cool.store.enums.closeup;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请单状态
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CloseUpStatusEnum {
|
||||
APPROVAL(1, "审批中"),
|
||||
REJECTED(5, "审批拒绝"),
|
||||
PASS(10, "审批通过"),
|
||||
|
||||
APPLY_OPEN(15, "申请营业中"),
|
||||
APPLY_OPEN_REJECTED(20, "申请营业审批拒绝"),
|
||||
APPLY_OPEN_PASS(25, "申请营业审批通过"),
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
|
||||
private final String desc;
|
||||
|
||||
public static String getDesc(Integer status) {
|
||||
for (CloseUpStatusEnum value : CloseUpStatusEnum.values()) {
|
||||
if (value.status.equals(status)) {
|
||||
return value.desc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean unPass(Integer status) {
|
||||
return REJECTED.getStatus().equals(status) || APPROVAL.getStatus().equals(status);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,16 @@ public class BeanUtil extends cn.hutool.core.bean.BeanUtil {
|
||||
return newPage;
|
||||
}
|
||||
|
||||
public static <T, R> PageInfo<R> toPage(PageInfo<T> page, List<R> list) {
|
||||
PageInfo<R> newPage = new PageInfo<>();
|
||||
newPage.setPages(page.getPages());
|
||||
newPage.setTotal(page.getTotal());
|
||||
newPage.setPageNum(page.getPageNum());
|
||||
newPage.setPageSize(page.getPageSize());
|
||||
newPage.setList(list);
|
||||
return newPage;
|
||||
}
|
||||
|
||||
public static void copyPropertiesIgnoreId(Object source, Object target, String... ignoreProperties) {
|
||||
if (source == null || target == null) {
|
||||
return;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -302,6 +302,12 @@
|
||||
WHERE store_id = #{storeId} AND is_delete = 'effective'
|
||||
</update>
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE store_${enterpriseId}
|
||||
SET store_status = #{storeStatus}
|
||||
WHERE store_id = #{storeId} AND is_delete = 'effective'
|
||||
</update>
|
||||
|
||||
<update id="closeStore">
|
||||
UPDATE store_${enterpriseId}
|
||||
SET store_status = 'closed',
|
||||
@@ -317,6 +323,13 @@
|
||||
close_nature = VALUES(close_nature)
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateCloseUpReason">
|
||||
INSERT INTO store_extend_info_${enterpriseId}(store_id, close_up_reason)
|
||||
VALUES(#{storeId}, #{closeUpReason})
|
||||
ON DUPLICATE KEY UPDATE
|
||||
close_up_reason = VALUES(close_up_reason)
|
||||
</insert>
|
||||
|
||||
<select id="getNoOrderStore" resultType="com.cool.store.entity.StoreDO">
|
||||
SELECT * FROM store_${enterpriseId} a
|
||||
LEFT JOIN store_extend_info_${enterpriseId} b ON a.store_id = b.store_id
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?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.closeup.CloseUpApplyFormMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.closeup.CloseUpApplyFormDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="type" jdbcType="TINYINT" property="type" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="apply_no" jdbcType="VARCHAR" property="applyNo" />
|
||||
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="plan_close_date" jdbcType="DATE" property="planCloseDate" />
|
||||
<result column="actual_close_date" jdbcType="DATE" property="actualCloseDate" />
|
||||
<result column="plan_open_date" jdbcType="DATE" property="planOpenDate" />
|
||||
<result column="actual_open_date" jdbcType="TIMESTAMP" property="actualOpenDate" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="reason" jdbcType="VARCHAR" property="reason" />
|
||||
<result column="source_apply_id" jdbcType="BIGINT" property="sourceApplyId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||
<result column="urls" jdbcType="LONGVARCHAR" property="urls" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List_A">
|
||||
a.id, a.type, a.store_id, a.apply_no, a.line_id, a.status, a.plan_close_date, a.actual_close_date, a.plan_open_date, a.actual_open_date,
|
||||
a.user_id, a.reason, a.source_apply_id, a.create_time, a.updated_time, a.urls
|
||||
</sql>
|
||||
|
||||
<select id="getList" parameterType="com.cool.store.request.closeup.CloseUpQueryRequest" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List_A" />
|
||||
FROM zxjp_close_up_apply_form a
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
<if test="lineKeyword != null and lineKeyword != ''">
|
||||
INNER JOIN xfsg_line_info c ON a.line_id = c.id AND c.deleted = 0
|
||||
</if>
|
||||
<if test="closeUpApplyNo != null and closeUpApplyNo != ''">
|
||||
LEFT JOIN zxjp_close_up_apply_form d ON a.source_apply_id = d.id
|
||||
</if>
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND a.type = #{type}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND a.status = #{status}
|
||||
</if>
|
||||
<if test="beginPlanCloseDate != null and endPlanCloseDate!= null">
|
||||
AND a.plan_close_date BETWEEN #{beginPlanCloseDate} AND #{endPlanCloseDate}
|
||||
</if>
|
||||
<if test="beginActualOpenDate != null and endActualOpenDate != null">
|
||||
AND a.actual_open_date BETWEEN #{beginActualOpenDate} AND #{endActualOpenDate}
|
||||
</if>
|
||||
<if test="applyNo != null and applyNo != ''">
|
||||
AND a.apply_no LIKE CONCAT('%',#{applyNo},'%')
|
||||
</if>
|
||||
<if test="storeKeyword != null and storeKeyword != ''">
|
||||
AND (b.store_name LIKE CONCAT('%',#{storeKeyword},'%') OR b.store_num LIKE CONCAT('%',#{storeKeyword},'%'))
|
||||
</if>
|
||||
<if test="joinBrand != null">
|
||||
AND b.join_brand = #{joinBrand}
|
||||
</if>
|
||||
<if test="regionIds != null and regionIds.size() > 0">
|
||||
<foreach item="regionId" collection="regionIds" separator=" OR " open="AND (" close=")" index="">
|
||||
b.region_path LIKE CONCAT('%/',#{regionId},'/%')
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="lineKeyword != null and lineKeyword != ''">
|
||||
AND (c.username LIKE CONCAT('%',#{lineKeyword},'%') OR c.mobile LIKE CONCAT('%',#{lineKeyword},'%'))
|
||||
</if>
|
||||
<if test="closeUpApplyNo != null and closeUpApplyNo != ''">
|
||||
AND d.apply_no LIKE CONCAT('%', #{closeUpApplyNo}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="com.cool.store.entity.closeup.CloseUpApplyFormDO" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO zxjp_close_up_apply_form (
|
||||
id, type, store_id, apply_no, line_id, status, plan_close_date, actual_close_date,
|
||||
plan_open_date, actual_open_date, user_id, reason, source_apply_id, urls
|
||||
) VALUES (
|
||||
#{id}, #{type}, #{storeId}, #{applyNo}, #{lineId}, #{status}, #{planCloseDate}, #{actualCloseDate},
|
||||
#{planOpenDate}, #{actualOpenDate}, #{userId}, #{reason}, #{sourceApplyId}, #{urls}
|
||||
) ON DUPLICATE KEY UPDATE
|
||||
type = #{type},
|
||||
store_id = #{storeId},
|
||||
apply_no = #{applyNo},
|
||||
line_id = #{lineId},
|
||||
status = #{status},
|
||||
plan_close_date = #{planCloseDate},
|
||||
actual_close_date = #{actualCloseDate},
|
||||
plan_open_date = #{planOpenDate},
|
||||
actual_open_date = #{actualOpenDate},
|
||||
user_id = #{userId},
|
||||
reason = #{reason},
|
||||
source_apply_id = #{sourceApplyId},
|
||||
urls = #{urls}
|
||||
</insert>
|
||||
|
||||
<select id="existsTimeOverlap" resultType="int">
|
||||
SELECT COUNT(1) FROM zxjp_close_up_apply_form
|
||||
WHERE store_id = #{storeId}
|
||||
AND type = 0
|
||||
AND status != 5
|
||||
AND plan_close_date <= #{planOpenDate}
|
||||
AND plan_open_date >= #{planCloseDate}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.closeup.CloseUpAuditRecordMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.closeup.CloseUpAuditRecordDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="apply_id" jdbcType="BIGINT" property="applyId" />
|
||||
<result column="record_type" jdbcType="TINYINT" property="recordType" />
|
||||
<result column="action_remark" jdbcType="VARCHAR" property="actionRemark" />
|
||||
<result column="handler_user_id" jdbcType="VARCHAR" property="handlerUserId" />
|
||||
<result column="handler_user_name" jdbcType="VARCHAR" property="handlerUserName" />
|
||||
<result column="handler_user_ids" jdbcType="VARCHAR" property="handlerUserIds" />
|
||||
<result column="receive_task_time" jdbcType="TIMESTAMP" property="receiveTaskTime" />
|
||||
<result column="finish_task_time" jdbcType="TIMESTAMP" property="finishTaskTime" />
|
||||
<result column="audit_status" jdbcType="TINYINT" property="auditStatus" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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.closeup.CloseUpPlatformMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.closeup.CloseUpPlatformDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="apply_id" jdbcType="BIGINT" property="applyId" />
|
||||
<result column="apply_type" jdbcType="TINYINT" property="applyType" />
|
||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="type" jdbcType="TINYINT" property="type" />
|
||||
<result column="task_start_date" jdbcType="DATE" property="taskStartDate" />
|
||||
<result column="icon" jdbcType="VARCHAR" property="icon" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO zxjp_close_up_platform(apply_id, apply_type, code, name, status, type, task_start_date, icon)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.applyId}, #{item.applyType}, #{item.code}, #{item.name}, #{item.status}, #{item.type}, #{item.taskStartDate}, #{item.icon})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectTodoApplyIds" resultType="java.lang.Long">
|
||||
SELECT DISTINCT apply_id FROM zxjp_close_up_platform a
|
||||
<if test="storeKeyword != null and storeKeyword != ''">
|
||||
LEFT JOIN zxjp_close_up_apply_form b ON a.apply_id = b.id
|
||||
LEFT JOIN store_${enterpriseId} c ON b.store_id = c.store_id
|
||||
</if>
|
||||
WHERE a.status = 0 AND a.task_start_date <= now()
|
||||
<if test="applyType != null">
|
||||
AND a.apply_type = #{applyType}
|
||||
</if>
|
||||
<if test="storeKeyword != null and storeKeyword != ''">
|
||||
AND (c.store_name LIKE CONCAT('%', #{storeKeyword}, '%') OR c.store_num LIKE CONCAT('%', #{storeKeyword}, '%'))
|
||||
</if>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.cool.store.entity.closeup;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 歇业开业申请单
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zxjp_close_up_apply_form")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CloseUpApplyFormDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型,0歇业申请 1开业申请
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
*/
|
||||
@Column(name = "store_id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 申请单号
|
||||
*/
|
||||
@Column(name = "apply_no")
|
||||
private String applyNo;
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
@Column(name = "line_id")
|
||||
private Long lineId;
|
||||
|
||||
/**
|
||||
* 状态,1-审批中 5-审批拒绝 10-审批通过
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 计划歇业日期
|
||||
*/
|
||||
@Column(name = "plan_close_date")
|
||||
private Date planCloseDate;
|
||||
|
||||
/**
|
||||
* 实际歇业日期
|
||||
*/
|
||||
@Column(name = "actual_close_date")
|
||||
private Date actualCloseDate;
|
||||
|
||||
/**
|
||||
* 计划开业日期
|
||||
*/
|
||||
@Column(name = "plan_open_date")
|
||||
private Date planOpenDate;
|
||||
|
||||
/**
|
||||
* 实际开业日期
|
||||
*/
|
||||
@Column(name = "actual_open_date")
|
||||
private Date actualOpenDate;
|
||||
|
||||
/**
|
||||
* 代申请运营顾问id
|
||||
*/
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 附件列表
|
||||
*/
|
||||
private String urls;
|
||||
|
||||
/**
|
||||
* 原因说明
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 源申请单id
|
||||
*/
|
||||
@Column(name = "source_apply_id")
|
||||
private Long sourceApplyId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "updated_time")
|
||||
private Date updatedTime;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.cool.store.entity.closeup;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 歇业开业审批记录
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zxjp_close_up_audit_record")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CloseUpAuditRecordDO {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请单id
|
||||
*/
|
||||
@Column(name = "apply_id")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 申请单类型
|
||||
*/
|
||||
@Column(name = "apply_type")
|
||||
private Integer applyType;
|
||||
|
||||
/**
|
||||
* 记录类型:1-申请提交,2-审批操作
|
||||
*/
|
||||
@Column(name = "record_type")
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column(name = "action_remark")
|
||||
private String actionRemark;
|
||||
|
||||
/**
|
||||
* 实际处理人
|
||||
*/
|
||||
@Column(name = "handler_user_id")
|
||||
private String handlerUserId;
|
||||
|
||||
/**
|
||||
* 实际处理人名称
|
||||
*/
|
||||
@Column(name = "handler_user_name")
|
||||
private String handlerUserName;
|
||||
|
||||
/**
|
||||
* 处理人集合
|
||||
*/
|
||||
@Column(name = "handler_user_ids")
|
||||
private String handlerUserIds;
|
||||
|
||||
/**
|
||||
* 收到任务时间
|
||||
*/
|
||||
@Column(name = "receive_task_time")
|
||||
private Date receiveTaskTime;
|
||||
|
||||
/**
|
||||
* 完成任务时间
|
||||
*/
|
||||
@Column(name = "finish_task_time")
|
||||
private Date finishTaskTime;
|
||||
|
||||
/**
|
||||
* 审核状态 0待处理,1通过,2拒绝
|
||||
*/
|
||||
@Column(name = "audit_status")
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "updated_time")
|
||||
private Date updatedTime;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.cool.store.entity.closeup;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 歇业开业平台账号
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "zxjp_close_up_platform")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CloseUpPlatformDO {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请单id
|
||||
*/
|
||||
@Column(name = "apply_id")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 申请单类型,0歇业申请 1开业申请
|
||||
*/
|
||||
@Column(name = "apply_type")
|
||||
private Integer applyType;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态:0-待处理, 1-已处理
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 关闭类型,0手动关闭,1自动关闭
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 任务开始日期
|
||||
*/
|
||||
@Column(name = "task_start_date")
|
||||
private Date taskStartDate;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpApplyRequest {
|
||||
@ApiModelProperty("申请单id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
@NotBlank(message = "门店id不能为空")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("计划歇业日期")
|
||||
@NotNull(message = "计划歇业日期不能为空")
|
||||
private Date planCloseDate;
|
||||
|
||||
@ApiModelProperty("计划开业日期")
|
||||
@NotNull(message = "计划开业日期不能为空")
|
||||
private Date planOpenDate;
|
||||
|
||||
@ApiModelProperty("原因说明")
|
||||
@NotBlank(message = "原因说明不能为空")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty("附件列表,逗号分割")
|
||||
private String urls;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 申请单简单信息查询Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpApplySimpleQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("门店id")
|
||||
@NotBlank(message = "门店id不能为空")
|
||||
private String storeId;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请审批Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpAuditRequest {
|
||||
@ApiModelProperty("审批记录id")
|
||||
@NotNull(message = "审批记录id不能为空")
|
||||
private Long auditRecordId;
|
||||
|
||||
@ApiModelProperty("审批意见")
|
||||
@Length(max = 300, message = "审批意见长度不能超过300")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("正式歇业时间")
|
||||
private Date actualCloseDate;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 营业申请Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpOpenApplyRequest {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("源申请单id")
|
||||
@NotNull(message = "源申请单id不能为空")
|
||||
private Long sourceApplyId;
|
||||
|
||||
@ApiModelProperty("实际开业日期")
|
||||
@NotNull(message = "实际开业日期不能为空")
|
||||
private Date actualOpenDate;
|
||||
|
||||
@ApiModelProperty("原因说明")
|
||||
private String reason;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 平台关闭开启处理Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/12
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpPlatformHandleRequest {
|
||||
@ApiModelProperty("id")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("状态:0-待处理, 1-已处理")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 申请单查询Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("申请单类型,0-歇业 1-开业")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("加盟商姓名或手机号")
|
||||
private String lineKeyword;
|
||||
|
||||
@ApiModelProperty("门店名称或编码")
|
||||
private String storeKeyword;
|
||||
|
||||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("计划歇业开始时间")
|
||||
private Date beginPlanCloseDate;
|
||||
|
||||
@ApiModelProperty("计划歇业结束时间")
|
||||
private Date endPlanCloseDate;
|
||||
|
||||
@ApiModelProperty("实际开业开始时间")
|
||||
private Date beginActualOpenDate;
|
||||
|
||||
@ApiModelProperty("实际开业结束时间")
|
||||
private Date endActualOpenDate;
|
||||
|
||||
@ApiModelProperty("所属品牌")
|
||||
private Integer joinBrand;
|
||||
|
||||
@ApiModelProperty("申请单号")
|
||||
private String applyNo;
|
||||
|
||||
@ApiModelProperty("歇业申请单号(恢复申请单使用)")
|
||||
private String closeUpApplyNo;
|
||||
|
||||
@ApiModelProperty(value = "管辖区域id", hidden = true)
|
||||
private List<String> regionIds;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.store.request.closeup;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请待办查询Request
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpTodoQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("类型,0歇业申请 1开业申请")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("门店名称或编码")
|
||||
private String storeKeyword;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.cool.store.vo.closeup;
|
||||
|
||||
import com.cool.store.enums.closeup.CloseUpStatusEnum;
|
||||
import com.cool.store.enums.master.BrandTypeEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请单简单列表VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpApplyFormSimpleVO {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("审批id")
|
||||
private Long auditId;
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("门店名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty("门店编码")
|
||||
private String storeNum;
|
||||
|
||||
@ApiModelProperty("所属品牌")
|
||||
private Integer joinBrand;
|
||||
|
||||
@ApiModelProperty("所属品牌名称")
|
||||
private String joinBrandName;
|
||||
|
||||
@ApiModelProperty("申请单号")
|
||||
private String applyNo;
|
||||
|
||||
@ApiModelProperty("歇业申请单号")
|
||||
private String closeUpApplyNo;
|
||||
|
||||
@ApiModelProperty("线索id")
|
||||
private Long lineId;
|
||||
|
||||
@ApiModelProperty("申请人手机号")
|
||||
private String applyMobile;
|
||||
|
||||
@ApiModelProperty("申请人名称")
|
||||
private String applyName;
|
||||
|
||||
@ApiModelProperty("申请人角色")
|
||||
private String applyRoleName;
|
||||
|
||||
@ApiModelProperty("状态,1-审批中 5-审批拒绝 10-审批通过 15-申请营业中 20-申请营业审批拒绝 25-申请营业审批通过")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("状态名称")
|
||||
private String statusName;
|
||||
|
||||
@ApiModelProperty("计划歇业日期")
|
||||
private Date planCloseDate;
|
||||
|
||||
@ApiModelProperty("实际歇业日期")
|
||||
private Date actualCloseDate;
|
||||
|
||||
@ApiModelProperty("计划开业日期")
|
||||
private Date planOpenDate;
|
||||
|
||||
@ApiModelProperty("实际开业日期")
|
||||
private Date actualOpenDate;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "源申请单id", hidden = true)
|
||||
private Long sourceApplyId;
|
||||
|
||||
public String getStatusName() {
|
||||
return CloseUpStatusEnum.getDesc(status);
|
||||
}
|
||||
|
||||
public String getJoinBrandName() {
|
||||
return BrandTypeEnum.getDescByCode(joinBrand);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.cool.store.vo.closeup;
|
||||
|
||||
import com.cool.store.enums.closeup.CloseUpStatusEnum;
|
||||
import com.cool.store.enums.master.BrandTypeEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请单VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpApplyFormVO {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("审批单id")
|
||||
private Long auditId;
|
||||
|
||||
@ApiModelProperty("类型,0歇业申请 1开业申请")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("门店名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty("门店编码")
|
||||
private String storeNum;
|
||||
|
||||
@ApiModelProperty("所属品牌")
|
||||
private Integer joinBrand;
|
||||
|
||||
@ApiModelProperty("所属品牌名称")
|
||||
private String joinBrandName;
|
||||
|
||||
@ApiModelProperty("申请单号")
|
||||
private String applyNo;
|
||||
|
||||
@ApiModelProperty("线索id")
|
||||
private Long lineId;
|
||||
|
||||
@ApiModelProperty("申请人手机号")
|
||||
private String applyMobile;
|
||||
|
||||
@ApiModelProperty("申请人名称")
|
||||
private String applyName;
|
||||
|
||||
@ApiModelProperty("申请人角色")
|
||||
private String applyRoleName;
|
||||
|
||||
@ApiModelProperty("状态,1-审批中 5-审批拒绝 10-审批通过")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("状态名称")
|
||||
private String statusName;
|
||||
|
||||
@ApiModelProperty("计划歇业日期")
|
||||
private Date planCloseDate;
|
||||
|
||||
@ApiModelProperty("实际歇业日期")
|
||||
private Date actualCloseDate;
|
||||
|
||||
@ApiModelProperty("计划开业日期")
|
||||
private Date planOpenDate;
|
||||
|
||||
@ApiModelProperty("实际开业日期")
|
||||
private Date actualOpenDate;
|
||||
|
||||
@ApiModelProperty("附件列表")
|
||||
private String urls;
|
||||
|
||||
@ApiModelProperty("原因说明")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty("审批拒绝原因")
|
||||
private String rejectReason;
|
||||
|
||||
public String getJoinBrandName() {
|
||||
return BrandTypeEnum.getDescByCode(joinBrand);
|
||||
}
|
||||
|
||||
public String getStatusName() {
|
||||
return CloseUpStatusEnum.getDesc(status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cool.store.vo.closeup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业开业平台账号VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/9
|
||||
*/
|
||||
@Data
|
||||
public class CloseUpPlatformVO {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("申请单类型,0歇业申请 1开业申请")
|
||||
private Integer applyType;
|
||||
|
||||
@ApiModelProperty("code")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("状态:0-待处理, 1-已处理")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("图标")
|
||||
private String icon;
|
||||
}
|
||||
@@ -40,6 +40,8 @@ public class ConsumerClient {
|
||||
private VisitRecordListener visitRecordListener;
|
||||
@Resource
|
||||
private TpPenaltyAppealListener tpPenaltyAppealListener;
|
||||
@Resource
|
||||
private CloseUpApplyStoreUpdateListener closeUpApplyStoreUpdateListener;
|
||||
|
||||
/**
|
||||
* 获取通用配置
|
||||
@@ -145,4 +147,17 @@ public class ConsumerClient {
|
||||
return consumerBean;
|
||||
}
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||
public ConsumerBean closeUpApplyStoreUpdate() {
|
||||
RocketMqGroupEnum groupEnum = RocketMqGroupEnum.CLOSE_UP_APPLY_STORE_UPDATE;
|
||||
ConsumerBean consumerBean = new ConsumerBean();
|
||||
//配置文件
|
||||
Properties properties = getCommonProperties(groupEnum);
|
||||
consumerBean.setProperties(properties);
|
||||
Map<Subscription, MessageListener> commonSubscriptionTable = getCommonSubscriptionTable(groupEnum, closeUpApplyStoreUpdateListener);
|
||||
//订阅多个topic如上面设置
|
||||
consumerBean.setSubscriptionTable(commonSubscriptionTable);
|
||||
return consumerBean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.cool.store.mq.consumer.listener;
|
||||
|
||||
import com.aliyun.openservices.ons.api.Action;
|
||||
import com.aliyun.openservices.ons.api.ConsumeContext;
|
||||
import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.MessageListener;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.service.closeup.CloseUpService;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业申请修改门店状态
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CloseUpApplyStoreUpdateListener implements MessageListener {
|
||||
private final RedisUtilPool redisUtilPool;
|
||||
private final CloseUpService closeUpService;
|
||||
|
||||
@Override
|
||||
public Action consume(Message message, ConsumeContext consumeContext) {
|
||||
String text = new String(message.getBody());
|
||||
if (StringUtils.isBlank(text)) {
|
||||
log.info("消息体为空,tag:{},messageId:{}", message.getTag(), message.getMsgID());
|
||||
return Action.CommitMessage;
|
||||
}
|
||||
String lockKey = "CloseUpApplyStoreUpdateListener:" + message.getMsgID();
|
||||
boolean lock = redisUtilPool.setNxExpire(lockKey, message.getMsgID(), CommonConstants.NORMAL_LOCK_TIMES);
|
||||
if (lock) {
|
||||
try {
|
||||
closeUpService.storeStatusAndPlatformUpdate(Long.valueOf(text));
|
||||
} catch (Exception e) {
|
||||
log.error("CloseUpApplyStoreUpdateListener consume error", e);
|
||||
return Action.ReconsumeLater;
|
||||
} finally {
|
||||
redisUtilPool.delKey(lockKey);
|
||||
}
|
||||
log.info("消费成功,tag:{},messageId:{},reqBody={}", message.getTag(), message.getMsgID(), text);
|
||||
return Action.CommitMessage;
|
||||
}
|
||||
return Action.ReconsumeLater;
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public class CloseStoreServiceImpl implements CloseStoreService {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CloseStoreAuditRecordDO auditRecordDO = list.get(i);
|
||||
AuditInfoResponse auditInfo = AuditInfoResponse.builder()
|
||||
.type(getAuditInfoType(auditRecordDO))
|
||||
.type(getAuditInfoType(auditRecordDO.getRecordType(), auditRecordDO.getAuditStatus()))
|
||||
// 0加盟商发起 1云流水发起 2督导审批 3大区经理审批
|
||||
.execute(i == 0 ? (CloseTypeEnum.INITIATE.getCloseType().equals(closeStoreInfoDO.getCloseType()) ? 0 : 1) : i + 1)
|
||||
.status(CommonConstants.INDEX_ZERO.equals(auditRecordDO.getAuditStatus()) ? 0 : 1)
|
||||
@@ -324,11 +324,11 @@ public class CloseStoreServiceImpl implements CloseStoreService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Integer getAuditInfoType(CloseStoreAuditRecordDO auditRecordDO) {
|
||||
if (CommonConstants.INDEX_ONE.equals(auditRecordDO.getRecordType())) {
|
||||
public static Integer getAuditInfoType(Integer recordType, Integer auditStatus) {
|
||||
if (CommonConstants.INDEX_ONE.equals(recordType)) {
|
||||
return OperationLogAuditEnum.SUBMIT_AUDIT.getCode();
|
||||
} else {
|
||||
switch (auditRecordDO.getAuditStatus()) {
|
||||
switch (auditStatus) {
|
||||
case 0:
|
||||
return OperationLogAuditEnum.WAIT_AUDIT.getCode();
|
||||
case 1:
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.cool.store.service.closeup;
|
||||
|
||||
import com.cool.store.request.closeup.*;
|
||||
import com.cool.store.response.AuditInfoResponse;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormSimpleVO;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormVO;
|
||||
import com.cool.store.vo.closeup.CloseUpPlatformVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业管理
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
public interface CloseUpService {
|
||||
|
||||
/**
|
||||
* 歇业申请
|
||||
*/
|
||||
Boolean closeUpApply(CloseUpApplyRequest request);
|
||||
|
||||
/**
|
||||
* 恢复营业申请
|
||||
*/
|
||||
Boolean openApply(CloseUpOpenApplyRequest request);
|
||||
|
||||
/**
|
||||
* 审批通过
|
||||
*/
|
||||
Boolean auditPass(CloseUpAuditRequest request);
|
||||
|
||||
/**
|
||||
* 审批拒绝
|
||||
*/
|
||||
Boolean auditRejected(CloseUpAuditRequest request);
|
||||
|
||||
/**
|
||||
* 小程序歇业申请单分页查询
|
||||
*/
|
||||
PageInfo<CloseUpApplyFormSimpleVO> miniApplyFormList(CloseUpApplySimpleQueryRequest request);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
CloseUpApplyFormVO getDetail(Long applyId);
|
||||
|
||||
/**
|
||||
* 待办列表
|
||||
*/
|
||||
PageInfo<CloseUpApplyFormSimpleVO> todoList(CloseUpTodoQueryRequest request);
|
||||
|
||||
/**
|
||||
* 申请列表
|
||||
*/
|
||||
PageInfo<CloseUpApplyFormSimpleVO> applyList(CloseUpQueryRequest request);
|
||||
|
||||
/**
|
||||
* 根据申请单id查询歇业开业平台账号
|
||||
*/
|
||||
List<CloseUpPlatformVO> getPlatformListByApplyId(Long applyId);
|
||||
|
||||
/**
|
||||
* 查询审批记录
|
||||
*/
|
||||
List<AuditInfoResponse> getAuditRecordList(Long applyId);
|
||||
|
||||
/**
|
||||
* 平台待办列表
|
||||
*/
|
||||
PageInfo<CloseUpApplyFormSimpleVO> getPlatformTodoList(CloseUpTodoQueryRequest request);
|
||||
|
||||
/**
|
||||
* 门店状态变更
|
||||
* @param formId 申请单id
|
||||
*/
|
||||
void storeStatusAndPlatformUpdate(Long formId);
|
||||
|
||||
/**
|
||||
* 平台关闭开启处理
|
||||
*/
|
||||
Boolean handlePlatform(CloseUpPlatformHandleRequest request);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.cool.store.service.closeup;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业平台自动开闭店
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
public interface PlatformAutoStrategy {
|
||||
|
||||
String getCode();
|
||||
|
||||
Boolean close();
|
||||
|
||||
Boolean open();
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
package com.cool.store.service.closeup.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dao.closeup.CloseUpApplyFormDAO;
|
||||
import com.cool.store.dao.closeup.CloseUpAuditRecordDAO;
|
||||
import com.cool.store.dao.closeup.CloseUpPlatformDAO;
|
||||
import com.cool.store.dto.store.StoreMasterIssueDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.entity.closeup.CloseUpApplyFormDO;
|
||||
import com.cool.store.entity.closeup.CloseUpAuditRecordDO;
|
||||
import com.cool.store.entity.closeup.CloseUpPlatformDO;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.enums.close.CloseStoreAuditStatusEnum;
|
||||
import com.cool.store.enums.closeup.CloseUpStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mq.producer.SimpleMessageService;
|
||||
import com.cool.store.request.closeup.*;
|
||||
import com.cool.store.response.AuditInfoResponse;
|
||||
import com.cool.store.service.UserAuthMappingService;
|
||||
import com.cool.store.service.closeup.CloseUpService;
|
||||
import com.cool.store.service.closeup.PlatformAutoStrategy;
|
||||
import com.cool.store.service.sms.AliyunSmsService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormSimpleVO;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormVO;
|
||||
import com.cool.store.vo.closeup.CloseUpPlatformVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cool.store.service.close.impl.CloseStoreServiceImpl.getAuditInfoType;
|
||||
import static com.cool.store.utils.GenerateNoUtil.generateMillsNoWithRandom;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业管理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CloseUpServiceImpl implements CloseUpService {
|
||||
private final CloseUpApplyFormDAO applyFormDAO;
|
||||
private final CloseUpAuditRecordDAO auditRecordDAO;
|
||||
private final CloseUpPlatformDAO platformDAO;
|
||||
private final UserAuthMappingService userAuthMappingService;
|
||||
private final RegionDao regionDao;
|
||||
private final StoreDao storeDao;
|
||||
private final SimpleMessageService simpleMessageService;
|
||||
private final PlatformAutoFactory platformAutoFactory;
|
||||
private final EnterpriseUserRoleDao enterpriseUserRoleDao;
|
||||
private final LineInfoDAO lineInfoDAO;
|
||||
private final EnterpriseUserDAO enterpriseUserDAO;
|
||||
private final AliyunSmsService aliyunSmsService;
|
||||
|
||||
@Value("${mybatis.configuration.variables.enterpriseId}")
|
||||
private String enterpriseId;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean closeUpApply(CloseUpApplyRequest request) {
|
||||
// 查询当前当前门店 校验门店状态
|
||||
StoreDO store = storeDao.getByStoreId(request.getStoreId());
|
||||
if (store == null){
|
||||
throw new ServiceException(ErrorCodeEnum.STORE_NOT_EXIST);
|
||||
}
|
||||
if (DateUtil.betweenDay(request.getPlanCloseDate(), request.getPlanOpenDate(), true) >= 7
|
||||
&& StringUtils.isBlank(request.getUrls())) {
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "歇业时间大于7天,歇业检查清单不能为空");
|
||||
}
|
||||
// 校验是否存在时间交集的申请单(非审批拒绝状态)
|
||||
if (applyFormDAO.existsTimeOverlap(request.getStoreId(), request.getPlanCloseDate(), request.getPlanOpenDate())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_EXIST_ONGOING_RECORD);
|
||||
}
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
CloseUpApplyFormDO formDO = BeanUtil.toBean(request, CloseUpApplyFormDO.class);
|
||||
formDO.setType(0);
|
||||
formDO.setApplyNo(generateMillsNoWithRandom());
|
||||
formDO.setStatus(CloseUpStatusEnum.APPROVAL.getStatus());
|
||||
formDO.setLineId(user.getLineId());
|
||||
applyFormDAO.insertOrUpdate(formDO);
|
||||
RegionDO regionDO = regionDao.getRegionByStoreId(request.getStoreId());
|
||||
if (Objects.isNull(regionDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.REGION_NOT_EXIST);
|
||||
}
|
||||
// 运营顾问审批
|
||||
List<String> auditUserIds = getAuditUserIds(regionDO.getId(), UserRoleEnum.SUPERVISION);
|
||||
auditRecordDAO.addRecord(formDO.getId(), formDO.getType(), String.valueOf(user.getLineId()), user.getUsername(), auditUserIds);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean openApply(CloseUpOpenApplyRequest request) {
|
||||
CloseUpApplyFormDO sourceFormDO = applyFormDAO.getById(request.getSourceApplyId());
|
||||
if (Objects.isNull(sourceFormDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_FORM_NOT_EXIST);
|
||||
}
|
||||
StoreDO store = storeDao.getByStoreId(sourceFormDO.getStoreId());
|
||||
if (store == null){
|
||||
throw new ServiceException(ErrorCodeEnum.STORE_NOT_EXIST);
|
||||
}
|
||||
if (CloseUpStatusEnum.unPass(sourceFormDO.getStatus())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_CLOSED_AUDIT_NOT_PASS);
|
||||
}
|
||||
if (applyFormDAO.existOpenApply(request.getSourceApplyId())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_EXIST_OPEN_APPLY);
|
||||
}
|
||||
CloseUpApplyFormDO openFormDO = CloseUpApplyFormDO.builder()
|
||||
.type(1)
|
||||
.applyNo(generateMillsNoWithRandom())
|
||||
.storeId(sourceFormDO.getStoreId())
|
||||
.lineId(sourceFormDO.getLineId())
|
||||
.status(CloseUpStatusEnum.APPROVAL.getStatus())
|
||||
.planCloseDate(sourceFormDO.getPlanCloseDate())
|
||||
.actualCloseDate(sourceFormDO.getActualCloseDate())
|
||||
.planOpenDate(sourceFormDO.getPlanOpenDate())
|
||||
.actualOpenDate(request.getActualOpenDate())
|
||||
.reason(request.getReason())
|
||||
.sourceApplyId(request.getSourceApplyId())
|
||||
.build();
|
||||
applyFormDAO.insertOrUpdate(openFormDO);
|
||||
// 修改源歇业申请单状态
|
||||
CloseUpApplyFormDO updateSourceForm = CloseUpApplyFormDO.builder()
|
||||
.id(sourceFormDO.getId())
|
||||
.status(CloseUpStatusEnum.APPLY_OPEN.getStatus())
|
||||
.build();
|
||||
applyFormDAO.updateByPrimaryKeySelective(updateSourceForm);
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
RegionDO regionDO = regionDao.getRegionByStoreId(sourceFormDO.getStoreId());
|
||||
if (Objects.isNull(regionDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.REGION_NOT_EXIST);
|
||||
}
|
||||
// 运营顾问审批
|
||||
List<String> auditUserIds = getAuditUserIds(regionDO.getId(), UserRoleEnum.SUPERVISION);
|
||||
auditRecordDAO.addRecord(openFormDO.getId(), openFormDO.getType(), String.valueOf(user.getLineId()), user.getUsername(), auditUserIds);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean auditPass(CloseUpAuditRequest request) {
|
||||
CloseUpAuditRecordDO auditRecord = auditRecordDAO.getById(request.getAuditRecordId());
|
||||
if (Objects.isNull(auditRecord)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_AUDIT_RECORD_NOT_EXIST);
|
||||
}
|
||||
CloseUpApplyFormDO formDO = applyFormDAO.getById(auditRecord.getApplyId());
|
||||
if (Objects.isNull(formDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_FORM_NOT_EXIST);
|
||||
}
|
||||
if (!CloseUpStatusEnum.APPROVAL.getStatus().equals(formDO.getStatus())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_APPROVED);
|
||||
}
|
||||
// 校验审批权限并修改审批单状态
|
||||
verifyAuthAndUpdateAuditStatus(auditRecord, CloseStoreAuditStatusEnum.PASS.getStatus(), request.getRemark());
|
||||
// 更新申请单状态
|
||||
Date actualCloseDate = Objects.nonNull(request.getActualCloseDate()) ? request.getActualCloseDate() : formDO.getPlanCloseDate();
|
||||
formDO.setActualCloseDate(actualCloseDate);
|
||||
CloseUpApplyFormDO updateFormDO = CloseUpApplyFormDO.builder()
|
||||
.id(formDO.getId())
|
||||
.status(CloseUpStatusEnum.PASS.getStatus())
|
||||
.actualCloseDate(formDO.getType().equals(0) ? actualCloseDate : null)
|
||||
.build();
|
||||
applyFormDAO.updateByPrimaryKeySelective(updateFormDO);
|
||||
if (formDO.getType().equals(0)) {
|
||||
closeExecute(formDO);
|
||||
} else if (formDO.getType().equals(1)) {
|
||||
openExecute(formDO);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void openExecute(CloseUpApplyFormDO formDO) {
|
||||
// 根据营业时间判断直接修改主数据还是定时任务修改主数据
|
||||
if (formDO.getActualOpenDate().after(new Date())) {
|
||||
// 发送延时任务
|
||||
log.info("发送延时任务");
|
||||
simpleMessageService.send(String.valueOf(formDO.getId()), RocketMqTagEnum.CLOSE_UP_APPLY_STORE_UPDATE, formDO.getPlanOpenDate().getTime());
|
||||
} else {
|
||||
log.info("直接变更");
|
||||
storeStatusAndPlatformUpdate(formDO.getStoreId(), formDO.getId(), formDO.getType(), formDO.getSourceApplyId(), false);
|
||||
}
|
||||
// 修改源歇业申请单
|
||||
CloseUpApplyFormDO updateSourceForm = CloseUpApplyFormDO.builder()
|
||||
.id(formDO.getSourceApplyId())
|
||||
.actualOpenDate(formDO.getActualOpenDate())
|
||||
.status(CloseUpStatusEnum.APPLY_OPEN_PASS.getStatus())
|
||||
.build();
|
||||
applyFormDAO.updateByPrimaryKeySelective(updateSourceForm);
|
||||
// 初始化各外卖团购平台账号
|
||||
List<CloseUpPlatformDO> platformList = platformDAO.init(formDO.getId(), formDO.getType(), formDO.getActualOpenDate());
|
||||
// 根据平台类型自动开启
|
||||
autoPlatform(formDO.getType(), platformList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 歇业执行操作
|
||||
*/
|
||||
private void closeExecute(CloseUpApplyFormDO formDO) {
|
||||
Date now = new Date();
|
||||
// 过去的单据不处理
|
||||
if (Objects.nonNull(formDO.getActualOpenDate()) && formDO.getActualOpenDate().before(now)
|
||||
|| Objects.isNull(formDO.getActualOpenDate()) && formDO.getPlanOpenDate().before(now)) {
|
||||
return;
|
||||
}
|
||||
// 根据实际闭店时间判断直接修改主数据还是定时任务修改主数据
|
||||
if (formDO.getActualCloseDate().after(now)) {
|
||||
// 发送延时任务
|
||||
log.info("发送延时任务");
|
||||
simpleMessageService.send(String.valueOf(formDO.getId()), RocketMqTagEnum.CLOSE_UP_APPLY_STORE_UPDATE, formDO.getActualCloseDate().getTime());
|
||||
} else {
|
||||
log.info("直接变更");
|
||||
storeStatusAndPlatformUpdate(formDO.getStoreId(), formDO.getId(), formDO.getType(), formDO.getSourceApplyId(), false);
|
||||
}
|
||||
// 初始化各外卖团购平台账号
|
||||
List<CloseUpPlatformDO> platformList = platformDAO.init(formDO.getId(), formDO.getType(), formDO.getActualCloseDate());
|
||||
// 根据平台类型自动关闭
|
||||
autoPlatform(formDO.getType(), platformList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean auditRejected(CloseUpAuditRequest request) {
|
||||
CloseUpAuditRecordDO auditRecord = auditRecordDAO.getById(request.getAuditRecordId());
|
||||
if (Objects.isNull(auditRecord)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_AUDIT_RECORD_NOT_EXIST);
|
||||
}
|
||||
CloseUpApplyFormDO formDO = applyFormDAO.getById(auditRecord.getApplyId());
|
||||
if (Objects.isNull(formDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_FORM_NOT_EXIST);
|
||||
}
|
||||
if (!CloseUpStatusEnum.APPROVAL.getStatus().equals(formDO.getStatus())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_APPROVED);
|
||||
}
|
||||
// 校验审批权限并修改审批单状态
|
||||
verifyAuthAndUpdateAuditStatus(auditRecord, CloseStoreAuditStatusEnum.REJECTED.getStatus(), request.getRemark());
|
||||
// 修改申请单
|
||||
CloseUpApplyFormDO updateFormDO = CloseUpApplyFormDO.builder()
|
||||
.id(formDO.getId())
|
||||
.status(CloseUpStatusEnum.REJECTED.getStatus())
|
||||
.build();
|
||||
applyFormDAO.updateByPrimaryKeySelective(updateFormDO);
|
||||
// 营业申请修改源单据状态
|
||||
if (formDO.getType().equals(1)) {
|
||||
CloseUpApplyFormDO updateSourceFormDO = CloseUpApplyFormDO.builder()
|
||||
.id(formDO.getSourceApplyId())
|
||||
.status(CloseUpStatusEnum.APPLY_OPEN_REJECTED.getStatus())
|
||||
.build();
|
||||
applyFormDAO.updateByPrimaryKeySelective(updateSourceFormDO);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CloseUpApplyFormSimpleVO> miniApplyFormList(CloseUpApplySimpleQueryRequest request) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<CloseUpApplyFormDO> list = applyFormDAO.getList(user.getLineId(), 0, request.getStoreId());
|
||||
PageInfo<CloseUpApplyFormSimpleVO> page = BeanUtil.toPage(new PageInfo<>(list), CloseUpApplyFormSimpleVO.class);
|
||||
fillSimpleField(page.getList());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseUpApplyFormVO getDetail(Long applyId) {
|
||||
CloseUpApplyFormDO formDO = applyFormDAO.getById(applyId);
|
||||
if (Objects.nonNull(formDO)) {
|
||||
CloseUpApplyFormVO vo = BeanUtil.toBean(formDO, CloseUpApplyFormVO.class);
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(formDO.getLineId());
|
||||
StoreDO storeDO = storeDao.getByStoreId(formDO.getStoreId());
|
||||
vo.setApplyName(lineInfo.getUsername());
|
||||
vo.setApplyMobile(lineInfo.getMobile());
|
||||
vo.setApplyRoleName("加盟商");
|
||||
vo.setStoreName(storeDO.getStoreName());
|
||||
vo.setStoreNum(storeDO.getStoreNum());
|
||||
vo.setJoinBrand(storeDO.getJoinBrand());
|
||||
// 查询审批记录
|
||||
if (CloseUpStatusEnum.REJECTED.getStatus().equals(formDO.getStatus())) {
|
||||
CloseUpAuditRecordDO auditRecord = auditRecordDAO.getLatestRecordByStatus(applyId, CloseStoreAuditStatusEnum.REJECTED.getStatus());
|
||||
if (Objects.nonNull(auditRecord)) {
|
||||
vo.setRejectReason(auditRecord.getActionRemark());
|
||||
}
|
||||
} else if (CloseUpStatusEnum.APPLY_OPEN_REJECTED.getStatus().equals(formDO.getStatus())) {
|
||||
CloseUpApplyFormDO resumeForm = applyFormDAO.getBySourceApplyId(applyId);
|
||||
CloseUpAuditRecordDO auditRecord = auditRecordDAO.getLatestRecordByStatus(resumeForm.getId(), CloseStoreAuditStatusEnum.REJECTED.getStatus());
|
||||
if (Objects.nonNull(auditRecord)) {
|
||||
vo.setRejectReason(auditRecord.getActionRemark());
|
||||
}
|
||||
} else {
|
||||
CloseUpAuditRecordDO auditRecord = auditRecordDAO.getOngoingRecordByApplyId(applyId);
|
||||
if (Objects.nonNull(auditRecord)) {
|
||||
vo.setAuditId(auditRecord.getId());
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CloseUpApplyFormSimpleVO> todoList(CloseUpTodoQueryRequest request) {
|
||||
LoginUserInfo user = CurrentUserHolder.getUser();
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<CloseUpAuditRecordDO> list = auditRecordDAO.getList(user.getUserId(), request.getType(), 0);
|
||||
PageInfo<CloseUpAuditRecordDO> page = new PageInfo<>(list);
|
||||
|
||||
List<Long> applyIds = CollStreamUtil.toList(list, CloseUpAuditRecordDO::getApplyId);
|
||||
List<CloseUpApplyFormDO> forms = applyFormDAO.getByIds(applyIds);
|
||||
Map<Long, CloseUpApplyFormDO> formMap = CollStreamUtil.toMap(forms, CloseUpApplyFormDO::getId, v -> v);
|
||||
|
||||
List<CloseUpApplyFormSimpleVO> resultList = CollStreamUtil.toList(list, v -> {
|
||||
CloseUpApplyFormDO formDO = formMap.get(v.getApplyId());
|
||||
CloseUpApplyFormSimpleVO vo = BeanUtil.toBean(formDO, CloseUpApplyFormSimpleVO.class);
|
||||
vo.setAuditId(v.getId());
|
||||
return vo;
|
||||
});
|
||||
fillSimpleField(resultList);
|
||||
return BeanUtil.toPage(page, resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充信息
|
||||
*/
|
||||
private void fillSimpleField(List<CloseUpApplyFormSimpleVO> list) {
|
||||
Set<Long> lineIds = CollStreamUtil.toSet(list, CloseUpApplyFormSimpleVO::getLineId);
|
||||
Set<String> storeIds = CollStreamUtil.toSet(list, CloseUpApplyFormSimpleVO::getStoreId);
|
||||
List<LineInfoDO> lines = lineInfoDAO.getByLineIds(new ArrayList<>(lineIds));
|
||||
Map<Long, LineInfoDO> lineMap = CollStreamUtil.toMap(lines, LineInfoDO::getId, v -> v);
|
||||
Map<String, StoreDO> storeMap = storeDao.getStoreMapByStoreIds(new ArrayList<>(storeIds));
|
||||
Set<Long> sourceApplyIds = list.stream()
|
||||
.map(CloseUpApplyFormSimpleVO::getSourceApplyId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
List<CloseUpApplyFormDO> closeUpApplyList = applyFormDAO.getByIds(new ArrayList<>(sourceApplyIds));
|
||||
Map<Long, CloseUpApplyFormDO> sourceApplyMap = CollStreamUtil.toMap(closeUpApplyList, CloseUpApplyFormDO::getId, v -> v);
|
||||
|
||||
for (CloseUpApplyFormSimpleVO vo : list) {
|
||||
LineInfoDO lineInfoDO = lineMap.get(vo.getLineId());
|
||||
if (Objects.nonNull(lineInfoDO)) {
|
||||
vo.setApplyMobile(lineInfoDO.getMobile());
|
||||
vo.setApplyName(lineInfoDO.getUsername());
|
||||
vo.setApplyRoleName("加盟商");
|
||||
}
|
||||
StoreDO storeDO = storeMap.get(vo.getStoreId());
|
||||
if (Objects.nonNull(storeDO)) {
|
||||
vo.setStoreName(storeDO.getStoreName());
|
||||
vo.setStoreNum(storeDO.getStoreNum());
|
||||
vo.setJoinBrand(storeDO.getJoinBrand());
|
||||
}
|
||||
CloseUpApplyFormDO sourceApplyForm = sourceApplyMap.get(vo.getSourceApplyId());
|
||||
if (Objects.nonNull(sourceApplyForm)) {
|
||||
vo.setCloseUpApplyNo(sourceApplyForm.getApplyNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CloseUpApplyFormSimpleVO> applyList(CloseUpQueryRequest request) {
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
Boolean isAdmin = enterpriseUserRoleDao.checkIsAdmin(userId);
|
||||
if (!isAdmin) {
|
||||
List<UserAuthMappingDO> userAuthMappingDOS = userAuthMappingService.listUserAuthMappingByUserId(userId);
|
||||
if (CollectionUtils.isEmpty(userAuthMappingDOS)) {
|
||||
return new PageInfo<>();
|
||||
}
|
||||
request.setRegionIds(CollStreamUtil.toList(userAuthMappingDOS, UserAuthMappingDO::getMappingId));
|
||||
}
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<CloseUpApplyFormDO> list = applyFormDAO.getList(request);
|
||||
PageInfo<CloseUpApplyFormSimpleVO> page = BeanUtil.toPage(new PageInfo<>(list), CloseUpApplyFormSimpleVO.class);
|
||||
fillSimpleField(page.getList());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloseUpPlatformVO> getPlatformListByApplyId(Long applyId) {
|
||||
List<CloseUpPlatformDO> list = platformDAO.getList(applyId, null, null);
|
||||
return BeanUtil.toList(list, CloseUpPlatformVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuditInfoResponse> getAuditRecordList(Long applyId) {
|
||||
List<CloseUpAuditRecordDO> list = auditRecordDAO.getListByApplyId(applyId);
|
||||
Set<String> userIds = new HashSet<>();
|
||||
list.forEach(v -> {
|
||||
if (!CommonConstants.INDEX_ONE.equals(v.getRecordType())) {
|
||||
userIds.addAll(StringUtils.isNotBlank(v.getHandlerUserIds()) ? Arrays.asList(v.getHandlerUserIds().split(",")) : Collections.emptyList());
|
||||
}
|
||||
});
|
||||
Map<String, EnterpriseUserDO> userMap = enterpriseUserDAO.getUserMap(new ArrayList<>(userIds));
|
||||
List<AuditInfoResponse> result = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CloseUpAuditRecordDO auditRecordDO = list.get(i);
|
||||
AuditInfoResponse auditInfo = AuditInfoResponse.builder()
|
||||
.type(getAuditInfoType(auditRecordDO.getRecordType(), auditRecordDO.getAuditStatus()))
|
||||
// 0加盟商发起 1运营顾问审批
|
||||
.execute(CommonConstants.INDEX_ONE.equals(auditRecordDO.getRecordType()) ? 0 : 1)
|
||||
.status(CommonConstants.INDEX_ZERO.equals(auditRecordDO.getAuditStatus()) ? 0 : 1)
|
||||
.createTime(auditRecordDO.getCreateTime())
|
||||
.remark(auditRecordDO.getActionRemark())
|
||||
.actualUserId(auditRecordDO.getHandlerUserId())
|
||||
.build();
|
||||
List<AuditInfoResponse.AuditUserInfoVO> auditUserList = Arrays.stream(auditRecordDO.getHandlerUserIds().split(","))
|
||||
.filter(com.cool.store.utils.poi.StringUtils::isNotBlank)
|
||||
.map(v -> {
|
||||
String userName = null, avatar = null;
|
||||
if (CommonConstants.INDEX_ZERO.equals(auditInfo.getExecute())) {
|
||||
userName = auditRecordDO.getHandlerUserName();
|
||||
} else {
|
||||
EnterpriseUserDO user = userMap.get(v);
|
||||
if (Objects.nonNull(user)) {
|
||||
userName = user.getName();
|
||||
avatar = user.getAvatar();
|
||||
}
|
||||
}
|
||||
return new AuditInfoResponse.AuditUserInfoVO(v, userName, avatar);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
auditInfo.setList(auditUserList);
|
||||
result.add(auditInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CloseUpApplyFormSimpleVO> getPlatformTodoList(CloseUpTodoQueryRequest request) {
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<Long> applyIds = platformDAO.selectTodoApplyIds(request.getType(), request.getStoreKeyword());
|
||||
|
||||
List<CloseUpApplyFormDO> list = applyFormDAO.getByIds(applyIds);
|
||||
List<CloseUpApplyFormSimpleVO> resultList = BeanUtil.toList(list, CloseUpApplyFormSimpleVO.class);
|
||||
PageInfo<CloseUpApplyFormSimpleVO> page = BeanUtil.toPage(new PageInfo<>(applyIds), resultList);
|
||||
fillSimpleField(page.getList());
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验审批权限并修改审批单状态
|
||||
*/
|
||||
private void verifyAuthAndUpdateAuditStatus(CloseUpAuditRecordDO auditRecord, Integer status, String remark) {
|
||||
if (!auditRecord.getAuditStatus().equals(0)) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_APPROVED);
|
||||
}
|
||||
LoginUserInfo user = CurrentUserHolder.getUser();
|
||||
Boolean isAdmin = enterpriseUserRoleDao.checkIsAdmin(user.getUserId());
|
||||
if (!isAdmin) {
|
||||
boolean match = Arrays.stream(auditRecord.getHandlerUserIds().split(","))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.anyMatch(v -> v.equals(user.getUserId()));
|
||||
if (!match) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLOSE_UP_AUDIT_ACCESS_DENIED);
|
||||
}
|
||||
}
|
||||
// 更新审批单状态
|
||||
CloseUpAuditRecordDO updateAuditRecord = new CloseUpAuditRecordDO();
|
||||
updateAuditRecord.setId(auditRecord.getId());
|
||||
updateAuditRecord.setAuditStatus(status);
|
||||
updateAuditRecord.setHandlerUserId(user.getUserId());
|
||||
updateAuditRecord.setHandlerUserName(user.getName());
|
||||
updateAuditRecord.setActionRemark(remark);
|
||||
updateAuditRecord.setFinishTaskTime(new Date());
|
||||
auditRecordDAO.updateByPrimaryKeySelective(updateAuditRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动开启关闭各平台
|
||||
*/
|
||||
private void autoPlatform(Integer applyType, List<CloseUpPlatformDO> list) {
|
||||
List<Long> updateIds = new ArrayList<>();
|
||||
for (CloseUpPlatformDO platformDO : list) {
|
||||
// 待处理且自动关闭
|
||||
if (platformDO.getStatus().equals(0) && platformDO.getType().equals(1) && (new Date()).after(platformDO.getTaskStartDate())) {
|
||||
PlatformAutoStrategy platformAuto = platformAutoFactory.getByCode(platformDO.getCode());
|
||||
if (Objects.isNull(platformAuto)) {
|
||||
log.info("平台不存在实现类, code:{} name:{}", platformDO.getCode(), platformDO.getName());
|
||||
} else {
|
||||
boolean update = false;
|
||||
if (applyType.equals(0)) {
|
||||
update = platformAuto.close();
|
||||
} else if (applyType.equals(1)) {
|
||||
update = platformAuto.open();
|
||||
}
|
||||
if (update) {
|
||||
updateIds.add(platformDO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateIds)) {
|
||||
platformDAO.updateStatusByIds(updateIds, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据申请单修改主数据并处理各外卖团购平台开闭店
|
||||
*/
|
||||
@Override
|
||||
public void storeStatusAndPlatformUpdate(Long formId) {
|
||||
CloseUpApplyFormDO formDO = applyFormDAO.getById(formId);
|
||||
if (Objects.nonNull(formDO)) {
|
||||
storeStatusAndPlatformUpdate(formDO.getStoreId(), formDO.getId(), formDO.getType(), formDO.getSourceApplyId(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean handlePlatform(CloseUpPlatformHandleRequest request) {
|
||||
platformDAO.updateStatusByIds(Collections.singletonList(request.getId()), request.getStatus());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主数据并处理各外卖团购平台开闭店
|
||||
*/
|
||||
private void storeStatusAndPlatformUpdate(String storeId, Long applyId, Integer applyType, Long sourceApplyId, boolean autoPlatform) {
|
||||
StoreDO storeDO = storeDao.getByStoreId(storeId);
|
||||
if (Objects.isNull(storeDO)) {
|
||||
return;
|
||||
}
|
||||
// 主数据状态修改
|
||||
boolean storeUpdate = false;
|
||||
if (applyType.equals(0)) {
|
||||
if (StoreStatusEnum.OPEN.getValue().equals(storeDO.getStoreStatus())) {
|
||||
storeDao.closeUp(storeId, "close_up_special_reason");
|
||||
storeUpdate = true;
|
||||
} else {
|
||||
log.info("门店不处于在营状态,修改为暂停营业失败");
|
||||
}
|
||||
} else {
|
||||
if (StoreStatusEnum.CLOSE_UP.getValue().equals(storeDO.getStoreStatus())) {
|
||||
storeDao.closeUpToOpen(storeId);
|
||||
storeUpdate = true;
|
||||
} else {
|
||||
log.info("门店不处于暂停营业状态,修改为在营失败");
|
||||
}
|
||||
// 删除歇业申请的平台数据
|
||||
if (Objects.nonNull(sourceApplyId)) {
|
||||
platformDAO.deleteByApplyId(sourceApplyId);
|
||||
}
|
||||
}
|
||||
if (autoPlatform) {
|
||||
// 自动开关平台
|
||||
List<CloseUpPlatformDO> platformList = platformDAO.getList(applyId, 0, applyType);
|
||||
autoPlatform(applyType, platformList);
|
||||
}
|
||||
if (StringUtils.isNotBlank(storeDO.getTelephone())) {
|
||||
aliyunSmsService.sendNotice(storeDO.getTelephone(), applyType.equals(0) ? SmsNoticeTypeEnum.CLOSE_UP_CLOSE_NOTICE : SmsNoticeTypeEnum.CLOSE_UP_OPEN_NOTICE);
|
||||
}
|
||||
|
||||
// 用mq通知主应用下发门店主数据
|
||||
if (storeUpdate) {
|
||||
try {
|
||||
StoreMasterIssueDTO storeMasterIssueDTO = new StoreMasterIssueDTO(enterpriseId, Collections.singletonList(storeId));
|
||||
simpleMessageService.send(JSONObject.toJSONString(storeMasterIssueDTO), RocketMqTagEnum.STORE_MASTER_ISSUE);
|
||||
} catch (Exception e) {
|
||||
log.error("mq通知主应用下发门店主数据失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拥有区域管辖权限的指定角色用户
|
||||
* @param regionId 区域id
|
||||
* @param userRoleEnum 角色枚举
|
||||
* @return 用户id列表
|
||||
*/
|
||||
private List<String> getAuditUserIds(Long regionId, UserRoleEnum userRoleEnum) {
|
||||
List<EnterpriseUserDO> allUserByRoleEnumAndRegionId = userAuthMappingService.getAllUserByRoleEnumAndRegionId(userRoleEnum, regionId);
|
||||
return ListUtils.emptyIfNull(allUserByRoleEnumAndRegionId).stream().map(EnterpriseUserDO::getUserId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cool.store.service.closeup.impl;
|
||||
|
||||
import com.cool.store.service.closeup.PlatformAutoStrategy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 默认
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Service
|
||||
public class DefaultPlatformAutoStrategy implements PlatformAutoStrategy {
|
||||
@Override
|
||||
public String getCode() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean close() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean open() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cool.store.service.closeup.impl;
|
||||
|
||||
import com.cool.store.service.closeup.PlatformAutoStrategy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业平台自动开闭店工厂
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Service
|
||||
public class PlatformAutoFactory {
|
||||
private final Map<String , PlatformAutoStrategy> map = new HashMap<>();
|
||||
|
||||
@Autowired
|
||||
public PlatformAutoFactory(PlatformAutoStrategy[] strategies) {
|
||||
for (PlatformAutoStrategy platformAutoStrategy : strategies) {
|
||||
map.put(platformAutoStrategy.getCode(), platformAutoStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
public PlatformAutoStrategy getByCode(String code) {
|
||||
return map.get(code);
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,10 @@ public class CommonService {
|
||||
// private String qywxUrl1;
|
||||
@Value("${qywx.task.notice.url2}")
|
||||
private String qywxUrl2;
|
||||
@Value("${aliyun.sms.private.accessKeyId}")
|
||||
private String smsPrivateAccessKeyId;
|
||||
@Value("${aliyun.sms.private.accessKeySecret}")
|
||||
private String smsPrivateAccessKeySecret;
|
||||
|
||||
public LineFlowService getLineFlowService(Integer workflowSubStage){
|
||||
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(workflowSubStage);
|
||||
@@ -134,17 +138,36 @@ public class CommonService {
|
||||
}
|
||||
|
||||
public void sendSms(List<String> poneNumbers, String templateCode, Map<String, String> templateParamMap){
|
||||
log.info("templateCode:{}, request:{}, poneNumbers:{}", templateCode, JSONObject.toJSONString(templateParamMap), JSONObject.toJSONString(poneNumbers));
|
||||
if(CollectionUtils.isEmpty(poneNumbers)){
|
||||
return;
|
||||
}
|
||||
sendSms(poneNumbers, templateCode, "杭州好多店智能科技", templateParamMap, smsAccessKeyId, smsAccessKeySecret);
|
||||
}
|
||||
|
||||
public void privateSendSms(List<String> poneNumbers, String templateCode, String signName, Map<String, String> templateParamMap) {
|
||||
if(CollectionUtils.isEmpty(poneNumbers)){
|
||||
return;
|
||||
}
|
||||
sendSms(poneNumbers, templateCode, signName, templateParamMap, smsPrivateAccessKeyId, smsPrivateAccessKeySecret);
|
||||
}
|
||||
|
||||
public void sendSms(List<String> poneNumbers,
|
||||
String templateCode,
|
||||
String signName,
|
||||
Map<String, String> templateParamMap,
|
||||
String accessKeyId,
|
||||
String accessKeySecret) {
|
||||
log.info("templateCode:{}, signName:{}, request:{}, poneNumbers:{}", templateCode, signName, JSONObject.toJSONString(templateParamMap), JSONObject.toJSONString(poneNumbers));
|
||||
if (CollectionUtils.isEmpty(poneNumbers)) {
|
||||
return;
|
||||
}
|
||||
List<String> signNameList = new ArrayList<>();
|
||||
signNameList.add("杭州好多店智能科技");
|
||||
signNameList.add(signName);
|
||||
AsyncClient client = null;
|
||||
try {
|
||||
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
|
||||
.accessKeyId(smsAccessKeyId)
|
||||
.accessKeySecret(smsAccessKeySecret)
|
||||
.accessKeyId(accessKeyId)
|
||||
.accessKeySecret(accessKeySecret)
|
||||
.build());
|
||||
client = AsyncClient.builder()
|
||||
.region("cn-hangzhou")
|
||||
@@ -168,7 +191,7 @@ public class CommonService {
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(Objects.isNull(client)){
|
||||
if (Objects.isNull(client)) {
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.service.sms;
|
||||
|
||||
|
||||
import com.cool.store.enums.SmsCodeTypeEnum;
|
||||
import com.cool.store.enums.SmsNoticeTypeEnum;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
|
||||
/**
|
||||
@@ -18,4 +19,9 @@ public interface AliyunSmsService {
|
||||
* @param codeType 验证码类型
|
||||
*/
|
||||
ResponseResult sendSmsCode(String mobile, SmsCodeTypeEnum codeType);
|
||||
|
||||
/**
|
||||
* 发送通知
|
||||
*/
|
||||
void sendNotice(String mobile, SmsNoticeTypeEnum type);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service.sms.impl;
|
||||
|
||||
import com.cool.store.enums.SmsCodeTypeEnum;
|
||||
import com.cool.store.enums.SmsNoticeTypeEnum;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.impl.CommonService;
|
||||
import com.cool.store.service.sms.AliyunSmsService;
|
||||
@@ -10,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -42,6 +44,11 @@ public class AliyunSmsServiceImpl implements AliyunSmsService {
|
||||
return ResponseResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNotice(String mobile, SmsNoticeTypeEnum type) {
|
||||
commonService.privateSendSms(Collections.singletonList(mobile), type.getTemplateCode(), type.getSmsSign().getSignName(), null);
|
||||
}
|
||||
|
||||
public static String getRandNum() {
|
||||
return String.valueOf((int) ((Math.random() * 9 + 1) * Math.pow(10, 5)));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.request.closeup.CloseUpAuditRequest;
|
||||
import com.cool.store.request.closeup.CloseUpPlatformHandleRequest;
|
||||
import com.cool.store.request.closeup.CloseUpQueryRequest;
|
||||
import com.cool.store.request.closeup.CloseUpTodoQueryRequest;
|
||||
import com.cool.store.response.AuditInfoResponse;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.closeup.CloseUpService;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormSimpleVO;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormVO;
|
||||
import com.cool.store.vo.closeup.CloseUpPlatformVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 歇业管理 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Api(tags = "歇业管理")
|
||||
@RestController
|
||||
@RequestMapping("/pc/closeup")
|
||||
@RequiredArgsConstructor
|
||||
@Validated
|
||||
public class CloseUpController {
|
||||
private final CloseUpService closeUpService;
|
||||
|
||||
@ApiOperation("H5歇业开业待办")
|
||||
@PostMapping("/todoList")
|
||||
public ResponseResult<PageInfo<CloseUpApplyFormSimpleVO>> todoList(@RequestBody @Validated CloseUpTodoQueryRequest request) {
|
||||
return ResponseResult.success(closeUpService.todoList(request));
|
||||
}
|
||||
|
||||
@ApiOperation("开业歇业申请列表")
|
||||
@PostMapping("/applyList")
|
||||
public ResponseResult<PageInfo<CloseUpApplyFormSimpleVO>> applyList(@RequestBody @Validated CloseUpQueryRequest request) {
|
||||
return ResponseResult.success(closeUpService.applyList(request));
|
||||
}
|
||||
|
||||
@ApiOperation("申请单详情")
|
||||
@GetMapping("/detail")
|
||||
public ResponseResult<CloseUpApplyFormVO> getDetail(@RequestParam("applyId") Long applyId) {
|
||||
return ResponseResult.success(closeUpService.getDetail(applyId));
|
||||
}
|
||||
|
||||
@ApiOperation("审批通过")
|
||||
@PostMapping("/auditPass")
|
||||
public ResponseResult<Boolean> auditPass(@RequestBody @Validated CloseUpAuditRequest request) {
|
||||
return ResponseResult.success(closeUpService.auditPass(request));
|
||||
}
|
||||
|
||||
@ApiOperation("审批拒绝")
|
||||
@PostMapping("/auditRejected")
|
||||
public ResponseResult<Boolean> auditRefuse(@RequestBody @Validated CloseUpAuditRequest request) {
|
||||
return ResponseResult.success(closeUpService.auditRejected(request));
|
||||
}
|
||||
|
||||
@ApiOperation("查询平台账号列表")
|
||||
@GetMapping("/platformList")
|
||||
public ResponseResult<List<CloseUpPlatformVO>> getPlatformList(@RequestParam("applyId") Long applyId) {
|
||||
return ResponseResult.success(closeUpService.getPlatformListByApplyId(applyId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询审批记录")
|
||||
@GetMapping("/auditRecordList")
|
||||
public ResponseResult<List<AuditInfoResponse>> getAuditRecordList(@RequestParam("applyId") Long applyId) {
|
||||
return ResponseResult.success(closeUpService.getAuditRecordList(applyId));
|
||||
}
|
||||
|
||||
@ApiOperation("平台待办记录-工作台")
|
||||
@GetMapping("/platformTodoList")
|
||||
public ResponseResult<PageInfo<CloseUpApplyFormSimpleVO>> getPlatformTodoList(@Validated CloseUpTodoQueryRequest request) {
|
||||
return ResponseResult.success(closeUpService.getPlatformTodoList(request));
|
||||
}
|
||||
|
||||
@ApiOperation("平台关闭开启处理")
|
||||
@PostMapping("/handlePlatform")
|
||||
public ResponseResult<Boolean> handlePlatform(@RequestBody @Validated CloseUpPlatformHandleRequest request) {
|
||||
return ResponseResult.success(closeUpService.handlePlatform(request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.request.closeup.CloseUpApplyRequest;
|
||||
import com.cool.store.request.closeup.CloseUpApplySimpleQueryRequest;
|
||||
import com.cool.store.request.closeup.CloseUpOpenApplyRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.closeup.CloseUpService;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormSimpleVO;
|
||||
import com.cool.store.vo.closeup.CloseUpApplyFormVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mini歇业管理
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/4/8
|
||||
*/
|
||||
@Api(tags = "Mini歇业管理")
|
||||
@RestController
|
||||
@RequestMapping("/mini/closeup")
|
||||
@RequiredArgsConstructor
|
||||
@Validated
|
||||
public class MiniCloseUpController {
|
||||
private final CloseUpService closeUpService;
|
||||
|
||||
@ApiOperation("歇业申请")
|
||||
@PostMapping("/apply")
|
||||
public ResponseResult<Boolean> closeUpApply(@RequestBody @Validated CloseUpApplyRequest request) {
|
||||
return ResponseResult.success(closeUpService.closeUpApply(request));
|
||||
}
|
||||
|
||||
@ApiOperation("恢复营业申请")
|
||||
@PostMapping("/openApply")
|
||||
public ResponseResult<Boolean> openApply(@RequestBody @Validated CloseUpOpenApplyRequest request) {
|
||||
return ResponseResult.success(closeUpService.openApply(request));
|
||||
}
|
||||
|
||||
@ApiOperation("申请列表")
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<PageInfo<CloseUpApplyFormSimpleVO>> applyList(@RequestBody @Validated CloseUpApplySimpleQueryRequest request) {
|
||||
return ResponseResult.success(closeUpService.miniApplyFormList(request));
|
||||
}
|
||||
|
||||
@ApiOperation("申请单详情")
|
||||
@GetMapping("/detail")
|
||||
public ResponseResult<CloseUpApplyFormVO> getDetail(@RequestParam("applyId") Long applyId) {
|
||||
return ResponseResult.success(closeUpService.getDetail(applyId));
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,8 @@ xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
|
||||
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
|
||||
aliyun.sms.signName=酷店掌
|
||||
aliyun.sms.private.accessKeyId=LTAI5tDp9nFNSca53jjzepE5
|
||||
aliyun.sms.private.accessKeySecret=oTWhLJ6t6DeIINFTkAzwlY18ORfyYl
|
||||
|
||||
mybatis.configuration.variables.enterpriseId=5558ce7a3aa84e3590392fcaa8697ffb
|
||||
enterprise.dingCorpId=dingef2502a50df74ccc35c2f4657eb6378f
|
||||
|
||||
@@ -79,6 +79,8 @@ xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
|
||||
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
|
||||
aliyun.sms.signName=酷店掌
|
||||
aliyun.sms.private.accessKeyId=LTAI5tDp9nFNSca53jjzepE5
|
||||
aliyun.sms.private.accessKeySecret=oTWhLJ6t6DeIINFTkAzwlY18ORfyYl
|
||||
|
||||
mybatis.configuration.variables.enterpriseId=214ac5a3a517472a87268e02a2e6410a
|
||||
enterprise.dingCorpId=wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g
|
||||
|
||||
@@ -88,6 +88,8 @@ xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
|
||||
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
|
||||
aliyun.sms.signName=酷店掌
|
||||
aliyun.sms.private.accessKeyId=LTAI5tDp9nFNSca53jjzepE5
|
||||
aliyun.sms.private.accessKeySecret=oTWhLJ6t6DeIINFTkAzwlY18ORfyYl
|
||||
|
||||
mybatis.configuration.variables.enterpriseId=5558ce7a3aa84e3590392fcaa8697ffb
|
||||
enterprise.dingCorpId=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg
|
||||
|
||||
@@ -83,6 +83,8 @@ xfsg.url=https://inf.xianfengsg.com/InfService
|
||||
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
|
||||
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
|
||||
aliyun.sms.signName=酷店掌
|
||||
aliyun.sms.private.accessKeyId=LTAI5tDp9nFNSca53jjzepE5
|
||||
aliyun.sms.private.accessKeySecret=oTWhLJ6t6DeIINFTkAzwlY18ORfyYl
|
||||
|
||||
mybatis.configuration.variables.enterpriseId=214ac5a3a517472a87268e02a2e6410a
|
||||
enterprise.dingCorpId=wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g
|
||||
|
||||
@@ -89,6 +89,8 @@ xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
|
||||
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
|
||||
aliyun.sms.signName=酷店掌
|
||||
aliyun.sms.private.accessKeyId=LTAI5tDp9nFNSca53jjzepE5
|
||||
aliyun.sms.private.accessKeySecret=oTWhLJ6t6DeIINFTkAzwlY18ORfyYl
|
||||
|
||||
mybatis.configuration.variables.enterpriseId=5558ce7a3aa84e3590392fcaa8697ffb
|
||||
enterprise.dingCorpId=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg
|
||||
|
||||
Reference in New Issue
Block a user