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