Commit 87d250ad by 陶光胜

通知详情修改

parent 880cc0f8
......@@ -122,7 +122,8 @@ public interface PushMessageApiService {
* @Param
* @return
*/
ServiceResponse<Integer> totalUserMessage(Integer userId, Integer status);
ServiceResponse<Integer> totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId);
/** @Description: 推送消息接口
* @author taogs
......
......@@ -3,6 +3,7 @@ package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabPushUserMessage;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface TabPushUserMessageMapper {
......@@ -56,8 +57,12 @@ public interface TabPushUserMessageMapper {
int recallMessage(@Param("messageId") Integer messageId);
List<Integer> totalUserMessage(@Param("userId") Integer userId,
@Param("status") Integer status);
List<Integer> totalUserMessage(@Param("search") String search,
@Param("status") Integer status,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("classify") String classify,
@Param("userId") Integer userId);
int readAll(@Param("userId") Integer userId);
......
......@@ -2,12 +2,15 @@ package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabPushUserMessage;
import java.util.Date;
public interface PushUserMessageService {
int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content);
int reCallMessage(Integer messageId);
int totalUserMessage(Integer userId, int status);
int totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId);
int readAll(Integer userId);
......
package com.gic.enterprise.service.impl;
import com.gic.enterprise.dao.mapper.TabPushUserMessageMapper;
import com.gic.enterprise.entity.TabPushClassify;
import com.gic.enterprise.entity.TabPushUserMessage;
import com.gic.enterprise.service.PushTypeService;
import com.gic.enterprise.service.PushUserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -13,6 +15,8 @@ import java.util.List;
public class PushUserMessageServiceImpl implements PushUserMessageService {
@Autowired
private TabPushUserMessageMapper tabPushUserMessageMapper;
@Autowired
private PushTypeService pushTypeService;
@Override
public int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content) {
......@@ -35,8 +39,10 @@ public class PushUserMessageServiceImpl implements PushUserMessageService {
}
@Override
public int totalUserMessage(Integer userId, int status) {
List<Integer> list = this.tabPushUserMessageMapper.totalUserMessage(userId, status);
public int totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId) {
TabPushClassify byId = this.pushTypeService.getById(pushClassifyId);
List<Integer> list = this.tabPushUserMessageMapper.totalUserMessage(search, status, startTime, endTime, byId == null ? null : byId.getClassifyName(), userId);
return list.get(0);
}
......
......@@ -166,8 +166,9 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
}
@Override
public ServiceResponse<Integer> totalUserMessage(Integer userId, Integer status) {
return ServiceResponse.success(this.pushUserMessageService.totalUserMessage(userId, status));
public ServiceResponse<Integer> totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId) {
return ServiceResponse.success(this.pushUserMessageService.totalUserMessage(userId, search, status, startTime, endTime, pushClassifyId));
}
@Override
......
......@@ -156,10 +156,25 @@
where message_id = #{messageId,jdbcType=INTEGER} and status!=0
</update>
<select id="totalUserMessage" resultType="integer">
select
count(1)
from tab_push_user_message
where user_id=#{userId} and status = #{status}
select count(1)
from tab_push_user_message t1 left join tab_push_message t3 on t1.message_id = t3.message_id
where t1.user_id=#{userId}
and (t1.status = 1 or t1.status = 2)
<if test="search != null and search != ''">
and (t1.title like concat('%', #{search}, '%') or t1.content like concat('%', #{search}, '%'))
</if>
<if test="status != null">
and t1.status = #{status}
</if>
<if test="startTime != null">
and (t1.create_time &gt;= #{startTime})
</if>
<if test="endTime != null">
and (t1.create_time &lt;= #{endTime})
</if>
<if test="classify != null and classify !=''">
and t1.classify = #{classify}
</if>
</select>
<update id="readAll">
update tab_push_user_message
......
......@@ -59,7 +59,8 @@ public class IndexModuleController {
try {
ServiceResponse<Page<UserMessageDTO>> response = this.pushMessageApiService.pageUserMessage(userId, search, status, StringUtils.isBlank(startTime) ? null : sdf.parse(startTime+" 00:00:00"),
StringUtils.isBlank(endTime) ? null : sdf.parse(endTime+" 23:59:59"), pushClassifyId, pageQO.getCurrentPage(), pageQO.getPageSize());
ServiceResponse<Integer> unReadResponse = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), 1);
ServiceResponse<Integer> unReadResponse = this.pushMessageApiService.totalUserMessage(userId, search, 1, StringUtils.isBlank(startTime) ? null : sdf.parse(startTime+" 00:00:00"),
StringUtils.isBlank(endTime) ? null : sdf.parse(endTime+" 23:59:59"), pushClassifyId);
Map<String, Object> result = new HashMap<>();
result.put("page", response.getResult());
result.put("unReadCount", unReadResponse.getResult());
......@@ -72,7 +73,8 @@ public class IndexModuleController {
@RequestMapping("total-message")
public RestResponse totalMessage(){
ServiceResponse<Integer> response = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), 1);
ServiceResponse<Integer> response = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), null, null, null,
null, null);
return RestResponse.success(response.getResult());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment