feat:事项

This commit is contained in:
苏竹红
2025-07-27 22:20:33 +08:00
parent 5035a7e054
commit 00f883192a
23 changed files with 1040 additions and 39 deletions

View File

@@ -1,7 +1,9 @@
package com.cool.store.dao;
import com.cool.store.dto.notice.NoticeDTO;
import com.cool.store.entity.MessageTemplateDO;
import com.cool.store.mapper.MessageTemplateMapper;
import com.cool.store.request.notice.MessageTemplateQueryRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
@@ -47,7 +49,27 @@ public class MessageTemplateDAO {
}
public List<NoticeDTO> getMessageTemplateList(MessageTemplateQueryRequest request) {
return messageTemplateMapper.getMessageTemplateList(request);
}
public int batchUpdateStoreInfoAndUserInfo(List<Long> ids,
String storeInfo,
String userInfo,
String userId) {
if (CollectionUtils.isEmpty(ids)){
return 0;
}
return messageTemplateMapper.batchUpdateStoreInfoAndUserInfo(ids,storeInfo,userInfo,userId);
}
public int batchUpdatePublishStatus(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)){
return 0;
}
return messageTemplateMapper.batchUpdatePublishStatus(ids);
}

View File

@@ -1,10 +1,18 @@
package com.cool.store.dao;
import cn.hutool.core.collection.CollUtil;
import com.cool.store.dto.notice.MessageTemplateCountDTO;
import com.cool.store.entity.StoreMessageDO;
import com.cool.store.mapper.StoreMessageMapper;
import com.cool.store.request.notice.StoreMessageRequest;
import com.cool.store.vo.notice.MessageDetailVO;
import com.cool.store.vo.notice.StoreMessageVO;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@@ -17,16 +25,63 @@ public class StoreMessageDAO {
@Resource
StoreMessageMapper storeMessageMapper;
public StoreMessageDO getById(Long id){
return storeMessageMapper.selectByPrimaryKey(id);
}
public int update(StoreMessageDO storeMessageDO){
return storeMessageMapper.updateByPrimaryKey(storeMessageDO);
}
/**
* 批量新增
* @param list
* @return
*/
public int batchInsert(List<StoreMessageDO> list){
if (CollectionUtils.isEmpty(list)){
return 0;
}
return storeMessageMapper.insertBatch(list);
}
public List<MessageTemplateCountDTO> getMessageTemplateCountList(List<Long> templateIds){
if (CollUtil.isEmpty(templateIds)){
return new ArrayList<>();
}
return storeMessageMapper.getMessageTemplateCountList(templateIds);
}
public List<StoreMessageDO> getStoreMessageList(StoreMessageRequest request){
return storeMessageMapper.getStoreMessageList(request);
}
public Integer batchRevoke(List<Long> ids, String userId, String userName){
if (CollectionUtils.isEmpty(ids)){
return 0;
}
return storeMessageMapper.batchRevoke(ids,userId,userName);
}
public Integer revokeById(Long id, String userId, String userName){
if (id == null){
return 0;
}
return storeMessageMapper.revokeById(id,userId,userName);
}
public Integer queryStoreModuleCount(String storeId, Integer moduleCode){
return storeMessageMapper.queryStoreModuleCount(storeId,moduleCode);
}
public List<StoreMessageVO> getStoreMessageListByCondition(String storeId, Integer moduleCode, Integer todayTask, Integer pendingFlag, String userId){
return storeMessageMapper.getStoreMessageListByCondition(storeId,moduleCode,todayTask,pendingFlag,userId);
}
public MessageDetailVO getMessageDetail(Long id){
return storeMessageMapper.getMessageDetail(id);
}
}

View File

@@ -1,6 +1,9 @@
package com.cool.store.mapper;
import com.cool.store.dto.notice.CommonDTO;
import com.cool.store.dto.notice.NoticeDTO;
import com.cool.store.entity.MessageTemplateDO;
import com.cool.store.request.notice.MessageTemplateQueryRequest;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -12,4 +15,16 @@ public interface MessageTemplateMapper extends Mapper<MessageTemplateDO> {
int updateDeleteStatusBatch(@Param("ids") List<Long> ids, @Param("userId") String userId);
List<NoticeDTO> getMessageTemplateList(@Param("request") MessageTemplateQueryRequest request);
int batchUpdateStoreInfoAndUserInfo(@Param("ids") List<Long> ids,
@Param("storeInfo") String storeInfo,
@Param("userInfo") String userInfo,
@Param("userId") String userId);
int batchUpdatePublishStatus(@Param("ids") List<Long> ids);
}

