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
3cd30d72
Commit
3cd30d72
authored
Sep 05, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增 邀请码和我的
parent
fcfdec3b
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1698 additions
and
190 deletions
+1698
-190
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
...in/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
+32
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/SwitchDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/SwitchDao.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/Switch.java
ch-dao/src/main/java/com/wwdz/ch/db/domain/Switch.java
+236
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/SwitchExample.java
...ao/src/main/java/com/wwdz/ch/db/domain/SwitchExample.java
+566
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
...va/com/wwdz/ch/db/impl/FavoritesItemsRelationDaoImpl.java
+43
-3
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
+13
-1
ch-dao/src/main/java/com/wwdz/ch/db/impl/SwitchDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/SwitchDaoImpl.java
+21
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/SwitchMapper.java
ch-dao/src/main/java/com/wwdz/ch/db/mapper/SwitchMapper.java
+69
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/SwitchMapper.xml
...src/main/resources/com/wwdz/ch/db/mapper/SwitchMapper.xml
+259
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
.../main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
+4
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+10
-69
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
+15
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+217
-66
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/SwitchServiceImpl.java
.../src/main/java/com/wwdz/ch/wx/impl/SwitchServiceImpl.java
+18
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+0
-8
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
...ain/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
+74
-10
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
.../main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+0
-8
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
...api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
+19
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/SwitchService.java
...i/src/main/java/com/wwdz/ch/wx/service/SwitchService.java
+12
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+52
-13
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+21
-1
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
View file @
3cd30d72
...
@@ -79,6 +79,17 @@ public interface FavoritesItemsRelationDao {
...
@@ -79,6 +79,17 @@ public interface FavoritesItemsRelationDao {
*/
*/
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
/**
* 通过用户id分页查询
*
* @param userId
* @param page
* @param size
* @param type
* @return
*/
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
Integer
type
,
int
page
,
int
size
);
/**
/**
* 通过藏品id统计记录数
* 通过藏品id统计记录数
*
*
...
@@ -94,7 +105,7 @@ public interface FavoritesItemsRelationDao {
...
@@ -94,7 +105,7 @@ public interface FavoritesItemsRelationDao {
* @param itemId
* @param itemId
* @return
* @return
*/
*/
boolean
isCollected
(
Long
userId
,
Long
itemId
);
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
);
/**
/**
* 通过收藏册id统计记录数
* 通过收藏册id统计记录数
...
@@ -118,4 +129,24 @@ public interface FavoritesItemsRelationDao {
...
@@ -118,4 +129,24 @@ public interface FavoritesItemsRelationDao {
* @return
* @return
*/
*/
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
);
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
);
/**
* 更新收藏册id
*
* @param userId
* @param favoritesId
* @param itemIds
* @return
*/
int
updateFavoritesId
(
Long
userId
,
Long
favoritesId
,
List
<
Long
>
itemIds
);
/**
* 更新收藏册id
*
* @param userId
* @param favoritesId
* @param itemIds
* @return
*/
int
deleteFavoritesId
(
Long
userId
,
Long
favoritesId
,
List
<
Long
>
itemIds
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
View file @
3cd30d72
...
@@ -21,6 +21,14 @@ public interface ItemDao {
...
@@ -21,6 +21,14 @@ public interface ItemDao {
*/
*/
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
);
/**
* 获取未删除的分页
*
* @param coinRequestDto
* @return
*/
PageInfo
<
Item
>
findPageNotDeleted
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
PageInfo
<
Item
>
findByPage
(
CoinRequestDto
coinRequestDto
);
PageInfo
<
Item
>
findByPage
(
CoinRequestDto
coinRequestDto
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/SwitchDao.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.Switch
;
public
interface
SwitchDao
{
Switch
find
();
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/Switch.java
0 → 100644
View file @
3cd30d72
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/04
*/
@Data
public
class
Switch
implements
Serializable
{
private
Long
id
;
/**
* 状态(0:关闭,2:打开)
*/
private
Integer
state
;
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
(
", id="
).
append
(
id
);
sb
.
append
(
", state="
).
append
(
state
);
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
;
}
Switch
other
=
(
Switch
)
that
;
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getState
()
==
null
?
other
.
getState
()
==
null
:
this
.
getState
().
equals
(
other
.
getState
()));
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getState
()
==
null
)
?
0
:
getState
().
hashCode
());
return
result
;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
enum
Column
{
id
(
"id"
,
"id"
,
"BIGINT"
,
false
),
state
(
"state"
,
"state"
,
"INTEGER"
,
true
);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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 switch
*
* @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/SwitchExample.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.db.domain
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SwitchExample
{
protected
String
orderByClause
;
protected
boolean
distinct
;
protected
List
<
Criteria
>
oredCriteria
;
public
SwitchExample
()
{
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 switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
SwitchExample
orderBy
(
String
orderByClause
)
{
this
.
setOrderByClause
(
orderByClause
);
return
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
SwitchExample
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 switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
static
Criteria
newAndCreateCriteria
()
{
SwitchExample
example
=
new
SwitchExample
();
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
andIdIsNull
()
{
addCriterion
(
"id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIsNotNull
()
{
addCriterion
(
"id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdEqualTo
(
Long
value
)
{
addCriterion
(
"id ="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"id <>"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdNotEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThan
(
Long
value
)
{
addCriterion
(
"id >"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdGreaterThanColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id >="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdGreaterThanOrEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThan
(
Long
value
)
{
addCriterion
(
"id <"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdLessThanColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id <="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andIdLessThanOrEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"id <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id not in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id not between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateIsNull
()
{
addCriterion
(
"`state` is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateIsNotNull
()
{
addCriterion
(
"`state` is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateEqualTo
(
Integer
value
)
{
addCriterion
(
"`state` ="
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateNotEqualTo
(
Integer
value
)
{
addCriterion
(
"`state` <>"
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateNotEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateGreaterThan
(
Integer
value
)
{
addCriterion
(
"`state` >"
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateGreaterThanColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"`state` >="
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateGreaterThanOrEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateLessThan
(
Integer
value
)
{
addCriterion
(
"`state` <"
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateLessThanColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"`state` <="
,
value
,
"state"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andStateLessThanOrEqualToColumn
(
Switch
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"`state` <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andStateIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"`state` in"
,
values
,
"state"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"`state` not in"
,
values
,
"state"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"`state` between"
,
value1
,
value2
,
"state"
);
return
(
Criteria
)
this
;
}
public
Criteria
andStateNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"`state` not between"
,
value1
,
value2
,
"state"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private
SwitchExample
example
;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected
Criteria
(
SwitchExample
example
)
{
super
();
this
.
example
=
example
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
SwitchExample
example
()
{
return
this
.
example
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @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 switch
*
* @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 switch
*
* @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/impl/FavoritesItemsRelationDaoImpl.java
View file @
3cd30d72
...
@@ -12,6 +12,7 @@ import com.xxdxxs.db.component.JdbcHelper;
...
@@ -12,6 +12,7 @@ import com.xxdxxs.db.component.JdbcHelper;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -84,6 +85,20 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -84,6 +85,20 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
return
new
PageInfo
<>(
list
);
return
new
PageInfo
<>(
list
);
}
}
@Override
public
PageInfo
<
FavoritesItemsRelation
>
pageByUserId
(
Long
userId
,
Integer
type
,
int
page
,
int
size
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
if
(
type
==
1
)
{
criteria
.
andFavoritesIdEqualTo
(
0L
);
}
example
.
orderBy
(
"add_time desc"
);
PageHelper
.
startPage
(
page
,
size
);
List
<
FavoritesItemsRelation
>
list
=
favoritesItemsRelationMapper
.
selectByExample
(
example
);
return
new
PageInfo
<>(
list
);
}
@Override
@Override
public
long
countByItemId
(
Long
itemId
)
{
public
long
countByItemId
(
Long
itemId
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
...
@@ -93,11 +108,11 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -93,11 +108,11 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
}
}
@Override
@Override
public
boolean
isCollected
(
Long
userId
,
Long
itemId
)
{
public
boolean
isCollected
(
Long
userId
,
Long
itemId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
example
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
JdbcHelper
.
ifPresent
(
itemId
,
criteria:
:
andItemIdEqualTo
);
criteria
.
andItemIdEqualTo
(
itemId
);
JdbcHelper
.
ifPresent
(
itemIds
,
criteria:
:
andItemIdIn
);
return
favoritesItemsRelationMapper
.
countByExample
(
example
)
>
0
;
return
favoritesItemsRelationMapper
.
countByExample
(
example
)
>
0
;
}
}
...
@@ -120,4 +135,29 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
...
@@ -120,4 +135,29 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
favoritesRequestDto
.
setId
(
favoritesId
);
favoritesRequestDto
.
setId
(
favoritesId
);
return
favoritesItemsRelationMapper
.
selectItemImages
(
favoritesRequestDto
);
return
favoritesItemsRelationMapper
.
selectItemImages
(
favoritesRequestDto
);
}
}
@Override
public
int
updateFavoritesId
(
Long
userId
,
Long
favoritesId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
favoritesItemsRelationExample
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
favoritesItemsRelationExample
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andItemIdIn
(
itemIds
);
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
favoritesItemsRelation
.
setFavoritesId
(
favoritesId
);
favoritesItemsRelation
.
setUpdateTime
(
new
Date
());
return
favoritesItemsRelationMapper
.
updateByExampleSelective
(
favoritesItemsRelation
,
favoritesItemsRelationExample
);
}
@Override
public
int
deleteFavoritesId
(
Long
userId
,
Long
favoritesId
,
List
<
Long
>
itemIds
)
{
FavoritesItemsRelationExample
favoritesItemsRelationExample
=
new
FavoritesItemsRelationExample
();
FavoritesItemsRelationExample
.
Criteria
criteria
=
favoritesItemsRelationExample
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andItemIdIn
(
itemIds
);
criteria
.
andFavoritesIdEqualTo
(
favoritesId
);
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
favoritesItemsRelation
.
setFavoritesId
(
0L
);
favoritesItemsRelation
.
setUpdateTime
(
new
Date
());
return
favoritesItemsRelationMapper
.
updateByExampleSelective
(
favoritesItemsRelation
,
favoritesItemsRelationExample
);
}
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
View file @
3cd30d72
...
@@ -49,7 +49,7 @@ public class ItemDaoImpl implements ItemDao {
...
@@ -49,7 +49,7 @@ public class ItemDaoImpl implements ItemDao {
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getName
(),
criteria
::
andNameLike
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getName
(),
criteria
::
andNameLike
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getCid
(),
criteria
::
andCidEqualTo
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getCid
(),
criteria
::
andCidEqualTo
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
return
itemMapper
.
selectByExample
(
example
);
return
itemMapper
.
selectByExample
WithBLOBs
(
example
);
}
}
@Override
@Override
...
@@ -61,6 +61,18 @@ public class ItemDaoImpl implements ItemDao {
...
@@ -61,6 +61,18 @@ public class ItemDaoImpl implements ItemDao {
return
itemMapper
.
selectByExampleWithBLOBs
(
example
);
return
itemMapper
.
selectByExampleWithBLOBs
(
example
);
}
}
@Override
public
PageInfo
<
Item
>
findPageNotDeleted
(
CoinRequestDto
coinRequestDto
)
{
ItemExample
example
=
new
ItemExample
();
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
criteria
.
andIsDeletedEqualTo
(
false
);
example
.
orderBy
(
"update_time desc"
);
PageHelper
.
startPage
(
coinRequestDto
.
getPage
(),
coinRequestDto
.
getLimit
());
List
<
Item
>
list
=
itemMapper
.
selectByExampleWithBLOBs
(
example
);
return
new
PageInfo
<>(
list
);
}
@Override
@Override
public
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
)
{
public
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
)
{
ItemExample
example
=
new
ItemExample
();
ItemExample
example
=
new
ItemExample
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/SwitchDaoImpl.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.db.impl
;
import
com.wwdz.ch.db.dao.SwitchDao
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.SwitchExample
;
import
com.wwdz.ch.db.mapper.SwitchMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
SwitchDaoImpl
implements
SwitchDao
{
@Autowired
private
SwitchMapper
switchMapper
;
@Override
public
Switch
find
()
{
SwitchExample
switchExample
=
new
SwitchExample
();
switchExample
.
orderBy
(
"id asc"
);
return
switchMapper
.
selectOneByExample
(
switchExample
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/SwitchMapper.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.db.mapper
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.SwitchExample
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
SwitchMapper
{
long
countByExample
(
SwitchExample
example
);
int
deleteByExample
(
SwitchExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
Switch
record
);
int
insertSelective
(
Switch
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Switch
selectOneByExample
(
SwitchExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Switch
selectOneByExampleSelective
(
@Param
(
"example"
)
SwitchExample
example
,
@Param
(
"selective"
)
Switch
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
Switch
>
selectByExampleSelective
(
@Param
(
"example"
)
SwitchExample
example
,
@Param
(
"selective"
)
Switch
.
Column
...
selective
);
List
<
Switch
>
selectByExample
(
SwitchExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table switch
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Switch
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Long
id
,
@Param
(
"selective"
)
Switch
.
Column
...
selective
);
Switch
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
Switch
record
,
@Param
(
"example"
)
SwitchExample
example
);
int
updateByExample
(
@Param
(
"record"
)
Switch
record
,
@Param
(
"example"
)
SwitchExample
example
);
int
updateByPrimaryKeySelective
(
Switch
record
);
int
updateByPrimaryKey
(
Switch
record
);
}
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/SwitchMapper.xml
0 → 100644
View file @
3cd30d72
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.wwdz.ch.db.mapper.SwitchMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.Switch"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"state"
jdbcType=
"INTEGER"
property=
"state"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, `state`
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.SwitchExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if
test=
"example.distinct"
>
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, `state`
</otherwise>
</choose>
from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from switch
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByPrimaryKeySelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, `state`
</otherwise>
</choose>
from switch
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from switch
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.wwdz.ch.db.domain.SwitchExample"
>
delete from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.wwdz.ch.db.domain.Switch"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into switch (`state`)
values (#{state,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.Switch"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into switch
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"state != null"
>
`state`,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"state != null"
>
#{state,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.SwitchExample"
resultType=
"java.lang.Long"
>
select count(*) from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update switch
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.state != null"
>
`state` = #{record.state,jdbcType=INTEGER},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update switch
set id = #{record.id,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.wwdz.ch.db.domain.Switch"
>
update switch
<set>
<if
test=
"state != null"
>
`state` = #{state,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.wwdz.ch.db.domain.Switch"
>
update switch
set `state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.SwitchExample"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include
refid=
"Base_Column_List"
/>
from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
limit 1
</select>
<select
id=
"selectOneByExampleSelective"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when
test=
"selective != null and selective.length > 0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, `state`
</otherwise>
</choose>
from switch
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
<if
test=
"example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
View file @
3cd30d72
...
@@ -30,9 +30,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
...
@@ -30,9 +30,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
registry
.
addInterceptor
(
loginInterceptor
())
registry
.
addInterceptor
(
loginInterceptor
())
.
addPathPatterns
(
"/**"
)
.
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/user/login"
,
"/wx/user/loginByWx"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/user/login"
);
,
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/item/findNames"
//
, "/wx/item/page", "/wx/item/info", "/wx/item/findNames"
,
"/wx/favorites/info"
,
"/wx/favorites/itemList"
//
, "/wx/favorites/info", "/wx/favorites/itemList"
,
"/wx/keyword/recommend"
,
"/wx/queryPrice/**"
);
//
, "/wx/keyword/recommend", "/wx/queryPrice/**");
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
3cd30d72
...
@@ -45,29 +45,6 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -45,29 +45,6 @@ public class FavoritesServiceImpl implements FavoritesService {
@Autowired
@Autowired
private
ItemDao
itemDao
;
private
ItemDao
itemDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
addDefault
(
FavoritesRequestDto
dto
)
{
try
{
Favorites
favorites
=
new
Favorites
();
favorites
.
setUserId
(
dto
.
getUserId
());
favorites
.
setTitle
(
"默认收藏册"
);
favorites
.
setDescription
(
""
);
favorites
.
setImages
(
""
);
Date
date
=
new
Date
();
favorites
.
setAddTime
(
date
);
favorites
.
setUpdateTime
(
date
);
favorites
.
setDeleted
(
false
);
favorites
.
setSort
(
1
);
favoritesDao
.
insert
(
favorites
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"新建默认收藏册失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(-
1
,
"新建默认收藏册失败"
);
}
}
@Override
@Override
public
Result
page
(
FavoritesRequestDto
dto
)
{
public
Result
page
(
FavoritesRequestDto
dto
)
{
try
{
try
{
...
@@ -254,7 +231,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -254,7 +231,7 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setIsCollected
(
0
);
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
0
);
vo
.
setIsMine
(
0
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
dto
.
getUserId
()
!=
0L
)
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
dto
.
getUserId
()
!=
0L
)
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
())
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
()
,
null
)
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
}
// 设置收藏数
// 设置收藏数
...
@@ -287,9 +264,6 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -287,9 +264,6 @@ public class FavoritesServiceImpl implements FavoritesService {
if
(
Objects
.
isNull
(
favorites
))
{
if
(
Objects
.
isNull
(
favorites
))
{
return
Result
.
failed
(
"数据异常,收藏册不存在"
);
return
Result
.
failed
(
"数据异常,收藏册不存在"
);
}
}
if
(
1
==
favorites
.
getSort
())
{
return
Result
.
failed
(
"无法删除默认收藏册"
);
}
// 删除收藏册
// 删除收藏册
favoritesDao
.
delete
(
dto
.
getId
(),
null
);
favoritesDao
.
delete
(
dto
.
getId
(),
null
);
...
@@ -345,16 +319,12 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -345,16 +319,12 @@ public class FavoritesServiceImpl implements FavoritesService {
if
(
Objects
.
isNull
(
favorites
))
{
if
(
Objects
.
isNull
(
favorites
))
{
return
Result
.
failed
(
"数据异常,收藏册不存在"
);
return
Result
.
failed
(
"数据异常,收藏册不存在"
);
}
}
if
(
favoritesItemsRelationDao
.
isCollected
(
favorites
.
getUserId
(),
dto
.
getId
()))
{
if
(
favoritesItemsRelationDao
.
isCollected
(
favorites
.
getUserId
(),
null
,
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"
您已经收藏过该藏品
"
);
return
Result
.
failed
(
"
选择的藏品中存在已加入收藏册的藏品,请重新选择
"
);
}
}
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
// 更新收藏册id
favoritesItemsRelation
.
setUserId
(
favorites
.
getUserId
());
favoritesItemsRelationDao
.
updateFavoritesId
(
favorites
.
getUserId
(),
dto
.
getFavoritesId
(),
dto
.
getItemIds
());
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setItemId
(
dto
.
getId
());
favoritesItemsRelation
.
setAddTime
(
new
Date
());
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
// 更新收藏册操作时间
// 更新收藏册操作时间
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
...
@@ -371,31 +341,17 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -371,31 +341,17 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
@Override
public
Result
removeItem
(
ItemRequestDto
dto
)
{
public
Result
removeItem
(
ItemRequestDto
dto
)
{
try
{
try
{
// 批量删除收藏册下用户创建的钱币
List
<
UserItemsRelation
>
usersItemsList
=
userItemsRelationDao
.
listByUserIds
(
dto
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
usersItemsList
))
{
List
<
Long
>
usersItemsIds
=
usersItemsList
.
stream
()
.
map
(
UserItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
itemIds
=
dto
.
getItemIds
().
stream
()
.
filter
(
usersItemsIds:
:
contains
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
itemIds
))
{
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
itemDao
.
deleteUserItems
(
coinRequestDto
);
}
}
// 删除收藏册和钱币的关联
// 删除收藏册和钱币的关联
favoritesItemsRelationDao
.
delete
ByChosen
(
dto
.
getFavoritesId
(),
dto
.
getItemIds
());
favoritesItemsRelationDao
.
delete
FavoritesId
(
dto
.
getUserId
(),
dto
.
getFavoritesId
(),
dto
.
getItemIds
());
// 更新收藏册操作时间
// 更新收藏册操作时间
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
logger
.
info
(
"【请求结束】取消收藏成功"
);
logger
.
info
(
"【请求结束】取消收藏成功"
);
return
Result
.
success
();
return
Result
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"收藏册
取消收藏
失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
info
(
"收藏册
移除
失败,原因:"
+
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"收藏册
取消收藏
失败"
);
return
Result
.
failed
(
"收藏册
移除
失败"
);
}
}
}
}
...
@@ -407,23 +363,8 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -407,23 +363,8 @@ public class FavoritesServiceImpl implements FavoritesService {
if
(
Objects
.
isNull
(
favorites
))
{
if
(
Objects
.
isNull
(
favorites
))
{
return
Result
.
failed
(
"数据异常,目标收藏册不存在"
);
return
Result
.
failed
(
"数据异常,目标收藏册不存在"
);
}
}
// 删除原收藏册和藏品关联记录
// 更新收藏册id
favoritesItemsRelationDao
.
deleteByChosen
(
dto
.
getBeforeFavoritesId
(),
dto
.
getItemIds
());
favoritesItemsRelationDao
.
updateFavoritesId
(
favorites
.
getUserId
(),
dto
.
getAfterFavoritesId
(),
dto
.
getItemIds
());
// 新增新收藏册和藏品关联记录
Date
now
=
new
Date
();
List
<
FavoritesItemsRelation
>
list
=
new
ArrayList
<>();
for
(
Long
itemId
:
dto
.
getItemIds
())
{
FavoritesItemsRelation
record
=
new
FavoritesItemsRelation
();
record
.
setFavoritesId
(
dto
.
getAfterFavoritesId
());
record
.
setUserId
(
favorites
.
getUserId
());
record
.
setItemId
(
itemId
);
record
.
setAddTime
(
now
);
list
.
add
(
record
);
}
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
favoritesItemsRelationDao
.
batchInsert
(
list
);
}
// 更新收藏册操作时间
// 更新收藏册操作时间
List
<
Long
>
favoritesIds
=
new
ArrayList
<>();
List
<
Long
>
favoritesIds
=
new
ArrayList
<>();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
View file @
3cd30d72
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.db.dao.ItemDao;
...
@@ -9,6 +9,7 @@ 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.Footprint
;
import
com.wwdz.ch.db.domain.Footprint
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
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
;
...
@@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
FootPrintServiceImpl
implements
FootPrintService
{
public
class
FootPrintServiceImpl
implements
FootPrintService
{
...
@@ -48,6 +50,7 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -48,6 +50,7 @@ public class FootPrintServiceImpl implements FootPrintService {
result
.
setList
(
new
ArrayList
<>());
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
false
);
result
.
setHasNextPage
(
false
);
// 分页查询足迹
PageInfo
<
Footprint
>
page
=
footPrintDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getPage
(),
dto
.
getSize
());
PageInfo
<
Footprint
>
page
=
footPrintDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getPage
(),
dto
.
getSize
());
if
(
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
if
(
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
...
@@ -75,9 +78,19 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -75,9 +78,19 @@ public class FootPrintServiceImpl implements FootPrintService {
calendar
.
setTime
(
now
);
calendar
.
setTime
(
now
);
calendar
.
add
(
Calendar
.
MONTH
,
-
1
);
calendar
.
add
(
Calendar
.
MONTH
,
-
1
);
Date
month
=
calendar
.
getTime
();
Date
month
=
calendar
.
getTime
();
// 获取足迹对应的藏品列表
List
<
Long
>
itemIds
=
page
.
getList
().
stream
()
.
map
(
Footprint:
:
getItemId
).
collect
(
Collectors
.
toList
());
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
List
<
Item
>
itemList
=
itemDao
.
findList
(
coinRequestDto
);
Map
<
Long
,
Item
>
itemMap
=
itemList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Item:
:
getId
,
s
->
s
,
(
k1
,
k2
)
->
k2
));
// 包装结果
for
(
Footprint
footprint
:
page
.
getList
())
{
for
(
Footprint
footprint
:
page
.
getList
())
{
ItemResponseVo
itemResponseVo
=
new
ItemResponseVo
();
ItemResponseVo
itemResponseVo
=
new
ItemResponseVo
();
Item
item
=
item
Dao
.
findDetails
(
footprint
.
getItemId
());
Item
item
=
item
Map
.
get
(
footprint
.
getItemId
());
// 设置基本信息
// 设置基本信息
itemResponseVo
.
setId
(
footprint
.
getId
());
itemResponseVo
.
setId
(
footprint
.
getId
());
itemResponseVo
.
setItemId
(
item
.
getId
());
itemResponseVo
.
setItemId
(
item
.
getId
());
...
@@ -88,7 +101,7 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -88,7 +101,7 @@ public class FootPrintServiceImpl implements FootPrintService {
// 设置价格
// 设置价格
itemResponseVo
.
setPrice
(
getPrice
(
item
.
getPrice
()));
itemResponseVo
.
setPrice
(
getPrice
(
item
.
getPrice
()));
// 设置是否收藏或是否是自己发布的
// 设置是否收藏或是否是自己发布的
itemResponseVo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
footprint
.
getItemId
())
?
1
:
0
);
itemResponseVo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
footprint
.
getItemId
()
,
null
)
?
1
:
0
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
// 设置收藏数
// 设置收藏数
itemResponseVo
.
setCollectCount
(
getCollectCount
(
item
.
getId
(),
item
.
getSourceType
()));
itemResponseVo
.
setCollectCount
(
getCollectCount
(
item
.
getId
(),
item
.
getSourceType
()));
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
3cd30d72
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.db.bean.EsPageInfo;
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.db.bean.EsPageInfo;
import
com.wwdz.ch.db.bean.ItemOfEs
;
import
com.wwdz.ch.db.bean.ItemOfEs
;
import
com.wwdz.ch.db.dao.*
;
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.EsSearchRequestDto
;
import
com.wwdz.ch.db.dto.request.EsSearchRequestDto
;
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
;
...
@@ -141,16 +142,16 @@ public class ItemServiceImpl implements ItemService {
...
@@ -141,16 +142,16 @@ public class ItemServiceImpl implements ItemService {
// 设置价格
// 设置价格
vo
.
setPrice
(
getPrice
(
es
.
getPrice
()));
vo
.
setPrice
(
getPrice
(
es
.
getPrice
()));
// 设置图片或视频
// 设置图片或视频
vo
.
setHomePageImage
(
getImage
(
es
));
vo
.
setHomePageImage
(
getImage
(
es
.
getImages
(),
es
.
getVideos
()
));
// 设置是否收藏和是否是自己发布的
// 设置是否收藏和是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
0
);
vo
.
setIsMine
(
0
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
es
.
getId
()
,
null
)
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
}
}
// 设置收藏数
// 设置收藏数
vo
.
setCollectCount
(
getCollectCount
(
es
.
getId
()
,
es
.
getSourceType
()
));
vo
.
setCollectCount
(
getCollectCount
(
es
.
getId
()));
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
...
@@ -168,8 +169,128 @@ public class ItemServiceImpl implements ItemService {
...
@@ -168,8 +169,128 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
@Override
public
Result
list
(
ItemRequestDto
dto
)
{
public
Result
myPage
(
ItemRequestDto
dto
)
{
return
null
;
try
{
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
result
.
setPageNum
(
dto
.
getPage
());
result
.
setPageSize
(
dto
.
getSize
());
result
.
setTotal
(
0L
);
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
false
);
// 查询用户和藏品关联表
List
<
UserItemsRelation
>
userItemsRelations
=
userItemsRelationDao
.
listByUserIds
(
dto
.
getUserId
(),
null
);
if
(
CollectionUtils
.
isEmpty
(
userItemsRelations
))
{
return
Result
.
success
(
result
);
}
List
<
Long
>
itemIds
=
userItemsRelations
.
stream
()
.
map
(
UserItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
// 分页查询
PageInfo
<
Item
>
pageInfo
=
itemDao
.
findPageNotDeleted
(
coinRequestDto
);
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
return
Result
.
success
(
result
);
}
result
.
setTotal
(
pageInfo
.
getTotal
());
result
.
setHasNextPage
(
pageInfo
.
isHasNextPage
());
List
<
AgentTranceResponseVo
>
resultList
=
new
ArrayList
<>();
for
(
Item
item
:
pageInfo
.
getList
())
{
ItemResponseVo
vo
=
new
ItemResponseVo
();
// 设置基本信息
vo
.
setId
(
item
.
getId
());
vo
.
setName
(
item
.
getName
());
vo
.
setDetail
(
item
.
getDetail
());
vo
.
setSourceType
(
item
.
getSourceType
());
// 设置价格
vo
.
setPrice
(
getPrice
(
item
.
getPrice
()));
// 设置图片或视频
vo
.
setHomePageImage
(
getImage
(
item
.
getImages
(),
item
.
getVideos
()));
// 设置是否收藏和是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
1
);
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
(),
null
)
?
1
:
0
);
}
// 设置收藏数
vo
.
setCollectCount
(
getCollectCount
(
item
.
getId
()));
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
1
);
agentTranceResponseVo
.
setDetail
(
vo
);
resultList
.
add
(
agentTranceResponseVo
);
}
result
.
setList
(
resultList
);
logger
.
info
(
"【请求结束】查询我发布的成功"
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询我发布的失败"
,
e
);
return
Result
.
failed
(
"查询我发布的失败"
);
}
}
@Override
public
Result
collectPage
(
ItemRequestDto
dto
)
{
try
{
PageInfo
<
AgentTranceResponseVo
>
result
=
new
PageInfo
<>();
result
.
setPageNum
(
dto
.
getPage
());
result
.
setPageSize
(
dto
.
getSize
());
result
.
setTotal
(
0L
);
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
false
);
// 分页查询
PageInfo
<
FavoritesItemsRelation
>
pageInfo
=
favoritesItemsRelationDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getType
(),
dto
.
getPage
(),
dto
.
getSize
());
if
(
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
return
Result
.
success
(
result
);
}
result
.
setTotal
(
pageInfo
.
getTotal
());
result
.
setHasNextPage
(
pageInfo
.
isHasNextPage
());
// 获取查询结果对应的藏品列表
List
<
Long
>
itemIds
=
pageInfo
.
getList
().
stream
()
.
map
(
FavoritesItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
());
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setIds
(
itemIds
);
List
<
Item
>
itemList
=
itemDao
.
findList
(
coinRequestDto
);
Map
<
Long
,
Item
>
itemMap
=
itemList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Item:
:
getId
,
s
->
s
,
(
k1
,
k2
)
->
k2
));
// 包装结果
List
<
AgentTranceResponseVo
>
resultList
=
new
ArrayList
<>();
for
(
FavoritesItemsRelation
favoritesItemsRelation
:
pageInfo
.
getList
())
{
ItemResponseVo
itemResponseVo
=
new
ItemResponseVo
();
Item
item
=
itemMap
.
get
(
favoritesItemsRelation
.
getItemId
());
// 设置基本信息
itemResponseVo
.
setId
(
item
.
getId
());
itemResponseVo
.
setName
(
item
.
getName
());
itemResponseVo
.
setImages
(
item
.
getImages
());
itemResponseVo
.
setDetail
(
item
.
getDetail
());
itemResponseVo
.
setIsDeleted
(
item
.
getIsDeleted
());
// 设置价格
itemResponseVo
.
setPrice
(
getPrice
(
item
.
getPrice
()));
// 设置是否收藏或是否是自己发布的
itemResponseVo
.
setIsCollected
(
1
);
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
// 设置收藏数
itemResponseVo
.
setCollectCount
(
getCollectCount
(
item
.
getId
()));
// 设置图片或视频
itemResponseVo
.
setHomePageImage
(
getImage
(
item
.
getImages
(),
item
.
getVideos
()));
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
1
);
agentTranceResponseVo
.
setDetail
(
itemResponseVo
);
resultList
.
add
(
agentTranceResponseVo
);
}
result
.
setList
(
resultList
);
logger
.
info
(
"【请求结束】查询全部收藏成功"
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询全部收藏失败"
,
e
);
return
Result
.
failed
(
"查询全部收藏失败"
);
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -206,15 +327,18 @@ public class ItemServiceImpl implements ItemService {
...
@@ -206,15 +327,18 @@ public class ItemServiceImpl implements ItemService {
userItemsRelationDao
.
insert
(
userItemsRelation
);
userItemsRelationDao
.
insert
(
userItemsRelation
);
// 新增收藏册和藏品关联记录
// 新增收藏册和藏品关联记录
if
(
Objects
.
nonNull
(
dto
.
getFavoritesId
())
&&
!
dto
.
getFavoritesId
().
equals
(
0L
))
{
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
favoritesItemsRelation
.
setUserId
(
dto
.
getUserId
());
favoritesItemsRelation
.
setUserId
(
dto
.
getUserId
());
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setItemId
(
item
.
getId
());
favoritesItemsRelation
.
setItemId
(
item
.
getId
());
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setUpdateTime
(
now
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
// 更新收藏册操作时间
// 更新收藏册操作时间
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
item
.
getId
());
map
.
put
(
"id"
,
item
.
getId
());
...
@@ -334,46 +458,54 @@ public class ItemServiceImpl implements ItemService {
...
@@ -334,46 +458,54 @@ public class ItemServiceImpl implements ItemService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
Result
collect
(
ItemRequestDto
dto
)
{
public
Result
del
(
ItemRequestDto
dto
)
{
try
{
try
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
itemDao
.
deleteById
(
dto
.
getId
());
return
Result
.
failed
(
"您尚未登录,请先登录"
);
logger
.
info
(
"【请求结束】藏品删除成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"藏品删除失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(
"藏品删除失败"
);
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
collect
(
ItemRequestDto
dto
)
{
try
{
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
return
Result
.
failed
(
"数据异常,藏品不存在"
);
return
Result
.
failed
(
"数据异常,藏品不存在"
);
}
}
// 判断是否收藏过
// 判断是否收藏过
if
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
dto
.
getId
()))
{
if
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
dto
.
getId
()
,
null
))
{
return
Result
.
failed
(
"您已经收藏过该藏品"
);
return
Result
.
failed
(
"您已经收藏过该藏品"
);
}
}
// 查找默认收藏册
Favorites
favorites
=
favoritesDao
.
defaultFavorites
(
dto
.
getUserId
());
if
(
Objects
.
isNull
(
favorites
))
{
return
Result
.
failed
(
"数据异常,查询不到用户的默认收藏册"
);
}
// 新增藏品
和新收藏册
关联
// 新增藏品
收藏
关联
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
favoritesItemsRelation
.
setUserId
(
dto
.
getUserId
());
favoritesItemsRelation
.
setUserId
(
dto
.
getUserId
());
favoritesItemsRelation
.
setFavoritesId
(
favorites
.
get
Id
());
favoritesItemsRelation
.
setFavoritesId
(
Objects
.
isNull
(
dto
.
getFavoritesId
())
?
0L
:
dto
.
getFavorites
Id
());
favoritesItemsRelation
.
setItemId
(
dto
.
getId
());
favoritesItemsRelation
.
setItemId
(
dto
.
getId
());
favoritesItemsRelation
.
setAddTime
(
new
Date
());
Date
now
=
new
Date
();
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setUpdateTime
(
now
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
// 更新收藏册操作时间
// 更新收藏册操作时间
favoritesDao
.
updateTime
(
favorites
.
getId
(),
null
);
if
(
Objects
.
nonNull
(
dto
.
getFavoritesId
())
&&
!
dto
.
getFavoritesId
().
equals
(
0L
))
{
favoritesDao
.
updateTime
(
dto
.
getFavoritesId
(),
null
);
}
// 查询收藏数
// 查询收藏数
String
collectCount
=
getCollectCount
(
item
.
getId
()
,
item
.
getSourceType
()
);
String
collectCount
=
getCollectCount
(
item
.
getId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"favoritesId"
,
favorites
.
getId
());
map
.
put
(
"collectCount"
,
collectCount
);
map
.
put
(
"collectCount"
,
collectCount
);
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
首页
收藏失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
error
(
"
直接
收藏失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(
"
首页
收藏失败"
);
return
Result
.
failed
(
"收藏失败"
);
}
}
}
}
...
@@ -381,20 +513,14 @@ public class ItemServiceImpl implements ItemService {
...
@@ -381,20 +513,14 @@ public class ItemServiceImpl implements ItemService {
@Override
@Override
public
Result
cancel
(
ItemRequestDto
dto
)
{
public
Result
cancel
(
ItemRequestDto
dto
)
{
try
{
try
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
return
Result
.
failed
(
"数据异常,藏品不存在"
);
return
Result
.
failed
(
"数据异常,藏品不存在"
);
}
}
if
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
dto
.
getId
()))
{
return
Result
.
failed
(
"自己发布的藏品不能取消收藏"
);
}
// 更新收藏册操作时间
// 更新收藏册操作时间
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
if
(
Objects
.
nonNull
(
favoritesItemsRelation
)
&&
!
favoritesItemsRelation
.
getFavoritesId
().
equals
(
0L
)
)
{
favoritesDao
.
updateTime
(
favoritesItemsRelation
.
getFavoritesId
(),
null
);
favoritesDao
.
updateTime
(
favoritesItemsRelation
.
getFavoritesId
(),
null
);
}
}
...
@@ -402,14 +528,14 @@ public class ItemServiceImpl implements ItemService {
...
@@ -402,14 +528,14 @@ public class ItemServiceImpl implements ItemService {
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
// 查询收藏数
// 查询收藏数
String
collectCount
=
getCollectCount
(
item
.
getId
()
,
item
.
getSourceType
()
);
String
collectCount
=
getCollectCount
(
item
.
getId
());
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
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
首页
取消收藏失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
error
(
"
直接
取消收藏失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(
"
首页
取消收藏失败"
);
return
Result
.
failed
(
"取消收藏失败"
);
}
}
}
}
...
@@ -437,12 +563,30 @@ public class ItemServiceImpl implements ItemService {
...
@@ -437,12 +563,30 @@ public class ItemServiceImpl implements ItemService {
// 更新收藏册
// 更新收藏册
List
<
Long
>
favoritesIds
=
new
ArrayList
<>();
List
<
Long
>
favoritesIds
=
new
ArrayList
<>();
FavoritesItemsRelation
beforeRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
FavoritesItemsRelation
beforeRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
if
(
Objects
.
nonNull
(
beforeRelation
)
&&
!
beforeRelation
.
getFavoritesId
().
equals
(
dto
.
getFavoritesId
()))
{
if
(
Objects
.
isNull
(
beforeRelation
))
{
// 更新操作时间
if
(
Objects
.
nonNull
(
dto
.
getFavoritesId
())
&&
!
dto
.
getFavoritesId
().
equals
(
0L
))
{
favoritesIds
.
add
(
beforeRelation
.
getFavoritesId
());
// 新增藏品和收藏册关联
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
favoritesItemsRelation
.
setUserId
(
dto
.
getUserId
());
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setItemId
(
item
.
getId
());
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setUpdateTime
(
now
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
// 加入更新列表
favoritesIds
.
add
(
dto
.
getFavoritesId
());
favoritesIds
.
add
(
dto
.
getFavoritesId
());
favoritesDao
.
updateTime
(
null
,
favoritesIds
);
}
}
else
{
Long
beforeFavoritesId
=
beforeRelation
.
getFavoritesId
();
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
())
||
dto
.
getFavoritesId
().
equals
(
0L
))
{
// 删除原来藏品和收藏册关联
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
// 加入更新列表
favoritesIds
.
add
(
beforeFavoritesId
);
}
else
{
if
(!
beforeRelation
.
getFavoritesId
().
equals
(
dto
.
getFavoritesId
()))
{
// 删除原来藏品和收藏册关联
// 删除原来藏品和收藏册关联
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
...
@@ -452,7 +596,17 @@ public class ItemServiceImpl implements ItemService {
...
@@ -452,7 +596,17 @@ public class ItemServiceImpl implements ItemService {
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setFavoritesId
(
dto
.
getFavoritesId
());
favoritesItemsRelation
.
setItemId
(
item
.
getId
());
favoritesItemsRelation
.
setItemId
(
item
.
getId
());
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setAddTime
(
now
);
favoritesItemsRelation
.
setUpdateTime
(
now
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
favoritesItemsRelationDao
.
insert
(
favoritesItemsRelation
);
// 加入更新列表
favoritesIds
.
add
(
beforeFavoritesId
);
favoritesIds
.
add
(
dto
.
getFavoritesId
());
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
favoritesIds
))
{
favoritesDao
.
updateTime
(
null
,
favoritesIds
);
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -676,17 +830,18 @@ public class ItemServiceImpl implements ItemService {
...
@@ -676,17 +830,18 @@ public class ItemServiceImpl implements ItemService {
/**
/**
* 获取展示图片
* 获取展示图片
*
*
* @param es
* @param images
* @param videos
* @return
* @return
*/
*/
private
Map
<
String
,
Object
>
getImage
(
ItemOfEs
e
s
)
{
private
Map
<
String
,
Object
>
getImage
(
String
images
,
String
video
s
)
{
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
homePageMap
.
put
(
"url"
,
""
);
homePageMap
.
put
(
"url"
,
""
);
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"width"
,
"0"
);
homePageMap
.
put
(
"width"
,
"0"
);
homePageMap
.
put
(
"height"
,
"0"
);
homePageMap
.
put
(
"height"
,
"0"
);
if
(
StringUtils
.
isNotBlank
(
es
.
getImages
()
))
{
if
(
StringUtils
.
isNotBlank
(
images
))
{
String
[]
image
=
es
.
getImages
()
.
split
(
";"
);
String
[]
image
=
images
.
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
if
(
image
[
0
].
contains
(
"_"
))
{
if
(
image
[
0
].
contains
(
"_"
))
{
homePageMap
=
getAspect
(
image
[
0
]);
homePageMap
=
getAspect
(
image
[
0
]);
...
@@ -694,8 +849,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -694,8 +849,8 @@ public class ItemServiceImpl implements ItemService {
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"type"
,
2
);
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
es
.
getVideos
()
))
{
if
(
StringUtils
.
isNotBlank
(
videos
))
{
String
[]
vedioImage
=
es
.
getVideos
()
.
split
(
";"
);
String
[]
vedioImage
=
videos
.
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
if
(
vedioImage
[
0
].
contains
(
","
))
{
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
homePageMap
=
getAspect
(
video
[
1
]);
homePageMap
=
getAspect
(
video
[
1
]);
...
@@ -776,16 +931,12 @@ public class ItemServiceImpl implements ItemService {
...
@@ -776,16 +931,12 @@ public class ItemServiceImpl implements ItemService {
* 获取藏品的收藏数
* 获取藏品的收藏数
*
*
* @param itemId
* @param itemId
* @param sourceType
* @return
* @return
*/
*/
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
private
String
getCollectCount
(
Long
itemId
)
{
String
countString
=
""
;
String
countString
=
""
;
// 设置收藏数
// 设置收藏数
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
itemId
);
long
count
=
favoritesItemsRelationDao
.
countByItemId
(
itemId
);
if
(
sourceType
.
equals
(
CommonEnum
.
SourceTypeEnum
.
USER_UPLOAD
.
getCode
()))
{
count
--;
}
if
(
count
<
1000
)
{
if
(
count
<
1000
)
{
countString
=
String
.
valueOf
(
count
);
countString
=
String
.
valueOf
(
count
);
}
else
{
}
else
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/SwitchServiceImpl.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.wx.impl
;
import
com.wwdz.ch.db.dao.SwitchDao
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.wx.service.SwitchService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
SwitchServiceImpl
implements
SwitchService
{
@Autowired
private
SwitchDao
switchDao
;
@Override
public
Switch
findOnly
()
{
return
switchDao
.
find
();
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
3cd30d72
...
@@ -13,7 +13,6 @@ import com.wwdz.ch.core.util.UUID;
...
@@ -13,7 +13,6 @@ import com.wwdz.ch.core.util.UUID;
import
com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder
;
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.User
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
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,7 +22,6 @@ import com.wwdz.ch.wx.manager.AlipayLoginManager;
...
@@ -23,7 +22,6 @@ 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.FavoritesService
;
import
com.wwdz.ch.wx.service.UserService
;
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
;
...
@@ -59,8 +57,6 @@ public class UserServiceImpl implements UserService {
...
@@ -59,8 +57,6 @@ public class UserServiceImpl implements UserService {
@Autowired
@Autowired
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
@Autowired
@Autowired
private
FavoritesService
favoritesService
;
@Autowired
private
WxLoginManager
wxLoginManager
;
private
WxLoginManager
wxLoginManager
;
@Autowired
@Autowired
private
AlipayLoginManager
alipayLoginManager
;
private
AlipayLoginManager
alipayLoginManager
;
...
@@ -437,10 +433,6 @@ public class UserServiceImpl implements UserService {
...
@@ -437,10 +433,6 @@ public class UserServiceImpl implements UserService {
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setShareUserId
(
0L
);
user
.
setShareUserId
(
0L
);
userDao
.
insert
(
user
);
userDao
.
insert
(
user
);
FavoritesRequestDto
favoritesRequestDto
=
new
FavoritesRequestDto
();
favoritesRequestDto
.
setUserId
(
user
.
getId
());
favoritesService
.
addDefault
(
favoritesRequestDto
);
}
else
{
}
else
{
user
.
setLastLoginTime
(
new
Date
());
user
.
setLastLoginTime
(
new
Date
());
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
View file @
3cd30d72
package
com.wwdz.ch.wx.interceptor
;
package
com.wwdz.ch.wx.interceptor
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.domain.Switch
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.manager.UserTokenManager
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.SwitchService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -11,14 +16,24 @@ import org.springframework.web.servlet.ModelAndView;
...
@@ -11,14 +16,24 @@ import org.springframework.web.servlet.ModelAndView;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
public
class
LoginInterceptor
implements
HandlerInterceptor
{
public
class
LoginInterceptor
implements
HandlerInterceptor
{
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginInterceptor
.
class
);
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginInterceptor
.
class
);
@Autowired
@Autowired
private
UserTokenManager
userTokenManager
;
private
UserTokenManager
userTokenManager
;
@Autowired
private
SwitchService
switchService
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
InviteRecordService
inviteRecordService
;
String
[]
excludeUrl
=
{
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/item/findNames"
,
"/wx/keyword/recommend"
};
/***
/***
* 在请求处理之前进行调用(Controller方法调用之前)
* 在请求处理之前进行调用(Controller方法调用之前)
...
@@ -27,6 +42,16 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -27,6 +42,16 @@ public class LoginInterceptor implements HandlerInterceptor {
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
logger
.
info
(
"进入拦截器"
);
logger
.
info
(
"进入拦截器"
);
String
token
=
request
.
getHeader
(
"Authorization"
);
String
token
=
request
.
getHeader
(
"Authorization"
);
Switch
switchh
=
switchService
.
findOnly
();
boolean
isOpen
=
false
;
if
(
Objects
.
nonNull
(
switchh
)
&&
switchh
.
getState
()
==
1
)
{
isOpen
=
true
;
}
String
url
=
request
.
getRequestURI
();
if
(!
isOpen
)
{
if
(
Arrays
.
asList
(
excludeUrl
).
contains
(
url
))
{
return
true
;
}
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
return
true
;
return
true
;
...
@@ -40,6 +65,45 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -40,6 +65,45 @@ public class LoginInterceptor implements HandlerInterceptor {
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
else
{
Integer
loginType
=
1
;
if
(
StringUtils
.
isBlank
(
token
))
{
loginType
=
2
;
}
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
User
user
=
userDao
.
queryById
(
userTokenManager
.
getUserId
(
token
));
if
(!(
Boolean
)
inviteRecordService
.
isExisted
(
user
.
getMobile
()).
getData
())
{
loginType
=
3
;
}
}
else
{
loginType
=
2
;
}
}
if
(
loginType
==
1
)
{
return
true
;
}
if
(
loginType
==
2
)
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
401
);
map
.
put
(
"success"
,
false
);
map
.
put
(
"message"
,
"未登录!"
);
map
.
put
(
"result"
,
null
);
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setStatus
(
HttpServletResponse
.
SC_UNAUTHORIZED
);
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
if
(
loginType
==
3
)
{
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
403
);
map
.
put
(
"success"
,
false
);
map
.
put
(
"message"
,
"未授权!"
);
map
.
put
(
"result"
,
null
);
response
.
setContentType
(
"application/json; charset=utf-8"
);
response
.
setStatus
(
HttpServletResponse
.
SC_FORBIDDEN
);
response
.
getWriter
().
write
(
JSON
.
toJSONString
(
map
));
}
}
return
false
;
return
false
;
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/AlipayLoginManager.java
View file @
3cd30d72
...
@@ -82,6 +82,7 @@ public class AlipayLoginManager {
...
@@ -82,6 +82,7 @@ public class AlipayLoginManager {
logger
.
error
(
"支付宝解密失败,解密异常"
,
e
);
logger
.
error
(
"支付宝解密失败,解密异常"
,
e
);
return
"false"
;
return
"false"
;
}
}
logger
.
info
(
"支付宝解密结果:"
+
plainData
);
if
(
StringUtils
.
isBlank
(
plainData
)
||
!
plainData
.
contains
(
"mobile"
))
{
if
(
StringUtils
.
isBlank
(
plainData
)
||
!
plainData
.
contains
(
"mobile"
))
{
logger
.
info
(
"支付宝解密失败,解密不通过"
);
logger
.
info
(
"支付宝解密失败,解密不通过"
);
return
"false"
;
return
"false"
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
3cd30d72
...
@@ -5,14 +5,6 @@ import com.wwdz.ch.wx.entity.request.ItemRequestDto;
...
@@ -5,14 +5,6 @@ import com.wwdz.ch.wx.entity.request.ItemRequestDto;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
public
interface
FavoritesService
{
public
interface
FavoritesService
{
/**
* 新增默认收藏册
*
* @param dto
* @return
*/
Result
addDefault
(
FavoritesRequestDto
dto
);
/**
/**
* 收藏册分页
* 收藏册分页
*
*
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
View file @
3cd30d72
...
@@ -16,7 +16,7 @@ public interface ItemService {
...
@@ -16,7 +16,7 @@ public interface ItemService {
Result
nameList
(
ItemRequestDto
dto
);
Result
nameList
(
ItemRequestDto
dto
);
/**
/**
*
藏品分
页
*
首
页
*
*
* @param dto
* @param dto
* @return
* @return
...
@@ -24,12 +24,20 @@ public interface ItemService {
...
@@ -24,12 +24,20 @@ public interface ItemService {
Result
page
(
ItemRequestDto
dto
);
Result
page
(
ItemRequestDto
dto
);
/**
/**
*
藏品列表
*
我发布的
*
*
* @param dto
* @param dto
* @return
* @return
*/
*/
Result
list
(
ItemRequestDto
dto
);
Result
myPage
(
ItemRequestDto
dto
);
/**
* 全部藏品
*
* @param dto
* @return
*/
Result
collectPage
(
ItemRequestDto
dto
);
/**
/**
* 新增藏品
* 新增藏品
...
@@ -47,6 +55,14 @@ public interface ItemService {
...
@@ -47,6 +55,14 @@ public interface ItemService {
*/
*/
Result
info
(
ItemRequestDto
dto
);
Result
info
(
ItemRequestDto
dto
);
/**
* 藏品删除
*
* @param dto
* @return
*/
Result
del
(
ItemRequestDto
dto
);
/**
/**
* 收藏(仅首页使用)
* 收藏(仅首页使用)
*
*
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/SwitchService.java
0 → 100644
View file @
3cd30d72
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.db.domain.Switch
;
public
interface
SwitchService
{
/**
* 获取开关配置
*
* @return
*/
Switch
findOnly
();
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
3cd30d72
...
@@ -146,7 +146,7 @@ public class WxFavoritesController {
...
@@ -146,7 +146,7 @@ public class WxFavoritesController {
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
return
Result
.
failed
(
"收藏册id不能为空"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
}
}
return
favoritesService
.
addItem
(
dto
);
return
favoritesService
.
addItem
(
dto
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
3cd30d72
...
@@ -34,7 +34,7 @@ public class WxItemController {
...
@@ -34,7 +34,7 @@ public class WxItemController {
return
itemService
.
nameList
(
dto
);
return
itemService
.
nameList
(
dto
);
}
}
@ApiOperation
(
value
=
"
分页查询
"
)
@ApiOperation
(
value
=
"
首页
"
)
@PostMapping
(
"/page"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
page
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】藏品列表首页,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】藏品列表首页,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
...
@@ -47,10 +47,39 @@ public class WxItemController {
...
@@ -47,10 +47,39 @@ public class WxItemController {
return
itemService
.
page
(
dto
);
return
itemService
.
page
(
dto
);
}
}
@ApiOperation
(
value
=
"列表查询"
)
@ApiOperation
(
value
=
"我发布的"
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/myPage"
)
public
Result
list
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
myPage
(
@RequestBody
ItemRequestDto
dto
)
{
return
itemService
.
list
(
dto
);
logger
.
info
(
"【请求开始】我发布的,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getPage
()))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
return
itemService
.
myPage
(
dto
);
}
@ApiOperation
(
value
=
"全部收藏"
)
@PostMapping
(
"/collectPage"
)
public
Result
collectPage
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】全部收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getPage
()))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getSize
()))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
if
(
Objects
.
isNull
(
dto
.
getType
()))
{
return
Result
.
failed
(
"类型不能为空"
);
}
return
itemService
.
collectPage
(
dto
);
}
}
@ApiOperation
(
value
=
"新增"
)
@ApiOperation
(
value
=
"新增"
)
...
@@ -69,9 +98,6 @@ public class WxItemController {
...
@@ -69,9 +98,6 @@ public class WxItemController {
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
return
Result
.
failed
(
"请至少上传一张图片"
);
return
Result
.
failed
(
"请至少上传一张图片"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
dto
.
setPrice
(
StringUtils
.
isBlank
(
dto
.
getPrice
())
?
"0"
:
dto
.
getPrice
());
dto
.
setPrice
(
StringUtils
.
isBlank
(
dto
.
getPrice
())
?
"0"
:
dto
.
getPrice
());
return
itemService
.
add
(
dto
);
return
itemService
.
add
(
dto
);
}
}
...
@@ -95,9 +121,6 @@ public class WxItemController {
...
@@ -95,9 +121,6 @@ public class WxItemController {
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getImages
()))
{
return
Result
.
failed
(
"请至少上传一张图片"
);
return
Result
.
failed
(
"请至少上传一张图片"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
dto
.
setDetail
(
StringUtils
.
isBlank
(
dto
.
getDetail
())
?
""
:
dto
.
getDetail
());
dto
.
setDetail
(
StringUtils
.
isBlank
(
dto
.
getDetail
())
?
""
:
dto
.
getDetail
());
dto
.
setVideos
(
StringUtils
.
isBlank
(
dto
.
getVideos
())
?
""
:
dto
.
getVideos
());
dto
.
setVideos
(
StringUtils
.
isBlank
(
dto
.
getVideos
())
?
""
:
dto
.
getVideos
());
dto
.
setPrice
(
StringUtils
.
isBlank
(
dto
.
getPrice
())
?
"0"
:
dto
.
getPrice
());
dto
.
setPrice
(
StringUtils
.
isBlank
(
dto
.
getPrice
())
?
"0"
:
dto
.
getPrice
());
...
@@ -114,10 +137,23 @@ public class WxItemController {
...
@@ -114,10 +137,23 @@ public class WxItemController {
return
itemService
.
info
(
dto
);
return
itemService
.
info
(
dto
);
}
}
@ApiOperation
(
value
=
"删除"
)
@PostMapping
(
"/del"
)
public
Result
del
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】藏品详情查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"藏品id不能为空"
);
}
return
itemService
.
del
(
dto
);
}
@ApiOperation
(
value
=
"收藏"
)
@ApiOperation
(
value
=
"收藏"
)
@PostMapping
(
"/collect"
)
@PostMapping
(
"/collect"
)
public
Result
collect
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
collect
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】首页收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】直接收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"藏品id不能为空"
);
return
Result
.
failed
(
"藏品id不能为空"
);
}
}
...
@@ -127,7 +163,10 @@ public class WxItemController {
...
@@ -127,7 +163,10 @@ public class WxItemController {
@ApiOperation
(
value
=
"取消收藏"
)
@ApiOperation
(
value
=
"取消收藏"
)
@PostMapping
(
"/cancel"
)
@PostMapping
(
"/cancel"
)
public
Result
cancel
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
cancel
(
@RequestBody
ItemRequestDto
dto
)
{
logger
.
info
(
"【请求开始】首页取消收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】直接取消收藏,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
return
Result
.
failed
(
"藏品id不能为空"
);
return
Result
.
failed
(
"藏品id不能为空"
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
3cd30d72
...
@@ -3,9 +3,11 @@ package com.wwdz.ch.wx.web;
...
@@ -3,9 +3,11 @@ package com.wwdz.ch.wx.web;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.InviteRecordRequestDto
;
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.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.service.InviteRecordService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.service.UserService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -31,6 +33,8 @@ public class WxUserController {
...
@@ -31,6 +33,8 @@ public class WxUserController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxUserController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxUserController
.
class
);
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@Autowired
private
InviteRecordService
inviteRecordService
;
@ApiOperation
(
value
=
"快捷登录"
)
@ApiOperation
(
value
=
"快捷登录"
)
...
@@ -98,7 +102,7 @@ public class WxUserController {
...
@@ -98,7 +102,7 @@ public class WxUserController {
@ApiOperation
(
value
=
"手机验证码登录"
)
@ApiOperation
(
value
=
"手机验证码登录"
)
@PostMapping
(
"/loginByMobile"
)
@PostMapping
(
"/loginByMobile"
)
public
Result
loginByMobile
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
public
Result
loginByMobile
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】手机号登录,请求参数
,kl_data
:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】手机号登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
return
Result
.
failed
(
"手机号不能为空"
);
return
Result
.
failed
(
"手机号不能为空"
);
}
}
...
@@ -108,6 +112,22 @@ public class WxUserController {
...
@@ -108,6 +112,22 @@ public class WxUserController {
return
userService
.
loginByMobile
(
dto
,
request
);
return
userService
.
loginByMobile
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"填写邀请码"
)
@PostMapping
(
"/fillCode"
)
public
Result
fillCode
(
@RequestBody
InviteRecordRequestDto
dto
)
{
logger
.
info
(
"【请求开始】填写邀请码,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getInvitee
())
||
dto
.
getInvitee
().
equals
(
0L
))
{
return
Result
.
failed
(
"受邀人id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getInviteePhone
()))
{
return
Result
.
failed
(
"受邀人手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getInvitationCode
()))
{
return
Result
.
failed
(
"请填写邀请码"
);
}
return
inviteRecordService
.
create
(
dto
);
}
@ApiOperation
(
value
=
"修改个性签名"
)
@ApiOperation
(
value
=
"修改个性签名"
)
@PostMapping
(
"/updateProfile"
)
@PostMapping
(
"/updateProfile"
)
public
Result
updateProfile
(
@RequestBody
UserRequestDto
dto
)
{
public
Result
updateProfile
(
@RequestBody
UserRequestDto
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