Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
6f7879b6
Commit
6f7879b6
authored
Jul 08, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量会员导入
parent
afae915e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
377 additions
and
163 deletions
+377
-163
BaseUserMemberExportDTO.java
...b/wxiaoqi/security/admin/dto/BaseUserMemberExportDTO.java
+34
-0
BaseUserMemberExport.java
...b/wxiaoqi/security/admin/entity/BaseUserMemberExport.java
+38
-0
AdminBootstrap.java
...ava/com/github/wxiaoqi/security/admin/AdminBootstrap.java
+2
-0
AppUserLoginBiz.java
...om/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
+30
-23
BaseUserMemberBiz.java
.../github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
+2
-0
BaseUserMemberExportBiz.java
...b/wxiaoqi/security/admin/biz/BaseUserMemberExportBiz.java
+85
-0
UserMemberLevelBiz.java
...github/wxiaoqi/security/admin/biz/UserMemberLevelBiz.java
+13
-1
AppUserLoginMapper.java
...hub/wxiaoqi/security/admin/mapper/AppUserLoginMapper.java
+4
-0
BaseUserMemberExportMapper.java
...oqi/security/admin/mapper/BaseUserMemberExportMapper.java
+14
-0
BaseUserMemberLevelMapper.java
...aoqi/security/admin/mapper/BaseUserMemberLevelMapper.java
+6
-1
BaseUserMemberExportController.java
...i/security/admin/rest/BaseUserMemberExportController.java
+10
-0
UserMemberController.java
...hub/wxiaoqi/security/admin/rest/UserMemberController.java
+25
-7
AppUserLoginMapper.xml
...ce-admin/src/main/resources/mapper/AppUserLoginMapper.xml
+11
-0
BaseUserMemberExportMapper.xml
.../src/main/resources/mapper/BaseUserMemberExportMapper.xml
+14
-0
BaseUserMemberLevelMapper.xml
...n/src/main/resources/mapper/BaseUserMemberLevelMapper.xml
+11
-0
CampsiteShopBiz.java
.../java/com/xxfc/platform/campsite/biz/CampsiteShopBiz.java
+74
-128
CampsiteShopAdminController.java
...form/campsite/rest/admin/CampsiteShopAdminController.java
+4
-3
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/BaseUserMemberExportDTO.java
0 → 100644
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/8 16:08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"base_user_member_export"
)
public
class
BaseUserMemberExportDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
Integer
id
;
private
String
username
;
private
Integer
memberLevel
;
private
Integer
totalNumber
;
private
Integer
rentFreeDays
;
private
Integer
discount
;
private
Integer
status
;
private
Integer
isDel
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/BaseUserMemberExport.java
0 → 100644
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/8 16:08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"base_user_member_export"
)
public
class
BaseUserMemberExport
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
Integer
id
;
private
String
username
;
@Column
(
name
=
"member_level"
)
private
Integer
memberLevel
;
@Column
(
name
=
"total_number"
)
private
Integer
totalNumber
;
@Column
(
name
=
"rent_free_days"
)
private
Integer
rentFreeDays
;
private
Integer
discount
;
private
Integer
status
;
@Column
(
name
=
"is_del"
)
private
Integer
isDel
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/AdminBootstrap.java
View file @
6f7879b6
...
...
@@ -9,6 +9,7 @@ import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
tk.mybatis.spring.annotation.MapperScan
;
...
...
@@ -25,6 +26,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@EnableFeignClients
(
value
=
{
"com.github.wxiaoqi.security"
,
"com.xxfc.platform"
},
defaultConfiguration
=
HeaderConfig
.
class
)
@EnableScheduling
@EnableAsync
@EnableAceAuthClient
@EnableAceCache
@EnableTransactionManagement
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
View file @
6f7879b6
...
...
@@ -2,27 +2,22 @@ package com.github.wxiaoqi.security.admin.biz;
import
com.ace.cache.annotation.Cache
;
import
com.ace.cache.annotation.CacheClear
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
import
com.github.wxiaoqi.security.admin.entity.User
;
import
com.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.constant.UserConstant
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.time.Instant
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
github
.
wxiaoqi
.
security
.
auth
.
common
.
constatns
.
CommonConstants
.
DATA_ALL_TRUE
;
import
java.util.Optional
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
/**
* ${DESCRIPTION}
...
...
@@ -43,12 +38,12 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
@Override
@CacheClear
(
pre
=
"user{1.username}"
)
@CacheClear
(
pre
=
"user{1.username}"
)
public
void
updateSelectiveById
(
AppUserLogin
entity
)
{
super
.
updateSelectiveById
(
entity
);
}
@CacheClear
(
pre
=
"user{1.username}"
)
@CacheClear
(
pre
=
"user{1.username}"
)
public
void
updatePasswordById
(
AppUserLogin
entity
)
{
String
password
=
new
BCryptPasswordEncoder
(
UserConstant
.
PW_ENCORDER_SALT
).
encode
(
entity
.
getPassword
());
entity
.
setPassword
(
password
);
...
...
@@ -58,11 +53,12 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
/**
* 根据用户名获取用户信息
*
* @param username
* @return
*/
@Cache
(
key
=
"user{1}"
)
public
AppUserLogin
getUserByUsername
(
String
username
){
@Cache
(
key
=
"user{1}"
)
public
AppUserLogin
getUserByUsername
(
String
username
)
{
AppUserLogin
user
=
new
AppUserLogin
();
user
.
setUsername
(
username
);
return
mapper
.
selectOne
(
user
);
...
...
@@ -101,7 +97,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public
AppUserLogin
checkeUserLogin
(
String
username
)
{
Example
example
=
new
Example
(
AppUserLogin
.
class
);
example
.
createCriteria
().
andEqualTo
(
"username"
,
username
).
andEqualTo
(
"isdel"
,
0
).
andEqualTo
(
"status"
,
0
);
example
.
createCriteria
().
andEqualTo
(
"username"
,
username
).
andEqualTo
(
"isdel"
,
0
).
andEqualTo
(
"status"
,
0
);
List
<
AppUserLogin
>
userLoginList
=
mapper
.
selectByExample
(
example
);
if
(
userLoginList
!=
null
&&
userLoginList
.
size
()
!=
0
)
{
return
userLoginList
.
get
(
0
);
...
...
@@ -111,14 +107,15 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
/**
* 根据微信号判断是否存在用户
*
* @param openid
* @return
*/
public
AppUserLogin
getUserByOpenid
(
String
openid
,
Integer
isQQ
)
{
public
AppUserLogin
getUserByOpenid
(
String
openid
,
Integer
isQQ
)
{
Example
example
=
new
Example
(
AppUserLogin
.
class
);
if
(
isQQ
==
1
)
{
if
(
isQQ
==
1
)
{
example
.
createCriteria
().
andEqualTo
(
"openid"
,
openid
).
andEqualTo
(
"isdel"
,
0
);
}
else
{
}
else
{
example
.
createCriteria
().
andEqualTo
(
"wxOpenid"
,
openid
).
andEqualTo
(
"isdel"
,
0
);
}
List
<
AppUserLogin
>
userLoginList
=
mapper
.
selectByExample
(
example
);
...
...
@@ -138,25 +135,35 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
boolean
flag
=
true
;
if
(
null
!=
userLogin
)
{
Integer
userid
=
userLogin
.
getId
();
userLogin
=
mapper
.
selectByPrimaryKey
(
userid
);
if
(
userLogin
==
null
)
{
flag
=
false
;
userLogin
=
mapper
.
selectByPrimaryKey
(
userid
);
if
(
userLogin
==
null
)
{
flag
=
false
;
}
}
return
flag
;
}
//获取用户信息
public
AppUserLogin
getUserById
(
Integer
userId
){
public
AppUserLogin
getUserById
(
Integer
userId
)
{
return
mapper
.
selectByPrimaryKey
(
userId
);
}
/**
* 登录信息更改
*
* @param userId
* @param ip
*/
public
void
updateLoginInfo
(
Integer
userId
,
String
ip
){
mapper
.
updateLoginUserInfoById
(
userId
,
ip
,
Instant
.
now
().
toEpochMilli
());
public
void
updateLoginInfo
(
Integer
userId
,
String
ip
)
{
mapper
.
updateLoginUserInfoById
(
userId
,
ip
,
Instant
.
now
().
toEpochMilli
());
}
public
Map
<
String
,
Integer
>
findPhoneAndUserIdMapByPhones
(
List
<
String
>
phones
)
{
List
<
AppUserLogin
>
appUserLogins
=
mapper
.
selectbyPhones
(
phones
);
Map
<
String
,
Integer
>
phoneAndUserIdMap
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
appUserLogins
))
{
phoneAndUserIdMap
=
appUserLogins
.
stream
().
collect
(
Collectors
.
toMap
(
AppUserLogin:
:
getUsername
,
AppUserLogin:
:
getId
));
}
return
phoneAndUserIdMap
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
View file @
6f7879b6
...
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMember
;
import
com.github.wxiaoqi.security.admin.mapper.BaseUserMemberMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
...
...
@@ -56,6 +57,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
//用户购买会员信息更新
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
void
updUserMemberByUserId
(
UserMemberDTO
userMemberDTO
)
throws
Exception
{
if
(
userMemberDTO
==
null
){
log
.
error
(
"updUserMemberByUserId----参数为空"
);
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberExportBiz.java
0 → 100644
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.dto.BaseUserMemberExportDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberExport
;
import
com.github.wxiaoqi.security.admin.mapper.BaseUserMemberExportMapper
;
import
com.github.wxiaoqi.security.admin.mapper.BaseUserMemberMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.excel.ExcelImport
;
import
com.sun.org.apache.regexp.internal.RE
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/8 16:19
*/
@Service
public
class
BaseUserMemberExportBiz
extends
BaseBiz
<
BaseUserMemberExportMapper
,
BaseUserMemberExport
>
{
@Autowired
private
UserMemberLevelBiz
userMemberLevelBiz
;
@Autowired
private
BaseUserMemberBiz
baseUserMemberBiz
;
@Autowired
private
AppUserLoginBiz
appUserLoginBiz
;
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Async
public
void
importUserMember
(
List
<
String
[]>
userMemberData
)
throws
Exception
{
List
<
BaseUserMemberExport
>
baseUserMemberExports
=
new
ArrayList
<>();
List
<
Integer
>
levels
=
userMemberData
.
stream
().
map
(
x
->
x
[
1
]).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
Integer
>
levelAndDisCountMap
=
userMemberLevelBiz
.
getUserMemberLevelAndDisCountMapByLevels
(
levels
);
List
<
String
>
phones
=
userMemberData
.
stream
().
map
(
x
->
x
[
0
]).
collect
(
Collectors
.
toList
());
Map
<
String
,
Integer
>
phoneAndUserIdMap
=
appUserLoginBiz
.
findPhoneAndUserIdMapByPhones
(
phones
);
for
(
String
[]
data
:
userMemberData
)
{
String
username
=
data
[
0
];
String
memberLevel
=
data
[
1
];
String
totalNumber
=
data
[
2
];
String
rentFreeDays
=
data
[
3
];
UserMemberDTO
userMemberDTO
=
new
UserMemberDTO
();
userMemberDTO
.
setUserId
(
phoneAndUserIdMap
.
get
(
username
));
userMemberDTO
.
setDiscount
(
levelAndDisCountMap
==
null
?
0
:(
levelAndDisCountMap
.
get
(
memberLevel
)==
null
?
0
:
levelAndDisCountMap
.
get
(
memberLevel
)));
userMemberDTO
.
setTotalNumber
(
Integer
.
valueOf
(
totalNumber
));
baseUserMemberBiz
.
updUserMemberByUserId
(
userMemberDTO
);
BaseUserMemberExport
memberExport
=
BaseUserMemberExport
.
builder
()
.
username
(
username
)
.
memberLevel
(
Integer
.
valueOf
(
memberLevel
))
.
totalNumber
(
Integer
.
valueOf
(
totalNumber
))
.
rentFreeDays
(
Integer
.
valueOf
(
rentFreeDays
))
.
status
(
phoneAndUserIdMap
==
null
?
0
:
(
phoneAndUserIdMap
.
get
(
username
)
==
null
?
0
:
1
))
.
build
();
baseUserMemberExports
.
add
(
memberExport
);
}
InsertBatch
(
baseUserMemberExports
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
InsertBatch
(
List
<
BaseUserMemberExport
>
baseUserMemberExports
)
{
mapper
.
insertList
(
baseUserMemberExports
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserMemberLevelBiz.java
View file @
6f7879b6
...
...
@@ -4,11 +4,15 @@ import com.ace.cache.annotation.Cache;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel
;
import
com.github.wxiaoqi.security.admin.mapper.BaseUserMemberLevelMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author keliii
...
...
@@ -26,5 +30,13 @@ public class UserMemberLevelBiz extends BaseBiz<BaseUserMemberLevelMapper,BaseUs
return
mapper
.
selectByExample
(
example
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
Map
<
Integer
,
Integer
>
getUserMemberLevelAndDisCountMapByLevels
(
List
<
Integer
>
levels
){
List
<
BaseUserMemberLevel
>
baseUserMemberLevels
=
mapper
.
selectUserMembersLevelByLevels
(
levels
);
Map
<
Integer
,
Integer
>
levelAndDiscountMap
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
baseUserMemberLevels
)){
levelAndDiscountMap
=
baseUserMemberLevels
.
stream
().
collect
(
Collectors
.
toMap
(
BaseUserMemberLevel:
:
getLevel
,
BaseUserMemberLevel:
:
getDiscount
));
}
return
levelAndDiscountMap
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserLoginMapper.java
View file @
6f7879b6
...
...
@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Param;
import
org.apache.ibatis.annotations.Update
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
public
interface
AppUserLoginMapper
extends
Mapper
<
AppUserLogin
>
{
...
...
@@ -17,4 +19,6 @@ public interface AppUserLoginMapper extends Mapper<AppUserLogin> {
*/
@Update
(
"update `app_user_login` set `last_host`=#{ip},`last_time`=#{lastTime} where `id`=#{userId}"
)
void
updateLoginUserInfoById
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"ip"
)
String
ip
,
@Param
(
"lastTime"
)
long
lastTime
);
List
<
AppUserLogin
>
selectbyPhones
(
@Param
(
"phones"
)
List
<
String
>
phones
);
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/BaseUserMemberExportMapper.java
0 → 100644
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberExport
;
import
tk.mybatis.mapper.additional.insert.InsertListMapper
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/8 16:21
*/
public
interface
BaseUserMemberExportMapper
extends
Mapper
<
BaseUserMemberExport
>,
InsertListMapper
<
BaseUserMemberExport
>
{
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/BaseUserMemberLevelMapper.java
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
/**
* 会员等级表
*
...
...
@@ -10,5 +14,6 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-11 11:06:45
*/
public
interface
BaseUserMemberLevelMapper
extends
Mapper
<
BaseUserMemberLevel
>
{
List
<
BaseUserMemberLevel
>
selectUserMembersLevelByLevels
(
@Param
(
"levels"
)
List
<
Integer
>
levels
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/BaseUserMemberExportController.java
0 → 100644
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/8 16:20
*/
public
class
BaseUserMemberExportController
{
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/UserMemberController.java
View file @
6f7879b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.BaseUserMemberBiz
;
import
com.github.wxiaoqi.security.admin.biz.BaseUserMemberExportBiz
;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.excel.ExcelImport
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
...
...
@@ -22,33 +27,46 @@ public class UserMemberController {
@Autowired
private
BaseUserMemberBiz
memberBiz
;
@Autowired
private
BaseUserMemberExportBiz
baseUserMemberExportBiz
;
/**
* 购买会员
*
* @param userMemberDTO
* @return
* @throws Exception
*/
@RequestMapping
(
value
=
"/user/buyMember"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
buyMember
(
@RequestBody
UserMemberDTO
userMemberDTO
)
throws
Exception
{
memberBiz
.
updUserMemberByUserId
(
userMemberDTO
);
memberBiz
.
updUserMemberByUserId
(
userMemberDTO
);
return
ObjectRestResponse
.
succ
();
}
/**
* 订单更改会员
*
* @param userId
* @param days
* @param type 1-用户锁定下单;2-购买下单;3-取消订单
* @param type
1-用户锁定下单;2-购买下单;3-取消订单
* @return
* @throws Exception
*/
@RequestMapping
(
value
=
"/user/memberDays"
,
method
=
RequestMethod
.
POST
)
public
int
memberDays
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"days"
,
defaultValue
=
"0"
)
Integer
days
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
)
throws
Exception
{
return
memberBiz
.
upMemberDays
(
userId
,
days
,
type
);
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"days"
,
defaultValue
=
"0"
)
Integer
days
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
)
throws
Exception
{
return
memberBiz
.
upMemberDays
(
userId
,
days
,
type
);
}
@PostMapping
(
"/user/export"
)
public
ObjectRestResponse
importUserMember
(
@RequestPart
(
"file"
)
MultipartFile
userMemberExcel
)
{
List
<
String
[]>
userMemberData
=
ExcelImport
.
getExcelData
(
userMemberExcel
);
if
(
userMemberData
.
size
()
<
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
}
return
baseUserMemberExportBiz
.
importUserMember
(
userMemberData
);
}
}
ace-modules/ace-admin/src/main/resources/mapper/AppUserLoginMapper.xml
0 → 100644
View file @
6f7879b6
<?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.github.wxiaoqi.security.admin.mapper.AppUserLoginMapper"
>
<select
id=
"selectbyPhones"
resultType=
"com.github.wxiaoqi.security.admin.entity.AppUserLogin"
>
select `id`,`username` from `app_user_login` where `username` in
<foreach
collection=
"phones"
item=
"phone"
open=
"("
close=
")"
separator=
","
>
#{phone}
</foreach>
</select>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/BaseUserMemberExportMapper.xml
0 → 100644
View file @
6f7879b6
<?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.github.wxiaoqi.security.admin.mapper.BaseUserMemberExportMapper"
>
<resultMap
type=
"com.github.wxiaoqi.security.admin.entity.BaseUserMemberExport"
id=
"baseUserMemberExportMap"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"discount"
column=
"discount"
/>
<result
property=
"memberLevel"
column=
"member_level"
/>
<result
property=
"rentFreeDays"
column=
"rent_free_days"
/>
<result
property=
"totalNumber"
column=
"total_number"
/>
<result
property=
"username"
column=
"username"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"status"
column=
"status"
/>
</resultMap>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/BaseUserMemberLevelMapper.xml
0 → 100644
View file @
6f7879b6
<?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.github.wxiaoqi.security.admin.mapper.BaseUserMemberLevelMapper"
>
<select
id=
"selectUserMembersLevelByLevels"
resultType=
"com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel"
>
select `level`,`discount` from `base_user_member_level` where `level` in
<foreach
collection=
"levels"
item=
"level"
separator=
","
open=
"("
close=
")"
>
#{level}
</foreach>
</select>
</mapper>
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/biz/CampsiteShopBiz.java
View file @
6f7879b6
package
com
.
xxfc
.
platform
.
campsite
.
biz
;
import
com.ace.cache.annotation.Cache
;
import
com.ace.cache.annotation.CacheClear
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.github.wxiaoqi.security.common.vo.GoodDataVO
;
...
...
@@ -40,10 +38,6 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public
class
CampsiteShopBiz
extends
BaseBiz
<
CampsiteShopMapper
,
CampsiteShop
>
{
/**
* 地球半径,单位 km
*/
private
static
final
double
EARTH_RADIUS
=
6378.137
;
@Autowired
private
CampsiteShopTagBiz
campsiteShopTagBiz
;
...
...
@@ -60,36 +54,46 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
@Resource
(
name
=
"customRedisTemplate"
)
ValueOperations
<
String
,
String
>
campsiteValueOperations
;
private
static
final
String
CAMPSITE_CACHE
=
"campsite_cache:"
;
private
static
final
String
CAMSITE_DETAIL_CACHE
=
"campsite:detail:cache:"
;
/**
* 营地缓存前缀
*/
private
static
final
String
CAMPSITE_LIST_CACHE_PREKEY
=
"campsite_cache:"
;
private
static
final
String
CAMSITE_DETAIL_CACHE_PREKEY
=
"campsite:detail:cache:"
;
private
static
final
String
CAMPSITE_CACHE_ALL
=
"all"
;
private
static
final
long
CAMPSITE_EXPIRE_TIME
=
6000
;
private
static
final
long
CAMPSITE_CACHE_EXPIRE_TIME
=
6000
;
/**
* 根据店铺类型查找列表
* 地球半径,单位 km
*/
private
static
final
double
EARTH_RADIUS
=
6378.137
;
/**
* 首页营地列表
*
* @param type
* @param page
* @param limit
* @return
*/
public
List
<
GoodDataVO
>
getAllByHome
(
Integer
page
,
Integer
limit
)
{
return
mapper
.
findAllByHome
((
page
-
1
)
*
limit
,
limit
);
}
public
PageDataVO
<
CampsiteShopPageVo
>
findCampsiteShopPageByType
(
Integer
type
,
Integer
pageNo
,
Integer
pageSize
)
{
//根据type类型查找店铺
String
result
=
null
;
String
result
;
if
(
Objects
.
isNull
(
type
))
{
result
=
campHashOperations
.
get
(
CAMPSITE_
CACHE
,
CAMPSITE_CACHE_ALL
);
result
=
campHashOperations
.
get
(
CAMPSITE_
LIST_CACHE_PREKEY
,
String
.
format
(
"%s%d%d"
,
CAMPSITE_CACHE_ALL
,
pageNo
,
pageSize
)
);
}
else
{
result
=
campHashOperations
.
get
(
CAMPSITE_
CACHE
,
String
.
format
(
"%s%d%d"
,
String
.
valueOf
(
type
),
pageNo
,
pageSize
));
result
=
campHashOperations
.
get
(
CAMPSITE_
LIST_CACHE_PREKEY
,
String
.
format
(
"%s%d%d"
,
String
.
valueOf
(
type
),
pageNo
,
pageSize
));
}
if
(
result
!=
null
)
{
return
JSONObject
.
parseObject
(
result
,
new
TypeReference
<
PageDataVO
<
CampsiteShopPageVo
>>(){});
return
JSONObject
.
parseObject
(
result
,
new
TypeReference
<
PageDataVO
<
CampsiteShopPageVo
>>()
{
});
}
PageDataVO
<
CampsiteShopPageVo
>
campsiteShopPageDataVO
=
new
PageDataVO
<>();
PageDataVO
<
CampsiteShopPageDTO
>
pageDataVO
=
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
findAllCampsiteShopsByType
(
type
));
List
<
CampsiteShopPageDTO
>
campsiteShopPageDTOS
=
pageDataVO
.
getData
();
PageDataVO
<
CampsiteShopPageVo
>
campsiteShopPageDataVO
=
new
PageDataVO
<>();
campsiteShopPageDataVO
.
setTotalPage
(
pageDataVO
.
getTotalPage
());
campsiteShopPageDataVO
.
setTotalCount
(
pageDataVO
.
getTotalCount
());
campsiteShopPageDataVO
.
setPageSize
(
pageDataVO
.
getPageSize
());
campsiteShopPageDataVO
.
setPageNum
(
pageDataVO
.
getPageNum
());
if
(
CollectionUtils
.
isEmpty
(
campsiteShopPageDTOS
))
{
campsiteShopPageDataVO
.
setData
(
new
ArrayList
<
CampsiteShopPageVo
>());
return
campsiteShopPageDataVO
;
...
...
@@ -97,6 +101,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"根据type=【{}】查询到的店铺数据:【{}】"
,
type
,
campsiteShopPageDTOS
);
}
List
<
CampsiteShopPageVo
>
campsiteShopPageVoList
=
new
ArrayList
<>();
campsiteShopPageDTOS
=
campsiteShopPageDTOS
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
for
(
CampsiteShopPageDTO
campsiteShopPageDTO
:
campsiteShopPageDTOS
)
{
...
...
@@ -105,38 +110,44 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
campsiteShopPageVoList
.
add
(
campsiteShopPageVo
);
}
campsiteShopPageVoList
.
sort
(
Comparator
.
comparing
(
CampsiteShopPageVo:
:
getHot
).
reversed
().
thenComparing
(
CampsiteShopPageVo:
:
getCrtTime
).
reversed
());
campsiteShopPageDataVO
.
setTotalPage
(
pageDataVO
.
getTotalPage
());
campsiteShopPageDataVO
.
setTotalCount
(
pageDataVO
.
getTotalCount
());
campsiteShopPageDataVO
.
setPageSize
(
pageDataVO
.
getPageSize
());
campsiteShopPageDataVO
.
setPageNum
(
pageDataVO
.
getPageNum
());
campsiteShopPageDataVO
.
setData
(
campsiteShopPageVoList
);
if
(
Objects
.
isNull
(
type
))
{
campHashOperations
.
put
(
CAMPSITE_
CACHE
,
CAMPSITE_CACHE_ALL
,
JSONObject
.
toJSONString
(
campsiteShopPageDataVO
));
campHashOperations
.
put
(
CAMPSITE_
LIST_CACHE_PREKEY
,
String
.
format
(
"%s%d%d"
,
CAMPSITE_CACHE_ALL
,
pageNo
,
pageSize
)
,
JSONObject
.
toJSONString
(
campsiteShopPageDataVO
));
}
else
{
campHashOperations
.
put
(
CAMPSITE_
CACHE
,
String
.
format
(
"%s%d%d"
,
String
.
valueOf
(
type
),
pageNo
,
pageSize
),
JSONObject
.
toJSONString
(
campsiteShopPageDataVO
));
campHashOperations
.
put
(
CAMPSITE_
LIST_CACHE_PREKEY
,
String
.
format
(
"%s%d%d"
,
String
.
valueOf
(
type
),
pageNo
,
pageSize
),
JSONObject
.
toJSONString
(
campsiteShopPageDataVO
));
}
return
campsiteShopPageDataVO
;
}
/**
* 根据店铺id查询店铺详情
*
* @param id
* @param longitude 经度
* @param latitude 纬度
* @return
*/
public
CampsiteShopDetailVo
findCampsiteShopDetailById
(
Integer
id
,
Double
longitude
,
Double
latitude
)
{
String
result
=
campsiteValueOperations
.
get
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE
,
id
));
if
(
Objects
.
nonNull
(
result
)){
return
JSONObject
.
parseObject
(
result
,
new
TypeReference
<
CampsiteShopDetailVo
>(){});
String
result
=
campsiteValueOperations
.
get
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE_PREKEY
,
id
));
if
(
Objects
.
nonNull
(
result
))
{
return
JSONObject
.
parseObject
(
result
,
new
TypeReference
<
CampsiteShopDetailVo
>()
{
});
}
CampsiteShopDetailVo
campsiteShopDetailVo
=
new
CampsiteShopDetailVo
();
//从店铺表根据店铺id查询
CampsiteShopDetailDTO
campsiteShopDetailDTO
=
mapper
.
findCampsiteShopDetailById
(
id
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"根据店铺id=【{}】查询出店铺信息【{}】"
,
id
,
campsiteShopDetailDTO
);
}
if
(
Objects
.
isNull
(
campsiteShopDetailDTO
)){
if
(
Objects
.
isNull
(
campsiteShopDetailDTO
))
{
return
campsiteShopDetailVo
;
}
BeanUtils
.
copyProperties
(
campsiteShopDetailDTO
,
campsiteShopDetailVo
);
//从轮播表根据店铺id查询
List
<
CampsiteShopCarouselDetailDTO
>
campsiteShopCarouselDTOS
=
campsiteShopCarouselBiz
.
findByCampsiteShopId
(
id
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"根据店铺id=【{}】查询出店铺轮播图信息:【{}】"
,
id
,
campsiteShopCarouselDTOS
);
...
...
@@ -150,7 +161,6 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
});
}
campsiteShopDetailVo
.
setCampsiteShopCarouselDetailVos
(
campsiteShopCarouselDetailVos
);
//从店铺类型表根据店铺id查询 -->类型列表拼接
List
<
CampsiteShopTagDTO
>
shopTagDTOS
=
campsiteShopTagBiz
.
findByCampsiteShopId
(
id
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"根据店铺id=【{}】查询出店铺类型:【{}】"
,
id
,
shopTagDTOS
);
...
...
@@ -162,56 +172,39 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
log
.
debug
(
"根据店铺经度=【{}】,纬度=【{}】和自己所在位置的经度=【{}】,纬度=【{}】计算出的距离:【{}km】"
,
campsiteShopDetailDTO
.
getLongitude
(),
campsiteShopDetailDTO
.
getLatitude
(),
longitude
,
latitude
,
distance
);
}
campsiteShopDetailVo
.
setDistance
(
String
.
format
(
"%.1f"
,
distance
));
campsiteValueOperations
.
set
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE
,
id
),
JSONObject
.
toJSONString
(
campsiteShopDetailVo
));
campsiteValueOperations
.
set
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE_PREKEY
,
id
),
JSONObject
.
toJSONString
(
campsiteShopDetailVo
));
return
campsiteShopDetailVo
;
}
/**
* 根据创建时间或营地名称来查找营地列表
*
* @param campsiteShopAdminFindDTO
* @return
*/
public
PageDataVO
<
CampsiteShopAdminPageVo
>
findCampsiteShopPage
(
CampsiteShopAdminFindDTO
campsiteShopAdminFindDTO
)
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"查询条件:【{}】"
,
campsiteShopAdminFindDTO
);
}
PageDataVO
<
CampsiteShopAdminPageVo
>
campsiteShopAdminPageDataVos
=
new
PageDataVO
<>();
//筛选时间处理
/* Long startTime = campsiteShopAdminFindDTO.getStartTime();
Long endTime = campsiteShopAdminFindDTO.getEndTime();
if (startTime==null || endTime ==null){
Long processTime = startTime!=null?startTime:(endTime!=null?endTime:null);
if (processTime!=null){
campsiteShopAdminFindDTO.setStartTime(processStartTime(processTime));
campsiteShopAdminFindDTO.setEndTime(processEndTime(processTime));
}
}else {
campsiteShopAdminFindDTO.setStartTime(processStartTime(startTime));
campsiteShopAdminFindDTO.setEndTime(processEndTime(endTime));
}*/
PageDataVO
<
CampsiteShopAdminPageDTO
>
campsiteShopAdminpageDTOPageDataVO
=
PageDataVO
.
pageInfo
(
campsiteShopAdminFindDTO
.
getPage
(),
campsiteShopAdminFindDTO
.
getLimit
(),
()
->
mapper
.
findAllCampsiteShops
(
campsiteShopAdminFindDTO
));
List
<
CampsiteShopAdminPageDTO
>
campsiteShopAdminPageDTOS
=
campsiteShopAdminpageDTOPageDataVO
.
getData
();
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"查询结果:【{}】"
,
campsiteShopAdminPageDTOS
);
}
PageDataVO
<
CampsiteShopAdminPageVo
>
campsiteShopAdminPageDataVos
=
new
PageDataVO
<>();
if
(
CollectionUtils
.
isEmpty
(
campsiteShopAdminPageDTOS
))
{
return
campsiteShopAdminPageDataVos
;
}
//转换成营地ids
List
<
Integer
>
campsiteShopIds
=
campsiteShopAdminPageDTOS
.
stream
().
map
(
CampsiteShopAdminPageDTO:
:
getId
).
collect
(
Collectors
.
toList
());
//根据营地ids查询营地对应的标签 键营地id 值对应的标签列表
Map
<
Integer
,
List
<
String
>>
shopTagsMap
=
campsiteShopTagBiz
.
findByCampsiteShopIds
(
campsiteShopIds
);
Map
<
Integer
,
List
<
String
>>
shop
IdOf
TagsMap
=
campsiteShopTagBiz
.
findByCampsiteShopIds
(
campsiteShopIds
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"营地id为:【{}】的类型【{}】"
,
campsiteShopIds
,
shopTagsMap
);
log
.
debug
(
"营地id为:【{}】的类型【{}】"
,
campsiteShopIds
,
shop
IdOf
TagsMap
);
}
campsiteShopAdminPageDTOS
=
campsiteShopAdminPageDTOS
.
stream
().
peek
(
campsiteShopAdminPageDTO
->
{
if
(
Objects
.
nonNull
(
shopTagsMap
))
{
List
<
String
>
tagNames
=
shopTagsMap
.
get
(
campsiteShopAdminPageDTO
.
getId
());
if
(
Objects
.
nonNull
(
shop
IdOf
TagsMap
))
{
List
<
String
>
tagNames
=
shop
IdOf
TagsMap
.
get
(
campsiteShopAdminPageDTO
.
getId
());
campsiteShopAdminPageDTO
.
setStoreTypeName
(
tagNames
==
null
?
new
ArrayList
<
String
>()
:
tagNames
);
}
}).
sorted
(
Comparator
.
comparing
(
CampsiteShopAdminPageDTO:
:
getHot
).
reversed
().
thenComparing
(
CampsiteShopAdminPageDTO:
:
getCrtTime
).
reversed
()).
collect
(
Collectors
.
toList
());
//组装数据
campsiteShopAdminPageDataVos
.
setTotalPage
(
campsiteShopAdminpageDTOPageDataVO
.
getTotalPage
());
campsiteShopAdminPageDataVos
.
setTotalCount
(
campsiteShopAdminpageDTOPageDataVO
.
getTotalCount
());
...
...
@@ -222,12 +215,7 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
return
campsiteShopAdminPageDataVos
;
}
/**
* 营地保存或更新
*
* @param campsiteShopAdminDTO
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
int
saveCampsiteShop
(
CampsiteShopAdminDTO
campsiteShopAdminDTO
)
{
CampsiteShop
campsiteShop
=
new
CampsiteShop
();
...
...
@@ -260,17 +248,12 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
//保存或更新 * 营地与营地类型信息
List
<
Integer
>
campsiteTagDTOS
=
campsiteShopAdminDTO
.
getCampsiteTagDTOS
();
campsiteShopTagBiz
.
saveBatch
(
campsiteTagDTOS
,
campsiteShop
.
getId
());
redisTemplate
.
delete
(
CAMPSITE_
CACHE
);
redisTemplate
.
delete
(
CAMPSITE_
LIST_CACHE_PREKEY
);
return
effectRows
;
}
/**
* 编辑查询
*
* @param id
* @return
*/
public
CampsiteShopAdminVO
findByCampsiteId
(
Integer
id
)
{
public
CampsiteShopAdminVO
findCampsiteById
(
Integer
id
)
{
CampsiteShopAdminVO
campsiteShopAdminVO
=
new
CampsiteShopAdminVO
();
CampsiteShop
campsiteShop
=
new
CampsiteShop
();
campsiteShop
.
setId
(
id
);
...
...
@@ -301,8 +284,8 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
}
campsiteShopAdminVO
.
setCarouse
(
campsiteShopAdminVO
.
getCarouse
()
==
null
?
new
ArrayList
<
CampsiteShopCarouselVo
>()
:
campsiteShopAdminVO
.
getCarouse
());
campsiteShopAdminVO
.
setCampsiteTagListVos
(
campsiteShopAdminVO
.
getCampsiteTagListVos
()
==
null
?
new
ArrayList
<
CampsiteTagListVo
>()
:
campsiteShopAdminVO
.
getCampsiteTagListVos
());
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
CACHE
);
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE_PREKEY
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
LIST_CACHE_PREKEY
);
return
campsiteShopAdminVO
;
}
...
...
@@ -314,37 +297,26 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
*/
public
int
updateCampsiteSatus
(
int
id
)
{
int
effectRows
=
mapper
.
updateCampsiteStatusById
(
id
,
1
);
if
(
effectRows
>
0
)
{
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
CACHE
);
if
(
effectRows
>
0
)
{
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE_PREKEY
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
LIST_CACHE_PREKEY
);
}
return
effectRows
;
}
/**
* 上下架
*
* @param id
* @param status
* @return
*/
public
int
updateCampsiteSaleStatus
(
Integer
id
,
Integer
status
)
{
public
int
upperOrLowerShelves
(
Integer
id
,
Integer
status
)
{
int
effectRows
=
mapper
.
updateCampsiteSaleStatusById
(
id
,
status
);
if
(
effectRows
>
0
)
{
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
CACHE
);
if
(
effectRows
>
0
)
{
redisTemplate
.
delete
(
String
.
format
(
"%s%d"
,
CAMSITE_DETAIL_CACHE_PREKEY
,
id
));
redisTemplate
.
delete
(
CAMPSITE_
LIST_CACHE_PREKEY
);
}
return
effectRows
;
}
/**
* 检验营地名称是否存在
*
* @param id
* @param name
* @return
*/
public
Boolean
chekcCampsiteNameExist
(
Integer
id
,
String
name
)
{
public
Boolean
checkCampsiteNameExist
(
Integer
id
,
String
name
)
{
int
count
=
mapper
.
checkNameExist
(
id
,
name
);
if
(
count
==
0
)
{
return
false
;
...
...
@@ -352,14 +324,8 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
return
true
;
}
/**
* 处理开始时间
*
* @param time
* @return
*/
private
long
processStartTime
(
Long
time
)
{
return
LocalDateTime
.
ofInstant
(
new
Date
(
time
).
toInstant
(),
ZoneOffset
.
ofHours
(+
8
))
private
long
transformStartTime
(
Long
startTime
)
{
return
LocalDateTime
.
ofInstant
(
new
Date
(
startTime
).
toInstant
(),
ZoneOffset
.
ofHours
(+
8
))
.
withHour
(
0
)
.
withMinute
(
0
)
.
withSecond
(
0
)
...
...
@@ -368,14 +334,9 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
.
toEpochMilli
();
}
/**
* 处理结束时间
*
* @param time
* @return
*/
private
long
processEndTime
(
Long
time
)
{
return
LocalDateTime
.
ofInstant
(
new
Date
(
time
).
toInstant
(),
ZoneOffset
.
ofHours
(+
8
))
private
long
transformEndTime
(
Long
endTime
)
{
return
LocalDateTime
.
ofInstant
(
new
Date
(
endTime
).
toInstant
(),
ZoneOffset
.
ofHours
(+
8
))
.
withHour
(
23
)
.
withMinute
(
59
)
.
withSecond
(
59
)
...
...
@@ -411,19 +372,4 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
s
=
s
*
EARTH_RADIUS
;
return
s
;
}
/**
* 首页营地列表
*
* @param page
* @param limit
* @return
*/
public
List
<
GoodDataVO
>
getAllByHome
(
Integer
page
,
Integer
limit
)
{
return
mapper
.
findAllByHome
((
page
-
1
)
*
limit
,
limit
);
}
;
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/rest/admin/CampsiteShopAdminController.java
View file @
6f7879b6
...
...
@@ -56,8 +56,9 @@ public class CampsiteShopAdminController extends BaseController<CampsiteShopBiz,
@ApiOperation
(
"营地上下架"
)
@PutMapping
(
"/saleStatus"
)
public
ObjectRestResponse
<
Void
>
updateSaleStatus
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"status"
)
Integer
status
){
int
effectRows
=
getBaseBiz
().
up
dateCampsiteSaleStatu
s
(
id
,
status
);
int
effectRows
=
getBaseBiz
().
up
perOrLowerShelve
s
(
id
,
status
);
if
(
effectRows
>
0
){
return
ObjectRestResponse
.
succ
();
}
return
ObjectRestResponse
.
createDefaultFail
();
...
...
@@ -66,14 +67,14 @@ public class CampsiteShopAdminController extends BaseController<CampsiteShopBiz,
@ApiOperation
(
"检验营地名称"
)
@GetMapping
(
"/exist"
)
public
ObjectRestResponse
<
Boolean
>
checkCampsiteNameExist
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
Integer
id
,
@RequestParam
(
"name"
)
String
name
){
Boolean
exist
=
getBaseBiz
().
che
kc
CampsiteNameExist
(
id
,
name
==
null
?
""
:
name
.
trim
());
Boolean
exist
=
getBaseBiz
().
che
ck
CampsiteNameExist
(
id
,
name
==
null
?
""
:
name
.
trim
());
return
ObjectRestResponse
.
succ
(
exist
);
}
@ApiOperation
(
"营地编辑查询"
)
@GetMapping
(
"/campsite/{id}"
)
public
ObjectRestResponse
<
CampsiteShopAdminVO
>
findByCampsiteId
(
@PathVariable
(
value
=
"id"
)
Integer
id
){
CampsiteShopAdminVO
campsiteShopAdminVO
=
getBaseBiz
().
find
ByCampsite
Id
(
id
);
CampsiteShopAdminVO
campsiteShopAdminVO
=
getBaseBiz
().
find
CampsiteBy
Id
(
id
);
return
ObjectRestResponse
.
succ
(
campsiteShopAdminVO
);
}
}
\ No newline at end of file
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