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
c6fd5f69
Commit
c6fd5f69
authored
Sep 19, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 三期相关内容
parent
839e36b7
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
1595 additions
and
255 deletions
+1595
-255
ch-core/src/main/java/com/wwdz/ch/core/consts/ViewPermissionEnum.java
...main/java/com/wwdz/ch/core/consts/ViewPermissionEnum.java
+32
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
...in/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
+11
-3
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
+1
-7
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemsOfficialUsersRelationDao.java
...ava/com/wwdz/ch/db/dao/ItemsOfficialUsersRelationDao.java
+9
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/ItemsOfficialUsersRelation.java
...ava/com/wwdz/ch/db/domain/ItemsOfficialUsersRelation.java
+239
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/ItemsOfficialUsersRelationExample.java
.../wwdz/ch/db/domain/ItemsOfficialUsersRelationExample.java
+698
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
.../main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/FavoritesRequestDto.java
.../java/com/wwdz/ch/db/dto/request/FavoritesRequestDto.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
...va/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
+18
-3
ch-dao/src/main/java/com/wwdz/ch/db/impl/FootPrintDaoImpl.java
...o/src/main/java/com/wwdz/ch/db/impl/FootPrintDaoImpl.java
+10
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
+7
-14
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemsOfficialUsersRelationDaoImpl.java
...om/wwdz/ch/db/impl/ItemsOfficialUsersRelationDaoImpl.java
+31
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/ItemMapper.java
ch-dao/src/main/java/com/wwdz/ch/db/mapper/ItemMapper.java
+3
-3
ch-dao/src/main/java/com/wwdz/ch/db/mapper/ItemsOfficialUsersRelationMapper.java
...m/wwdz/ch/db/mapper/ItemsOfficialUsersRelationMapper.java
+52
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/FavoritesItemsRelationMapper.xml
...es/com/wwdz/ch/db/mapper/FavoritesItemsRelationMapper.xml
+7
-1
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/ItemMapper.xml
...o/src/main/resources/com/wwdz/ch/db/mapper/ItemMapper.xml
+2
-16
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
+81
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/ItemRequestDto.java
...in/java/com/wwdz/ch/wx/entity/request/ItemRequestDto.java
+2
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
...rc/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
+5
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+24
-14
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
.../main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
+83
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+121
-64
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+62
-42
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+6
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemCommonService.java
...c/main/java/com/wwdz/ch/wx/service/ItemCommonService.java
+14
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
...api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
+8
-25
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
...api/src/main/java/com/wwdz/ch/wx/service/UserService.java
+19
-9
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+9
-8
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+11
-24
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+18
-18
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/ViewPermissionEnum.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.core.consts
;
public
enum
ViewPermissionEnum
{
ALL
(
0
,
"所有人"
),
ONLY_ONESELF
(
1
,
"仅自己"
),
;
private
int
code
;
private
String
des
;
ViewPermissionEnum
(
int
code
,
String
des
)
{
this
.
code
=
code
;
this
.
des
=
des
;
}
public
static
String
getNameByCode
(
int
code
)
{
for
(
ViewPermissionEnum
viewPermissionEnum
:
ViewPermissionEnum
.
values
())
{
if
(
code
==
viewPermissionEnum
.
getCode
())
{
return
viewPermissionEnum
.
getDes
();
}
}
return
null
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getDes
()
{
return
des
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
View file @
c6fd5f69
...
@@ -77,7 +77,7 @@ public interface FavoritesItemsRelationDao {
...
@@ -77,7 +77,7 @@ public interface FavoritesItemsRelationDao {
* @param size
* @param size
* @return
* @return
*/
*/
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
onlyOneselfItemIds
,
int
page
,
int
size
);
/**
/**
* 通过用户id分页查询
* 通过用户id分页查询
...
@@ -88,7 +88,7 @@ public interface FavoritesItemsRelationDao {
...
@@ -88,7 +88,7 @@ public interface FavoritesItemsRelationDao {
* @param type
* @param type
* @return
* @return
*/
*/
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
Integer
type
,
int
page
,
int
size
);
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
List
<
Long
>
itemIds
,
Integer
type
,
int
page
,
int
size
);
/**
/**
* 通过藏品id统计记录数
* 通过藏品id统计记录数
...
@@ -98,6 +98,14 @@ public interface FavoritesItemsRelationDao {
...
@@ -98,6 +98,14 @@ public interface FavoritesItemsRelationDao {
*/
*/
long
countByItemId
(
Long
itemId
);
long
countByItemId
(
Long
itemId
);
/**
* 通过藏品id列表统计记录数
*
* @param itemIds
* @return
*/
long
countByItemIds
(
List
<
Long
>
itemIds
);
/**
/**
* 判断是否已经存在用户id和藏品id对应的记录
* 判断是否已经存在用户id和藏品id对应的记录
*
*
...
@@ -136,7 +144,7 @@ public interface FavoritesItemsRelationDao {
...
@@ -136,7 +144,7 @@ public interface FavoritesItemsRelationDao {
* @param favoritesId
* @param favoritesId
* @return
* @return
*/
*/
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
);
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
,
List
<
Long
>
onlyOneselfItemIds
);
/**
/**
* 更新收藏册id
* 更新收藏册id
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
View file @
c6fd5f69
...
@@ -32,6 +32,14 @@ public interface FootPrintDao {
...
@@ -32,6 +32,14 @@ public interface FootPrintDao {
*/
*/
long
countByUserId
(
Long
userId
);
long
countByUserId
(
Long
userId
);
/**
* 通过藏品id列表统计记录数
*
* @param itemIds
* @return
*/
long
countByItemIds
(
List
<
Long
>
itemIds
);
/**
/**
* 批量删除记录
* 批量删除记录
*
*
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
View file @
c6fd5f69
...
@@ -124,11 +124,5 @@ public interface ItemDao {
...
@@ -124,11 +124,5 @@ public interface ItemDao {
*/
*/
List
<
Item
>
findListWithImages
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListWithImages
(
CoinRequestDto
coinRequestDto
);
/**
List
<
Long
>
findOnlyOneselfItems
(
Long
userId
);
* 商品名称联想,返回16条
*
* @param coinRequestDto
* @return
*/
List
<
String
>
findNames
(
CoinRequestDto
coinRequestDto
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemsOfficialUsersRelationDao.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelation
;
public
interface
ItemsOfficialUsersRelationDao
{
ItemsOfficialUsersRelation
findUser
(
Long
itemId
);
ItemsOfficialUsersRelation
findItems
(
Long
user
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/ItemsOfficialUsersRelation.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.db.domain
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
lombok.Data
;
/**
* @author shiyu
* @date 2023/09/15
*/
@Data
public
class
ItemsOfficialUsersRelation
implements
Serializable
{
private
Long
beginItemId
;
private
Long
endItemId
;
private
Long
userId
;
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", beginItemId="
).
append
(
beginItemId
);
sb
.
append
(
", endItemId="
).
append
(
endItemId
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
@Override
public
boolean
equals
(
Object
that
)
{
if
(
this
==
that
)
{
return
true
;
}
if
(
that
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
that
.
getClass
())
{
return
false
;
}
ItemsOfficialUsersRelation
other
=
(
ItemsOfficialUsersRelation
)
that
;
return
(
this
.
getBeginItemId
()
==
null
?
other
.
getBeginItemId
()
==
null
:
this
.
getBeginItemId
().
equals
(
other
.
getBeginItemId
()))
&&
(
this
.
getEndItemId
()
==
null
?
other
.
getEndItemId
()
==
null
:
this
.
getEndItemId
().
equals
(
other
.
getEndItemId
()))
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()));
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getBeginItemId
()
==
null
)
?
0
:
getBeginItemId
().
hashCode
());
result
=
prime
*
result
+
((
getEndItemId
()
==
null
)
?
0
:
getEndItemId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
beginItemId
(
"begin_item_id"
,
"beginItemId"
,
"BIGINT"
,
false
),
endItemId
(
"end_item_id"
,
"endItemId"
,
"BIGINT"
,
false
),
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
BEGINNING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
static
final
String
ENDING_DELIMITER
=
"`"
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
column
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
boolean
isColumnNameDelimited
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
javaProperty
;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
final
String
jdbcType
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
value
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getValue
()
{
return
this
.
column
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJavaProperty
()
{
return
this
.
javaProperty
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getJdbcType
()
{
return
this
.
jdbcType
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column
(
String
column
,
String
javaProperty
,
String
jdbcType
,
boolean
isColumnNameDelimited
)
{
this
.
column
=
column
;
this
.
javaProperty
=
javaProperty
;
this
.
jdbcType
=
jdbcType
;
this
.
isColumnNameDelimited
=
isColumnNameDelimited
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
desc
()
{
return
this
.
getEscapedColumnName
()
+
" DESC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
asc
()
{
return
this
.
getEscapedColumnName
()
+
" ASC"
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Column
[]
excludes
(
Column
...
excludes
)
{
ArrayList
<
Column
>
columns
=
new
ArrayList
<>(
Arrays
.
asList
(
Column
.
values
()));
if
(
excludes
!=
null
&&
excludes
.
length
>
0
)
{
columns
.
removeAll
(
new
ArrayList
<>(
Arrays
.
asList
(
excludes
)));
}
return
columns
.
toArray
(
new
Column
[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
String
getEscapedColumnName
()
{
if
(
this
.
isColumnNameDelimited
)
{
return
new
StringBuilder
().
append
(
BEGINNING_DELIMITER
).
append
(
this
.
column
).
append
(
ENDING_DELIMITER
).
toString
();
}
else
{
return
this
.
column
;
}
}
}
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/domain/ItemsOfficialUsersRelationExample.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.db.domain
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ItemsOfficialUsersRelationExample
{
protected
String
orderByClause
;
protected
boolean
distinct
;
protected
List
<
Criteria
>
oredCriteria
;
public
ItemsOfficialUsersRelationExample
()
{
oredCriteria
=
new
ArrayList
<
Criteria
>();
}
public
void
setOrderByClause
(
String
orderByClause
)
{
this
.
orderByClause
=
orderByClause
;
}
public
String
getOrderByClause
()
{
return
orderByClause
;
}
public
void
setDistinct
(
boolean
distinct
)
{
this
.
distinct
=
distinct
;
}
public
boolean
isDistinct
()
{
return
distinct
;
}
public
List
<
Criteria
>
getOredCriteria
()
{
return
oredCriteria
;
}
public
void
or
(
Criteria
criteria
)
{
oredCriteria
.
add
(
criteria
);
}
public
Criteria
or
()
{
Criteria
criteria
=
createCriteriaInternal
();
oredCriteria
.
add
(
criteria
);
return
criteria
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
ItemsOfficialUsersRelationExample
orderBy
(
String
orderByClause
)
{
this
.
setOrderByClause
(
orderByClause
);
return
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
ItemsOfficialUsersRelationExample
orderBy
(
String
...
orderByClauses
)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
orderByClauses
.
length
;
i
++)
{
sb
.
append
(
orderByClauses
[
i
]);
if
(
i
<
orderByClauses
.
length
-
1
)
{
sb
.
append
(
" , "
);
}
}
this
.
setOrderByClause
(
sb
.
toString
());
return
this
;
}
public
Criteria
createCriteria
()
{
Criteria
criteria
=
createCriteriaInternal
();
if
(
oredCriteria
.
size
()
==
0
)
{
oredCriteria
.
add
(
criteria
);
}
return
criteria
;
}
protected
Criteria
createCriteriaInternal
()
{
Criteria
criteria
=
new
Criteria
(
this
);
return
criteria
;
}
public
void
clear
()
{
oredCriteria
.
clear
();
orderByClause
=
null
;
distinct
=
false
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Criteria
newAndCreateCriteria
()
{
ItemsOfficialUsersRelationExample
example
=
new
ItemsOfficialUsersRelationExample
();
return
example
.
createCriteria
();
}
protected
abstract
static
class
GeneratedCriteria
{
protected
List
<
Criterion
>
criteria
;
protected
GeneratedCriteria
()
{
super
();
criteria
=
new
ArrayList
<
Criterion
>();
}
public
boolean
isValid
()
{
return
criteria
.
size
()
>
0
;
}
public
List
<
Criterion
>
getAllCriteria
()
{
return
criteria
;
}
public
List
<
Criterion
>
getCriteria
()
{
return
criteria
;
}
protected
void
addCriterion
(
String
condition
)
{
if
(
condition
==
null
)
{
throw
new
RuntimeException
(
"Value for condition cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
));
}
protected
void
addCriterion
(
String
condition
,
Object
value
,
String
property
)
{
if
(
value
==
null
)
{
throw
new
RuntimeException
(
"Value for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value
));
}
protected
void
addCriterion
(
String
condition
,
Object
value1
,
Object
value2
,
String
property
)
{
if
(
value1
==
null
||
value2
==
null
)
{
throw
new
RuntimeException
(
"Between values for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value1
,
value2
));
}
public
Criteria
andBeginItemIdIsNull
()
{
addCriterion
(
"begin_item_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdIsNotNull
()
{
addCriterion
(
"begin_item_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdEqualTo
(
Long
value
)
{
addCriterion
(
"begin_item_id ="
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"begin_item_id <>"
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdNotEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdGreaterThan
(
Long
value
)
{
addCriterion
(
"begin_item_id >"
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdGreaterThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"begin_item_id >="
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdGreaterThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdLessThan
(
Long
value
)
{
addCriterion
(
"begin_item_id <"
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdLessThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"begin_item_id <="
,
value
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andBeginItemIdLessThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"begin_item_id <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"begin_item_id in"
,
values
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"begin_item_id not in"
,
values
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"begin_item_id between"
,
value1
,
value2
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBeginItemIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"begin_item_id not between"
,
value1
,
value2
,
"beginItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdIsNull
()
{
addCriterion
(
"end_item_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdIsNotNull
()
{
addCriterion
(
"end_item_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdEqualTo
(
Long
value
)
{
addCriterion
(
"end_item_id ="
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"end_item_id <>"
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdNotEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdGreaterThan
(
Long
value
)
{
addCriterion
(
"end_item_id >"
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdGreaterThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"end_item_id >="
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdGreaterThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdLessThan
(
Long
value
)
{
addCriterion
(
"end_item_id <"
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdLessThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"end_item_id <="
,
value
,
"endItemId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andEndItemIdLessThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"end_item_id <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"end_item_id in"
,
values
,
"endItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"end_item_id not in"
,
values
,
"endItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"end_item_id between"
,
value1
,
value2
,
"endItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEndItemIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"end_item_id not between"
,
value1
,
value2
,
"endItemId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdIsNull
()
{
addCriterion
(
"user_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdIsNotNull
()
{
addCriterion
(
"user_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdEqualTo
(
Long
value
)
{
addCriterion
(
"user_id ="
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"user_id <>"
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdNotEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdGreaterThan
(
Long
value
)
{
addCriterion
(
"user_id >"
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdGreaterThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"user_id >="
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdGreaterThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdLessThan
(
Long
value
)
{
addCriterion
(
"user_id <"
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdLessThanColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"user_id <="
,
value
,
"userId"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andUserIdLessThanOrEqualToColumn
(
ItemsOfficialUsersRelation
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"user_id <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"user_id in"
,
values
,
"userId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"user_id not in"
,
values
,
"userId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"user_id between"
,
value1
,
value2
,
"userId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andUserIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"user_id not between"
,
value1
,
value2
,
"userId"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
ItemsOfficialUsersRelationExample
example
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected
Criteria
(
ItemsOfficialUsersRelationExample
example
)
{
super
();
this
.
example
=
example
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
ItemsOfficialUsersRelationExample
example
()
{
return
this
.
example
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIf
(
boolean
ifAdd
,
ICriteriaAdd
add
)
{
if
(
ifAdd
)
{
add
.
add
(
this
);
}
return
this
;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
interface
ICriteriaAdd
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria
add
(
Criteria
add
);
}
}
public
static
class
Criterion
{
private
String
condition
;
private
Object
value
;
private
Object
secondValue
;
private
boolean
noValue
;
private
boolean
singleValue
;
private
boolean
betweenValue
;
private
boolean
listValue
;
private
String
typeHandler
;
public
String
getCondition
()
{
return
condition
;
}
public
Object
getValue
()
{
return
value
;
}
public
Object
getSecondValue
()
{
return
secondValue
;
}
public
boolean
isNoValue
()
{
return
noValue
;
}
public
boolean
isSingleValue
()
{
return
singleValue
;
}
public
boolean
isBetweenValue
()
{
return
betweenValue
;
}
public
boolean
isListValue
()
{
return
listValue
;
}
public
String
getTypeHandler
()
{
return
typeHandler
;
}
protected
Criterion
(
String
condition
)
{
super
();
this
.
condition
=
condition
;
this
.
typeHandler
=
null
;
this
.
noValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
typeHandler
=
typeHandler
;
if
(
value
instanceof
List
<?>)
{
this
.
listValue
=
true
;
}
else
{
this
.
singleValue
=
true
;
}
}
protected
Criterion
(
String
condition
,
Object
value
)
{
this
(
condition
,
value
,
null
);
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
secondValue
=
secondValue
;
this
.
typeHandler
=
typeHandler
;
this
.
betweenValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
)
{
this
(
condition
,
value
,
secondValue
,
null
);
}
}
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/CoinRequestDto.java
View file @
c6fd5f69
...
@@ -108,4 +108,6 @@ public class CoinRequestDto extends BaseRequestDto implements Entity {
...
@@ -108,4 +108,6 @@ public class CoinRequestDto extends BaseRequestDto implements Entity {
*/
*/
private
Integer
state
;
private
Integer
state
;
// 是否是客态
private
Boolean
isGuest
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/FavoritesRequestDto.java
View file @
c6fd5f69
...
@@ -30,4 +30,6 @@ public class FavoritesRequestDto implements Entity {
...
@@ -30,4 +30,6 @@ public class FavoritesRequestDto implements Entity {
// 收藏册id列表
// 收藏册id列表
private
List
<
Long
>
ids
;
private
List
<
Long
>
ids
;
// 藏品id列表
private
List
<
Long
>
itemIds
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
View file @
c6fd5f69
...
@@ -75,10 +75,13 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -75,10 +75,13 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
}
}
@Override
@Override
public
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
)
{
public
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
onlyOneselfItemIds
,
int
page
,
int
size
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
if
(!
CollectionUtils
.
isEmpty
(
onlyOneselfItemIds
))
{
criteria
.
andItemIdNotIn
(
onlyOneselfItemIds
);
}
example
.
orderBy
(
"update_time desc"
);
example
.
orderBy
(
"update_time desc"
);
PageHelper
.
startPage
(
page
,
size
);
PageHelper
.
startPage
(
page
,
size
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
...
@@ -86,13 +89,16 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -86,13 +89,16 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
}
}
@Override
@Override
public
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
Integer
type
,
int
page
,
int
size
)
{
public
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
List
<
Long
>
itemIds
,
Integer
type
,
int
page
,
int
size
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andUserIdEqualTo
(
userId
);
if
(
type
==
1
)
{
if
(
type
==
1
)
{
criteria
.
andFavoritesIdEqualTo
(
0L
);
criteria
.
andFavoritesIdEqualTo
(
0L
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
itemIds
))
{
criteria
.
andItemIdNotIn
(
itemIds
);
}
example
.
orderBy
(
"update_time desc"
);
example
.
orderBy
(
"update_time desc"
);
PageHelper
.
startPage
(
page
,
size
);
PageHelper
.
startPage
(
page
,
size
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
...
@@ -107,6 +113,14 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -107,6 +113,14 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
}
}
@Override
public
long
countByItemIds
(
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdIn
(
itemIds
);
return
favoritesItemsRelationMapper
.
countByExample
(
example
);
}
@Override
@Override
public
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
)
{
public
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
...
@@ -142,9 +156,10 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -142,9 +156,10 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
}
}
@Override
@Override
public
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
)
{
public
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
,
List
<
Long
>
onlyOneselfItemIds
)
{
FavoritesRequestDto
favoritesRequestDto
=
new
FavoritesRequestDto
();
FavoritesRequestDto
favoritesRequestDto
=
new
FavoritesRequestDto
();
favoritesRequestDto
.
setId
(
favoritesId
);
favoritesRequestDto
.
setId
(
favoritesId
);
favoritesRequestDto
.
setItemIds
(
onlyOneselfItemIds
);
return
favoritesItemsRelationMapper
.
selectItemImages
(
favoritesRequestDto
);
return
favoritesItemsRelationMapper
.
selectItemImages
(
favoritesRequestDto
);
}
}
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/FootPrintDaoImpl.java
View file @
c6fd5f69
...
@@ -56,6 +56,16 @@ public class FootPrintDaoImpl implements FootPrintDao {
...
@@ -56,6 +56,16 @@ public class FootPrintDaoImpl implements FootPrintDao {
return
footprintMapper
.
countByExample
(
example
);
return
footprintMapper
.
countByExample
(
example
);
}
}
@Override
public
long
countByItemIds
(
List
<
Long
>
itemIds
)
{
FootprintExample
example
=
new
FootprintExample
();
FootprintExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdIn
(
itemIds
);
criteria
.
andDeletedEqualTo
(
false
);
return
footprintMapper
.
countByExample
(
example
);
}
@Override
@Override
public
int
delete
(
List
<
Long
>
ids
)
{
public
int
delete
(
List
<
Long
>
ids
)
{
FootprintExample
example
=
new
FootprintExample
();
FootprintExample
example
=
new
FootprintExample
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
View file @
c6fd5f69
...
@@ -17,6 +17,7 @@ import org.springframework.util.StringUtils;
...
@@ -17,6 +17,7 @@ import org.springframework.util.StringUtils;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.IntStream
;
import
java.util.stream.IntStream
;
@Repository
@Repository
...
@@ -67,6 +68,10 @@ public class ItemDaoImpl implements ItemDao {
...
@@ -67,6 +68,10 @@ public class ItemDaoImpl implements ItemDao {
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
criteria
.
andIsDeletedEqualTo
(
false
);
criteria
.
andIsDeletedEqualTo
(
false
);
// 如果是客态则筛选所有人可见
if
(
Objects
.
nonNull
(
coinRequestDto
.
getIsGuest
())
&&
coinRequestDto
.
getIsGuest
())
{
criteria
.
andViewPermissionEqualTo
(
0
);
}
example
.
orderBy
(
"update_time desc"
);
example
.
orderBy
(
"update_time desc"
);
PageHelper
.
startPage
(
coinRequestDto
.
getPage
(),
coinRequestDto
.
getLimit
());
PageHelper
.
startPage
(
coinRequestDto
.
getPage
(),
coinRequestDto
.
getLimit
());
List
<
Item
>
list
=
itemMapper
.
selectByExampleWithBLOBs
(
example
);
List
<
Item
>
list
=
itemMapper
.
selectByExampleWithBLOBs
(
example
);
...
@@ -368,19 +373,7 @@ public class ItemDaoImpl implements ItemDao {
...
@@ -368,19 +373,7 @@ public class ItemDaoImpl implements ItemDao {
}
}
@Override
@Override
public
List
<
String
>
findNames
(
CoinRequestDto
coinRequestDto
)
{
public
List
<
Long
>
findOnlyOneselfItems
(
Long
userId
)
{
ItemExample
example
=
new
ItemExample
();
return
itemMapper
.
selectOnlyOneselfItems
(
userId
);
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIsDeletedEqualTo
(
false
);
//暂时去除华夏古泉和天眷堂的钱币, 对应编码2和7
if
(!
ObjectUtils
.
isEmpty
(
coinRequestDto
.
getIsExcluded
())
&&
coinRequestDto
.
getIsExcluded
()
==
1
)
{
criteria
.
andSourceNotEqualTo
(
2
);
criteria
.
andSourceNotEqualTo
(
7
);
}
criteria
.
andSourceIn
(
CHINESE_SOURCE_LIST
);
if
(
StringUtils
.
hasLength
(
coinRequestDto
.
getName
()))
{
criteria
.
andNameLike
(
"%"
+
coinRequestDto
.
getName
()
+
"%"
);
}
return
itemMapper
.
selectNameByExample
(
example
);
}
}
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemsOfficialUsersRelationDaoImpl.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.db.impl
;
import
com.wwdz.ch.db.dao.ItemsOfficialUsersRelationDao
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelation
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelationExample
;
import
com.wwdz.ch.db.mapper.ItemsOfficialUsersRelationMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
ItemsOfficialUsersRelationDaoImpl
implements
ItemsOfficialUsersRelationDao
{
@Autowired
private
ItemsOfficialUsersRelationMapper
itemsOfficialUsersRelationMapper
;
@Override
public
ItemsOfficialUsersRelation
findUser
(
Long
itemId
)
{
ItemsOfficialUsersRelationExample
example
=
new
ItemsOfficialUsersRelationExample
();
ItemsOfficialUsersRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andBeginItemIdLessThanOrEqualTo
(
itemId
);
criteria
.
andEndItemIdGreaterThanOrEqualTo
(
itemId
);
return
itemsOfficialUsersRelationMapper
.
selectOneByExample
(
example
);
}
@Override
public
ItemsOfficialUsersRelation
findItems
(
Long
userId
)
{
ItemsOfficialUsersRelationExample
example
=
new
ItemsOfficialUsersRelationExample
();
ItemsOfficialUsersRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
return
itemsOfficialUsersRelationMapper
.
selectOneByExample
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/ItemMapper.java
View file @
c6fd5f69
...
@@ -2,11 +2,11 @@ package com.wwdz.ch.db.mapper;
...
@@ -2,11 +2,11 @@ package com.wwdz.ch.db.mapper;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.ItemExample
;
import
com.wwdz.ch.db.domain.ItemExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
ItemMapper
{
public
interface
ItemMapper
{
long
countByExample
(
ItemExample
example
);
long
countByExample
(
ItemExample
example
);
...
@@ -82,5 +82,5 @@ public interface ItemMapper {
...
@@ -82,5 +82,5 @@ public interface ItemMapper {
int
updateByPrimaryKey
(
Item
record
);
int
updateByPrimaryKey
(
Item
record
);
List
<
String
>
selectNameByExample
(
ItemExample
example
);
List
<
Long
>
selectOnlyOneselfItems
(
@Param
(
"userId"
)
Long
userId
);
}
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/mapper/ItemsOfficialUsersRelationMapper.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.db.mapper
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelation
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelationExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
ItemsOfficialUsersRelationMapper
{
long
countByExample
(
ItemsOfficialUsersRelationExample
example
);
int
deleteByExample
(
ItemsOfficialUsersRelationExample
example
);
int
insert
(
ItemsOfficialUsersRelation
record
);
int
insertSelective
(
ItemsOfficialUsersRelation
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ItemsOfficialUsersRelation
selectOneByExample
(
ItemsOfficialUsersRelationExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ItemsOfficialUsersRelation
selectOneByExampleSelective
(
@Param
(
"example"
)
ItemsOfficialUsersRelationExample
example
,
@Param
(
"selective"
)
ItemsOfficialUsersRelation
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table items_official_users_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
ItemsOfficialUsersRelation
>
selectByExampleSelective
(
@Param
(
"example"
)
ItemsOfficialUsersRelationExample
example
,
@Param
(
"selective"
)
ItemsOfficialUsersRelation
.
Column
...
selective
);
List
<
ItemsOfficialUsersRelation
>
selectByExample
(
ItemsOfficialUsersRelationExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
ItemsOfficialUsersRelation
record
,
@Param
(
"example"
)
ItemsOfficialUsersRelationExample
example
);
int
updateByExample
(
@Param
(
"record"
)
ItemsOfficialUsersRelation
record
,
@Param
(
"example"
)
ItemsOfficialUsersRelationExample
example
);
}
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/FavoritesItemsRelationMapper.xml
View file @
c6fd5f69
...
@@ -268,6 +268,12 @@
...
@@ -268,6 +268,12 @@
<select
id=
"selectItemImages"
parameterType=
"com.wwdz.ch.db.dto.request.FavoritesRequestDto"
resultMap=
"ItemResultMap"
>
<select
id=
"selectItemImages"
parameterType=
"com.wwdz.ch.db.dto.request.FavoritesRequestDto"
resultMap=
"ItemResultMap"
>
select a.item_id,a.add_time,b.images,b.top_image
select a.item_id,a.add_time,b.images,b.top_image
from favorites_items_relation a left join item b on a.item_id = b.id
from favorites_items_relation a left join item b on a.item_id = b.id
where a.favorites_id = ${id} order by a.add_time desc
where a.favorites_id = ${id}
and a.item_id not in
<foreach
item=
"item"
index=
"index"
collection=
"itemIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
order by a.add_time desc
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/ItemMapper.xml
View file @
c6fd5f69
...
@@ -30,8 +30,6 @@
...
@@ -30,8 +30,6 @@
<result
column=
"detail"
jdbcType=
"LONGVARCHAR"
property=
"detail"
/>
<result
column=
"detail"
jdbcType=
"LONGVARCHAR"
property=
"detail"
/>
<result
column=
"original_extra"
jdbcType=
"LONGVARCHAR"
property=
"originalExtra"
/>
<result
column=
"original_extra"
jdbcType=
"LONGVARCHAR"
property=
"originalExtra"
/>
</resultMap>
</resultMap>
<resultMap
id=
"StringResultMap"
type=
"java.lang.String"
>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<sql
id=
"Example_Where_Clause"
>
<where>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
...
@@ -720,19 +718,7 @@
...
@@ -720,19 +718,7 @@
</if>
</if>
limit 1
limit 1
</select>
</select>
<select
id=
"selectOnlyOneselfItems"
parameterType=
"java.lang.Long"
resultType=
"java.lang.Long"
>
select a.id from item a join user_items_relation b on a.id = b.item_id where a.source_type = 2 and a.view_permission = 1 and b.user_id != ${userId}
<select
id=
"selectNameByExample"
parameterType=
"com.wwdz.ch.db.domain.ItemExample"
resultMap=
"StringResultMap"
>
select
distinct
name
from item
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
limit 16
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/dao/UserInfo.java
View file @
c6fd5f69
...
@@ -28,6 +28,15 @@ public class UserInfo implements Serializable {
...
@@ -28,6 +28,15 @@ public class UserInfo implements Serializable {
private
String
registerDate
;
//注册日期
private
String
registerDate
;
//注册日期
// 微信号
// 微信号
private
String
wechatId
;
private
String
wechatId
;
private
String
followersNumber
;
private
String
fansNumber
;
private
long
collectionsNumber
;
private
long
viewsNumber
;
private
String
collectionsViewsNumber
;
private
Boolean
isFollowed
;
private
Integer
followedId
;
private
String
profile
;
private
String
background
;
public
String
getCountry
()
{
public
String
getCountry
()
{
return
country
;
return
country
;
...
@@ -141,4 +150,76 @@ public class UserInfo implements Serializable {
...
@@ -141,4 +150,76 @@ public class UserInfo implements Serializable {
this
.
status
=
status
;
this
.
status
=
status
;
}
}
public
String
getFollowersNumber
()
{
return
followersNumber
;
}
public
void
setFollowersNumber
(
String
followersNumber
)
{
this
.
followersNumber
=
followersNumber
;
}
public
String
getCollectionsViewsNumber
()
{
return
collectionsViewsNumber
;
}
public
void
setCollectionsViewsNumber
(
String
collectionsViewsNumber
)
{
this
.
collectionsViewsNumber
=
collectionsViewsNumber
;
}
public
String
getFansNumber
()
{
return
fansNumber
;
}
public
void
setFansNumber
(
String
fansNumber
)
{
this
.
fansNumber
=
fansNumber
;
}
public
long
getCollectionsNumber
()
{
return
collectionsNumber
;
}
public
void
setCollectionsNumber
(
long
collectionsNumber
)
{
this
.
collectionsNumber
=
collectionsNumber
;
}
public
long
getViewsNumber
()
{
return
viewsNumber
;
}
public
void
setViewsNumber
(
long
viewsNumber
)
{
this
.
viewsNumber
=
viewsNumber
;
}
public
Boolean
getIsFollowed
()
{
return
isFollowed
;
}
public
void
setIsFollowed
(
Boolean
isFollowed
)
{
this
.
isFollowed
=
isFollowed
;
}
public
Integer
getFollowedId
()
{
return
followedId
;
}
public
void
setFollowedId
(
Integer
followedId
)
{
this
.
followedId
=
followedId
;
}
public
String
getProfile
()
{
return
profile
;
}
public
void
setProfile
(
String
profile
)
{
this
.
profile
=
profile
;
}
public
String
getBackground
()
{
return
background
;
}
public
void
setBackground
(
String
background
)
{
this
.
background
=
background
;
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/ItemRequestDto.java
View file @
c6fd5f69
...
@@ -43,4 +43,6 @@ public class ItemRequestDto implements Entity {
...
@@ -43,4 +43,6 @@ public class ItemRequestDto implements Entity {
private
String
pageUrl
;
private
String
pageUrl
;
// 环境类型(1、微信,2、支付宝,3、抖音)
// 环境类型(1、微信,2、支付宝,3、抖音)
private
Integer
loginType
;
private
Integer
loginType
;
// 查看权限(0所有人,1仅自己可见)
private
Integer
viewPermission
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
View file @
c6fd5f69
...
@@ -25,8 +25,13 @@ public class ItemResponseVo implements Entity {
...
@@ -25,8 +25,13 @@ public class ItemResponseVo implements Entity {
private
String
videos
;
private
String
videos
;
private
Map
<
String
,
Object
>
homePageImage
;
private
Map
<
String
,
Object
>
homePageImage
;
private
Boolean
isDeleted
;
private
Boolean
isDeleted
;
private
String
itemAvatar
;
private
String
itemNickname
;
private
String
itemNickname
;
private
String
profile
;
private
Integer
timeType
;
private
Integer
timeType
;
private
List
<
Map
<
String
,
Object
>>
imagesList
;
private
List
<
Map
<
String
,
Object
>>
imagesList
;
private
List
<
Map
<
String
,
Object
>>
videosList
;
private
List
<
Map
<
String
,
Object
>>
videosList
;
private
Integer
viewPermission
;
private
Boolean
isFollowed
;
private
Integer
followedId
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
c6fd5f69
...
@@ -7,10 +7,7 @@ import com.wwdz.ch.db.dao.FavoritesDao;
...
@@ -7,10 +7,7 @@ import com.wwdz.ch.db.dao.FavoritesDao;
import
com.wwdz.ch.db.dao.FavoritesItemsRelationDao
;
import
com.wwdz.ch.db.dao.FavoritesItemsRelationDao
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.UserItemsRelationDao
;
import
com.wwdz.ch.db.dao.UserItemsRelationDao
;
import
com.wwdz.ch.db.domain.Favorites
;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.domain.FavoritesItemsRelation
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.UserItemsRelation
;
import
com.wwdz.ch.db.dto.FavoritesItemsDto
;
import
com.wwdz.ch.db.dto.FavoritesItemsDto
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
...
@@ -19,6 +16,7 @@ import com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo;
...
@@ -19,6 +16,7 @@ import com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo;
import
com.wwdz.ch.wx.entity.vo.FavoritesResponseVo
;
import
com.wwdz.ch.wx.entity.vo.FavoritesResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.wwdz.ch.wx.service.ItemCommonService
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -28,6 +26,7 @@ import org.springframework.stereotype.Service;
...
@@ -28,6 +26,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -43,9 +42,11 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -43,9 +42,11 @@ public class FavoritesServiceImpl implements FavoritesService {
private
UserItemsRelationDao
userItemsRelationDao
;
private
UserItemsRelationDao
userItemsRelationDao
;
@Autowired
@Autowired
private
ItemDao
itemDao
;
private
ItemDao
itemDao
;
@Autowired
private
ItemCommonService
itemCommonService
;
@Override
@Override
public
Result
page
(
FavoritesRequestDto
dto
)
{
public
Result
page
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
PageInfo
<
AgentTranceResponseVo
>
page
=
new
PageInfo
<>();
PageInfo
<
AgentTranceResponseVo
>
page
=
new
PageInfo
<>();
page
.
setPageNum
(
dto
.
getPage
());
page
.
setPageNum
(
dto
.
getPage
());
...
@@ -70,7 +71,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -70,7 +71,7 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setDeleted
(
favorites
.
getDeleted
());
vo
.
setDeleted
(
favorites
.
getDeleted
());
vo
.
setAddTime
(
favorites
.
getAddTime
());
vo
.
setAddTime
(
favorites
.
getAddTime
());
// 设置封面图
// 设置封面图
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()));
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()
,
request
.
getHeader
(
"Authorization"
)
));
vo
.
setUpdateTime
(
favorites
.
getUpdateTime
());
vo
.
setUpdateTime
(
favorites
.
getUpdateTime
());
// 设置收藏数
// 设置收藏数
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
...
@@ -88,7 +89,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -88,7 +89,7 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
@Override
@Override
public
Result
list
(
FavoritesRequestDto
dto
)
{
public
Result
list
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
List
<
Favorites
>
list
=
favoritesDao
.
listByUserId
(
dto
.
getUserId
());
List
<
Favorites
>
list
=
favoritesDao
.
listByUserId
(
dto
.
getUserId
());
List
<
FavoritesResponseVo
>
result
=
new
ArrayList
<>();
List
<
FavoritesResponseVo
>
result
=
new
ArrayList
<>();
...
@@ -101,7 +102,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -101,7 +102,7 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setDeleted
(
favorites
.
getDeleted
());
vo
.
setDeleted
(
favorites
.
getDeleted
());
vo
.
setAddTime
(
favorites
.
getAddTime
());
vo
.
setAddTime
(
favorites
.
getAddTime
());
// 设置封面图
// 设置封面图
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()));
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()
,
request
.
getHeader
(
"Authorization"
)
));
vo
.
setUpdateTime
(
favorites
.
getUpdateTime
());
vo
.
setUpdateTime
(
favorites
.
getUpdateTime
());
// 设置收藏数
// 设置收藏数
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
...
@@ -170,7 +171,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -170,7 +171,7 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
@Override
@Override
public
Result
info
(
FavoritesRequestDto
dto
)
{
public
Result
info
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getId
());
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getId
());
if
(
Objects
.
isNull
(
favorites
))
{
if
(
Objects
.
isNull
(
favorites
))
{
...
@@ -187,7 +188,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -187,7 +188,7 @@ public class FavoritesServiceImpl implements FavoritesService {
// 设置收藏数
// 设置收藏数
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
// 设置封面图
// 设置封面图
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()));
vo
.
setImages
(
getFavoritesImage
(
favorites
.
getId
()
,
request
.
getHeader
(
"Authorization"
)
));
logger
.
info
(
"【请求结束】查看收藏册详情成功"
);
logger
.
info
(
"【请求结束】查看收藏册详情成功"
);
return
Result
.
success
(
vo
);
return
Result
.
success
(
vo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -213,14 +214,18 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -213,14 +214,18 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
@Override
@Override
public
Result
itemList
(
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
PageInfo
<
AgentTranceResponseVo
>
page
=
new
PageInfo
<>();
PageInfo
<
AgentTranceResponseVo
>
page
=
new
PageInfo
<>();
page
.
setPageNum
(
dto
.
getPage
());
page
.
setPageNum
(
dto
.
getPage
());
page
.
setPageSize
(
dto
.
getSize
());
page
.
setPageSize
(
dto
.
getSize
());
page
.
setTotal
(
0L
);
page
.
setTotal
(
0L
);
page
.
setList
(
new
ArrayList
<>());
page
.
setList
(
new
ArrayList
<>());
PageInfo
<
FavoritesItemsRelation
>
relationPage
=
favoritesItemsRelationDao
.
pageByFavoritesId
(
dto
.
getId
(),
dto
.
getPage
(),
dto
.
getSize
());
// 获取仅自己可见的藏品列表
List
<
Long
>
onlyOneselfItemIds
=
itemCommonService
.
getOnlyOneselfItemIds
(
request
.
getHeader
(
"Authorization"
));
// 分页查询
PageInfo
<
FavoritesItemsRelation
>
relationPage
=
favoritesItemsRelationDao
.
pageByFavoritesId
(
dto
.
getId
(),
onlyOneselfItemIds
,
dto
.
getPage
(),
dto
.
getSize
());
page
.
setHasNextPage
(
relationPage
.
isHasNextPage
());
page
.
setHasNextPage
(
relationPage
.
isHasNextPage
());
if
(
relationPage
.
getList
().
isEmpty
())
{
if
(
relationPage
.
getList
().
isEmpty
())
{
return
Result
.
success
(
page
);
return
Result
.
success
(
page
);
...
@@ -252,6 +257,8 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -252,6 +257,8 @@ public class FavoritesServiceImpl implements FavoritesService {
// 设置收藏数
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
// 设置藏品发布用户的昵称和头像
itemCommonService
.
getNicknameAvatar
(
item
.
getId
(),
vo
);
// 设置图片或视频
// 设置图片或视频
vo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
item
.
getImages
(),
item
.
getVideos
()));
vo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
item
.
getImages
(),
item
.
getVideos
()));
...
@@ -418,9 +425,12 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -418,9 +425,12 @@ public class FavoritesServiceImpl implements FavoritesService {
* @param id
* @param id
* @return
* @return
*/
*/
private
List
<
String
>
getFavoritesImage
(
Long
id
)
{
private
List
<
String
>
getFavoritesImage
(
Long
id
,
String
token
)
{
List
<
String
>
images
=
new
ArrayList
<>();
List
<
String
>
images
=
new
ArrayList
<>();
List
<
FavoritesItemsDto
>
favoritesItemsDtos
=
favoritesItemsRelationDao
.
queryItemImages
(
id
);
// 获取不属于登录用户的仅自己可见的藏品列表
List
<
Long
>
onlyOneselfItemIds
=
itemCommonService
.
getOnlyOneselfItemIds
(
token
);
List
<
FavoritesItemsDto
>
favoritesItemsDtos
=
favoritesItemsRelationDao
.
queryItemImages
(
id
,
onlyOneselfItemIds
);
if
(
CollectionUtils
.
isNotEmpty
(
favoritesItemsDtos
))
{
if
(
CollectionUtils
.
isNotEmpty
(
favoritesItemsDtos
))
{
if
(
favoritesItemsDtos
.
size
()
<=
4
)
{
if
(
favoritesItemsDtos
.
size
()
<=
4
)
{
for
(
FavoritesItemsDto
favoritesItemsDto
:
favoritesItemsDtos
)
{
for
(
FavoritesItemsDto
favoritesItemsDto
:
favoritesItemsDtos
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemCommonServiceImpl.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.wx.impl
;
import
com.wwdz.ch.db.dao.*
;
import
com.wwdz.ch.db.domain.ItemsOfficialUsersRelation
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.UserItemsRelation
;
import
com.wwdz.ch.wx.dao.UserInfo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.service.ItemCommonService
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
public
class
ItemCommonServiceImpl
implements
ItemCommonService
{
@Autowired
private
UserItemsRelationDao
userItemsRelationDao
;
@Autowired
private
FavoritesItemsRelationDao
favoritesItemsRelationDao
;
@Autowired
private
FootPrintDao
footPrintDao
;
@Autowired
private
ItemsOfficialUsersRelationDao
itemsOfficialUsersRelationDao
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
ItemDao
itemDao
;
@Autowired
private
UserTokenManager
userTokenManager
;
@Override
public
void
getNicknameAvatar
(
Long
itemId
,
ItemResponseVo
vo
)
{
User
user
=
null
;
UserItemsRelation
userItemsRelation
=
userItemsRelationDao
.
find
(
itemId
);
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
user
=
userDao
.
queryById
(
userItemsRelation
.
getUserId
());
}
else
{
ItemsOfficialUsersRelation
itemsOfficialUsersRelation
=
itemsOfficialUsersRelationDao
.
findUser
(
itemId
);
if
(
Objects
.
nonNull
(
itemsOfficialUsersRelation
))
{
user
=
userDao
.
queryById
(
itemsOfficialUsersRelation
.
getUserId
());
}
}
vo
.
setItemNickname
(
Objects
.
nonNull
(
user
)
?
user
.
getNickname
()
:
""
);
vo
.
setItemAvatar
(
Objects
.
nonNull
(
user
)
?
user
.
getAvatar
()
:
""
);
vo
.
setProfile
(
Objects
.
nonNull
(
user
)
?
user
.
getProfile
()
:
""
);
}
@Override
public
List
<
Long
>
getOnlyOneselfItemIds
(
String
token
)
{
Long
userId
=
userTokenManager
.
getUserId
(
token
);
return
itemDao
.
findOnlyOneselfItems
(
userId
);
}
@Override
public
void
getPageViews
(
UserInfo
userInfo
)
{
long
followersNumber
=
0
;
long
fansNumber
=
0
;
long
collectionsNumber
=
0
;
long
viewsNumber
=
0
;
//TODO 关注和粉丝数量
List
<
UserItemsRelation
>
userItemsRelations
=
userItemsRelationDao
.
listByUserIds
(
userInfo
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
userItemsRelations
))
{
List
<
Long
>
itemIds
=
userItemsRelations
.
stream
()
.
map
(
UserItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
collectionsNumber
=
favoritesItemsRelationDao
.
countByItemIds
(
itemIds
);
viewsNumber
=
footPrintDao
.
countByItemIds
(
itemIds
);
}
userInfo
.
setCollectionsNumber
(
collectionsNumber
);
userInfo
.
setViewsNumber
(
viewsNumber
);
userInfo
.
setFollowersNumber
(
StringUtil
.
formatCount
(
followersNumber
));
userInfo
.
setFansNumber
(
StringUtil
.
formatCount
(
fansNumber
));
userInfo
.
setCollectionsViewsNumber
(
StringUtil
.
formatCount
(
collectionsNumber
+
viewsNumber
));
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
c6fd5f69
...
@@ -12,15 +12,21 @@ import com.wwdz.ch.db.dao.*;
...
@@ -12,15 +12,21 @@ import com.wwdz.ch.db.dao.*;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.EsSearchRequestDto
;
import
com.wwdz.ch.db.dto.request.EsSearchRequestDto
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.db.es.ItemEsDao
;
import
com.wwdz.ch.db.es.ItemEsDao
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.MessageRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.manager.AlipayLoginManager
;
import
com.wwdz.ch.wx.manager.AlipayLoginManager
;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.service.FollowFansRecordService
;
import
com.wwdz.ch.wx.service.ItemCommonService
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.MessageService
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.xxdxxs.utils.CommonUtils
;
import
com.xxdxxs.utils.CommonUtils
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.DateUtils
;
...
@@ -35,6 +41,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
...
@@ -35,6 +41,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
...
@@ -60,6 +67,11 @@ public class ItemServiceImpl implements ItemService {
...
@@ -60,6 +67,11 @@ public class ItemServiceImpl implements ItemService {
private
FootPrintDao
footPrintDao
;
private
FootPrintDao
footPrintDao
;
@Autowired
@Autowired
private
FavoritesDao
favoritesDao
;
private
FavoritesDao
favoritesDao
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
ItemEsDao
itemEsDao
;
@Autowired
@Autowired
private
WxLoginManager
wxLoginManager
;
private
WxLoginManager
wxLoginManager
;
@Autowired
@Autowired
...
@@ -67,11 +79,16 @@ public class ItemServiceImpl implements ItemService {
...
@@ -67,11 +79,16 @@ public class ItemServiceImpl implements ItemService {
@Autowired
@Autowired
private
TikTokLoginManager
tikTokLoginManager
;
private
TikTokLoginManager
tikTokLoginManager
;
@Autowired
@Autowired
private
UserTokenManager
userTokenManager
;
@Autowired
private
QiniuStorage
qiniuStorage
;
private
QiniuStorage
qiniuStorage
;
@Autowired
@Autowired
private
UserDao
userDao
;
private
ItemCommonService
itemCommonService
;
@Autowired
@Autowired
private
ItemEsDao
itemEsDao
;
private
MessageService
messageService
;
@Autowired
private
FollowFansRecordService
followFansRecordService
;
@Override
@Override
public
Result
nameList
(
ItemRequestDto
dto
)
{
public
Result
nameList
(
ItemRequestDto
dto
)
{
...
@@ -153,6 +170,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -153,6 +170,8 @@ public class ItemServiceImpl implements ItemService {
// 设置收藏数
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
es
.
getId
());
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
es
.
getId
());
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
// 设置藏品发布用户的昵称和头像
itemCommonService
.
getNicknameAvatar
(
es
.
getId
(),
vo
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
...
@@ -170,8 +189,10 @@ public class ItemServiceImpl implements ItemService {
...
@@ -170,8 +189,10 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
myPage
(
ItemRequestDto
dto
)
{
public
Result
myPage
(
ItemRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
result
.
setPageNum
(
dto
.
getPage
());
result
.
setPageNum
(
dto
.
getPage
());
result
.
setPageSize
(
dto
.
getSize
());
result
.
setPageSize
(
dto
.
getSize
());
...
@@ -190,6 +211,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -190,6 +211,7 @@ public class ItemServiceImpl implements ItemService {
coinRequestDto
.
setPage
(
dto
.
getPage
());
coinRequestDto
.
setPage
(
dto
.
getPage
());
coinRequestDto
.
setLimit
(
dto
.
getSize
());
coinRequestDto
.
setLimit
(
dto
.
getSize
());
coinRequestDto
.
setIds
(
itemIds
);
coinRequestDto
.
setIds
(
itemIds
);
coinRequestDto
.
setIsGuest
(!
dto
.
getUserId
().
equals
(
userId
));
// 分页查询
// 分页查询
PageInfo
<
Item
>
pageInfo
=
itemDao
.
findPageNotDeleted
(
coinRequestDto
);
PageInfo
<
Item
>
pageInfo
=
itemDao
.
findPageNotDeleted
(
coinRequestDto
);
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
...
@@ -199,6 +221,14 @@ public class ItemServiceImpl implements ItemService {
...
@@ -199,6 +221,14 @@ public class ItemServiceImpl implements ItemService {
result
.
setHasNextPage
(
pageInfo
.
isHasNextPage
());
result
.
setHasNextPage
(
pageInfo
.
isHasNextPage
());
List
<
AgentTranceResponseVo
>
resultList
=
new
ArrayList
<>();
List
<
AgentTranceResponseVo
>
resultList
=
new
ArrayList
<>();
// 获取用户的昵称和头像
String
nickname
=
""
;
String
avatar
=
""
;
User
user
=
userDao
.
queryById
(
dto
.
getId
());
if
(
Objects
.
nonNull
(
user
))
{
nickname
=
user
.
getNickname
();
avatar
=
user
.
getAvatar
();
}
for
(
Item
item
:
pageInfo
.
getList
())
{
for
(
Item
item
:
pageInfo
.
getList
())
{
ItemResponseVo
vo
=
new
ItemResponseVo
();
ItemResponseVo
vo
=
new
ItemResponseVo
();
// 设置基本信息
// 设置基本信息
...
@@ -213,12 +243,13 @@ public class ItemServiceImpl implements ItemService {
...
@@ -213,12 +243,13 @@ public class ItemServiceImpl implements ItemService {
// 设置是否收藏和是否是自己发布的
// 设置是否收藏和是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
1
);
vo
.
setIsMine
(
1
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
(),
null
)
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
(),
null
)
?
1
:
0
);
}
// 设置收藏数
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
vo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
// 设置用户头像和昵称
vo
.
setItemNickname
(
nickname
);
vo
.
setItemAvatar
(
avatar
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
...
@@ -236,7 +267,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -236,7 +267,7 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
collectPage
(
ItemRequestDto
dto
)
{
public
Result
collectPage
(
ItemRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
result
.
setPageNum
(
dto
.
getPage
());
result
.
setPageNum
(
dto
.
getPage
());
...
@@ -245,8 +276,10 @@ public class ItemServiceImpl implements ItemService {
...
@@ -245,8 +276,10 @@ public class ItemServiceImpl implements ItemService {
result
.
setList
(
new
ArrayList
<>());
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
false
);
result
.
setHasNextPage
(
false
);
// 获取仅自己可见的藏品列表
List
<
Long
>
onlyOneselfItemIds
=
itemCommonService
.
getOnlyOneselfItemIds
(
request
.
getHeader
(
"Authorization"
));
// 分页查询
// 分页查询
PageInfo
<
FavoritesItemsRelation
>
pageInfo
=
favoritesItemsRelationDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getType
(),
dto
.
getPage
(),
dto
.
getSize
());
PageInfo
<
FavoritesItemsRelation
>
pageInfo
=
favoritesItemsRelationDao
.
pageByUserId
(
dto
.
getUserId
(),
onlyOneselfItemIds
,
dto
.
getType
(),
dto
.
getPage
(),
dto
.
getSize
());
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
}
}
...
@@ -282,6 +315,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -282,6 +315,8 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
itemResponseVo
.
setCollectCount
(
StringUtil
.
formatCount
(
count
));
// 设置图片或视频
// 设置图片或视频
itemResponseVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
item
.
getImages
(),
item
.
getVideos
()));
itemResponseVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
item
.
getImages
(),
item
.
getVideos
()));
// 设置发布藏品用户的昵称和头像
itemCommonService
.
getNicknameAvatar
(
item
.
getId
(),
itemResponseVo
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
...
@@ -323,6 +358,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -323,6 +358,7 @@ public class ItemServiceImpl implements ItemService {
item
.
setIsDeleted
(
false
);
item
.
setIsDeleted
(
false
);
item
.
setKind
(
ItemKindEnum
.
COIN
.
getCode
());
item
.
setKind
(
ItemKindEnum
.
COIN
.
getCode
());
item
.
setState
(
ItemStateEnum
.
PENDING
.
getCode
());
item
.
setState
(
ItemStateEnum
.
PENDING
.
getCode
());
item
.
setViewPermission
(
Objects
.
isNull
(
dto
.
getViewPermission
())
?
ViewPermissionEnum
.
ALL
.
getCode
()
:
dto
.
getViewPermission
());
itemDao
.
insert
(
item
);
itemDao
.
insert
(
item
);
// 新增用户和藏品关联记录
// 新增用户和藏品关联记录
...
@@ -359,7 +395,9 @@ public class ItemServiceImpl implements ItemService {
...
@@ -359,7 +395,9 @@ public class ItemServiceImpl implements ItemService {
public
Result
info
(
ItemRequestDto
dto
)
{
public
Result
info
(
ItemRequestDto
dto
)
{
try
{
try
{
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
// 如果藏品已经被删除
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
// 收藏品入口
if
(
Objects
.
nonNull
(
dto
.
getType
())
&&
dto
.
getType
().
equals
(
1
))
{
if
(
Objects
.
nonNull
(
dto
.
getType
())
&&
dto
.
getType
().
equals
(
1
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
// 如果当前用户已收藏该藏品,则删除收藏关联
// 如果当前用户已收藏该藏品,则删除收藏关联
...
@@ -371,6 +409,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -371,6 +409,7 @@ public class ItemServiceImpl implements ItemService {
}
}
}
}
}
}
// 足迹入口
if
(
Objects
.
nonNull
(
dto
.
getType
())
&&
dto
.
getType
().
equals
(
2
))
{
if
(
Objects
.
nonNull
(
dto
.
getType
())
&&
dto
.
getType
().
equals
(
2
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
// 删除用户足迹
// 删除用户足迹
...
@@ -379,6 +418,19 @@ public class ItemServiceImpl implements ItemService {
...
@@ -379,6 +418,19 @@ public class ItemServiceImpl implements ItemService {
}
}
return
Result
.
failed
(
ResultCode
.
INVALID_DATA
.
getCode
(),
"该藏品已经被移除"
);
return
Result
.
failed
(
ResultCode
.
INVALID_DATA
.
getCode
(),
"该藏品已经被移除"
);
}
}
// 查看权限校验
UserItemsRelation
userItemsRelation
=
userItemsRelationDao
.
find
(
item
.
getId
());
if
(
item
.
getViewPermission
().
equals
(
ViewPermissionEnum
.
ONLY_ONESELF
.
getCode
()))
{
// 未登录无权查看
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"暂无权限查看该藏品"
);
}
else
{
if
(
Objects
.
nonNull
(
userItemsRelation
)
&&
!
userItemsRelation
.
getUserId
().
equals
(
dto
.
getUserId
()))
{
return
Result
.
failed
(
"暂无权限查看该藏品"
);
}
}
}
ItemResponseVo
itemResponseVo
=
new
ItemResponseVo
();
ItemResponseVo
itemResponseVo
=
new
ItemResponseVo
();
// 设置基本信息
// 设置基本信息
itemResponseVo
.
setId
(
item
.
getId
());
itemResponseVo
.
setId
(
item
.
getId
());
...
@@ -386,6 +438,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -386,6 +438,7 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setImages
(
item
.
getImages
());
itemResponseVo
.
setImages
(
item
.
getImages
());
itemResponseVo
.
setDetail
(
item
.
getDetail
());
itemResponseVo
.
setDetail
(
item
.
getDetail
());
itemResponseVo
.
setSourceType
(
item
.
getSourceType
());
itemResponseVo
.
setSourceType
(
item
.
getSourceType
());
itemResponseVo
.
setViewPermission
(
item
.
getViewPermission
());
itemResponseVo
.
setCreateTime
(
DateUtils
.
toString
(
item
.
getUpdateTime
()));
itemResponseVo
.
setCreateTime
(
DateUtils
.
toString
(
item
.
getUpdateTime
()));
// 设置视频
// 设置视频
itemResponseVo
.
setVideos
(
null
);
itemResponseVo
.
setVideos
(
null
);
...
@@ -417,6 +470,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -417,6 +470,8 @@ public class ItemServiceImpl implements ItemService {
// 设置是否收藏或是否是自己发布的
// 设置是否收藏或是否是自己发布的
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsMine
(
0
);
itemResponseVo
.
setIsMine
(
0
);
itemResponseVo
.
setIsFollowed
(
false
);
itemResponseVo
.
setFollowedId
(
null
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
...
@@ -426,6 +481,19 @@ public class ItemServiceImpl implements ItemService {
...
@@ -426,6 +481,19 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsCollected
(
0
);
}
}
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
if
(
itemResponseVo
.
getIsMine
()
==
0
&&
item
.
getSourceType
().
equals
(
CommonEnum
.
SourceTypeEnum
.
USER_UPLOAD
.
getCode
()))
{
FollowFansRecordRequestDto
followFansRecordRequestDto
=
new
FollowFansRecordRequestDto
();
followFansRecordRequestDto
.
setFollowerId
(
userItemsRelation
.
getUserId
());
followFansRecordRequestDto
.
setFansId
(
dto
.
getUserId
());
Result
result
=
followFansRecordService
.
findFollowRelation
(
followFansRecordRequestDto
);
if
(
result
.
getSuccess
())
{
HashMap
<
String
,
Object
>
map
=
(
HashMap
<
String
,
Object
>)
result
.
getData
();
itemResponseVo
.
setIsFollowed
((
Boolean
)
map
.
get
(
"isFollowed"
));
if
(
Objects
.
nonNull
(
map
.
get
(
"id"
)))
{
itemResponseVo
.
setFollowedId
((
Integer
)
map
.
get
(
"id"
));
}
}
}
// 添加或更新用户足迹
// 添加或更新用户足迹
Footprint
footprint
=
footPrintDao
.
selectByUserIdItem
(
dto
.
getUserId
(),
item
.
getId
());
Footprint
footprint
=
footPrintDao
.
selectByUserIdItem
(
dto
.
getUserId
(),
item
.
getId
());
...
@@ -443,16 +511,9 @@ public class ItemServiceImpl implements ItemService {
...
@@ -443,16 +511,9 @@ public class ItemServiceImpl implements ItemService {
footPrintDao
.
upateTime
(
footprint
);
footPrintDao
.
upateTime
(
footprint
);
}
}
}
}
// 设置藏品的发布用户昵称
String
itemNickname
=
""
;
// 设置藏品的发布用户昵称和头像
UserItemsRelation
userItemsRelation
=
userItemsRelationDao
.
find
(
item
.
getId
());
itemCommonService
.
getNicknameAvatar
(
item
.
getId
(),
itemResponseVo
);
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
User
user
=
userDao
.
queryById
(
userItemsRelation
.
getUserId
());
if
(
Objects
.
nonNull
(
user
))
{
itemNickname
=
user
.
getNickname
();
}
}
itemResponseVo
.
setItemNickname
(
itemNickname
);
logger
.
info
(
"【请求结束】查看藏品详情成功"
);
logger
.
info
(
"【请求结束】查看藏品详情成功"
);
return
Result
.
success
(
itemResponseVo
);
return
Result
.
success
(
itemResponseVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -517,6 +578,9 @@ public class ItemServiceImpl implements ItemService {
...
@@ -517,6 +578,9 @@ public class ItemServiceImpl implements ItemService {
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
());
String
collectCount
=
StringUtil
.
formatCount
(
count
);
String
collectCount
=
StringUtil
.
formatCount
(
count
);
// 发送收藏消息
sendMessage
(
item
.
getId
(),
dto
.
getUserId
(),
MessageEnum
.
TypeEnum
.
COLLECT
.
getCode
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"collectCount"
,
collectCount
);
map
.
put
(
"collectCount"
,
collectCount
);
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
...
@@ -576,6 +640,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -576,6 +640,7 @@ public class ItemServiceImpl implements ItemService {
item
.
setDetail
(
dto
.
getDetail
());
item
.
setDetail
(
dto
.
getDetail
());
Date
now
=
new
Date
();
Date
now
=
new
Date
();
item
.
setUpdateTime
(
now
);
item
.
setUpdateTime
(
now
);
item
.
setViewPermission
(
Objects
.
isNull
(
dto
.
getViewPermission
())
?
ViewPermissionEnum
.
ALL
.
getCode
()
:
dto
.
getViewPermission
());
itemDao
.
update
(
item
);
itemDao
.
update
(
item
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -588,34 +653,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -588,34 +653,7 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
)
{
public
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
// 判断是否存储过该请求路径的微信小程序码图片
String
keyName
=
CommConsts
.
UPLOAD_PRE_WXACODE_DIRECTORY
+
page
+
"/"
+
scene
+
"."
+
MediaTypeEnum
.
IMAGE_JPG
.
getExt
();
FileInfo
fileInfo
=
(
FileInfo
)
qiniuStorage
.
checkFile
(
keyName
);
if
(
Objects
.
isNull
(
fileInfo
))
{
InputStream
inputStream
=
wxLoginManager
.
getWxacodeStream
(
page
,
scene
);
if
(
Objects
.
isNull
(
inputStream
))
{
return
Result
.
failed
(
"获取微信小程序流失败"
);
}
// 新生成微信小程序码并上传到七牛云
qiniuStorage
.
store
(
inputStream
,
1
,
MediaTypeEnum
.
IMAGE_JPG
.
getMime
(),
keyName
);
}
String
urlOfSize
=
qiniuStorage
.
generateUrl
(
keyName
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
urlOfSize
);
logger
.
info
(
"【请求结束】获取微信小程序码成功"
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取微信小程序码失败"
,
e
);
return
Result
.
failed
(
"获取微信小程序码失败"
);
}
}
@Override
public
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletResponse
response
)
{
try
{
try
{
String
url
=
""
;
String
url
=
""
;
if
(
loginType
.
equals
(
LoginTypeEnum
.
WECHAT
.
getCode
()))
{
if
(
loginType
.
equals
(
LoginTypeEnum
.
WECHAT
.
getCode
()))
{
...
@@ -649,6 +687,13 @@ public class ItemServiceImpl implements ItemService {
...
@@ -649,6 +687,13 @@ public class ItemServiceImpl implements ItemService {
return
Result
.
failed
(
"获取抖音小程序码失败"
);
return
Result
.
failed
(
"获取抖音小程序码失败"
);
}
}
}
}
// 发送消息
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
if
(
Objects
.
nonNull
(
userId
))
{
Long
itemId
=
Long
.
parseLong
(
scene
.
split
(
"="
)[
1
]);
sendMessage
(
itemId
,
userId
,
MessageEnum
.
TypeEnum
.
SHARE
.
getCode
());
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
url
);
map
.
put
(
"url"
,
url
);
logger
.
info
(
"【请求结束】获取小程序码成功"
);
logger
.
info
(
"【请求结束】获取小程序码成功"
);
...
@@ -660,23 +705,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -660,23 +705,7 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
getWxLink
(
String
pageUrl
)
{
public
Result
getLink
(
String
pageUrl
,
Integer
loginType
,
HttpServletRequest
request
)
{
try
{
String
link
=
wxLoginManager
.
getLink
(
pageUrl
);
if
(
StringUtils
.
isBlank
(
link
))
{
return
Result
.
failed
(
"获取微信小程序链接失败"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"link"
,
link
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取微信小程序链接失败"
,
e
);
return
Result
.
failed
(
"获取微信小程序链接失败"
);
}
}
@Override
public
Result
getLink
(
String
pageUrl
,
Integer
loginType
)
{
try
{
try
{
String
link
=
""
;
String
link
=
""
;
if
(
loginType
.
equals
(
LoginTypeEnum
.
WECHAT
.
getCode
()))
{
if
(
loginType
.
equals
(
LoginTypeEnum
.
WECHAT
.
getCode
()))
{
...
@@ -701,6 +730,13 @@ public class ItemServiceImpl implements ItemService {
...
@@ -701,6 +730,13 @@ public class ItemServiceImpl implements ItemService {
return
Result
.
failed
(
"获取抖音小程序链接失败"
);
return
Result
.
failed
(
"获取抖音小程序链接失败"
);
}
}
}
}
// 发送消息
Long
userId
=
userTokenManager
.
getUserId
(
request
.
getHeader
(
"Authorization"
));
if
(
Objects
.
nonNull
(
userId
))
{
Long
itemId
=
Long
.
parseLong
(
pageUrl
.
split
(
"="
)[
1
]);
sendMessage
(
itemId
,
userId
,
MessageEnum
.
TypeEnum
.
SHARE
.
getCode
());
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"link"
,
link
);
map
.
put
(
"link"
,
link
);
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
...
@@ -733,7 +769,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -733,7 +769,7 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
uploadV
edi
o
(
MultipartFile
file
)
{
public
Result
uploadV
ide
o
(
MultipartFile
file
)
{
try
{
try
{
InputStream
inputStream
=
file
.
getInputStream
();
InputStream
inputStream
=
file
.
getInputStream
();
String
lastKey
=
".mp4"
;
String
lastKey
=
".mp4"
;
...
@@ -861,4 +897,25 @@ public class ItemServiceImpl implements ItemService {
...
@@ -861,4 +897,25 @@ public class ItemServiceImpl implements ItemService {
}
}
return
StringUtil
.
formatAmount
(
priceString
);
return
StringUtil
.
formatAmount
(
priceString
);
}
}
/**
* 发送消息
*
* @param itemId 藏品id
* @param userId 用户id
* @param messageType 消息类型
*/
private
void
sendMessage
(
Long
itemId
,
Long
userId
,
Integer
messageType
)
{
UserItemsRelation
userItemsRelation
=
userItemsRelationDao
.
find
(
itemId
);
if
(
Objects
.
nonNull
(
userItemsRelation
))
{
if
(!
userItemsRelation
.
getUserId
().
equals
(
userId
))
{
MessageRequestDto
messageRequestDto
=
new
MessageRequestDto
();
messageRequestDto
.
setSenderId
(
userId
);
messageRequestDto
.
setType
(
messageType
);
messageRequestDto
.
setContent
(
itemId
.
toString
());
messageRequestDto
.
setReceiverId
(
userItemsRelation
.
getUserId
());
messageService
.
add
(
messageRequestDto
);
}
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
c6fd5f69
...
@@ -14,6 +14,7 @@ import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder;
...
@@ -14,6 +14,7 @@ import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
import
com.wwdz.ch.wx.constant.LoginTypeEnum
;
import
com.wwdz.ch.wx.dao.UserInfo
;
import
com.wwdz.ch.wx.dao.UserInfo
;
...
@@ -23,9 +24,7 @@ import com.wwdz.ch.wx.manager.AlipayLoginManager;
...
@@ -23,9 +24,7 @@ import com.wwdz.ch.wx.manager.AlipayLoginManager;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.TikTokLoginManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.*
;
import
com.wwdz.ch.wx.service.SwitchService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.IpUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.wwdz.ch.wx.util.StringUtil
;
...
@@ -77,6 +76,10 @@ public class UserServiceImpl implements UserService {
...
@@ -77,6 +76,10 @@ public class UserServiceImpl implements UserService {
private
InviteRecordService
inviteRecordService
;
private
InviteRecordService
inviteRecordService
;
@Autowired
@Autowired
private
SwitchService
switchService
;
private
SwitchService
switchService
;
@Autowired
private
ItemCommonService
itemCommonService
;
@Autowired
private
FollowFansRecordService
followFansRecordService
;
@Override
@Override
...
@@ -207,45 +210,6 @@ public class UserServiceImpl implements UserService {
...
@@ -207,45 +210,6 @@ public class UserServiceImpl implements UserService {
}
}
}
}
@Transactional
@Override
public
Result
loginByWx
(
UserRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
String
mobile
=
""
;
try
{
mobile
=
wxLoginManager
.
getPhone
(
dto
);
if
(
StringUtils
.
equals
(
"false"
,
mobile
))
{
return
Result
.
failed
(
"获取access_token失败"
);
}
if
(
StringUtils
.
equals
(
"sessionFalse"
,
mobile
))
{
return
Result
.
failed
(
"获取sessionKey失败"
);
}
if
(
StringUtils
.
equals
(
"phoneFalse"
,
mobile
))
{
return
Result
.
failed
(
"获取手机号失败"
);
}
if
(
StringUtils
.
equals
(
"decryptFalse"
,
mobile
))
{
return
Result
.
failed
(
ResultCode
.
FAILED
.
getCode
(),
"用户信息解密失败"
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取微信用户手机号失败"
,
e
);
return
Result
.
failed
(
"获取微信用户手机号失败"
);
}
if
(
StringUtils
.
isBlank
(
mobile
))
{
logger
.
error
(
"获取微信用户手机号失败"
);
return
Result
.
failed
(
"获取微信用户手机号失败"
);
}
// 获取登录结果
Map
<
String
,
Object
>
result
=
getLoginResult
(
mobile
,
request
);
logger
.
info
(
"【请求结束】手机号登录,响应结果:{}"
,
JSONObject
.
toJSONString
(
result
));
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信快捷登录失败"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"微信快捷登录失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
Result
updateProfile
(
UserRequestDto
dto
)
{
public
Result
updateProfile
(
UserRequestDto
dto
)
{
...
@@ -411,6 +375,62 @@ public class UserServiceImpl implements UserService {
...
@@ -411,6 +375,62 @@ public class UserServiceImpl implements UserService {
}
}
}
}
@Override
public
Result
guestUserInfo
(
UserRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
String
token
=
request
.
getHeader
(
"Authorization"
);
if
(
StringUtils
.
isBlank
(
token
))
{
logger
.
info
(
"获取登录用户的token失败"
);
return
Result
.
failed
(
"查询不到当前登录用户信息"
);
}
Long
userId
=
userTokenManager
.
getUserId
(
token
);
if
(
Objects
.
isNull
(
userId
))
{
logger
.
info
(
"获取登录用户的userId失败"
);
return
Result
.
failed
(
"查询不到当前登录用户信息"
);
}
User
user
=
userDao
.
queryById
(
dto
.
getUserId
());
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
.
getUserId
());
followFansRecordRequestDto
.
setFansId
(
userId
);
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"
));
}
}
logger
.
info
(
"【请求结束】查询用户信息(客态)成功"
);
return
Result
.
success
(
userInfo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询用户信息(客态)失败"
,
e
);
return
Result
.
failed
(
"查询用户信息(客态)失败"
);
}
}
@Override
public
Result
pageViews
(
UserRequestDto
dto
)
{
try
{
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setUserId
(
dto
.
getUserId
());
itemCommonService
.
getPageViews
(
userInfo
);
logger
.
info
(
"【请求结束】查询关注粉丝浏览量"
);
return
Result
.
success
(
userInfo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询关注粉丝浏览量失败"
,
e
);
return
Result
.
failed
(
"查询关注粉丝浏览量失败"
);
}
}
/**
/**
* 获取登录结果
* 获取登录结果
*
*
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
c6fd5f69
...
@@ -4,6 +4,8 @@ import com.wwdz.ch.core.type.Result;
...
@@ -4,6 +4,8 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
import
javax.servlet.http.HttpServletRequest
;
public
interface
FavoritesService
{
public
interface
FavoritesService
{
/**
/**
* 收藏册分页
* 收藏册分页
...
@@ -11,7 +13,7 @@ public interface FavoritesService {
...
@@ -11,7 +13,7 @@ public interface FavoritesService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
page
(
FavoritesRequestDto
dto
);
Result
page
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 收藏册列表
* 收藏册列表
...
@@ -19,7 +21,7 @@ public interface FavoritesService {
...
@@ -19,7 +21,7 @@ public interface FavoritesService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
list
(
FavoritesRequestDto
dto
);
Result
list
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 新增收藏册
* 新增收藏册
...
@@ -43,7 +45,7 @@ public interface FavoritesService {
...
@@ -43,7 +45,7 @@ public interface FavoritesService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
info
(
FavoritesRequestDto
dto
);
Result
info
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 收藏品和收藏册数量
* 收藏品和收藏册数量
...
@@ -59,7 +61,7 @@ public interface FavoritesService {
...
@@ -59,7 +61,7 @@ public interface FavoritesService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
itemList
(
FavoritesRequestDto
dto
);
Result
itemList
(
FavoritesRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 单个删除收藏册
* 单个删除收藏册
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemCommonService.java
0 → 100644
View file @
c6fd5f69
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.wx.dao.UserInfo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
java.util.List
;
public
interface
ItemCommonService
{
void
getNicknameAvatar
(
Long
itemId
,
ItemResponseVo
vo
);
List
<
Long
>
getOnlyOneselfItemIds
(
String
token
);
void
getPageViews
(
UserInfo
userInfo
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
View file @
c6fd5f69
...
@@ -4,6 +4,7 @@ import com.wwdz.ch.core.type.Result;
...
@@ -4,6 +4,7 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
public
interface
ItemService
{
public
interface
ItemService
{
...
@@ -29,7 +30,7 @@ public interface ItemService {
...
@@ -29,7 +30,7 @@ public interface ItemService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
myPage
(
ItemRequestDto
dto
);
Result
myPage
(
ItemRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 全部藏品
* 全部藏品
...
@@ -37,7 +38,7 @@ public interface ItemService {
...
@@ -37,7 +38,7 @@ public interface ItemService {
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
collectPage
(
ItemRequestDto
dto
);
Result
collectPage
(
ItemRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 新增藏品
* 新增藏品
...
@@ -64,7 +65,7 @@ public interface ItemService {
...
@@ -64,7 +65,7 @@ public interface ItemService {
Result
del
(
ItemRequestDto
dto
);
Result
del
(
ItemRequestDto
dto
);
/**
/**
* 收藏(
仅首页
使用)
* 收藏(
列表
使用)
*
*
* @param dto
* @param dto
* @return
* @return
...
@@ -72,7 +73,7 @@ public interface ItemService {
...
@@ -72,7 +73,7 @@ public interface ItemService {
Result
collect
(
ItemRequestDto
dto
);
Result
collect
(
ItemRequestDto
dto
);
/**
/**
* 取消收藏(
仅首页
使用)
* 取消收藏(
列表
使用)
*
*
* @param dto
* @param dto
* @return
* @return
...
@@ -87,16 +88,6 @@ public interface ItemService {
...
@@ -87,16 +88,6 @@ public interface ItemService {
*/
*/
Result
update
(
ItemRequestDto
dto
);
Result
update
(
ItemRequestDto
dto
);
/**
* 获取微信小程序小程序码
*
* @param page
* @param scene
* @param response
* @return
*/
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
);
/**
/**
* 获取小程序码
* 获取小程序码
*
*
...
@@ -105,15 +96,7 @@ public interface ItemService {
...
@@ -105,15 +96,7 @@ public interface ItemService {
* @param response
* @param response
* @return
* @return
*/
*/
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletResponse
response
);
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletRequest
request
,
HttpServletResponse
response
);
/**
* 获取微信小程序短链接
*
* @param pageUrl
* @return
*/
Result
getWxLink
(
String
pageUrl
);
/**
/**
* 获取小程序链接
* 获取小程序链接
...
@@ -121,7 +104,7 @@ public interface ItemService {
...
@@ -121,7 +104,7 @@ public interface ItemService {
* @param pageUrl
* @param pageUrl
* @return
* @return
*/
*/
Result
getLink
(
String
pageUrl
,
Integer
loginType
);
Result
getLink
(
String
pageUrl
,
Integer
loginType
,
HttpServletRequest
request
);
/**
/**
* 上传图片
* 上传图片
...
@@ -137,5 +120,5 @@ public interface ItemService {
...
@@ -137,5 +120,5 @@ public interface ItemService {
* @param file
* @param file
* @return
* @return
*/
*/
Result
uploadV
edi
o
(
MultipartFile
file
);
Result
uploadV
ide
o
(
MultipartFile
file
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
View file @
c6fd5f69
...
@@ -32,15 +32,6 @@ public interface UserService {
...
@@ -32,15 +32,6 @@ public interface UserService {
*/
*/
Result
login
(
UserRequestDto
dto
,
HttpServletRequest
request
);
Result
login
(
UserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 微信登录
*
* @param dto
* @param request
* @return
*/
Result
loginByWx
(
UserRequestDto
dto
,
HttpServletRequest
request
);
/**
/**
* 修改个性签名
* 修改个性签名
*
*
...
@@ -84,7 +75,26 @@ public interface UserService {
...
@@ -84,7 +75,26 @@ public interface UserService {
/**
/**
* 查询用户信息
* 查询用户信息
*
*
* @param dto
* @param request
* @return
* @return
*/
*/
Result
userInfo
(
HttpServletRequest
request
);
Result
userInfo
(
HttpServletRequest
request
);
/**
* 查询用户信息
*
* @param dto
* @param request
* @return
*/
Result
guestUserInfo
(
UserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 关注粉丝浏览量
*
* @param dto
* @return
*/
Result
pageViews
(
UserRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
c6fd5f69
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Objects
;
import
java.util.Objects
;
@RestController
@RestController
...
@@ -28,7 +29,7 @@ public class WxFavoritesController {
...
@@ -28,7 +29,7 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"分页查询"
)
@ApiOperation
(
value
=
"分页查询"
)
@PostMapping
(
"/page"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
page
(
@RequestBody
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
...
@@ -39,17 +40,17 @@ public class WxFavoritesController {
...
@@ -39,17 +40,17 @@ public class WxFavoritesController {
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
return
Result
.
failed
(
"页面大小不能为空"
);
return
Result
.
failed
(
"页面大小不能为空"
);
}
}
return
favoritesService
.
page
(
dto
);
return
favoritesService
.
page
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"列表查询"
)
@ApiOperation
(
value
=
"列表查询"
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
Result
list
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
list
(
@RequestBody
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
return
favoritesService
.
list
(
dto
);
return
favoritesService
.
list
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"新增"
)
@ApiOperation
(
value
=
"新增"
)
...
@@ -95,12 +96,12 @@ public class WxFavoritesController {
...
@@ -95,12 +96,12 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"详情"
)
@ApiOperation
(
value
=
"详情"
)
@PostMapping
(
"/info"
)
@PostMapping
(
"/info"
)
public
Result
info
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
info
(
@RequestBody
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】收藏册详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"请选择收藏册"
);
return
Result
.
failed
(
"请选择收藏册"
);
}
}
return
favoritesService
.
info
(
dto
);
return
favoritesService
.
info
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"收藏品和收藏册数量"
)
@ApiOperation
(
value
=
"收藏品和收藏册数量"
)
...
@@ -115,7 +116,7 @@ public class WxFavoritesController {
...
@@ -115,7 +116,7 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"收藏册下藏品列表"
)
@ApiOperation
(
value
=
"收藏册下藏品列表"
)
@PostMapping
(
"/itemList"
)
@PostMapping
(
"/itemList"
)
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
@RequestBody
FavoritesRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】收藏册下藏品列表分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册下藏品列表分页查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"请选择收藏册"
);
return
Result
.
failed
(
"请选择收藏册"
);
...
@@ -126,7 +127,7 @@ public class WxFavoritesController {
...
@@ -126,7 +127,7 @@ public class WxFavoritesController {
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
return
Result
.
failed
(
"页面大小不能为空"
);
return
Result
.
failed
(
"页面大小不能为空"
);
}
}
return
favoritesService
.
itemList
(
dto
);
return
favoritesService
.
itemList
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"单个删除"
)
@ApiOperation
(
value
=
"单个删除"
)
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
c6fd5f69
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -49,7 +50,7 @@ public class WxItemController {
...
@@ -49,7 +50,7 @@ public class WxItemController {
@ApiOperation
(
value
=
"我发布的"
)
@ApiOperation
(
value
=
"我发布的"
)
@PostMapping
(
"/myPage"
)
@PostMapping
(
"/myPage"
)
public
Result
myPage
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
myPage
(
@RequestBody
ItemRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】我发布的,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】我发布的,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
...
@@ -60,12 +61,12 @@ public class WxItemController {
...
@@ -60,12 +61,12 @@ public class WxItemController {
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
return
Result
.
failed
(
"页面大小不能为空"
);
return
Result
.
failed
(
"页面大小不能为空"
);
}
}
return
itemService
.
myPage
(
dto
);
return
itemService
.
myPage
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"全部收藏"
)
@ApiOperation
(
value
=
"全部收藏"
)
@PostMapping
(
"/collectPage"
)
@PostMapping
(
"/collectPage"
)
public
Result
collectPage
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
collectPage
(
@RequestBody
ItemRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】全部收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】全部收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
...
@@ -79,7 +80,7 @@ public class WxItemController {
...
@@ -79,7 +80,7 @@ public class WxItemController {
if
(
Objects
.
isNull
(
dto
.
getType
()))
{
if
(
Objects
.
isNull
(
dto
.
getType
()))
{
return
Result
.
failed
(
"类型不能为空"
);
return
Result
.
failed
(
"类型不能为空"
);
}
}
return
itemService
.
collectPage
(
dto
);
return
itemService
.
collectPage
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"新增"
)
@ApiOperation
(
value
=
"新增"
)
...
@@ -173,16 +174,9 @@ public class WxItemController {
...
@@ -173,16 +174,9 @@ public class WxItemController {
return
itemService
.
cancel
(
dto
);
return
itemService
.
cancel
(
dto
);
}
}
@ApiOperation
(
value
=
"小程序码"
)
@GetMapping
(
"/getWxacode"
)
public
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
)
{
logger
.
info
(
"【请求开始】获取微信小程序码,请求参数:{}"
,
"page="
+
page
+
",scene="
+
scene
);
return
itemService
.
getWxacode
(
page
,
scene
,
response
);
}
@ApiOperation
(
value
=
"小程序码"
)
@ApiOperation
(
value
=
"小程序码"
)
@GetMapping
(
"/getAcode"
)
@GetMapping
(
"/getAcode"
)
public
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletResponse
response
)
{
public
Result
getAcode
(
String
page
,
String
scene
,
Integer
loginType
,
HttpServletRe
quest
request
,
HttpServletRe
sponse
response
)
{
logger
.
info
(
"【请求开始】获小程序码,请求参数:{}"
,
"page="
+
page
+
",scene="
+
scene
+
",loginType="
+
loginType
);
logger
.
info
(
"【请求开始】获小程序码,请求参数:{}"
,
"page="
+
page
+
",scene="
+
scene
+
",loginType="
+
loginType
);
if
(
StringUtils
.
isBlank
(
page
))
{
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"页面路径不能为空"
);
return
Result
.
failed
(
"页面路径不能为空"
);
...
@@ -193,19 +187,12 @@ public class WxItemController {
...
@@ -193,19 +187,12 @@ public class WxItemController {
if
(
Objects
.
isNull
(
loginType
))
{
if
(
Objects
.
isNull
(
loginType
))
{
return
Result
.
failed
(
"请提供请求的环境类型"
);
return
Result
.
failed
(
"请提供请求的环境类型"
);
}
}
return
itemService
.
getAcode
(
page
,
scene
,
loginType
,
response
);
return
itemService
.
getAcode
(
page
,
scene
,
loginType
,
request
,
response
);
}
@ApiOperation
(
value
=
"小程序链接"
)
@PostMapping
(
"/getWxLink"
)
public
Result
getWxLink
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】获取小程序链接,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
itemService
.
getWxLink
(
dto
.
getPageUrl
());
}
}
@ApiOperation
(
value
=
"小程序链接"
)
@ApiOperation
(
value
=
"小程序链接"
)
@PostMapping
(
"/getLink"
)
@PostMapping
(
"/getLink"
)
public
Result
getLink
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
getLink
(
@RequestBody
ItemRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】获取小程序链接,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】获取小程序链接,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getPageUrl
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getPageUrl
()))
{
return
Result
.
failed
(
"页面路径不能为空"
);
return
Result
.
failed
(
"页面路径不能为空"
);
...
@@ -213,7 +200,7 @@ public class WxItemController {
...
@@ -213,7 +200,7 @@ public class WxItemController {
if
(
Objects
.
isNull
(
dto
.
getLoginType
()))
{
if
(
Objects
.
isNull
(
dto
.
getLoginType
()))
{
return
Result
.
failed
(
"请提供请求的环境类型"
);
return
Result
.
failed
(
"请提供请求的环境类型"
);
}
}
return
itemService
.
getLink
(
dto
.
getPageUrl
(),
dto
.
getLoginType
());
return
itemService
.
getLink
(
dto
.
getPageUrl
(),
dto
.
getLoginType
()
,
request
);
}
}
@ApiOperation
(
"图片上传"
)
@ApiOperation
(
"图片上传"
)
...
@@ -227,10 +214,10 @@ public class WxItemController {
...
@@ -227,10 +214,10 @@ public class WxItemController {
@ApiOperation
(
"视频上传"
)
@ApiOperation
(
"视频上传"
)
@PostMapping
(
value
=
"/uploadVedio"
)
@PostMapping
(
value
=
"/uploadVedio"
)
public
Result
uploadV
edi
o
(
@RequestParam
(
"vedio"
)
MultipartFile
file
)
{
public
Result
uploadV
ide
o
(
@RequestParam
(
"vedio"
)
MultipartFile
file
)
{
if
(
Objects
.
isNull
(
file
)
||
file
.
isEmpty
())
{
if
(
Objects
.
isNull
(
file
)
||
file
.
isEmpty
())
{
return
Result
.
failed
(
"请上传视频"
);
return
Result
.
failed
(
"请上传视频"
);
}
}
return
itemService
.
uploadV
edi
o
(
file
);
return
itemService
.
uploadV
ide
o
(
file
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
c6fd5f69
...
@@ -70,24 +70,6 @@ public class WxUserController {
...
@@ -70,24 +70,6 @@ public class WxUserController {
return
userService
.
login
(
dto
,
request
);
return
userService
.
login
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"微信登录"
)
@PostMapping
(
"/loginByWx"
)
public
Result
loginByWx
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】微信登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getCode
()))
{
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
userService
.
loginByWx
(
dto
,
request
);
}
@ApiOperation
(
value
=
"登录手机验证码"
)
@ApiOperation
(
value
=
"登录手机验证码"
)
@PostMapping
(
"/loginRegCaptcha"
)
@PostMapping
(
"/loginRegCaptcha"
)
public
Object
registerCaptcha
(
@RequestBody
UserRequestDto
dto
)
{
public
Object
registerCaptcha
(
@RequestBody
UserRequestDto
dto
)
{
...
@@ -137,6 +119,10 @@ public class WxUserController {
...
@@ -137,6 +119,10 @@ public class WxUserController {
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getProfile
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getProfile
()))
{
dto
.
setProfile
(
""
);
dto
.
setProfile
(
""
);
}
else
{
if
(
dto
.
getProfile
().
length
()
>
30
)
{
return
Result
.
failed
(
"个人简介的字数应在30字以内"
);
}
}
}
return
userService
.
updateProfile
(
dto
);
return
userService
.
updateProfile
(
dto
);
}
}
...
@@ -216,4 +202,18 @@ public class WxUserController {
...
@@ -216,4 +202,18 @@ public class WxUserController {
logger
.
info
(
"【请求开始】查询用户信息"
);
logger
.
info
(
"【请求开始】查询用户信息"
);
return
userService
.
userInfo
(
request
);
return
userService
.
userInfo
(
request
);
}
}
@ApiOperation
(
value
=
"用户信息(客态)"
)
@PostMapping
(
"/guest/userInfo"
)
public
Result
guestUserInfo
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】查询用户信息(客态),请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
userService
.
guestUserInfo
(
dto
,
request
);
}
@ApiOperation
(
value
=
"关注粉丝浏览量"
)
@PostMapping
(
"/pageViews"
)
public
Result
pageViews
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】查询关注粉丝浏览量,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
userService
.
pageViews
(
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