待阅已阅列表
This commit is contained in:
@@ -4,9 +4,7 @@ import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.messagecenter.api.message.Message;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMessageListQuery;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMessageListVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMsgMainVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -109,4 +107,8 @@ public interface MessageListFeign {
|
||||
public ResultBean updateAppReadByType(@RequestParam("msgTypeSid") String msgTypeSid, @RequestParam("userSid") String userSid);
|
||||
|
||||
/****************************************************************************************************************************/
|
||||
|
||||
@ApiOperation("手机端待阅已阅")
|
||||
@PostMapping("/getAppReadListByUserSid")
|
||||
public ResultBean<PagerVo<MessageReadListVo>> getAppReadListByUserSid(@RequestBody PagerQuery<MessageReadListQuery> pq);
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.messagecenter.api.message.Message;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMessageListQuery;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMsgMainVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.MessageReadListQuery;
|
||||
import com.yxt.messagecenter.api.messagelist.app.MessageReadListVo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -113,4 +115,9 @@ public class MessageListFeignFallback implements MessageListFeign {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
return rb.setMsg("接口message-center/messagelist/updateAppReadByType无法访问");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean<PagerVo<MessageReadListVo>> getAppReadListByUserSid(PagerQuery<MessageReadListQuery> pq) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.messagecenter.api.messagelist.MessageList;
|
||||
import com.yxt.messagecenter.api.messagelist.MessageListJoinMsgVo;
|
||||
import com.yxt.messagecenter.api.messagelist.MessageListVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppLastMsgVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMessageListQuery;
|
||||
import com.yxt.messagecenter.api.messagelist.app.AppMessageListVo;
|
||||
import com.yxt.messagecenter.api.messagelist.app.*;
|
||||
import com.yxt.messagecenter.api.messagelist.wx.WxMessageListQuery;
|
||||
import com.yxt.messagecenter.api.messagelist.wx.WxMessageListVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -85,6 +83,7 @@ public interface MessageListMapper extends BaseMapper<MessageList> {
|
||||
AppLastMsgVo selectLastMsg(@Param("userSid") String userSid, @Param("msgTypeSid") String msgTypeSid);
|
||||
|
||||
IPage<AppMessageListVo> getAppMsgListByUserSid(IPage<AppMessageListQuery> page, @Param(Constants.WRAPPER) QueryWrapper<MessageList> qw);
|
||||
IPage<MessageReadListVo> getAppReadListByUserSid(IPage<MessageReadListQuery> page, @Param(Constants.WRAPPER) QueryWrapper<MessageList> qw);
|
||||
|
||||
int updateAppReadByType(@Param("msgTypeSid") String msgTypeSid, @Param("userSid") String userSid);
|
||||
|
||||
|
||||
@@ -213,4 +213,27 @@
|
||||
from message_list
|
||||
where msgSid = #{s}
|
||||
</select>
|
||||
|
||||
<select id="getAppReadListByUserSid" resultType="com.yxt.messagecenter.api.messagelist.app.MessageReadListVo">
|
||||
SELECT ml.sid,
|
||||
ml.msgSid,
|
||||
m.app_type as type,
|
||||
m.moduleSid,
|
||||
m.args_json as json,
|
||||
m.msgTitle,
|
||||
m.msgContent,
|
||||
ml.state,
|
||||
DATE_FORMAT(ml.createTime, '%Y-%m-%d %H:%i') as sendTime,
|
||||
m.msgTargetUri as moduleAction,
|
||||
m.senderName,
|
||||
m.msgSource,
|
||||
DATE_FORMAT(ml.modifyTime, '%Y-%m-%d %H:%i') as redTime
|
||||
FROM message_list ml
|
||||
LEFT JOIN message m ON ml.msgSid = m.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
and ml.rDelStatus = 0
|
||||
</where>
|
||||
ORDER BY ml.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -308,9 +308,6 @@ public class MessageListService extends MybatisBaseService<MessageListMapper, Me
|
||||
QueryWrapper<MessageList> qw = new QueryWrapper<>();
|
||||
qw.eq("ml.receiverSid", pq.getParams().getUserSid());
|
||||
qw.eq("m.msgTypeSid", pq.getParams().getMsgTypeSid());
|
||||
// if(StringUtils.isNotBlank(pq.getParams().getOrgPath())){
|
||||
// qw.and(wrapper -> wrapper.isNull("ml.receiverDeptSid").or().eq("ml.receiverDeptSid",pq.getParams().getOrgPath()).or().eq("ml.receiverDeptSid", ""));
|
||||
// }
|
||||
IPage<AppMessageListQuery> iPage = PagerUtil.queryToPage(pq);
|
||||
IPage<AppMessageListVo> page = baseMapper.getAppMsgListByUserSid(iPage, qw);
|
||||
PagerVo<AppMessageListVo> pagerVo = PagerUtil.pageToVo(page, null);
|
||||
@@ -351,28 +348,6 @@ public class MessageListService extends MybatisBaseService<MessageListMapper, Me
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* pagerVo.getRecords().stream().forEach(vo -> {
|
||||
vo.setPath(fileUploadComponent.getUploadPath()+vo.getPath());
|
||||
if (vo.getType().equals("2")) {
|
||||
//插件
|
||||
List<Integer> integers = appVer.get(vo.getModuleSid());
|
||||
if (integers == null) {
|
||||
integers = new ArrayList<>();
|
||||
}
|
||||
integers.add(i);
|
||||
appVer.put(appSid2, integers);
|
||||
AppSubsetVersionVo subsetVersionVo = appSubsetVersionFeign.getLastByAppSid(vo.getModuleSid()).getData();
|
||||
vo.setPath(subsetVersionVo.getUpdateUrl());
|
||||
vo.setModulePluginName(subsetVersionVo.getModulePluginName());
|
||||
if (StringUtils.isNotBlank(subsetVersionVo.getVersionName())) {
|
||||
vo.setModuleVersion(subsetVersionVo.getVersionCode());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(vo.getJson())) {
|
||||
vo.setJson("{}");
|
||||
}
|
||||
});*/
|
||||
pagerVo.setMsg("共查询出" + pagerVo.getTotal() + "条消息");
|
||||
return pagerVo;
|
||||
}
|
||||
@@ -390,4 +365,61 @@ public class MessageListService extends MybatisBaseService<MessageListMapper, Me
|
||||
public List<String> selectByMsgSid(String s) {
|
||||
return baseMapper.selectByMsgSid(s);
|
||||
}
|
||||
|
||||
public PagerVo<MessageReadListVo> getAppReadListByUserSid(PagerQuery<MessageReadListQuery> pq) {
|
||||
QueryWrapper<MessageList> qw = new QueryWrapper<>();
|
||||
MessageReadListQuery messageReadListQuery = pq.getParams();
|
||||
qw.eq("ml.receiverSid", pq.getParams().getUserSid());
|
||||
qw.eq("m.msgTypeSid","bc59c198-2d52-bb54-e4106aa38821a9ec");//阅读类
|
||||
if(StringUtils.isNotBlank(messageReadListQuery.getNames())){
|
||||
qw.like("m.msgTitle",messageReadListQuery.getNames());
|
||||
}
|
||||
if(messageReadListQuery.getState() == 0){//待阅
|
||||
qw.eq("ml.state",0);
|
||||
}else{//已阅
|
||||
qw.eq("ml.state",1);
|
||||
}
|
||||
IPage<MessageReadListQuery> iPage = PagerUtil.queryToPage(pq);
|
||||
IPage<MessageReadListVo> page = baseMapper.getAppReadListByUserSid(iPage, qw);
|
||||
PagerVo<MessageReadListVo> pagerVo = PagerUtil.pageToVo(page, null);
|
||||
//定义的app的sid的index集合
|
||||
Map<String, List<Integer>> appVer = new HashMap<>();
|
||||
List<MessageReadListVo> records = page.getRecords();
|
||||
records.removeAll(Collections.singleton(null));
|
||||
if (!records.isEmpty()) {
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
MessageReadListVo vo = records.get(i);
|
||||
if (vo.getType().equals("2")) {
|
||||
//插件
|
||||
if(StringUtils.isNotBlank(vo.getModuleSid())){
|
||||
List<Integer> integers = appVer.get(vo.getModuleSid());
|
||||
if (integers == null) {
|
||||
integers = new ArrayList<>();
|
||||
}
|
||||
integers.add(i);
|
||||
appVer.put(vo.getModuleSid(), integers);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(vo.getJson())) {
|
||||
vo.setJson("{}");
|
||||
}
|
||||
}
|
||||
// 循环取map:若为同一个app版本,则只查询一次
|
||||
for (String key : appVer.keySet()) {
|
||||
AppSubsetVersionVo appSubsetVersions = appSubsetVersionFeign.getLastByAppSid(key).getData();
|
||||
if (appSubsetVersions != null) {
|
||||
List<Integer> integers = appVer.get(key);
|
||||
for (int i = 0; i < integers.size(); i++) {
|
||||
Integer integer = integers.get(i);
|
||||
String path = fileUploadComponent.getUrlPrefix();
|
||||
records.get(integer).setPath(path + appSubsetVersions.getUpdateUrl());
|
||||
records.get(integer).setModuleVersion(appSubsetVersions.getVersionCode());
|
||||
records.get(integer).setModulePluginName(appSubsetVersions.getModulePluginName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pagerVo.setMsg("共查询出" + pagerVo.getTotal() + "条消息");
|
||||
return pagerVo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user