View File

@@ -1,6 +1,10 @@
package com.cool.store.mapper;
import com.cool.store.dto.notice.MessageTemplateCountDTO;
import com.cool.store.entity.StoreMessageDO;
import com.cool.store.request.notice.StoreMessageRequest;
import com.cool.store.vo.notice.MessageDetailVO;
import com.cool.store.vo.notice.StoreMessageVO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -10,4 +14,23 @@ public interface StoreMessageMapper extends Mapper<StoreMessageDO> {
int insertBatch(@Param("list") List<StoreMessageDO> list);
List<MessageTemplateCountDTO> getMessageTemplateCountList(@Param("templateIds") List<Long> templateIds);
List<StoreMessageDO> getStoreMessageList(@Param("request") StoreMessageRequest request);
int batchRevoke(@Param("ids") List<Long> ids, @Param("userId") String userId, @Param("userName") String userName);
int revokeById(@Param("id") Long id, @Param("userId") String userId, @Param("userName") String userName);
Integer queryStoreModuleCount(@Param("storeId") String storeId, @Param("moduleCode") Integer moduleCode);
List<StoreMessageVO> getStoreMessageListByCondition(@Param("storeId") String storeId,
@Param("moduleCode") Integer moduleCode,
@Param("todayTask") Integer todayTask,
@Param("pendingFlag") Integer pendingFlag,
@Param("userId") String userId);
MessageDetailVO getMessageDetail(Long id);
}

View File

@@ -57,4 +57,75 @@
</update>
<select id="getMessageTemplateList" resultType="com.cool.store.dto.notice.NoticeDTO" >
SELECT
id as id,
message_code as messageCode,
module_code as moduleCode,
matter_type as matterType,
message_title as messageTitle,
system_source as systemSource,
process_type as processType,
remind_type as remindType,
remind_start_time as remindStartTime,
remind_end_time as remindEndTime,
deadline as deadline,
today_task as todayTask,
message_image as messageImage,
publish_status as publishStatus,
publish_time as publishTime,
publisher_user_id as publisherUserId,
create_user_id as createUserId,
create_time as createTime
FROM zxjp_message_template
WHERE deleted = 0
<if test="request.moduleCode != null">
AND module_code = #{request.moduleCode,jdbcType=TINYINT}
</if>
<if test="request.matterType != null">
AND matter_type = #{request.matterType,jdbcType=TINYINT}
</if>
<if test="request.messageTitle != null and messageTitle != ''">
AND message_title LIKE CONCAT('%', #{request.messageTitle,jdbcType=VARCHAR}, '%')
</if>
<if test="request.todayTask != null">
AND today_task = #{request.todayTask,jdbcType=BIT}
</if>
<if test="request.systemSource != null and request.systemSource != ''">
AND system_source = #{request.systemSource,jdbcType=VARCHAR}
</if>
<if test="request.publishStatus != null">
AND publish_status = #{request.publishStatus,jdbcType=BIT}
</if>
<if test="request.publishUserId != null">
AND publisher_user_id = #{request.publishUserId,jdbcType=BIT}
</if>
ORDER BY create_time DESC
</select>
<update id="batchUpdateStoreInfoAndUserInfo">
UPDATE zxjp_message_template
SET
store_info = #{storeInfo,jdbcType=LONGVARCHAR},
handle_person_info = #{userInfo,jdbcType=LONGVARCHAR},
update_time = NOW(),
publish_status = 1,
publish_time = NOW(),
publisher_user_id = #{userId}
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id,jdbcType=BIGINT}
</foreach>
</update>
<update id="batchUpdatePublishStatus">
UPDATE zxjp_message_template
SET
publish_status = 2
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id,jdbcType=BIGINT}
</foreach>
</update>
</mapper>

View File

