Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
72be54da
Commit
72be54da
authored
Jun 06, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据用户id查询
parent
6a15e86b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
292 additions
and
17 deletions
+292
-17
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
+10
-1
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
+142
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/UserRequestDto.java
.../main/java/com/wwdz/ch/db/dto/request/UserRequestDto.java
+5
-2
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
...o/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
+31
-13
ch-wx-api/src/main/java/com/wwdz/ch/wx/dao/UserInfo.java
ch-wx-api/src/main/java/com/wwdz/ch/wx/dao/UserInfo.java
+15
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
...java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
+4
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+58
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
...api/src/main/java/com/wwdz/ch/wx/service/UserService.java
+4
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+23
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/domain/User.java
View file @
72be54da
...
...
@@ -11,7 +11,7 @@ import org.springframework.util.StringUtils;
/**
* @author shiyu
* @date 202
3/11/01
* @date 202
4/06/06
*/
@Data
public
class
User
implements
Entity
{
...
...
@@ -115,6 +115,11 @@ public class User implements Entity {
*/
private
String
wechatId
;
/**
* 微信二维码
*/
private
String
wechatQrCode
;
/**
* 0 可用, 1 禁用, 2 注销
*/
...
...
@@ -245,6 +250,7 @@ public class User implements Entity {
sb
.
append
(
", weixinUnionid="
).
append
(
weixinUnionid
);
sb
.
append
(
", alipayUserId="
).
append
(
alipayUserId
);
sb
.
append
(
", wechatId="
).
append
(
wechatId
);
sb
.
append
(
", wechatQrCode="
).
append
(
wechatQrCode
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
...
...
@@ -285,6 +291,7 @@ public class User implements Entity {
&&
(
this
.
getWeixinUnionid
()
==
null
?
other
.
getWeixinUnionid
()
==
null
:
this
.
getWeixinUnionid
().
equals
(
other
.
getWeixinUnionid
()))
&&
(
this
.
getAlipayUserId
()
==
null
?
other
.
getAlipayUserId
()
==
null
:
this
.
getAlipayUserId
().
equals
(
other
.
getAlipayUserId
()))
&&
(
this
.
getWechatId
()
==
null
?
other
.
getWechatId
()
==
null
:
this
.
getWechatId
().
equals
(
other
.
getWechatId
()))
&&
(
this
.
getWechatQrCode
()
==
null
?
other
.
getWechatQrCode
()
==
null
:
this
.
getWechatQrCode
().
equals
(
other
.
getWechatQrCode
()))
&&
(
this
.
getStatus
()
==
null
?
other
.
getStatus
()
==
null
:
this
.
getStatus
().
equals
(
other
.
getStatus
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
...
...
@@ -314,6 +321,7 @@ public class User implements Entity {
result
=
prime
*
result
+
((
getWeixinUnionid
()
==
null
)
?
0
:
getWeixinUnionid
().
hashCode
());
result
=
prime
*
result
+
((
getAlipayUserId
()
==
null
)
?
0
:
getAlipayUserId
().
hashCode
());
result
=
prime
*
result
+
((
getWechatId
()
==
null
)
?
0
:
getWechatId
().
hashCode
());
result
=
prime
*
result
+
((
getWechatQrCode
()
==
null
)
?
0
:
getWechatQrCode
().
hashCode
());
result
=
prime
*
result
+
((
getStatus
()
==
null
)
?
0
:
getStatus
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
...
...
@@ -359,6 +367,7 @@ public class User implements Entity {
weixinUnionid
(
"weixin_unionid"
,
"weixinUnionid"
,
"VARCHAR"
,
false
),
alipayUserId
(
"alipay_user_id"
,
"alipayUserId"
,
"VARCHAR"
,
false
),
wechatId
(
"wechat_id"
,
"wechatId"
,
"VARCHAR"
,
false
),
wechatQrCode
(
"wechat_qr_code"
,
"wechatQrCode"
,
"VARCHAR"
,
false
),
status
(
"status"
,
"status"
,
"TINYINT"
,
true
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserExample.java
View file @
72be54da
...
...
@@ -2539,6 +2539,148 @@ public class UserExample {
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeIsNull
()
{
addCriterion
(
"wechat_qr_code is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeIsNotNull
()
{
addCriterion
(
"wechat_qr_code is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeEqualTo
(
String
value
)
{
addCriterion
(
"wechat_qr_code ="
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeNotEqualTo
(
String
value
)
{
addCriterion
(
"wechat_qr_code <>"
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeNotEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeGreaterThan
(
String
value
)
{
addCriterion
(
"wechat_qr_code >"
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeGreaterThanColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"wechat_qr_code >="
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeGreaterThanOrEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeLessThan
(
String
value
)
{
addCriterion
(
"wechat_qr_code <"
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeLessThanColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"wechat_qr_code <="
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andWechatQrCodeLessThanOrEqualToColumn
(
User
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"wechat_qr_code <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeLike
(
String
value
)
{
addCriterion
(
"wechat_qr_code like"
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeNotLike
(
String
value
)
{
addCriterion
(
"wechat_qr_code not like"
,
value
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeIn
(
List
<
String
>
values
)
{
addCriterion
(
"wechat_qr_code in"
,
values
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"wechat_qr_code not in"
,
values
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"wechat_qr_code between"
,
value1
,
value2
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andWechatQrCodeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"wechat_qr_code not between"
,
value1
,
value2
,
"wechatQrCode"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStatusIsNull
()
{
addCriterion
(
"`status` is null"
);
return
(
Criteria
)
this
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/UserRequestDto.java
View file @
72be54da
...
...
@@ -7,7 +7,7 @@ import lombok.Data;
public
class
UserRequestDto
implements
Entity
{
private
String
user
;
private
Long
id
;
// 用户id
private
Long
userId
;
// 手机号
...
...
@@ -55,7 +55,10 @@ public class UserRequestDto implements Entity {
* 备注
*/
private
String
remark
;
/**
* 微信二维码
*/
private
String
wechatQrCode
;
/**
* 玩物得志登录后token
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserMapper.xml
View file @
72be54da
...
...
@@ -19,6 +19,7 @@
<result
column=
"weixin_unionid"
jdbcType=
"VARCHAR"
property=
"weixinUnionid"
/>
<result
column=
"alipay_user_id"
jdbcType=
"VARCHAR"
property=
"alipayUserId"
/>
<result
column=
"wechat_id"
jdbcType=
"VARCHAR"
property=
"wechatId"
/>
<result
column=
"wechat_qr_code"
jdbcType=
"VARCHAR"
property=
"wechatQrCode"
/>
<result
column=
"status"
jdbcType=
"TINYINT"
property=
"status"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
...
...
@@ -87,7 +88,8 @@
<sql
id=
"Base_Column_List"
>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark
wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.UserExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -124,7 +126,8 @@
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark
wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise>
</choose>
from user
...
...
@@ -177,7 +180,8 @@
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark
wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise>
</choose>
from user
...
...
@@ -202,17 +206,17 @@
user_level, nickname, mobile,
avatar, profile, background,
weixin_openid, weixin_unionid, alipay_user_id,
wechat_id,
`status`, add_time
,
update_time, deleted, share_user_i
d,
remark)
wechat_id,
wechat_qr_code, `status`
,
add_time, update_time, delete
d,
share_user_id,
remark)
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{birthday,jdbcType=DATE}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{lastLoginIp,jdbcType=VARCHAR},
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR},
#{wechatId,jdbcType=VARCHAR}, #{
status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP
},
#{
updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{shareUserId,jdbcType=BIGIN
T},
#{remark,jdbcType=VARCHAR})
#{wechatId,jdbcType=VARCHAR}, #{
wechatQrCode,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT
},
#{
addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BI
T},
#{
shareUserId,jdbcType=BIGINT}, #{
remark,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertBySelfId"
parameterType=
"com.wwdz.ch.db.domain.User"
>
...
...
@@ -221,7 +225,7 @@
user_level, nickname, mobile,
avatar, profile, background,
weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time,
wechat_id,
wechat_qr_code,
`status`, add_time,
update_time, deleted, share_user_id,
remark)
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
...
...
@@ -229,7 +233,7 @@
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR},
#{wechatId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP},
#{wechatId,jdbcType=VARCHAR}, #{
wechatQrCode,jdbcType=VARCHAR}, #{
status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{shareUserId,jdbcType=BIGINT},
#{remark,jdbcType=VARCHAR})
</insert>
...
...
@@ -289,6 +293,9 @@
<if
test=
"wechatId != null"
>
wechat_id,
</if>
<if
test=
"wechatQrCode != null"
>
wechat_qr_code,
</if>
<if
test=
"status != null"
>
`status`,
</if>
...
...
@@ -357,6 +364,9 @@
<if
test=
"wechatId != null"
>
#{wechatId,jdbcType=VARCHAR},
</if>
<if
test=
"wechatQrCode != null"
>
#{wechatQrCode,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=TINYINT},
</if>
...
...
@@ -437,6 +447,9 @@
<if
test=
"record.wechatId != null"
>
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
</if>
<if
test=
"record.wechatQrCode != null"
>
wechat_qr_code = #{record.wechatQrCode,jdbcType=VARCHAR},
</if>
<if
test=
"record.status != null"
>
`status` = #{record.status,jdbcType=TINYINT},
</if>
...
...
@@ -479,6 +492,7 @@
weixin_unionid = #{record.weixinUnionid,jdbcType=VARCHAR},
alipay_user_id = #{record.alipayUserId,jdbcType=VARCHAR},
wechat_id = #{record.wechatId,jdbcType=VARCHAR},
wechat_qr_code = #{record.wechatQrCode,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=TINYINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
...
...
@@ -540,6 +554,9 @@
<if
test=
"wechatId != null"
>
wechat_id = #{wechatId,jdbcType=VARCHAR},
</if>
<if
test=
"wechatQrCode != null"
>
wechat_qr_code = #{wechatQrCode,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
`status` = #{status,jdbcType=TINYINT},
</if>
...
...
@@ -579,6 +596,7 @@
weixin_unionid = #{weixinUnionid,jdbcType=VARCHAR},
alipay_user_id = #{alipayUserId,jdbcType=VARCHAR},
wechat_id = #{wechatId,jdbcType=VARCHAR},
wechat_qr_code = #{wechatQrCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
...
...
@@ -622,7 +640,8 @@
<otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark
wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise>
</choose>
from user
...
...
@@ -654,5 +673,4 @@
update user set deleted = 1
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/dao/UserInfo.java
View file @
72be54da
package
com.wwdz.ch.wx.dao
;
import
com.wwdz.ch.core.consts.FollowFansEnum
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -54,5 +55,18 @@ public class UserInfo implements Serializable {
private
Integer
returnOrderNumber
;
/**
* 关系(已关注,互相关注,未关注)
*/
private
String
relation
;
/**
* 关系(已关注,互相关注,未关注)
*/
private
Integer
relationCode
;
/**
* 微信二维码
*/
private
String
wechatQrCode
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FollowFansRecordServiceImpl.java
View file @
72be54da
...
...
@@ -282,12 +282,16 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
//查询当前用户关注的人
FollowFansRecordRequestDto
currentFollowDto
=
new
FollowFansRecordRequestDto
();
currentFollowDto
.
setFansId
(
dto
.
getCurrentUserId
());
currentFollowDto
.
setPage
(
1
);
currentFollowDto
.
setLimit
(
9999
);
List
<
FollowFansRecord
>
currentFollowFansRecordList
=
followFansRecordDao
.
findList
(
currentFollowDto
);
List
<
Long
>
currentFollowIdList
=
currentFollowFansRecordList
.
stream
().
map
(
FollowFansRecord:
:
getFollowerId
).
collect
(
Collectors
.
toList
());
//查询当前用户的粉丝
FollowFansRecordRequestDto
currentFansDto
=
new
FollowFansRecordRequestDto
();
currentFansDto
.
setFollowerId
(
dto
.
getCurrentUserId
());
currentFansDto
.
setPage
(
1
);
currentFansDto
.
setLimit
(
9999
);
List
<
FollowFansRecord
>
currentFansRecordList
=
followFansRecordDao
.
findList
(
currentFansDto
);
List
<
Long
>
currentFansIdList
=
currentFansRecordList
.
stream
().
map
(
FollowFansRecord:
:
getFansId
).
collect
(
Collectors
.
toList
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
72be54da
...
...
@@ -19,6 +19,7 @@ import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder;
import
com.wwdz.ch.db.dao.*
;
import
com.wwdz.ch.db.dao.distribution.ShopWhiteListDao
;
import
com.wwdz.ch.db.domain.AiAssistant
;
import
com.wwdz.ch.db.domain.FollowFansRecord
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.distribution.ShopWhiteList
;
...
...
@@ -539,6 +540,29 @@ public class UserServiceImpl implements UserService {
}
}
@Override
public
Result
updateQrCode
(
UserRequestDto
dto
)
{
try
{
User
user
=
userDao
.
queryById
(
dto
.
getUserId
());
if
(
Objects
.
isNull
(
user
))
{
return
Result
.
failed
(
"数据异常,用户不存在"
);
}
user
.
setWechatQrCode
(
dto
.
getWechatQrCode
());
userDao
.
updateById
(
user
);
// 更新用户缓存
User
resultUser
=
userDao
.
queryById
(
user
.
getId
());
String
userKey
=
MessageFormat
.
format
(
CacheCodeConstants
.
USER_INFO_KEY
,
user
.
getId
());
redisUtil
.
set
(
userKey
,
resultUser
,
2
*
60
*
60
);
logger
.
info
(
"【请求结束】用户修改微信二维码成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改微信二维码失败"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"用户修改微信二维码失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
updateMobile
(
UserRequestDto
dto
)
{
...
...
@@ -824,4 +848,38 @@ public class UserServiceImpl implements UserService {
return
result
;
}
@Override
public
Result
findById
(
UserRequestDto
dto
)
{
try
{
User
user
=
userDao
.
queryById
(
dto
.
getId
());
if
(
user
==
null
)
{
return
Result
.
failed
(
"查询不到该用户信息"
);
}
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setUserId
(
dto
.
getUserId
());
userInfo
.
setNickName
(
user
.
getNickname
());
userInfo
.
setAvatarUrl
(
user
.
getAvatar
());
userInfo
.
setProfile
(
user
.
getProfile
());
userInfo
.
setBackground
(
user
.
getBackground
());
userInfo
.
setIsFollowed
(
false
);
userInfo
.
setFollowedId
(
null
);
FollowFansRecordRequestDto
followFansRecordRequestDto
=
new
FollowFansRecordRequestDto
();
followFansRecordRequestDto
.
setFollowerId
(
dto
.
getId
());
followFansRecordRequestDto
.
setFansId
(
dto
.
getUserId
());
Result
result
=
followFansRecordService
.
findFollowRelation
(
followFansRecordRequestDto
);
if
(
result
.
getSuccess
())
{
HashMap
<
String
,
Object
>
map
=
(
HashMap
<
String
,
Object
>)
result
.
getData
();
userInfo
.
setIsFollowed
((
Boolean
)
map
.
get
(
"isFollowed"
));
if
(
Objects
.
nonNull
(
map
.
get
(
"id"
)))
{
userInfo
.
setFollowedId
((
Integer
)
map
.
get
(
"id"
));
}
}
return
Result
.
success
(
userInfo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询用户信息失败"
,
e
);
return
Result
.
failed
(
"查询用户信息失败"
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
View file @
72be54da
...
...
@@ -74,6 +74,8 @@ public interface UserService {
*/
Result
updateAvatar
(
UserRequestDto
dto
);
Result
updateQrCode
(
UserRequestDto
dto
);
/**
* 修改手机号
*
...
...
@@ -115,4 +117,6 @@ public interface UserService {
* @return
*/
Result
pageViews
(
UserRequestDto
dto
);
Result
findById
(
UserRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
72be54da
...
...
@@ -191,6 +191,21 @@ public class WxUserController {
return
userService
.
regCaptcha
(
dto
);
}
@ApiOperation
(
value
=
"上传微信二维码"
)
@PostMapping
(
"/updateQrCode"
)
public
Result
updateQrCode
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改头像,请求参数:{}"
,
JSON
.
toJSONString
(
true
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getWechatQrCode
()))
{
return
Result
.
failed
(
"请微信二维码"
);
}
return
userService
.
updateQrCode
(
dto
);
}
@ApiOperation
(
value
=
"修改手机号"
)
@PostMapping
(
"/updateMobile"
)
public
Result
updateMobile
(
@RequestBody
UserRequestDto
dto
)
{
...
...
@@ -230,4 +245,12 @@ public class WxUserController {
logger
.
info
(
"【请求开始】查询关注粉丝浏览量,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
userService
.
pageViews
(
dto
);
}
@ApiOperation
(
value
=
"根据用户id查询用户信息"
)
@PostMapping
(
"/findById"
)
public
Result
findById
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】根据用户id查询用户信息,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
userService
.
findById
(
dto
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment