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
596d98e0
Commit
596d98e0
authored
Dec 19, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
乾岛
parent
256e37c2
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1747 additions
and
19 deletions
+1747
-19
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
...n/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
+291
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/QdUserInfo.java
...ore/src/main/java/com/wwdz/ch/core/entity/QdUserInfo.java
+68
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdGiveLikeRecordDao.java
.../java/com/wwdz/ch/db/dao/qiandao/QdGiveLikeRecordDao.java
+11
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdUserSignInTaskDao.java
.../java/com/wwdz/ch/db/dao/qiandao/QdUserSignInTaskDao.java
+13
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdUserSignInTask.java
.../java/com/wwdz/ch/db/domain/qiandao/QdUserSignInTask.java
+11
-4
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdUserSignInTaskExample.java
...om/wwdz/ch/db/domain/qiandao/QdUserSignInTaskExample.java
+132
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/qiandao/QdGiveLikeRecordRequestDto.java
...ch/db/dto/request/qiandao/QdGiveLikeRecordRequestDto.java
+45
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/qiandao/QdUserSignInTaskRequestDto.java
...ch/db/dto/request/qiandao/QdUserSignInTaskRequestDto.java
+49
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdGiveLikeRecordDaoImpl.java
.../com/wwdz/ch/db/impl/qiandao/QdGiveLikeRecordDaoImpl.java
+29
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdUserSignInNoteDaoImpl.java
.../com/wwdz/ch/db/impl/qiandao/QdUserSignInNoteDaoImpl.java
+0
-1
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdUserSignInTaskDaoImpl.java
.../com/wwdz/ch/db/impl/qiandao/QdUserSignInTaskDaoImpl.java
+38
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdGiveLikeRecordMapper.java
...com/wwdz/ch/db/mapper/qiandao/QdGiveLikeRecordMapper.java
+3
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.java
...com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.java
+3
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.xml
.../com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.xml
+28
-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
+2
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
...n/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
+560
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/QdUserTokenManager.java
.../main/java/com/wwdz/ch/wx/manager/QdUserTokenManager.java
+133
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/qiandao/QdUserService.java
...in/java/com/wwdz/ch/wx/service/qiandao/QdUserService.java
+124
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdUserController.java
...ain/java/com/wwdz/ch/wx/web/qiandao/QdUserController.java
+207
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
0 → 100644
View file @
596d98e0
This diff is collapsed.
Click to expand it.
ch-core/src/main/java/com/wwdz/ch/core/entity/QdUserInfo.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.core.entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 用户信息
*
* @author CHENBO
* @since 1.0.0
*/
@Data
public
class
QdUserInfo
implements
Entity
{
private
static
final
long
serialVersionUID
=
-
5813029516433359765L
;
private
Long
id
;
private
Long
userId
;
private
String
userName
;
private
String
nickName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
birthday
;
private
String
avatar
;
private
String
country
;
private
String
province
;
private
String
city
;
private
String
area
;
private
String
language
;
private
Integer
gender
;
private
String
phone
;
private
String
mobile
;
private
Integer
level
;
// 用户层级 0 普通用户,1 VIP1,2 VIP2, 3 VIP3
private
String
levelDesc
;
// 用户等级描述
private
Integer
status
;
//状态
private
String
registerDate
;
//注册日期
// 微信号
private
String
wechatId
;
/**
* 微信登录openid
*/
private
String
wxOpenid
;
/**
* 微信登录unionid
*/
private
String
wxUnionid
;
private
String
profile
;
private
String
background
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
this
.
userId
=
id
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
this
.
phone
=
mobile
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdGiveLikeRecordDao.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.dao.qiandao
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord
;
public
interface
QdGiveLikeRecordDao
{
boolean
insert
(
QdGiveLikeRecord
qdGiveLikeRecord
);
long
countByNoteId
(
long
noteId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdUserSignInTaskDao.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.dao.qiandao
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTask
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserSignInTaskRequestDto
;
import
java.util.List
;
public
interface
QdUserSignInTaskDao
{
boolean
insert
(
QdUserSignInTask
qdUserSignInTask
);
List
<
QdUserSignInTask
>
findByPage
(
QdUserSignInTaskRequestDto
dto
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdUserSignInTask.java
View file @
596d98e0
...
@@ -4,16 +4,14 @@ import java.io.Serializable;
...
@@ -4,16 +4,14 @@ 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
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
* @author shiyu
* @author shiyu
* @date 2024/12/1
8
* @date 2024/12/1
9
*/
*/
@Data
@Data
public
class
QdUserSignInTask
implements
Entity
{
public
class
QdUserSignInTask
implements
Serializable
{
private
Long
id
;
private
Long
id
;
/**
/**
...
@@ -26,6 +24,11 @@ public class QdUserSignInTask implements Entity {
...
@@ -26,6 +24,11 @@ public class QdUserSignInTask implements Entity {
*/
*/
private
Long
taskId
;
private
Long
taskId
;
/**
* 是否自己创建
*/
private
Boolean
isSelf
;
/**
/**
* 创建时间
* 创建时间
*/
*/
...
@@ -57,6 +60,7 @@ public class QdUserSignInTask implements Entity {
...
@@ -57,6 +60,7 @@ public class QdUserSignInTask implements Entity {
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", taskId="
).
append
(
taskId
);
sb
.
append
(
", taskId="
).
append
(
taskId
);
sb
.
append
(
", isSelf="
).
append
(
isSelf
);
sb
.
append
(
", createTimeTime="
).
append
(
createTimeTime
);
sb
.
append
(
", createTimeTime="
).
append
(
createTimeTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", isValid="
).
append
(
isValid
);
sb
.
append
(
", isValid="
).
append
(
isValid
);
...
@@ -81,6 +85,7 @@ public class QdUserSignInTask implements Entity {
...
@@ -81,6 +85,7 @@ public class QdUserSignInTask 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
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getTaskId
()
==
null
?
other
.
getTaskId
()
==
null
:
this
.
getTaskId
().
equals
(
other
.
getTaskId
()))
&&
(
this
.
getTaskId
()
==
null
?
other
.
getTaskId
()
==
null
:
this
.
getTaskId
().
equals
(
other
.
getTaskId
()))
&&
(
this
.
getIsSelf
()
==
null
?
other
.
getIsSelf
()
==
null
:
this
.
getIsSelf
().
equals
(
other
.
getIsSelf
()))
&&
(
this
.
getCreateTimeTime
()
==
null
?
other
.
getCreateTimeTime
()
==
null
:
this
.
getCreateTimeTime
().
equals
(
other
.
getCreateTimeTime
()))
&&
(
this
.
getCreateTimeTime
()
==
null
?
other
.
getCreateTimeTime
()
==
null
:
this
.
getCreateTimeTime
().
equals
(
other
.
getCreateTimeTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getIsValid
()
==
null
?
other
.
getIsValid
()
==
null
:
this
.
getIsValid
().
equals
(
other
.
getIsValid
()))
&&
(
this
.
getIsValid
()
==
null
?
other
.
getIsValid
()
==
null
:
this
.
getIsValid
().
equals
(
other
.
getIsValid
()))
...
@@ -94,6 +99,7 @@ public class QdUserSignInTask implements Entity {
...
@@ -94,6 +99,7 @@ public class QdUserSignInTask implements Entity {
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getTaskId
()
==
null
)
?
0
:
getTaskId
().
hashCode
());
result
=
prime
*
result
+
((
getTaskId
()
==
null
)
?
0
:
getTaskId
().
hashCode
());
result
=
prime
*
result
+
((
getIsSelf
()
==
null
)
?
0
:
getIsSelf
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTimeTime
()
==
null
)
?
0
:
getCreateTimeTime
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTimeTime
()
==
null
)
?
0
:
getCreateTimeTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getIsValid
()
==
null
)
?
0
:
getIsValid
().
hashCode
());
result
=
prime
*
result
+
((
getIsValid
()
==
null
)
?
0
:
getIsValid
().
hashCode
());
...
@@ -112,6 +118,7 @@ public class QdUserSignInTask implements Entity {
...
@@ -112,6 +118,7 @@ public class QdUserSignInTask implements Entity {
id
(
"id"
,
"id"
,
"BIGINT"
,
false
),
id
(
"id"
,
"id"
,
"BIGINT"
,
false
),
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
),
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
),
taskId
(
"task_id"
,
"taskId"
,
"BIGINT"
,
false
),
taskId
(
"task_id"
,
"taskId"
,
"BIGINT"
,
false
),
isSelf
(
"is_self"
,
"isSelf"
,
"BIT"
,
false
),
createTimeTime
(
"create_time_time"
,
"createTimeTime"
,
"TIMESTAMP"
,
false
),
createTimeTime
(
"create_time_time"
,
"createTimeTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
isValid
(
"is_valid"
,
"isValid"
,
"BIT"
,
false
),
isValid
(
"is_valid"
,
"isValid"
,
"BIT"
,
false
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdUserSignInTaskExample.java
View file @
596d98e0
...
@@ -544,6 +544,138 @@ public class QdUserSignInTaskExample {
...
@@ -544,6 +544,138 @@ public class QdUserSignInTaskExample {
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andIsSelfIsNull
()
{
addCriterion
(
"is_self is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfIsNotNull
()
{
addCriterion
(
"is_self is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfEqualTo
(
Boolean
value
)
{
addCriterion
(
"is_self ="
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfEqualToColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfNotEqualTo
(
Boolean
value
)
{
addCriterion
(
"is_self <>"
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfNotEqualToColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfGreaterThan
(
Boolean
value
)
{
addCriterion
(
"is_self >"
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfGreaterThanColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfGreaterThanOrEqualTo
(
Boolean
value
)
{
addCriterion
(
"is_self >="
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfGreaterThanOrEqualToColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfLessThan
(
Boolean
value
)
{
addCriterion
(
"is_self <"
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfLessThanColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfLessThanOrEqualTo
(
Boolean
value
)
{
addCriterion
(
"is_self <="
,
value
,
"isSelf"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_task
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIsSelfLessThanOrEqualToColumn
(
QdUserSignInTask
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"is_self <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfIn
(
List
<
Boolean
>
values
)
{
addCriterion
(
"is_self in"
,
values
,
"isSelf"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfNotIn
(
List
<
Boolean
>
values
)
{
addCriterion
(
"is_self not in"
,
values
,
"isSelf"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfBetween
(
Boolean
value1
,
Boolean
value2
)
{
addCriterion
(
"is_self between"
,
value1
,
value2
,
"isSelf"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIsSelfNotBetween
(
Boolean
value1
,
Boolean
value2
)
{
addCriterion
(
"is_self not between"
,
value1
,
value2
,
"isSelf"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCreateTimeTimeIsNull
()
{
public
Criteria
andCreateTimeTimeIsNull
()
{
addCriterion
(
"create_time_time is null"
);
addCriterion
(
"create_time_time is null"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/qiandao/QdGiveLikeRecordRequestDto.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.dto.request.qiandao
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
QdGiveLikeRecordRequestDto
implements
Entity
{
/**
* id
*/
private
Long
id
;
/**
* 用户id
*/
private
Long
userId
;
/**
* 笔记id
*/
private
Long
noteId
;
/**
* 笔记创建人id
*/
private
Long
noteCreatorId
;
/**
* 点赞时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Integer
updateTime
;
/**
* 是否有效
*/
private
Boolean
isValid
;
}
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/qiandao/QdUserSignInTaskRequestDto.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.dto.request.qiandao
;
import
com.wwdz.ch.db.dto.request.BaseRequestDto
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
QdUserSignInTaskRequestDto
extends
BaseRequestDto
implements
Entity
{
private
Long
id
;
/**
* 用户id
*/
private
Long
userId
;
/**
* 签到任务id
*/
private
Long
taskId
;
/**
* 创建时间
*/
private
Date
createTimeTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 是否自己创建
*/
private
Boolean
isSelf
;
/**
* 是否有效
*/
private
Boolean
isValid
;
/**
* 状态
*/
private
Integer
state
;
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdGiveLikeRecordDaoImpl.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.impl.qiandao
;
import
com.wwdz.ch.db.dao.qiandao.QdGiveLikeRecordDao
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecordExample
;
import
com.wwdz.ch.db.mapper.qiandao.QdGiveLikeRecordMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
QdGiveLikeRecordDaoImpl
implements
QdGiveLikeRecordDao
{
@Autowired
QdGiveLikeRecordMapper
qdGiveLikeRecordMapper
;
@Override
public
boolean
insert
(
QdGiveLikeRecord
qdGiveLikeRecord
)
{
return
qdGiveLikeRecordMapper
.
insert
(
qdGiveLikeRecord
)
>
0
;
}
@Override
public
long
countByNoteId
(
long
noteId
)
{
QdGiveLikeRecordExample
example
=
new
QdGiveLikeRecordExample
();
QdGiveLikeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andNoteIdEqualTo
(
noteId
);
criteria
.
andIsValidEqualTo
(
true
);
return
qdGiveLikeRecordMapper
.
countByExample
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdUserSignInNoteDaoImpl.java
View file @
596d98e0
package
com.wwdz.ch.db.impl.qiandao
;
package
com.wwdz.ch.db.impl.qiandao
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.dao.qiandao.QdUserSignInDao
;
import
com.wwdz.ch.db.dao.qiandao.QdUserSignInNoteDao
;
import
com.wwdz.ch.db.dao.qiandao.QdUserSignInNoteDao
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInNote
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInNote
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdUserSignInTaskDaoImpl.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.db.impl.qiandao
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.dao.qiandao.QdUserSignInTaskDao
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTask
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTaskExample
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserSignInTaskRequestDto
;
import
com.wwdz.ch.db.mapper.qiandao.QdUserSignInTaskMapper
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
class
QdUserSignInTaskDaoImpl
implements
QdUserSignInTaskDao
{
@Autowired
QdUserSignInTaskMapper
qdUserSignInTaskMapper
;
@Override
public
boolean
insert
(
QdUserSignInTask
qdUserSignInTask
)
{
return
qdUserSignInTaskMapper
.
insert
(
qdUserSignInTask
)
>
0
;
}
@Override
public
List
<
QdUserSignInTask
>
findByPage
(
QdUserSignInTaskRequestDto
dto
)
{
QdUserSignInTaskExample
example
=
new
QdUserSignInTaskExample
();
QdUserSignInTaskExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getUserId
(),
criteria
::
andUserIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getTaskId
(),
criteria
::
andTaskIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getIsSelf
(),
criteria
::
andIsSelfEqualTo
);
criteria
.
andIsValidEqualTo
(
true
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
example
.
setOrderByClause
(
"create_time desc"
);
return
qdUserSignInTaskMapper
.
selectByExample
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdGiveLikeRecordMapper.java
View file @
596d98e0
...
@@ -3,8 +3,11 @@ package com.wwdz.ch.db.mapper.qiandao;
...
@@ -3,8 +3,11 @@ package com.wwdz.ch.db.mapper.qiandao;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecordExample
;
import
com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecordExample
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
QdGiveLikeRecordMapper
{
public
interface
QdGiveLikeRecordMapper
{
long
countByExample
(
QdGiveLikeRecordExample
example
);
long
countByExample
(
QdGiveLikeRecordExample
example
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.java
View file @
596d98e0
...
@@ -3,8 +3,11 @@ package com.wwdz.ch.db.mapper.qiandao;
...
@@ -3,8 +3,11 @@ package com.wwdz.ch.db.mapper.qiandao;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTask
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTask
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTaskExample
;
import
com.wwdz.ch.db.domain.qiandao.QdUserSignInTaskExample
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
QdUserSignInTaskMapper
{
public
interface
QdUserSignInTaskMapper
{
long
countByExample
(
QdUserSignInTaskExample
example
);
long
countByExample
(
QdUserSignInTaskExample
example
);
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/qiandao/QdUserSignInTaskMapper.xml
View file @
596d98e0
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"task_id"
jdbcType=
"BIGINT"
property=
"taskId"
/>
<result
column=
"task_id"
jdbcType=
"BIGINT"
property=
"taskId"
/>
<result
column=
"is_self"
jdbcType=
"BIT"
property=
"isSelf"
/>
<result
column=
"create_time_time"
jdbcType=
"TIMESTAMP"
property=
"createTimeTime"
/>
<result
column=
"create_time_time"
jdbcType=
"TIMESTAMP"
property=
"createTimeTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"is_valid"
jdbcType=
"BIT"
property=
"isValid"
/>
<result
column=
"is_valid"
jdbcType=
"BIT"
property=
"isValid"
/>
...
@@ -69,7 +70,7 @@
...
@@ -69,7 +70,7 @@
</where>
</where>
</sql>
</sql>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, user_id, task_id, create_time_time, update_time, is_valid, `state`
id, user_id, task_id,
is_self,
create_time_time, update_time, is_valid, `state`
</sql>
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.qiandao.QdUserSignInTaskExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.qiandao.QdUserSignInTaskExample"
resultMap=
"BaseResultMap"
>
select
select
...
@@ -98,13 +99,13 @@
...
@@ -98,13 +99,13 @@
distinct
distinct
</if>
</if>
<choose>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
${column.escapedColumnName}
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, user_id, task_id, create_time_time, update_time, is_valid, `state`
id, user_id, task_id,
is_self,
create_time_time, update_time, is_valid, `state`
</otherwise>
</otherwise>
</choose>
</choose>
from qd_user_sign_in_task
from qd_user_sign_in_task
...
@@ -129,13 +130,13 @@
...
@@ -129,13 +130,13 @@
-->
-->
select
select
<choose>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
${column.escapedColumnName}
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, user_id, task_id, create_time_time, update_time, is_valid, `state`
id, user_id, task_id,
is_self,
create_time_time, update_time, is_valid, `state`
</otherwise>
</otherwise>
</choose>
</choose>
from qd_user_sign_in_task
from qd_user_sign_in_task
...
@@ -155,12 +156,12 @@
...
@@ -155,12 +156,12 @@
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
SELECT LAST_INSERT_ID()
SELECT LAST_INSERT_ID()
</selectKey>
</selectKey>
insert into qd_user_sign_in_task (user_id, task_id,
create_time_time
,
insert into qd_user_sign_in_task (user_id, task_id,
is_self
,
update_time, is_valid, `state`
create_time_time, update_time, is_valid,
)
`state`
)
values (#{userId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{
createTimeTime,jdbcType=TIMESTAMP
},
values (#{userId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{
isSelf,jdbcType=BIT
},
#{
updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT}, #{state,jdbcType=INTEGER}
#{
createTimeTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT},
)
#{state,jdbcType=INTEGER}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.qiandao.QdUserSignInTask"
>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.qiandao.QdUserSignInTask"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
@@ -174,6 +175,9 @@
...
@@ -174,6 +175,9 @@
<if
test=
"taskId != null"
>
<if
test=
"taskId != null"
>
task_id,
task_id,
</if>
</if>
<if
test=
"isSelf != null"
>
is_self,
</if>
<if
test=
"createTimeTime != null"
>
<if
test=
"createTimeTime != null"
>
create_time_time,
create_time_time,
</if>
</if>
...
@@ -194,6 +198,9 @@
...
@@ -194,6 +198,9 @@
<if
test=
"taskId != null"
>
<if
test=
"taskId != null"
>
#{taskId,jdbcType=BIGINT},
#{taskId,jdbcType=BIGINT},
</if>
</if>
<if
test=
"isSelf != null"
>
#{isSelf,jdbcType=BIT},
</if>
<if
test=
"createTimeTime != null"
>
<if
test=
"createTimeTime != null"
>
#{createTimeTime,jdbcType=TIMESTAMP},
#{createTimeTime,jdbcType=TIMESTAMP},
</if>
</if>
...
@@ -226,6 +233,9 @@
...
@@ -226,6 +233,9 @@
<if
test=
"record.taskId != null"
>
<if
test=
"record.taskId != null"
>
task_id = #{record.taskId,jdbcType=BIGINT},
task_id = #{record.taskId,jdbcType=BIGINT},
</if>
</if>
<if
test=
"record.isSelf != null"
>
is_self = #{record.isSelf,jdbcType=BIT},
</if>
<if
test=
"record.createTimeTime != null"
>
<if
test=
"record.createTimeTime != null"
>
create_time_time = #{record.createTimeTime,jdbcType=TIMESTAMP},
create_time_time = #{record.createTimeTime,jdbcType=TIMESTAMP},
</if>
</if>
...
@@ -248,6 +258,7 @@
...
@@ -248,6 +258,7 @@
set id = #{record.id,jdbcType=BIGINT},
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
task_id = #{record.taskId,jdbcType=BIGINT},
task_id = #{record.taskId,jdbcType=BIGINT},
is_self = #{record.isSelf,jdbcType=BIT},
create_time_time = #{record.createTimeTime,jdbcType=TIMESTAMP},
create_time_time = #{record.createTimeTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_valid = #{record.isValid,jdbcType=BIT},
is_valid = #{record.isValid,jdbcType=BIT},
...
@@ -265,6 +276,9 @@
...
@@ -265,6 +276,9 @@
<if
test=
"taskId != null"
>
<if
test=
"taskId != null"
>
task_id = #{taskId,jdbcType=BIGINT},
task_id = #{taskId,jdbcType=BIGINT},
</if>
</if>
<if
test=
"isSelf != null"
>
is_self = #{isSelf,jdbcType=BIT},
</if>
<if
test=
"createTimeTime != null"
>
<if
test=
"createTimeTime != null"
>
create_time_time = #{createTimeTime,jdbcType=TIMESTAMP},
create_time_time = #{createTimeTime,jdbcType=TIMESTAMP},
</if>
</if>
...
@@ -284,6 +298,7 @@
...
@@ -284,6 +298,7 @@
update qd_user_sign_in_task
update qd_user_sign_in_task
set user_id = #{userId,jdbcType=BIGINT},
set user_id = #{userId,jdbcType=BIGINT},
task_id = #{taskId,jdbcType=BIGINT},
task_id = #{taskId,jdbcType=BIGINT},
is_self = #{isSelf,jdbcType=BIT},
create_time_time = #{createTimeTime,jdbcType=TIMESTAMP},
create_time_time = #{createTimeTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT},
is_valid = #{isValid,jdbcType=BIT},
...
@@ -317,13 +332,13 @@
...
@@ -317,13 +332,13 @@
select
select
'true' as QUERYID,
'true' as QUERYID,
<choose>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
${column.escapedColumnName}
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, user_id, task_id, create_time_time, update_time, is_valid, `state`
id, user_id, task_id,
is_self,
create_time_time, update_time, is_valid, `state`
</otherwise>
</otherwise>
</choose>
</choose>
from qd_user_sign_in_task
from qd_user_sign_in_task
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/dao/UserInfo.java
View file @
596d98e0
package
com.wwdz.ch.wx.dao
;
package
com.wwdz.ch.wx.dao
;
import
com.wwdz.ch.core.consts.FollowFansEnum
;
import
com.wwdz.ch.core.consts.FollowFansEnum
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -12,7 +13,7 @@ import java.io.Serializable;
...
@@ -12,7 +13,7 @@ import java.io.Serializable;
* @since 1.0.0
* @since 1.0.0
*/
*/
@Data
@Data
public
class
UserInfo
implements
Serializable
{
public
class
UserInfo
implements
Entity
{
private
static
final
long
serialVersionUID
=
-
5813029516433359765L
;
private
static
final
long
serialVersionUID
=
-
5813029516433359765L
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/qiandao/QdUserServiceImpl.java
0 → 100644
View file @
596d98e0
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/QdUserTokenManager.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.wx.manager
;
import
com.google.gson.Gson
;
import
com.wwdz.ch.core.util.CharUtil
;
import
com.wwdz.ch.wx.dao.UserToken
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 维护用户token
*/
@Component
public
class
QdUserTokenManager
{
@Autowired
private
RedisUtil
redisUtil
;
private
Gson
gson
=
new
Gson
();
private
static
final
String
TOKEN_PREFIX
=
"qiandao:wx:token:token_prefix:"
;
private
static
final
String
TOKEN_ID_PREFIX
=
"qiandao:wx:token:token_id_prefix:"
;
private
static
Map
<
String
,
UserToken
>
tokenMap
=
new
HashMap
<>();
private
static
Map
<
Long
,
UserToken
>
idMap
=
new
HashMap
<>();
private
static
long
SURVIVAL_TIME
=
86400
*
7
*
365
;
public
Long
getUserId
(
String
token
)
{
String
key
=
TOKEN_PREFIX
+
token
;
Object
tokenObj
=
redisUtil
.
get
(
key
);
if
(
null
==
tokenObj
)
{
return
null
;
}
UserToken
userToken
=
gson
.
fromJson
(
tokenObj
.
toString
(),
UserToken
.
class
);
if
(
userToken
.
getExpireTime
().
isBefore
(
LocalDateTime
.
now
()))
{
redisUtil
.
del
(
key
);
String
idKey
=
TOKEN_ID_PREFIX
+
userToken
.
getUserId
();
redisUtil
.
del
(
idKey
);
return
null
;
}
return
userToken
.
getUserId
();
}
public
boolean
checkLogin
(
String
token
)
{
String
key
=
TOKEN_PREFIX
+
token
;
Object
tokenObj
=
redisUtil
.
get
(
key
);
if
(
Objects
.
isNull
(
tokenObj
))
{
return
false
;
}
UserToken
userToken
=
gson
.
fromJson
(
tokenObj
.
toString
(),
UserToken
.
class
);
if
(
userToken
.
getExpireTime
().
isBefore
(
LocalDateTime
.
now
()))
{
redisUtil
.
del
(
key
);
String
idKey
=
TOKEN_ID_PREFIX
+
userToken
.
getUserId
();
redisUtil
.
del
(
idKey
);
return
false
;
}
String
idKey
=
TOKEN_ID_PREFIX
+
userToken
.
getUserId
();
Object
idObj
=
redisUtil
.
get
(
idKey
);
if
(
Objects
.
isNull
(
idObj
))
{
return
false
;
}
UserToken
idUserToken
=
gson
.
fromJson
(
idObj
.
toString
(),
UserToken
.
class
);
String
idToken
=
idUserToken
.
getToken
();
return
StringUtils
.
equals
(
token
,
idToken
);
}
public
UserToken
generateToken
(
Long
id
,
String
token
)
{
UserToken
userToken
=
null
;
// userToken = idMap.get(id);
// if(userToken != null) {
// tokenMap.remove(userToken.getToken());
// idMap.remove(id);
// }
String
key
=
TOKEN_PREFIX
+
token
;
while
(
null
!=
redisUtil
.
get
(
key
))
{
token
=
CharUtil
.
getRandomString
(
32
);
key
=
TOKEN_PREFIX
+
token
;
}
LocalDateTime
update
=
LocalDateTime
.
now
();
LocalDateTime
expire
=
update
.
plusDays
(
7
);
userToken
=
new
UserToken
();
userToken
.
setToken
(
token
);
userToken
.
setUpdateTime
(
update
);
userToken
.
setExpireTime
(
expire
);
userToken
.
setUserId
(
id
);
String
data
=
gson
.
toJson
(
userToken
);
redisUtil
.
set
(
key
,
data
,
SURVIVAL_TIME
);
String
idKey
=
TOKEN_ID_PREFIX
+
id
;
redisUtil
.
set
(
idKey
,
data
,
SURVIVAL_TIME
);
return
userToken
;
}
public
String
getSessionKey
(
Long
userId
)
{
String
idKey
=
TOKEN_ID_PREFIX
+
userId
;
Object
data
=
redisUtil
.
get
(
idKey
);
if
(
null
==
data
)
{
return
null
;
}
UserToken
userToken
=
gson
.
fromJson
(
data
.
toString
(),
UserToken
.
class
);
if
(
userToken
.
getExpireTime
().
isBefore
(
LocalDateTime
.
now
()))
{
tokenMap
.
remove
(
userToken
.
getToken
());
idMap
.
remove
(
userId
);
return
null
;
}
return
userToken
.
getSessionKey
();
}
public
void
removeToken
(
Long
userId
)
{
String
idKey
=
TOKEN_ID_PREFIX
+
userId
;
Object
data
=
redisUtil
.
get
(
idKey
);
if
(
null
!=
data
)
{
UserToken
userToken
=
gson
.
fromJson
(
data
.
toString
(),
UserToken
.
class
);
String
token
=
userToken
.
getToken
();
String
key
=
TOKEN_PREFIX
+
token
;
redisUtil
.
del
(
key
);
redisUtil
.
del
(
idKey
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/qiandao/QdUserService.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.wx.service.qiandao
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserRequestDto
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
public
interface
QdUserService
{
/**
* 发送手机验证码
*
* @param dto
* @return
*/
Result
regCaptcha
(
QdUserRequestDto
dto
);
/**
* 手机号登录
*
* @param dto
* @param request
* @return
*/
Result
loginByMobile
(
QdUserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 快捷登录
*
* @param dto
* @param request
* @return
*/
Result
login
(
QdUserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 修改个性签名
*
* @param dto
* @return
*/
Result
updateProfile
(
QdUserRequestDto
dto
);
/**
* 修改背景图片
*
* @param dto
* @return
*/
Result
updateBackground
(
QdUserRequestDto
dto
);
/**
* 修改昵称
*
* @param dto
* @return
*/
Result
updateNickname
(
QdUserRequestDto
dto
);
/**
* 上传图片
*
* @param file
* @return
*/
Result
uploadImage
(
MultipartFile
file
);
/**
* 修改头像
*
* @param dto
* @return
*/
Result
updateAvatar
(
QdUserRequestDto
dto
);
Result
updateQrCode
(
QdUserRequestDto
dto
);
/**
* 修改手机号
*
* @param dto
* @return
*/
Result
updateMobile
(
QdUserRequestDto
dto
);
/**
* 查询用户信息
*
* @param request
* @return
*/
Result
userInfo
(
HttpServletRequest
request
);
/**
* 查询用户信息
*
* @param dto
* @return
*/
Result
queryUserInfo
(
QdUserRequestDto
dto
);
/**
* 查询用户信息
*
* @param dto
* @param request
* @return
*/
Result
guestUserInfo
(
QdUserRequestDto
dto
,
HttpServletRequest
request
);
Result
findById
(
QdUserRequestDto
dto
);
/**
* 退出登录
* @param dto
* @return
*/
Result
loginOut
(
QdUserRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdUserController.java
0 → 100644
View file @
596d98e0
package
com.wwdz.ch.wx.web.qiandao
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserRequestDto
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.service.qiandao.QdUserService
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Objects
;
/**
* 用户服务
*/
@RestController
@RequestMapping
(
"/wx/qdUser"
)
@Validated
public
class
QdUserController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QdUserController
.
class
);
@Autowired
private
QdUserService
qdUserService
;
@ApiOperation
(
value
=
"快捷登录"
)
@PostMapping
(
"/login"
)
public
Result
login
(
@RequestBody
QdUserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】快捷登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getLoginCode
()))
{
return
Result
.
failed
(
"授权码不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getType
()))
{
return
Result
.
failed
(
"版本类型不能为空"
);
}
if
(
dto
.
getType
()
==
2
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getEncryptedData
())
||
StringUtils
.
isBlank
(
dto
.
getIv
()))
{
return
Result
.
failed
(
"encryptedData或iv不能为空"
);
}
}
return
qdUserService
.
login
(
dto
,
request
);
}
@ApiOperation
(
value
=
"登录手机验证码"
)
@PostMapping
(
"/loginRegCaptcha"
)
public
Object
registerCaptcha
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】请求登录手机验证码,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
dto
.
setSmsType
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
());
return
qdUserService
.
regCaptcha
(
dto
);
}
@ApiOperation
(
value
=
"手机验证码登录"
)
@PostMapping
(
"/loginByMobile"
)
public
Result
loginByMobile
(
@RequestBody
QdUserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】手机号登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getSmsCode
()))
{
return
Result
.
failed
(
"验证码不能为空"
);
}
return
qdUserService
.
loginByMobile
(
dto
,
request
);
}
@ApiOperation
(
value
=
"修改个性签名"
)
@PostMapping
(
"/updateProfile"
)
public
Result
updateProfile
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改个性签名,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getProfile
()))
{
dto
.
setProfile
(
""
);
}
else
{
if
(
dto
.
getProfile
().
length
()
>
100
)
{
return
Result
.
failed
(
"个人简介应在100字以内"
);
}
}
return
qdUserService
.
updateProfile
(
dto
);
}
@ApiOperation
(
value
=
"修改背景"
)
@PostMapping
(
"/updateBackground"
)
public
Result
updateBackground
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改背景,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getBackground
()))
{
dto
.
setBackground
(
""
);
}
return
qdUserService
.
updateBackground
(
dto
);
}
@ApiOperation
(
value
=
"修改昵称"
)
@PostMapping
(
"/updateNickname"
)
public
Result
updateNickname
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改昵称,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getNickName
()))
{
return
Result
.
failed
(
"昵称不能为空"
);
}
return
qdUserService
.
updateNickname
(
dto
);
}
@ApiOperation
(
"图片上传"
)
@PostMapping
(
value
=
"/uploadImage"
)
public
Result
uploadImage
(
@RequestParam
(
"image"
)
MultipartFile
file
)
{
if
(
Objects
.
isNull
(
file
)
||
file
.
isEmpty
())
{
return
Result
.
failed
(
"请上传图片"
);
}
return
qdUserService
.
uploadImage
(
file
);
}
@ApiOperation
(
value
=
"修改头像"
)
@PostMapping
(
"/updateAvatar"
)
public
Result
updateAvatar
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改头像,请求参数:{}"
,
JSON
.
toJSONString
(
true
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getAvatar
()))
{
return
Result
.
failed
(
"请上传头像"
);
}
return
qdUserService
.
updateAvatar
(
dto
);
}
@ApiOperation
(
value
=
"修改手机验证码"
)
@PostMapping
(
"/updateRegCaptcha"
)
public
Object
updateRegCaptcha
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】请求修改手机验证码,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
dto
.
setSmsType
(
CacheCodeConstants
.
SmsTypeEnum
.
UPDATE
.
getCode
());
return
qdUserService
.
regCaptcha
(
dto
);
}
@ApiOperation
(
value
=
"修改手机号"
)
@PostMapping
(
"/updateMobile"
)
public
Result
updateMobile
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改手机号,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getBeforeMobile
()))
{
return
Result
.
failed
(
"原手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getAfterMobile
()))
{
return
Result
.
failed
(
"新绑定手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getSmsCode
()))
{
return
Result
.
failed
(
"验证码不能为空"
);
}
return
qdUserService
.
updateMobile
(
dto
);
}
@ApiOperation
(
value
=
"用户信息"
)
@PostMapping
(
"/userInfo"
)
public
Result
userInfo
(
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】查询用户信息"
);
return
qdUserService
.
userInfo
(
request
);
}
@ApiOperation
(
value
=
"用户信息(客态)"
)
@PostMapping
(
"/guest/userInfo"
)
public
Result
guestUserInfo
(
@RequestBody
QdUserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】查询用户信息(客态),请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
qdUserService
.
guestUserInfo
(
dto
,
request
);
}
@ApiOperation
(
value
=
"根据用户id查询用户信息"
)
@PostMapping
(
"/findById"
)
public
Result
findById
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】根据用户id查询用户信息,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
qdUserService
.
findById
(
dto
);
}
@ApiOperation
(
value
=
"退出登录"
)
@PostMapping
(
"/loginOut"
)
public
Result
loginOut
(
@RequestBody
QdUserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】退出登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
qdUserService
.
loginOut
(
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