@@ -26,7 +26,7 @@
</resultMap>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO store_message (
INSERT INTO zxjp_store_message (
store_id,
store_code,
store_name,
@@ -40,17 +40,164 @@
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.storeId,jdbcType=VARCHAR},
#{item.storeCode,jdbcType=VARCHAR},
#{item.storeName,jdbcType=VARCHAR},
#{item.messageTemplateId,jdbcType=BIGINT},
#{item.readStatus,jdbcType=BIT},
#{item.readTime,jdbcType=TIMESTAMP},
#{item.processStatus,jdbcType=TINYINT},
#{item.processTime,jdbcType=TIMESTAMP},
#{item.operatorList,jdbcType=LONGVARCHAR}
#{item.storeId},
#{item.storeCode},
#{item.storeName},
#{item.messageTemplateId},
#{item.readStatus},
#{item.readTime},
#{item.processStatus},
#{item.processTime},
#{item.operatorList}
)
</foreach>
</insert>
<select id="getMessageTemplateCountList" resultType="com.cool.store.dto.notice.MessageTemplateCountDTO">
SELECT
message_template_id AS templateId,
COUNT(DISTINCT store_id) AS totalStoreCount,
SUM(CASE WHEN process_status = 1 THEN 1 ELSE 0 END) AS processedStoreCount
FROM
zxjp_store_message
<where>
message_template_id IN
<foreach item="item" collection="templateIds" index="index" separator="," close=")" open="(">
#{item}
</foreach>
</where>
GROUP BY
message_template_id
</select>
<select id="getStoreMessageList" resultMap="BaseResultMap">
SELECT
id,
store_id,
store_code,
store_name,
message_template_id,
read_status,
read_time,
process_status,
process_time,
actual_operator_id,
actual_operator_name,
revoke_status,
revoke_time,
revoke_operator_id,
revoke_operator_name,
create_time,
update_time
FROM zxjp_store_message
<where>
<if test="request.templateId != null">
AND message_template_id = #{request.templateId,jdbcType=BIGINT}
</if>
<if test="request.readStatus != null">
AND read_status = #{request.readStatus,jdbcType=BIT}
</if>
<if test="request.processStatus != null">
AND process_status = #{request.processStatus,jdbcType=TINYINT}
</if>
<if test="request.keyword != null">
AND ( store_code LIKE CONCAT('%',#{request.keyword,jdbcType=VARCHAR},'%')
OR store_name LIKE CONCAT('%',#{request.keyword,jdbcType=VARCHAR},'%')
)
</if>
AND revoke_status = 0
</where>
ORDER BY create_time DESC
</select>
<update id="batchRevoke">
UPDATE zxjp_store_message
SET
revoke_status = 1,
revoke_time = NOW(),
revoke_operator_id = #{userId,jdbcType=BIGINT},
revoke_operator_name = #{userName,jdbcType=VARCHAR},
update_time = NOW()
<where>
message_template_id IN
<foreach item="item" collection="templateIds" index="index" separator="," close=")" open="(">
#{item}
</foreach>
AND process_status = 0
AND revoke_status = 0
</where>
</update>
<update id="revokeById">
UPDATE zxjp_store_message
SET
revoke_status = 1,
revoke_time = NOW(),
revoke_operator_id = #{userId,jdbcType=BIGINT},
revoke_operator_name = #{userName,jdbcType=VARCHAR},
update_time = NOW()
WHERE
id = #{id,jdbcType=BIGINT}
AND process_status = 0
AND revoke_status = 0
</update>
<select id="queryStoreModuleCount" resultType="java.lang.Integer">
select count(1) from zxjp_store_message a
left join zxjp_message_template b on a.message_template_id = b.id
where a.store_id = #{storeId}
and b.module_id = #{moduleCode}
limit 1
</select>
<select id="getStoreMessageListByCondition" resultType="com.cool.store.vo.notice.StoreMessageVO">
select
a.id,
a.store_id as storeId,
a.store_code as storeCode,
a.message_template_id as templateId,
a.read_status as readStatus,
a.process_status as processStatus,
a.create_time as createTime,
b.module_code as moduleCode,
b.message_title as messageTitle,
b.message_image as messageImage
from zxjp_store_message a
left join zxjp_message_template b on a.message_template_id = b.id
<where>
<if test="storeId != null">
and a.store_id = #{storeId}
</if>
<if test="moduleCode != null">
and b.module_id = #{moduleCode}
</if>
<if test="todayTask != null">
and b.today_task = #{todayTask}
</if>
<if test="pendingFlag != null">
and a.process_status = #{pendingFlag}
and (b.remind_type = 1 or (b.remind_type = 2 and NOW() BETWEEN b.remind_start_time AND b.remind_end_time ))
</if>
</where>
</select>
<select id="getMessageDetail" resultType="com.cool.store.vo.notice.MessageDetailVO">
select
a.id,
a.message_title,
a.message_image,
a.create_time,
a.publish_user_name
from
zxjp_store_message a
left join zxjp_message_template b on a.template_id = b.id
where
a.id = #{id}
</select>
</mapper>