Commit 68c5d996 authored by shiyu's avatar shiyu

版本更新

parent 3c64f57e
...@@ -15,6 +15,7 @@ public interface UserDao { ...@@ -15,6 +15,7 @@ public interface UserDao {
int insertByMapper(User user); int insertByMapper(User user);
/** /**
* 通过oid查询未删除的记录 * 通过oid查询未删除的记录
* *
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2023/09/15 * @date 2024/04/08
*/ */
@Data @Data
public class FollowFansRecord implements Entity { public class FollowFansRecord implements Entity {
...@@ -26,6 +26,11 @@ public class FollowFansRecord implements Entity { ...@@ -26,6 +26,11 @@ public class FollowFansRecord implements Entity {
*/ */
private Long followerId; private Long followerId;
/**
* 介绍人id
*/
private Long introducerId;
/** /**
* 创建时间 * 创建时间
*/ */
...@@ -52,6 +57,7 @@ public class FollowFansRecord implements Entity { ...@@ -52,6 +57,7 @@ public class FollowFansRecord implements Entity {
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", fansId=").append(fansId); sb.append(", fansId=").append(fansId);
sb.append(", followerId=").append(followerId); sb.append(", followerId=").append(followerId);
sb.append(", introducerId=").append(introducerId);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", state=").append(state); sb.append(", state=").append(state);
...@@ -75,6 +81,7 @@ public class FollowFansRecord implements Entity { ...@@ -75,6 +81,7 @@ public class FollowFansRecord implements Entity {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getFansId() == null ? other.getFansId() == null : this.getFansId().equals(other.getFansId())) && (this.getFansId() == null ? other.getFansId() == null : this.getFansId().equals(other.getFansId()))
&& (this.getFollowerId() == null ? other.getFollowerId() == null : this.getFollowerId().equals(other.getFollowerId())) && (this.getFollowerId() == null ? other.getFollowerId() == null : this.getFollowerId().equals(other.getFollowerId()))
&& (this.getIntroducerId() == null ? other.getIntroducerId() == null : this.getIntroducerId().equals(other.getIntroducerId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())); && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
...@@ -87,6 +94,7 @@ public class FollowFansRecord implements Entity { ...@@ -87,6 +94,7 @@ public class FollowFansRecord implements Entity {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getFansId() == null) ? 0 : getFansId().hashCode()); result = prime * result + ((getFansId() == null) ? 0 : getFansId().hashCode());
result = prime * result + ((getFollowerId() == null) ? 0 : getFollowerId().hashCode()); result = prime * result + ((getFollowerId() == null) ? 0 : getFollowerId().hashCode());
result = prime * result + ((getIntroducerId() == null) ? 0 : getIntroducerId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
...@@ -104,6 +112,7 @@ public class FollowFansRecord implements Entity { ...@@ -104,6 +112,7 @@ public class FollowFansRecord implements Entity {
id("id", "id", "INTEGER", false), id("id", "id", "INTEGER", false),
fansId("fans_id", "fansId", "BIGINT", false), fansId("fans_id", "fansId", "BIGINT", false),
followerId("follower_id", "followerId", "BIGINT", false), followerId("follower_id", "followerId", "BIGINT", false),
introducerId("introducer_id", "introducerId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false), createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
state("state", "state", "INTEGER", true); state("state", "state", "INTEGER", true);
......
...@@ -544,6 +544,138 @@ public class FollowFansRecordExample { ...@@ -544,6 +544,138 @@ public class FollowFansRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIntroducerIdIsNull() {
addCriterion("introducer_id is null");
return (Criteria) this;
}
public Criteria andIntroducerIdIsNotNull() {
addCriterion("introducer_id is not null");
return (Criteria) this;
}
public Criteria andIntroducerIdEqualTo(Long value) {
addCriterion("introducer_id =", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdEqualToColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdNotEqualTo(Long value) {
addCriterion("introducer_id <>", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdNotEqualToColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdGreaterThan(Long value) {
addCriterion("introducer_id >", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdGreaterThanColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdGreaterThanOrEqualTo(Long value) {
addCriterion("introducer_id >=", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdGreaterThanOrEqualToColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdLessThan(Long value) {
addCriterion("introducer_id <", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdLessThanColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdLessThanOrEqualTo(Long value) {
addCriterion("introducer_id <=", value, "introducerId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table follow_fans_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIntroducerIdLessThanOrEqualToColumn(FollowFansRecord.Column column) {
addCriterion(new StringBuilder("introducer_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIntroducerIdIn(List<Long> values) {
addCriterion("introducer_id in", values, "introducerId");
return (Criteria) this;
}
public Criteria andIntroducerIdNotIn(List<Long> values) {
addCriterion("introducer_id not in", values, "introducerId");
return (Criteria) this;
}
public Criteria andIntroducerIdBetween(Long value1, Long value2) {
addCriterion("introducer_id between", value1, value2, "introducerId");
return (Criteria) this;
}
public Criteria andIntroducerIdNotBetween(Long value1, Long value2) {
addCriterion("introducer_id not between", value1, value2, "introducerId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;
......
package com.wwdz.ch.db.domain; package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
......
...@@ -20,6 +20,11 @@ public class FollowFansRecordRequestDto extends BaseRequestDto implements Entity ...@@ -20,6 +20,11 @@ public class FollowFansRecordRequestDto extends BaseRequestDto implements Entity
*/ */
private Long fansId; private Long fansId;
/**
* 介绍人id
*/
private Long introducerId;
/** /**
* 被关注者id * 被关注者id
*/ */
......
...@@ -38,6 +38,12 @@ public class UserDaoImpl implements UserDao { ...@@ -38,6 +38,12 @@ public class UserDaoImpl implements UserDao {
return 0; return 0;
} }
@Override @Override
public User queryByOid(String openId) { public User queryByOid(String openId) {
CloudServerResponse<com.wwdz.user.api.model.user.User> cloudServerResponse = userReadService.getUserByOpenIdOrUnionId(null, openId); CloudServerResponse<com.wwdz.user.api.model.user.User> cloudServerResponse = userReadService.getUserByOpenIdOrUnionId(null, openId);
...@@ -70,12 +76,14 @@ public class UserDaoImpl implements UserDao { ...@@ -70,12 +76,14 @@ public class UserDaoImpl implements UserDao {
@Override @Override
public User queryById(Long id) { public User queryById(Long id) {
CloudServerResponse<com.wwdz.user.api.model.user.User> cloudServerResponse = userReadService.getUserIsNotDelete(id); return userMapper.selectByPrimaryKey(id);
/*CloudServerResponse<com.wwdz.user.api.model.user.User> cloudServerResponse = userReadService.getUserIsNotDelete(id);
if (cloudServerResponse.getCode() != 1001) { if (cloudServerResponse.getCode() != 1001) {
return new User(); return new User();
} }
com.wwdz.user.api.model.user.User wUser = cloudServerResponse.getResult(); com.wwdz.user.api.model.user.User wUser = cloudServerResponse.getResult();
return User.of(wUser); return User.of(wUser);*/
} }
@Override @Override
...@@ -110,8 +118,12 @@ public class UserDaoImpl implements UserDao { ...@@ -110,8 +118,12 @@ public class UserDaoImpl implements UserDao {
@Override @Override
public int updateById(User user) { public int updateById(User user) {
CloudServerResponse<Integer> cloudServerResponse = userWriteService.updateByUserId(User.convertToWWDZUser(user)); UserExample example = new UserExample();
return cloudServerResponse.getResult(); UserExample.Criteria criteria = example.or();
criteria.andIdEqualTo(user.getId());
return userMapper.updateByPrimaryKeySelective(user);
//CloudServerResponse<Integer> cloudServerResponse = userWriteService.updateByUserId(User.convertToWWDZUser(user));
// return cloudServerResponse.getResult();
} }
@Override @Override
......
...@@ -78,7 +78,7 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService { ...@@ -78,7 +78,7 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("recordId", id); map.put("recordId", id);
String messageKey = StringUtil.formatMessageKey(dto.getFansId(), MessageEnum.TypeEnum.FOLLOW.getCode(), dto.getFollowerId()); /* String messageKey = StringUtil.formatMessageKey(dto.getFansId(), MessageEnum.TypeEnum.FOLLOW.getCode(), dto.getFollowerId());
if (redisUtils.hasKey(messageKey)) { if (redisUtils.hasKey(messageKey)) {
return Result.success(map); return Result.success(map);
} }
...@@ -95,7 +95,7 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService { ...@@ -95,7 +95,7 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
messageRequestDto.setContent(JsonUtils.from(messageContentText)); messageRequestDto.setContent(JsonUtils.from(messageContentText));
messageService.add(messageRequestDto); messageService.add(messageRequestDto);
//五分钟内再次关注不会发送消息 //五分钟内再次关注不会发送消息
redisUtils.set(messageKey, LocalDateTime.now(), 60 * 5); redisUtils.set(messageKey, LocalDateTime.now(), 60 * 5);*/
return Result.success(map); return Result.success(map);
} catch (Exception e) { } catch (Exception e) {
logger.error("{} 关注 {} error {}", dto.getFansId(), dto.getFollowerId(), e); logger.error("{} 关注 {} error {}", dto.getFansId(), dto.getFollowerId(), e);
......
...@@ -30,7 +30,7 @@ public class FollowFansRecordController { ...@@ -30,7 +30,7 @@ public class FollowFansRecordController {
@PostMapping("/addFollow") @PostMapping("/addFollow")
public Result addFollow(@RequestBody FollowFansRecordRequestDto dto) { public Result addFollow(@RequestBody FollowFansRecordRequestDto dto) {
logger.info("新增关注,请求参数:{}", JSON.toJSONString(dto)); logger.info("新增关注,请求参数:{}", JSON.toJSONString(dto));
if (dto.getFollowerId() == null || dto.getFansId() == null) { if (dto.getFollowerId() == null || dto.getFansId() == null || dto.getIntroducerId() == null) {
return Result.failed(ResultCode.PARAM_ERROR); return Result.failed(ResultCode.PARAM_ERROR);
} }
return followFansRecordService.follow(dto); return followFansRecordService.follow(dto);
......
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