Browse Source

ring消息已读

master
zy_Java 5 years ago
parent
commit
ae16cf0dfd
  1. 4
      cloudutil/src/main/resources/application-util-test.yml
  2. 12
      tall/src/main/java/com/ccsens/tall/bean/dto/RingDto.java
  3. 6
      tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java
  4. 11
      tall/src/main/java/com/ccsens/tall/bean/po/SysRingSend.java
  5. 60
      tall/src/main/java/com/ccsens/tall/bean/po/SysRingSendExample.java
  6. 15
      tall/src/main/java/com/ccsens/tall/bean/vo/RingVo.java
  7. 10
      tall/src/main/java/com/ccsens/tall/persist/dao/SysRingMsgDao.java
  8. 6
      tall/src/main/java/com/ccsens/tall/service/IRingService.java
  9. 82
      tall/src/main/java/com/ccsens/tall/service/RingService.java
  10. 3
      tall/src/main/java/com/ccsens/tall/service/UserService.java
  11. 3
      tall/src/main/java/com/ccsens/tall/web/PluginController.java
  12. 12
      tall/src/main/java/com/ccsens/tall/web/RingController.java
  13. 4
      tall/src/main/resources/application-test.yml
  14. 8
      tall/src/main/resources/druid-test.yml
  15. 93
      tall/src/main/resources/mapper_dao/SysRingMsgDao.xml
  16. 25
      tall/src/main/resources/mapper_raw/SysRingSendMapper.xml

4
cloudutil/src/main/resources/application-util-test.yml

@ -20,8 +20,8 @@ eureka:
service-url: service-url:
# 指定eureka server通信地址,注意/eureka/小尾巴不能少 # 指定eureka server通信地址,注意/eureka/小尾巴不能少
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ #defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/
defaultZone: http://admin:admin@192.168.0.99:7010/eureka/ # defaultZone: http://admin:admin@192.168.0.99:7010/eureka/
# defaultZone: http://admin:admin@test.tall.wiki:7010/eureka/ defaultZone: http://admin:admin@test.tall.wiki:7010/eureka/
instance: instance:
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server
prefer-ip-address: true prefer-ip-address: true

12
tall/src/main/java/com/ccsens/tall/bean/dto/RingDto.java

@ -28,16 +28,18 @@ public class RingDto {
@NotNull(message = "项目id不能为空") @NotNull(message = "项目id不能为空")
@ApiModelProperty("项目id") @ApiModelProperty("项目id")
private Long projectId; private Long projectId;
@ApiModelProperty("消息内容") @ApiModelProperty("页数")
private Integer page = 1; private Integer page;
@ApiModelProperty("接受的角色的id") @ApiModelProperty("每页数量")
private Integer pageSize = 10; private Integer pageSize;
} }
@Data @Data
@ApiModel("将消息设为已读") @ApiModel("将消息设为已读")
public static class MessageId { public static class MessageId {
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("消息id") @ApiModelProperty("消息id")
private Long messageId; private List<Long> messageIdList;
} }
} }

6
tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java

@ -11,6 +11,8 @@ public class RingMessageWithReadDto extends BaseMessageDto{
@Getter @Getter
public static class Data{ public static class Data{
private Long msgId; private Long msgId;
private Long projectId;
private Long roleId;
} }
private Data data; private Data data;
@ -21,10 +23,12 @@ public class RingMessageWithReadDto extends BaseMessageDto{
setTime(System.currentTimeMillis()); setTime(System.currentTimeMillis());
} }
public RingMessageWithReadDto(Long msgId){ public RingMessageWithReadDto(Long msgId,Long projectId,Long roleId){
this(); this();
Data d = new Data(); Data d = new Data();
d.setMsgId(msgId); d.setMsgId(msgId);
d.setProjectId(projectId);
d.setRoleId(roleId);
setData(d); setData(d);
} }
} }

11
tall/src/main/java/com/ccsens/tall/bean/po/SysRingSend.java

@ -18,6 +18,8 @@ public class SysRingSend implements Serializable {
private Byte recStatus; private Byte recStatus;
private Long readTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Long getId() { public Long getId() {
@ -76,6 +78,14 @@ public class SysRingSend implements Serializable {
this.recStatus = recStatus; this.recStatus = recStatus;
} }
public Long getReadTime() {
return readTime;
}
public void setReadTime(Long readTime) {
this.readTime = readTime;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -89,6 +99,7 @@ public class SysRingSend implements Serializable {
sb.append(", createdAt=").append(createdAt); sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt); sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus); sb.append(", recStatus=").append(recStatus);
sb.append(", readTime=").append(readTime);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }

60
tall/src/main/java/com/ccsens/tall/bean/po/SysRingSendExample.java

@ -524,6 +524,66 @@ public class SysRingSendExample {
addCriterion("rec_status not between", value1, value2, "recStatus"); addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andReadTimeIsNull() {
addCriterion("read_time is null");
return (Criteria) this;
}
public Criteria andReadTimeIsNotNull() {
addCriterion("read_time is not null");
return (Criteria) this;
}
public Criteria andReadTimeEqualTo(Long value) {
addCriterion("read_time =", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeNotEqualTo(Long value) {
addCriterion("read_time <>", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeGreaterThan(Long value) {
addCriterion("read_time >", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeGreaterThanOrEqualTo(Long value) {
addCriterion("read_time >=", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeLessThan(Long value) {
addCriterion("read_time <", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeLessThanOrEqualTo(Long value) {
addCriterion("read_time <=", value, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeIn(List<Long> values) {
addCriterion("read_time in", values, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeNotIn(List<Long> values) {
addCriterion("read_time not in", values, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeBetween(Long value1, Long value2) {
addCriterion("read_time between", value1, value2, "readTime");
return (Criteria) this;
}
public Criteria andReadTimeNotBetween(Long value1, Long value2) {
addCriterion("read_time not between", value1, value2, "readTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

15
tall/src/main/java/com/ccsens/tall/bean/vo/RingVo.java

@ -1,5 +1,6 @@
package com.ccsens.tall.bean.vo; package com.ccsens.tall.bean.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -8,6 +9,16 @@ import java.util.List;
@Data @Data
public class RingVo { public class RingVo {
@Data
@ApiModel("返回ring消息")
public static class PageInfoRing{
@ApiModelProperty("当前页数")
private Integer pageNum;
@ApiModelProperty("总页数")
private Integer totalPage ;
@JsonIgnore //"总数据量"
private Integer size ;
}
@Data @Data
@ApiModel("返回ring消息") @ApiModel("返回ring消息")
public static class RingInfo{ public static class RingInfo{
@ -15,8 +26,12 @@ public class RingVo {
private String messageId; private String messageId;
@ApiModelProperty("消息内容") @ApiModelProperty("消息内容")
private String value ; private String value ;
@ApiModelProperty("消息发送时间")
private Long time ;
@ApiModelProperty("是否是自己发送的消息") @ApiModelProperty("是否是自己发送的消息")
private Integer mine ; private Integer mine ;
@ApiModelProperty("未读数量")
private Integer unread;
@ApiModelProperty("发送者信息") @ApiModelProperty("发送者信息")
private MsgSender sender; private MsgSender sender;
@ApiModelProperty("接收角色的信息") @ApiModelProperty("接收角色的信息")

10
tall/src/main/java/com/ccsens/tall/persist/dao/SysRingMsgDao.java

@ -1,8 +1,18 @@
package com.ccsens.tall.persist.dao; package com.ccsens.tall.persist.dao;
import com.ccsens.tall.bean.vo.RingVo;
import com.ccsens.tall.persist.mapper.SysRingMsgMapper; import com.ccsens.tall.persist.mapper.SysRingMsgMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface SysRingMsgDao extends SysRingMsgMapper { public interface SysRingMsgDao extends SysRingMsgMapper {
List<RingVo.RingInfo> selectRingInfoByProject(@Param("userId")Long userId, @Param("projectId")Long projectId, @Param("pageIndex")int pageIndex, @Param("pageSize")int pageSize);
List<Long> selectRoleIdByUserId(@Param("userId")Long userId, @Param("projectId")Long projectId);
void updateStatusByRoleIdAndMsgId(@Param("roleIdList")List<Long> roleIdList, @Param("messageIdList")List<Long> messageIdList);
} }

6
tall/src/main/java/com/ccsens/tall/service/IRingService.java

@ -2,13 +2,15 @@ package com.ccsens.tall.service;
import com.ccsens.tall.bean.dto.RingDto; import com.ccsens.tall.bean.dto.RingDto;
import com.ccsens.tall.bean.vo.RingVo; import com.ccsens.tall.bean.vo.RingVo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageInfo;
import java.util.List; import java.util.List;
public interface IRingService { public interface IRingService {
void sendRingMsg(Long currentUserId, RingDto.RingSendDto ringSendDto) throws Exception; void sendRingMsg(Long currentUserId, RingDto.RingSendDto ringSendDto) throws Exception;
List<RingVo.RingInfo> getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto); PageInfo<RingVo.RingInfo> getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto);
void readRingMsg(Long currentUserId, List<RingDto.MessageId> messageList); void readRingMsg(Long currentUserId, RingDto.MessageId message) throws JsonProcessingException;
} }

82
tall/src/main/java/com/ccsens/tall/service/RingService.java

@ -2,32 +2,40 @@ package com.ccsens.tall.service;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.tall.bean.dto.RingDto; import com.ccsens.tall.bean.dto.RingDto;
import com.ccsens.tall.bean.dto.message.BaseMessageDto; import com.ccsens.tall.bean.dto.message.BaseMessageDto;
import com.ccsens.tall.bean.dto.message.RingMessageWithReadDto;
import com.ccsens.tall.bean.dto.message.RingMessageWithSendDto; import com.ccsens.tall.bean.dto.message.RingMessageWithSendDto;
import com.ccsens.tall.bean.po.SysRingMsg; import com.ccsens.tall.bean.po.SysRingMsg;
import com.ccsens.tall.bean.po.SysRingSend; import com.ccsens.tall.bean.po.SysRingSend;
import com.ccsens.tall.bean.po.SysRingSendExample;
import com.ccsens.tall.bean.vo.RingVo; import com.ccsens.tall.bean.vo.RingVo;
import com.ccsens.tall.persist.dao.SysRingMsgDao; import com.ccsens.tall.persist.dao.SysRingMsgDao;
import com.ccsens.tall.persist.dao.SysRingSendDao; import com.ccsens.tall.persist.dao.SysRingSendDao;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JacksonUtil; import com.ccsens.util.JacksonUtil;
import com.ccsens.util.config.RabbitMQConfig; import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.util.exception.BaseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**
* @author * @author
*/ */
@Slf4j
@Service @Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class RingService implements IRingService{ public class RingService implements IRingService{
@Autowired @Autowired
private Snowflake snowflake; private Snowflake snowflake;
@ -93,20 +101,70 @@ public class RingService implements IRingService{
* @return 时间倒叙查询最近10条信息在返回的结果中需时间正序展示 * @return 时间倒叙查询最近10条信息在返回的结果中需时间正序展示
*/ */
@Override @Override
public List<RingVo.RingInfo> getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto) { public PageInfo<RingVo.RingInfo> getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto) {
// PageHelper.startPage(getRingDto.getPage(), getRingDto.getPageSize()); //计算分页信息
// List<RingVo.RingInfo> ringInfoList = sysRingMsgDao.getRingInfoByProjectId(); int pageIndex = 0;
// new PageInfo<>(); int pageSize = 10;
return null; if(ObjectUtil.isNotNull(getRingDto.getPageSize())) {
pageSize = getRingDto.getPageSize();
}
if(ObjectUtil.isNotNull(getRingDto.getPage())) {
pageIndex = (getRingDto.getPage() - 1) * pageSize;
}
getRingDto.setPage(getRingDto.getPage() == null ? 1 : getRingDto.getPage());
getRingDto.setPageSize(getRingDto.getPageSize() == null ? 10 : getRingDto.getPageSize());
PageHelper.startPage(getRingDto.getPage(), getRingDto.getPageSize());
List<RingVo.RingInfo> ringInfoList = sysRingMsgDao.selectRingInfoByProject(currentUserId,getRingDto.getProjectId(),pageIndex,pageSize);
CollectionUtil.sort(ringInfoList,new Comparator<RingVo.RingInfo>(){
@Override
public int compare(RingVo.RingInfo o1, RingVo.RingInfo o2) {
return (int)(o1.getTime() - o2.getTime());
}
});
return new PageInfo<>(ringInfoList);
} }
/** /**
* 阅读消息将消息设为已读 * 阅读消息将消息设为已读
* @param currentUserId userId * @param currentUserId userId
* @param messageList 消息id可以多个同时将多个消息设为已读 * @param message 项目id消息id可以多个同时将多个消息设为已读
*/ */
@Override @Override
public void readRingMsg(Long currentUserId, List<RingDto.MessageId> messageList) { public void readRingMsg(Long currentUserId, RingDto.MessageId message) throws JsonProcessingException {
//获取当前用户在项目内的角色
List<Long> roleIdList = sysRingMsgDao.selectRoleIdByUserId(currentUserId,message.getProjectId());
log.info("阅读者的角色:{}",roleIdList.toString());
//将每条消息的状态设为已读
if(CollectionUtil.isNotEmpty(roleIdList) && CollectionUtil.isNotEmpty(message.getMessageIdList())){
for(Long roleId : roleIdList){
for(Long msgId : message.getMessageIdList()){
//查找消息
SysRingMsg sysRingMsg = sysRingMsgDao.selectByPrimaryKey(msgId);
if(ObjectUtil.isNull(sysRingMsg)){
throw new BaseException(CodeEnum.PARAM_ERROR);
}
SysRingSendExample sysRingSendExample = new SysRingSendExample();
sysRingSendExample.createCriteria().andRingIdEqualTo(msgId).andRoleIdEqualTo(roleId);
List<SysRingSend> sysRingSendList = sysRingSendDao.selectByExample(sysRingSendExample);
if(CollectionUtil.isNotEmpty(sysRingSendList)){
for(SysRingSend sysRingSend : sysRingSendList){
sysRingSend.setReadStatus((byte) 1);
sysRingSend.setReadTime(System.currentTimeMillis());
sysRingSendDao.updateByPrimaryKeySelective(sysRingSend);
}
//将已读消息返回给发送者
List<Long> userIdList = new ArrayList<>();
userIdList.add(sysRingMsg.getSenderId());
RingMessageWithReadDto ringMessageWithReadDto = new RingMessageWithReadDto(msgId,message.getProjectId(),roleId);
ringMessageWithReadDto.setReceivers(BaseMessageDto.MessageUser.userIdToUsers(userIdList));
rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME,
JacksonUtil.beanToJson(ringMessageWithReadDto));
}
}
}
}
} }
} }

3
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -413,7 +413,7 @@ public class UserService implements IUserService {
*/ */
private UserVo.UserSign getUserSign(String openId, String unionId, private UserVo.UserSign getUserSign(String openId, String unionId,
byte identifyType, String redirect) { byte identifyType, String redirect) {
UserVo.UserSign userSignVo;//1.查找对应账户,不存在则注册 UserVo.UserSign userSignVo;
List<SysAuth> authList = null; List<SysAuth> authList = null;
SysAuth theAuth = null; SysAuth theAuth = null;
if (ObjectUtil.isNotNull(openId)) { if (ObjectUtil.isNotNull(openId)) {
@ -439,7 +439,6 @@ public class UserService implements IUserService {
theAuth.setCredential(unionId); theAuth.setCredential(unionId);
authDao.insertSelective(theAuth); authDao.insertSelective(theAuth);
} else { } else {
//新建用户并保存微信信息 //新建用户并保存微信信息
SysUser user = new SysUser(); SysUser user = new SysUser();

3
tall/src/main/java/com/ccsens/tall/web/PluginController.java

@ -8,6 +8,7 @@ import com.ccsens.tall.service.ISysPluginService;
import com.ccsens.tall.service.ITaskPluginService; import com.ccsens.tall.service.ITaskPluginService;
import com.ccsens.util.JsonResponse; import com.ccsens.util.JsonResponse;
import com.ccsens.util.WebConstant; import com.ccsens.util.WebConstant;
import com.ccsens.util.annotation.OperateType;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -75,7 +76,7 @@ public class PluginController {
return taskDetailId; return taskDetailId;
} }
@OperateType(13)
@ApiOperation(value = "评论", notes = "") @ApiOperation(value = "评论", notes = "")
@ApiImplicitParams({ @ApiImplicitParams({
}) })

12
tall/src/main/java/com/ccsens/tall/web/RingController.java

@ -6,6 +6,7 @@ import com.ccsens.tall.bean.vo.RingVo;
import com.ccsens.tall.service.IRingService; import com.ccsens.tall.service.IRingService;
import com.ccsens.util.JsonResponse; import com.ccsens.util.JsonResponse;
import com.ccsens.util.WebConstant; import com.ccsens.util.WebConstant;
import com.github.pagehelper.PageInfo;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -38,14 +39,15 @@ public class RingController {
} }
@ApiOperation(value = "发送ring消息", notes = "") @ApiOperation(value = "查看ring消息", notes = "")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@RequestMapping(value = "", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<RingVo.RingInfo>> getRingInfo(HttpServletRequest request, public JsonResponse<PageInfo<RingVo.RingInfo>> getRingInfo(HttpServletRequest request,
@ApiParam @Validated @RequestBody RingDto.GetRingDto getRingDto) throws Exception { @ApiParam @Validated @RequestBody RingDto.GetRingDto getRingDto) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
List<RingVo.RingInfo> ringInfoList = ringService.getRingInfo(currentUserId,getRingDto); PageInfo<RingVo.RingInfo> ringInfoList = ringService.getRingInfo(currentUserId,getRingDto);
return JsonResponse.newInstance().ok(ringInfoList); return JsonResponse.newInstance().ok(ringInfoList);
} }
@ -55,9 +57,9 @@ public class RingController {
}) })
@RequestMapping(value = "/read", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/read", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse readRingMsg(HttpServletRequest request, public JsonResponse readRingMsg(HttpServletRequest request,
@ApiParam @Validated @RequestBody List<RingDto.MessageId> messageList) throws Exception { @ApiParam @Validated @RequestBody RingDto.MessageId message) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
ringService.readRingMsg(currentUserId,messageList); ringService.readRingMsg(currentUserId,message);
return JsonResponse.newInstance().ok(); return JsonResponse.newInstance().ok();
} }

4
tall/src/main/resources/application-test.yml

@ -32,7 +32,7 @@ swagger:
enable: true enable: true
eureka: eureka:
instance: instance:
ip-address: 192.168.0.99 # ip-address: 192.168.0.99
# ip-address: 49.233.89.188 ip-address: 49.233.89.188
gatewayUrl: http://192.168.0.99/gateway/ gatewayUrl: http://192.168.0.99/gateway/
notGatewayUrl: http://192.168.0.99/ notGatewayUrl: http://192.168.0.99/

8
tall/src/main/resources/druid-test.yml

@ -15,8 +15,8 @@ spring:
maxWait: 60000 maxWait: 60000
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
minIdle: 5 minIdle: 5
# password: password:
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473 # password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473
poolPreparedStatements: true poolPreparedStatements: true
servletLogSlowSql: true servletLogSlowSql: true
servletLoginPassword: 111111 servletLoginPassword: 111111
@ -28,8 +28,8 @@ spring:
testOnReturn: false testOnReturn: false
testWhileIdle: true testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
# url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://test.tall.wiki/tall?useUnicode=true&characterEncoding=UTF-8 # url: jdbc:mysql://test.tall.wiki/tall?useUnicode=true&characterEncoding=UTF-8
username: root username: root
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL
env: CCSENS_TALL env: CCSENS_TALL

93
tall/src/main/resources/mapper_dao/SysRingMsgDao.xml

@ -0,0 +1,93 @@
<?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.ccsens.tall.persist.dao.SysRingMsgDao">
<resultMap id="ring_message" type="com.ccsens.tall.bean.vo.RingVo$RingInfo">
<id column="messageId" property="messageId" />
<result column="value" property="value" />
<result column="mine" property="mine" />
<result column="unread" property="unread" />
<result column="time" property="time" />
<collection property="roleList" ofType="com.ccsens.tall.bean.vo.RingVo$MsgReceiveRole">
<id column="roleId" property="id"/>
<result column="roleName" property="name"/>
<result column="readStatus" property="readStatus"/>
</collection>
<collection property="sender" ofType="com.ccsens.tall.bean.vo.RingVo$MsgSender">
<id column="senderId" property="id"/>
<result column="senderName" property="name"/>
</collection>
</resultMap>
<select id="selectRingInfoByProject" parameterType="java.util.Map" resultMap="ring_message">
SELECT
m.id as messageId,
m.`value` as `value`,
m.`value_text` as `valueText`,
m.`time` as time,
if(m.sender_id = #{userId},1,0) as mine,
r.id as roleId,
r.name as roleName,
s.read_status as readStatus,
m.sender_id as senderId,
(
SELECT
IF( u.nickname = '', a.identifier, u.nickname ) AS userName
FROM
t_sys_user u
LEFT JOIN t_sys_auth a ON u.id = a.user_id
AND a.identify_type = 3
WHERE
u.rec_status = 0
and
a.rec_status = 0
and
u.id = m.sender_id
limit 1
) as senderName,
(SELECT count(read_status) FROM t_sys_ring_send WHERE ring_id = m.id and read_status = 0) as unread
FROM
t_sys_ring_msg m LEFT JOIN t_sys_ring_send s on m.id = s.ring_id
LEFT JOIN t_pro_role r on s.role_id = r.id
WHERE
(
m.sender_id = #{userId}
or
s.role_id in (
SELECT
r.id as rId
FROM
t_pro_role r LEFT JOIN t_pro_member_role mr on r.id = mr.role_id
LEFT JOIN t_pro_member m on mr.member_id = m.id
WHERE
(m.user_id = #{userId}
or
r.`name` = '全体成员'
)
AND
r.project_id = #{projectId}
)
)
and
m.project_id = #{projectId}
ORDER BY m.time DESC
</select>
<select id="selectRoleIdByUserId" parameterType="java.util.Map" resultType="Long">
SELECT
r.id as rId
FROM
t_pro_role r LEFT JOIN t_pro_member_role mr on r.id = mr.role_id
LEFT JOIN t_pro_member m on mr.member_id = m.id
WHERE
(m.user_id = #{userId}
or
r.`name` = '全体成员'
)
AND
r.project_id = #{projectId}
</select>
</mapper>

25
tall/src/main/resources/mapper_raw/SysRingSendMapper.xml

@ -9,6 +9,7 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> <result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="read_time" jdbcType="BIGINT" property="readTime" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -69,7 +70,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, ring_id, role_id, read_status, created_at, updated_at, rec_status id, ring_id, role_id, read_status, created_at, updated_at, rec_status, read_time
</sql> </sql>
<select id="selectByExample" parameterType="com.ccsens.tall.bean.po.SysRingSendExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.ccsens.tall.bean.po.SysRingSendExample" resultMap="BaseResultMap">
select select
@ -104,10 +105,10 @@
<insert id="insert" parameterType="com.ccsens.tall.bean.po.SysRingSend"> <insert id="insert" parameterType="com.ccsens.tall.bean.po.SysRingSend">
insert into t_sys_ring_send (id, ring_id, role_id, insert into t_sys_ring_send (id, ring_id, role_id,
read_status, created_at, updated_at, read_status, created_at, updated_at,
rec_status) rec_status, read_time)
values (#{id,jdbcType=BIGINT}, #{ringId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{ringId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT},
#{readStatus,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{readStatus,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT}) #{recStatus,jdbcType=TINYINT}, #{readTime,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="com.ccsens.tall.bean.po.SysRingSend"> <insert id="insertSelective" parameterType="com.ccsens.tall.bean.po.SysRingSend">
insert into t_sys_ring_send insert into t_sys_ring_send
@ -133,6 +134,9 @@
<if test="recStatus != null"> <if test="recStatus != null">
rec_status, rec_status,
</if> </if>
<if test="readTime != null">
read_time,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -156,6 +160,9 @@
<if test="recStatus != null"> <if test="recStatus != null">
#{recStatus,jdbcType=TINYINT}, #{recStatus,jdbcType=TINYINT},
</if> </if>
<if test="readTime != null">
#{readTime,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.ccsens.tall.bean.po.SysRingSendExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.ccsens.tall.bean.po.SysRingSendExample" resultType="java.lang.Long">
@ -188,6 +195,9 @@
<if test="record.recStatus != null"> <if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT}, rec_status = #{record.recStatus,jdbcType=TINYINT},
</if> </if>
<if test="record.readTime != null">
read_time = #{record.readTime,jdbcType=BIGINT},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -201,7 +211,8 @@
read_status = #{record.readStatus,jdbcType=TINYINT}, read_status = #{record.readStatus,jdbcType=TINYINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT} rec_status = #{record.recStatus,jdbcType=TINYINT},
read_time = #{record.readTime,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -227,6 +238,9 @@
<if test="recStatus != null"> <if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT}, rec_status = #{recStatus,jdbcType=TINYINT},
</if> </if>
<if test="readTime != null">
read_time = #{readTime,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
@ -237,7 +251,8 @@
read_status = #{readStatus,jdbcType=TINYINT}, read_status = #{readStatus,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=TIMESTAMP}, created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT} rec_status = #{recStatus,jdbcType=TINYINT},
read_time = #{readTime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
Loading…
Cancel
Save