Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
485d61a4
Commit
485d61a4
authored
Oct 18, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Room manage dev;
Store mange opt; code generator opt;
parent
8ec830ad
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
470 additions
and
227 deletions
+470
-227
SConsumerController.java
...java/share/web/controller/system/SConsumerController.java
+21
-68
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+20
-57
SStoreController.java
...in/java/share/web/controller/system/SStoreController.java
+17
-50
WebConfig.java
...-front/src/main/java/share/web/core/config/WebConfig.java
+2
-0
generator.yml
share-generator/src/main/resources/generator.yml
+2
-1
pom.xml
share-system/pom.xml
+7
-0
SConsumer.java
...e-system/src/main/java/share/system/domain/SConsumer.java
+3
-3
FrontTokenComponent.java
...main/java/share/system/domain/vo/FrontTokenComponent.java
+2
-2
SRoomVo.java
...-system/src/main/java/share/system/domain/vo/SRoomVo.java
+15
-15
SStoreVo.java
...system/src/main/java/share/system/domain/vo/SStoreVo.java
+77
-0
SRoomMapper.java
...system/src/main/java/share/system/mapper/SRoomMapper.java
+3
-1
SStoreRequest.java
...tem/src/main/java/share/system/request/SStoreRequest.java
+55
-0
ISRoomService.java
...tem/src/main/java/share/system/service/ISRoomService.java
+10
-1
ISStoreService.java
...em/src/main/java/share/system/service/ISStoreService.java
+9
-0
SConsumerService.java
.../src/main/java/share/system/service/SConsumerService.java
+24
-0
SConsumerCenterServiceImpl.java
...share/system/service/impl/SConsumerCenterServiceImpl.java
+3
-3
SConsumerServiceImpl.java
.../java/share/system/service/impl/SConsumerServiceImpl.java
+46
-6
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+25
-1
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+84
-4
SmsServiceImpl.java
...c/main/java/share/system/service/impl/SmsServiceImpl.java
+1
-1
SConsumerMapper.xml
...stem/src/main/resources/mapper/system/SConsumerMapper.xml
+44
-14
No files found.
share-front/src/main/java/share/web/controller/system/SConsumerController.java
View file @
485d61a4
...
@@ -2,19 +2,17 @@ package share.web.controller.system;
...
@@ -2,19 +2,17 @@ package share.web.controller.system;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.R
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
import
share.system.service.SConsumerService
;
import
share.system.service.SConsumerService
;
...
@@ -28,77 +26,32 @@ import share.common.core.page.TableDataInfo;
...
@@ -28,77 +26,32 @@ import share.common.core.page.TableDataInfo;
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/consumer"
)
@RequestMapping
(
"/front/consumer"
)
@Api
(
tags
=
"微信 -- 用户信息"
)
public
class
SConsumerController
extends
BaseController
public
class
SConsumerController
extends
BaseController
{
{
@Autowired
@Autowired
private
SConsumerService
sConsumerService
;
private
SConsumerService
sConsumerService
;
/**
/**
* 查询会员用户列表
* 个人中心-用户信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SConsumer
sConsumer
)
{
startPage
();
List
<
SConsumer
>
list
=
sConsumerService
.
selectSConsumerList
(
sConsumer
);
return
getDataTable
(
list
);
}
/**
* 导出会员用户列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:export')"
)
@Log
(
title
=
"会员用户"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SConsumer
sConsumer
)
{
List
<
SConsumer
>
list
=
sConsumerService
.
selectSConsumerList
(
sConsumer
);
ExcelUtil
<
SConsumer
>
util
=
new
ExcelUtil
<
SConsumer
>(
SConsumer
.
class
);
util
.
exportExcel
(
response
,
list
,
"会员用户数据"
);
}
/**
* 获取会员用户详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
sConsumerService
.
selectSConsumerById
(
id
));
}
/**
* 新增会员用户
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:add')"
)
@ApiOperation
(
value
=
"个人中心-用户信息"
)
@Log
(
title
=
"会员用户"
,
businessType
=
BusinessType
.
INSERT
)
@RequestMapping
(
value
=
"/info"
,
method
=
RequestMethod
.
GET
)
@PostMapping
public
R
<
SConsumer
>
getSConsumerCenter
()
{
public
AjaxResult
add
(
@RequestBody
SConsumer
sConsumer
)
return
R
.
ok
(
sConsumerService
.
getSConsumer
());
{
return
toAjax
(
sConsumerService
.
insertSConsumer
(
sConsumer
));
}
}
/**
/**
* 修改
会员用户
* 修改
个人资料
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:edit')"
)
@ApiOperation
(
value
=
"修改个人资料"
)
@Log
(
title
=
"会员用户"
,
businessType
=
BusinessType
.
UPDATE
)
@RequestMapping
(
value
=
"/edit"
,
method
=
RequestMethod
.
POST
)
@PutMapping
public
R
<
Object
>
personInfo
(
@RequestBody
SConsumer
request
)
{
public
AjaxResult
edit
(
@RequestBody
SConsumer
sConsumer
)
if
(
sConsumerService
.
editSConsumer
(
request
))
{
{
return
R
.
ok
();
return
toAjax
(
sConsumerService
.
updateSConsumer
(
sConsumer
));
}
return
R
.
fail
();
}
}
/**
* 删除会员用户
*/
@PreAuthorize
(
"@ss.hasPermi('system:consumer:remove')"
)
@Log
(
title
=
"会员用户"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sConsumerService
.
deleteSConsumerByIds
(
ids
));
}
}
}
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
485d61a4
package
share
.
web
.
controller
.
system
;
package
share
.
web
.
controller
.
system
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.R
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
...
@@ -29,7 +28,8 @@ import share.common.core.page.TableDataInfo;
...
@@ -29,7 +28,8 @@ import share.common.core.page.TableDataInfo;
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/room"
)
@RequestMapping
(
"/front/room"
)
@Api
(
tags
=
"房间信息"
)
public
class
SRoomController
extends
BaseController
public
class
SRoomController
extends
BaseController
{
{
@Autowired
@Autowired
...
@@ -38,7 +38,6 @@ public class SRoomController extends BaseController
...
@@ -38,7 +38,6 @@ public class SRoomController extends BaseController
/**
/**
* 查询房间列表
* 查询房间列表
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SRoom
sRoom
)
public
TableDataInfo
list
(
SRoom
sRoom
)
{
{
...
@@ -47,59 +46,23 @@ public class SRoomController extends BaseController
...
@@ -47,59 +46,23 @@ public class SRoomController extends BaseController
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
/**
* 导出房间列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:export')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SRoom
sRoom
)
{
List
<
SRoomVo
>
list
=
sRoomService
.
selectSRoomList
(
sRoom
);
ExcelUtil
<
SRoomVo
>
util
=
new
ExcelUtil
<
SRoomVo
>(
SRoomVo
.
class
);
util
.
exportExcel
(
response
,
list
,
"房间数据"
);
}
/**
/**
* 获取房间详细信息
* 获取房间详细信息
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:query')"
)
@ApiOperation
(
value
=
"房间详情"
)
@GetMapping
(
value
=
"/{id}"
)
@RequestMapping
(
value
=
"/info"
,
method
=
RequestMethod
.
GET
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
public
R
<
SRoomVo
>
getInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
{
SRoom
room
=
sRoomService
.
getById
(
id
);
return
success
(
sRoomService
.
selectSRoomById
(
id
));
SRoomVo
vo
=
null
;
if
(
Objects
.
nonNull
(
room
)){
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
room
,
vo
);
}
return
R
.
ok
(
vo
);
}
}
/**
* 新增房间
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:add')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SRoom
sRoom
)
{
return
toAjax
(
sRoomService
.
insertSRoom
(
sRoom
));
}
/**
* 修改房间
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:edit')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SRoom
sRoom
)
{
return
toAjax
(
sRoomService
.
updateSRoom
(
sRoom
));
}
/**
* 删除房间
*/
@PreAuthorize
(
"@ss.hasPermi('system:room:remove')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sRoomService
.
deleteSRoomByIds
(
ids
));
}
}
}
share-front/src/main/java/share/web/controller/system/SStoreController.java
View file @
485d61a4
...
@@ -2,20 +2,21 @@ package share.web.controller.system;
...
@@ -2,20 +2,21 @@ package share.web.controller.system;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.R
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.system.domain.SConsumer
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.request.SStoreRequest
;
import
share.system.service.ISStoreService
;
import
share.system.service.ISStoreService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
...
@@ -28,7 +29,8 @@ import share.system.domain.SStore;
...
@@ -28,7 +29,8 @@ import share.system.domain.SStore;
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/store"
)
@RequestMapping
(
"/front/store"
)
@Api
(
tags
=
"门店信息"
)
public
class
SStoreController
extends
BaseController
public
class
SStoreController
extends
BaseController
{
{
@Autowired
@Autowired
...
@@ -37,7 +39,6 @@ public class SStoreController extends BaseController
...
@@ -37,7 +39,6 @@ public class SStoreController extends BaseController
/**
/**
* 查询门店列表
* 查询门店列表
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SStore
sStore
)
public
TableDataInfo
list
(
SStore
sStore
)
{
{
...
@@ -46,23 +47,10 @@ public class SStoreController extends BaseController
...
@@ -46,23 +47,10 @@ public class SStoreController extends BaseController
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
/**
* 导出门店列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:export')"
)
@Log
(
title
=
"门店"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SStore
sStore
)
{
List
<
SStore
>
list
=
sStoreService
.
selectSStoreList
(
sStore
);
ExcelUtil
<
SStore
>
util
=
new
ExcelUtil
<
SStore
>(
SStore
.
class
);
util
.
exportExcel
(
response
,
list
,
"门店数据"
);
}
/**
/**
* 获取门店详细信息
* 获取门店详细信息
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
{
...
@@ -70,35 +58,14 @@ public class SStoreController extends BaseController
...
@@ -70,35 +58,14 @@ public class SStoreController extends BaseController
}
}
/**
/**
* 新增门店
* 查询门店列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:add')"
)
@Log
(
title
=
"门店"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SStore
sStore
)
{
return
toAjax
(
sStoreService
.
insertSStore
(
sStore
));
}
/**
* 修改门店
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:edit')"
)
@ApiOperation
(
value
=
"按距离排序查询门店列表"
)
@Log
(
title
=
"门店"
,
businessType
=
BusinessType
.
UPDATE
)
@RequestMapping
(
value
=
"/listVo"
,
method
=
RequestMethod
.
POST
)
@PutMapping
public
R
<
List
<
SStoreVo
>>
listByDistance
(
@RequestBody
SStoreRequest
request
)
public
AjaxResult
edit
(
@RequestBody
SStore
sStore
)
{
{
return
toAjax
(
sStoreService
.
updateSStore
(
sStore
));
startPage
();
return
R
.
ok
(
sStoreService
.
listVo
(
request
));
}
}
/**
* 删除门店
*/
@PreAuthorize
(
"@ss.hasPermi('system:store:remove')"
)
@Log
(
title
=
"门店"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sStoreService
.
deleteSStoreByIds
(
ids
));
}
}
}
share-front/src/main/java/share/web/core/config/WebConfig.java
View file @
485d61a4
...
@@ -62,6 +62,8 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -62,6 +62,8 @@ public class WebConfig implements WebMvcConfigurer {
"/webjars/**"
,
"/webjars/**"
,
"/favicon.ico"
,
"/favicon.ico"
,
"/front/wechat/**"
,
"/front/wechat/**"
,
"/front/login/**"
,
"/front/store/**"
,
"**"
"**"
).
addPathPatterns
(
"/**"
);
).
addPathPatterns
(
"/**"
);
}
}
...
...
share-generator/src/main/resources/generator.yml
View file @
485d61a4
...
@@ -5,6 +5,6 @@ gen:
...
@@ -5,6 +5,6 @@ gen:
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName
:
share.system
packageName
:
share.system
# 自动去除表前缀,默认是false
# 自动去除表前缀,默认是false
autoRemovePre
:
fals
e
autoRemovePre
:
tru
e
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix
:
s_
tablePrefix
:
s_
\ No newline at end of file
share-system/pom.xml
View file @
485d61a4
...
@@ -52,6 +52,12 @@
...
@@ -52,6 +52,12 @@
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
4.5.7
</version>
<version>
4.5.7
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.locationtech.spatial4j
</groupId>
<artifactId>
spatial4j
</artifactId>
<version>
0.7
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
share-system/src/main/java/share/system/domain/SConsumer.java
View file @
485d61a4
...
@@ -25,9 +25,9 @@ public class SConsumer
...
@@ -25,9 +25,9 @@ public class SConsumer
@ApiModelProperty
(
value
=
"用户账号"
)
@ApiModelProperty
(
value
=
"用户账号"
)
private
String
account
;
private
String
account
;
/** 微信用户openId */
//
/** 微信用户openId */
@ApiModelProperty
(
value
=
"微信用户openId"
)
//
@ApiModelProperty(value = "微信用户openId")
private
String
openId
;
//
private String openId;
/** 用户昵称 */
/** 用户昵称 */
@ApiModelProperty
(
value
=
"用户昵称"
)
@ApiModelProperty
(
value
=
"用户昵称"
)
...
...
share-system/src/main/java/share/system/domain/vo/FrontTokenComponent.java
View file @
485d61a4
...
@@ -192,7 +192,7 @@ public class FrontTokenComponent {
...
@@ -192,7 +192,7 @@ public class FrontTokenComponent {
*/
*/
public
void
logout
(
HttpServletRequest
request
)
{
public
void
logout
(
HttpServletRequest
request
)
{
String
token
=
getToken
(
request
);
String
token
=
getToken
(
request
);
Integer
userId
=
getSConsumerId
();
Long
userId
=
getSConsumerId
();
delLoginSConsumer
(
token
);
delLoginSConsumer
(
token
);
}
}
...
@@ -200,7 +200,7 @@ public class FrontTokenComponent {
...
@@ -200,7 +200,7 @@ public class FrontTokenComponent {
/**
/**
* 获取当前登录用户id
* 获取当前登录用户id
*/
*/
public
Integer
getSConsumerId
()
{
public
Long
getSConsumerId
()
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
Objects
.
requireNonNull
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
Objects
.
requireNonNull
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
String
token
=
getToken
(
request
);
String
token
=
getToken
(
request
);
if
(
StrUtil
.
isEmpty
(
token
))
{
if
(
StrUtil
.
isEmpty
(
token
))
{
...
...
share-system/src/main/java/share/system/domain/vo/SRoomVo.java
View file @
485d61a4
package
share
.
system
.
domain
.
vo
;
package
share
.
system
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
share.common.core.domain.BaseEntity
;
/**
/**
...
@@ -23,59 +23,59 @@ public class SRoomVo extends BaseEntity
...
@@ -23,59 +23,59 @@ public class SRoomVo extends BaseEntity
private
Long
id
;
private
Long
id
;
/** 门店ID */
/** 门店ID */
@
Excel
(
nam
e
=
"门店ID"
)
@
ApiModelProperty
(
valu
e
=
"门店ID"
)
private
Long
storeId
;
private
Long
storeId
;
/** 门店名称 */
/** 门店名称 */
@
Excel
(
nam
e
=
"门店名称"
)
@
ApiModelProperty
(
valu
e
=
"门店名称"
)
private
String
storeName
;
private
String
storeName
;
/** 房间名称 */
/** 房间名称 */
@
Excel
(
nam
e
=
"房间名称"
)
@
ApiModelProperty
(
valu
e
=
"房间名称"
)
private
String
name
;
private
String
name
;
/** 房间类型(中、大、豪华包) */
/** 房间类型(中、大、豪华包) */
@
Excel
(
nam
e
=
"房间类型(中、大、豪华包)"
)
@
ApiModelProperty
(
valu
e
=
"房间类型(中、大、豪华包)"
)
private
String
roomType
;
private
String
roomType
;
/** 房间主图 */
/** 房间主图 */
@
Excel
(
nam
e
=
"房间主图"
)
@
ApiModelProperty
(
valu
e
=
"房间主图"
)
private
String
images
;
private
String
images
;
/** 房间设施(空调、外窗、沙发、茶几、、、) */
/** 房间设施(空调、外窗、沙发、茶几、、、) */
@
Excel
(
nam
e
=
"房间设施(空调、外窗、沙发、茶几、、、)"
)
@
ApiModelProperty
(
valu
e
=
"房间设施(空调、外窗、沙发、茶几、、、)"
)
private
String
facilities
;
private
String
facilities
;
/** 房间详情介绍 */
/** 房间详情介绍 */
@
Excel
(
nam
e
=
"房间详情介绍"
)
@
ApiModelProperty
(
valu
e
=
"房间详情介绍"
)
private
String
info
;
private
String
info
;
/** 房间状态(空闲、保洁中、使用中、维护中) */
/** 房间状态(空闲、保洁中、使用中、维护中) */
@
Excel
(
nam
e
=
"房间状态(空闲、保洁中、使用中、维护中)"
)
@
ApiModelProperty
(
valu
e
=
"房间状态(空闲、保洁中、使用中、维护中)"
)
private
String
status
;
private
String
status
;
/** 房间单价(默认单位:元/小时) */
/** 房间单价(默认单位:元/小时) */
@
Excel
(
nam
e
=
"房间单价(默认单位:元/小时)"
)
@
ApiModelProperty
(
valu
e
=
"房间单价(默认单位:元/小时)"
)
private
Integer
price
;
private
Integer
price
;
/** 门锁编码(接入第三方使用) */
/** 门锁编码(接入第三方使用) */
@
Excel
(
nam
e
=
"门锁编码(接入第三方使用)"
)
@
ApiModelProperty
(
valu
e
=
"门锁编码(接入第三方使用)"
)
private
String
doorLockCode
;
private
String
doorLockCode
;
/** 电控控制(接入第三方使用) */
/** 电控控制(接入第三方使用) */
@
Excel
(
nam
e
=
"电控控制(接入第三方使用)"
)
@
ApiModelProperty
(
valu
e
=
"电控控制(接入第三方使用)"
)
private
String
electricControlCode
;
private
String
electricControlCode
;
/** 门禁密码(多人可设置多个) */
/** 门禁密码(多人可设置多个) */
@
Excel
(
nam
e
=
"门禁密码(多人可设置多个)"
)
@
ApiModelProperty
(
valu
e
=
"门禁密码(多人可设置多个)"
)
private
String
password
;
private
String
password
;
/** 其他可能硬件接入参数(备用1) */
/** 其他可能硬件接入参数(备用1) */
@
Excel
(
nam
e
=
"其他可能硬件接入参数(备用1)"
)
@
ApiModelProperty
(
valu
e
=
"其他可能硬件接入参数(备用1)"
)
private
String
params1
;
private
String
params1
;
/** 其他可能硬件接入参数(备用2) */
/** 其他可能硬件接入参数(备用2) */
@
Excel
(
nam
e
=
"其他可能硬件接入参数(备用2)"
)
@
ApiModelProperty
(
valu
e
=
"其他可能硬件接入参数(备用2)"
)
private
String
params2
;
private
String
params2
;
@Override
@Override
...
...
share-system/src/main/java/share/system/domain/vo/SStoreVo.java
0 → 100644
View file @
485d61a4
package
share
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
share.common.core.domain.BaseEntity
;
import
java.util.List
;
/**
* 门店对象 s_store
*
* @author ruoyi
* @date 2023-10-11
*/
@Data
public
class
SStoreVo
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 门店ID */
@ApiModelProperty
(
value
=
"门店ID"
)
private
Long
id
;
/** 门店名称 */
@ApiModelProperty
(
value
=
"门店名称"
)
private
String
name
;
/** 门店主图 */
@ApiModelProperty
(
value
=
"门店主图"
)
private
String
images
;
/** 门店地址 */
@ApiModelProperty
(
value
=
"门店地址"
)
private
String
address
;
/** 经度 */
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
/** 纬度 */
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
/** 联系人 */
@ApiModelProperty
(
value
=
"联系人"
)
private
String
manager
;
/** 联系人电话 */
@ApiModelProperty
(
value
=
"联系人电话"
)
private
String
phone
;
/** 门店详情 */
@ApiModelProperty
(
value
=
"门店详情"
)
private
String
info
;
/** 营业状态 0:停业 1:正常营业 */
@ApiModelProperty
(
value
=
"营业状态 0:停业 1:正常营业"
)
private
String
status
;
/** 开始营业时间 */
@ApiModelProperty
(
value
=
"开始营业时间"
)
private
String
openStartTime
;
/** 结束营业时间 */
@ApiModelProperty
(
value
=
"结束营业时间"
)
private
String
openEndTime
;
/** 门店类型 1:标准店 2: 形象店 3:旗舰店 */
@ApiModelProperty
(
value
=
"门店类型 1:标准店 2: 形象店 3:旗舰店"
)
private
String
storeType
;
@ApiModelProperty
(
value
=
"距离(KM)"
)
private
String
distance
;
@ApiModelProperty
(
value
=
"房间列表"
)
private
List
<
SRoomVo
>
roomVoList
;
}
share-system/src/main/java/share/system/mapper/SRoomMapper.java
View file @
485d61a4
package
share
.
system
.
mapper
;
package
share
.
system
.
mapper
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
/**
/**
...
@@ -9,7 +11,7 @@ import share.system.domain.SRoom;
...
@@ -9,7 +11,7 @@ import share.system.domain.SRoom;
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
public
interface
SRoomMapper
public
interface
SRoomMapper
extends
BaseMapper
<
SRoom
>
{
{
/**
/**
* 查询房间
* 查询房间
...
...
share-system/src/main/java/share/system/request/SStoreRequest.java
0 → 100644
View file @
485d61a4
package
share
.
system
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
/**
* 门店对象 s_store
*
* @author ruoyi
* @date 2023-10-11
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"SStoreRequest对象"
,
description
=
"门店查询请求对象"
)
public
class
SStoreRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 门店ID */
@ApiModelProperty
(
value
=
"门店ID"
)
private
Long
id
;
/** 门店名称 */
@ApiModelProperty
(
value
=
"门店名称"
)
private
String
name
;
/** 门店地址 */
@ApiModelProperty
(
value
=
"门店地址"
)
private
String
address
;
/** 经度 */
@ApiModelProperty
(
value
=
"经度"
)
private
String
nowLongitude
;
/** 纬度 */
@ApiModelProperty
(
value
=
"纬度"
)
private
String
nowLatitude
;
/** 营业状态 0:停业 1:正常营业 */
@ApiModelProperty
(
value
=
"营业状态 0:停业 1:正常营业"
)
private
String
status
;
/** 门店类型 1:标准店 2: 形象店 3:旗舰店 */
@ApiModelProperty
(
value
=
"门店类型 1:标准店 2: 形象店 3:旗舰店"
)
private
String
storeType
;
}
share-system/src/main/java/share/system/service/ISRoomService.java
View file @
485d61a4
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
...
@@ -10,7 +12,7 @@ import share.system.domain.vo.SRoomVo;
...
@@ -10,7 +12,7 @@ import share.system.domain.vo.SRoomVo;
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
public
interface
ISRoomService
public
interface
ISRoomService
extends
IService
<
SRoom
>
{
{
/**
/**
* 查询房间
* 查询房间
...
@@ -59,4 +61,11 @@ public interface ISRoomService
...
@@ -59,4 +61,11 @@ public interface ISRoomService
* @return 结果
* @return 结果
*/
*/
public
int
deleteSRoomById
(
Long
id
);
public
int
deleteSRoomById
(
Long
id
);
/**
* 通过门店ID列表查询所有房间
* @param storeIds
* @return
*/
List
<
SRoomVo
>
listByStoreIds
(
List
<
Long
>
storeIds
);
}
}
share-system/src/main/java/share/system/service/ISStoreService.java
View file @
485d61a4
...
@@ -5,6 +5,8 @@ import java.util.Map;
...
@@ -5,6 +5,8 @@ import java.util.Map;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.request.SStoreRequest
;
/**
/**
* 门店Service接口
* 门店Service接口
...
@@ -77,4 +79,11 @@ public interface ISStoreService extends IService<SStore>
...
@@ -77,4 +79,11 @@ public interface ISStoreService extends IService<SStore>
* @return 门店集合
* @return 门店集合
*/
*/
public
List
<
Map
>
optionList
(
List
<
Long
>
ids
);
public
List
<
Map
>
optionList
(
List
<
Long
>
ids
);
/**
* 查询门店列表
* @param request
* @return
*/
List
<
SStoreVo
>
listVo
(
SStoreRequest
request
);
}
}
share-system/src/main/java/share/system/service/SConsumerService.java
View file @
485d61a4
...
@@ -84,4 +84,28 @@ public interface SConsumerService extends IService<SConsumer>
...
@@ -84,4 +84,28 @@ public interface SConsumerService extends IService<SConsumer>
SConsumer
registerByThird
(
RegisterThirdSConsumerRequest
thirdUserRequest
);
SConsumer
registerByThird
(
RegisterThirdSConsumerRequest
thirdUserRequest
);
/**
* 获取当前登陆用户个人信息(空则返回异常)
* @return
*/
SConsumer
getSConsumer
();
/**
* 获取当前登陆用户个人信息
* @return
*/
SConsumer
getInfo
();
/**
* 获取当前登陆用户ID
* @return
*/
Long
getUserId
();
/**
* 修改个人资料
* @param request
* @return
*/
boolean
editSConsumer
(
SConsumer
request
);
}
}
share-system/src/main/java/share/system/service/impl/SConsumerCenterServiceImpl.java
View file @
485d61a4
...
@@ -110,11 +110,11 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
...
@@ -110,11 +110,11 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
return
loginResponse
;
return
loginResponse
;
}
}
if
(
StrUtil
.
isBlank
(
request
.
getNickName
())
&&
StrUtil
.
isBlank
(
request
.
getAvatar
()))
{
/*
if (StrUtil.isBlank(request.getNickName()) && StrUtil.isBlank(request.getAvatar())) {
// 返回后,前端去走注册起始页
// 返回后,前端去走注册起始页
loginResponse.setType("start");
loginResponse.setType("start");
return loginResponse;
return loginResponse;
}
}
*/
request
.
setOpenId
(
response
.
getOpenId
());
request
.
setOpenId
(
response
.
getOpenId
());
String
key
=
SecureUtil
.
md5
(
response
.
getOpenId
());
String
key
=
SecureUtil
.
md5
(
response
.
getOpenId
());
redisUtil
.
set
(
key
,
JSONObject
.
toJSONString
(
request
),
(
long
)
(
60
*
2
),
TimeUnit
.
MINUTES
);
redisUtil
.
set
(
key
,
JSONObject
.
toJSONString
(
request
),
(
long
)
(
60
*
2
),
TimeUnit
.
MINUTES
);
...
@@ -133,7 +133,7 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
...
@@ -133,7 +133,7 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
@DSTransactional
@DSTransactional
@Override
@Override
public
LoginResponse
registerBindingPhone
(
WxBindingPhoneRequest
request
)
{
public
LoginResponse
registerBindingPhone
(
WxBindingPhoneRequest
request
)
{
check
Binding
Phone
(
request
);
check
Login
Phone
(
request
);
// 进入创建用户绑定手机号流程
// 进入创建用户绑定手机号流程
Object
o
=
redisUtil
.
get
(
request
.
getKey
());
Object
o
=
redisUtil
.
get
(
request
.
getKey
());
if
(
ObjectUtil
.
isNull
(
o
))
{
if
(
ObjectUtil
.
isNull
(
o
))
{
...
...
share-system/src/main/java/share/system/service/impl/SConsumerServiceImpl.java
View file @
485d61a4
...
@@ -4,6 +4,7 @@ import java.util.HashMap;
...
@@ -4,6 +4,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.codec.digest.DigestUtils
;
...
@@ -11,8 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -11,8 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.Constants
;
import
share.common.constant.Constants
;
import
share.common.constant.SmsConstants
;
import
share.common.constant.SmsConstants
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.DateUtil
;
import
share.common.utils.DateUtil
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.SConsumerMapper
;
import
share.system.mapper.SConsumerMapper
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
import
share.system.request.RegisterThirdSConsumerRequest
;
import
share.system.request.RegisterThirdSConsumerRequest
;
...
@@ -30,6 +33,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
...
@@ -30,6 +33,9 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Autowired
@Autowired
private
SConsumerMapper
sConsumerMapper
;
private
SConsumerMapper
sConsumerMapper
;
@Autowired
private
FrontTokenComponent
tokenComponet
;
/**
/**
* 查询会员用户
* 查询会员用户
*
*
...
@@ -134,12 +140,46 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
...
@@ -134,12 +140,46 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
public
SConsumer
registerByThird
(
RegisterThirdSConsumerRequest
thirdSConsumerRequest
)
{
public
SConsumer
registerByThird
(
RegisterThirdSConsumerRequest
thirdSConsumerRequest
)
{
SConsumer
user
=
new
SConsumer
();
SConsumer
user
=
new
SConsumer
();
user
.
setAccount
(
DigestUtils
.
md5Hex
(
BaseUtil
.
getUuid
()
+
DateUtil
.
getNowTime
()));
user
.
setAccount
(
DigestUtils
.
md5Hex
(
BaseUtil
.
getUuid
()
+
DateUtil
.
getNowTime
()));
user
.
setNickName
(
thirdSConsumerRequest
.
getNickName
());
//
user.setNickName(thirdSConsumerRequest.getNickName());
String
avatar
=
thirdSConsumerRequest
.
getAvatar
();
//
String avatar = thirdSConsumerRequest.getAvatar();
//
user
.
setAvatar
(
avatar
);
//
user.setAvatar(avatar);
user
.
setSex
(
Integer
.
parseInt
(
thirdSConsumerRequest
.
getSex
()));
//
user.setSex(Integer.parseInt(thirdSConsumerRequest.getSex()));
user
.
setAddres
(
thirdSConsumerRequest
.
getCountry
()
+
","
+
thirdSConsumerRequest
.
getProvince
()
+
","
+
thirdSConsumerRequest
.
getCity
());
//
user.setAddres(thirdSConsumerRequest.getCountry() + "," + thirdSConsumerRequest.getProvince() + "," + thirdSConsumerRequest.getCity());
return
user
;
return
user
;
}
}
@Override
public
SConsumer
getSConsumer
()
{
SConsumer
currentUser
=
getInfo
();
if
(
ObjectUtil
.
isNull
(
currentUser
))
{
throw
new
BaseException
(
"您的登录已过期,请先登录"
);
}
return
currentUser
;
}
/**
* 获取个人资料
*/
@Override
public
SConsumer
getInfo
()
{
if
(
getUserId
()
==
0
)
{
return
null
;
}
return
this
.
selectSConsumerById
(
getUserId
());
}
@Override
public
Long
getUserId
()
{
Long
id
=
tokenComponet
.
getSConsumerId
();
if
(
null
==
id
)
{
return
0L
;
}
return
id
;
}
@Override
public
boolean
editSConsumer
(
SConsumer
request
)
{
return
updateById
(
request
);
}
}
}
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
485d61a4
...
@@ -6,6 +6,9 @@ import java.util.Map;
...
@@ -6,6 +6,9 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
...
@@ -25,7 +28,7 @@ import share.system.service.ISStoreService;
...
@@ -25,7 +28,7 @@ import share.system.service.ISStoreService;
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@Service
@Service
public
class
SRoomServiceImpl
implements
ISRoomService
public
class
SRoomServiceImpl
extends
ServiceImpl
<
SRoomMapper
,
SRoom
>
implements
ISRoomService
{
{
@Autowired
@Autowired
private
SRoomMapper
sRoomMapper
;
private
SRoomMapper
sRoomMapper
;
...
@@ -130,4 +133,25 @@ public class SRoomServiceImpl implements ISRoomService
...
@@ -130,4 +133,25 @@ public class SRoomServiceImpl implements ISRoomService
{
{
return
sRoomMapper
.
deleteSRoomById
(
id
);
return
sRoomMapper
.
deleteSRoomById
(
id
);
}
}
@Override
public
List
<
SRoomVo
>
listByStoreIds
(
List
<
Long
>
storeIds
)
{
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SRoom:
:
getStoreId
,
storeIds
);
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectList
(
queryWrapper
);
return
convertDoListToVoList
(
roomList
);
}
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
){
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
)){
roomList
.
stream
().
forEach
(
o
->
{
SRoomVo
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
voList
.
add
(
vo
);
});
}
return
voList
;
}
}
}
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
485d61a4
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.bouncycastle.util.Store
;
import
org.locationtech.spatial4j.context.SpatialContext
;
import
org.locationtech.spatial4j.distance.DistanceUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SStoreVo
;
import
share.system.mapper.SStoreMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.domain.SStore
;
import
share.system.domain.SStore
;
import
share.system.request.SStoreRequest
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
import
share.system.service.ISStoreService
;
/**
/**
...
@@ -27,6 +35,9 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -27,6 +35,9 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
@Autowired
@Autowired
private
SStoreMapper
sStoreMapper
;
private
SStoreMapper
sStoreMapper
;
@Autowired
private
ISRoomService
sRoomService
;
/**
/**
* 查询门店
* 查询门店
*
*
...
@@ -113,6 +124,75 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -113,6 +124,75 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return
convertOptionList
(
storeList
);
return
convertOptionList
(
storeList
);
}
}
@Override
public
List
<
SStoreVo
>
listVo
(
SStoreRequest
request
)
{
if
(
StringUtils
.
isBlank
(
request
.
getStatus
())){
//默认营业状态
request
.
setStatus
(
YesNoEnum
.
yes
.
getIndex
().
toString
());
}
listVoCheck
(
request
);
Double
nowLng
=
Double
.
parseDouble
(
request
.
getNowLongitude
());
Double
nowLat
=
Double
.
parseDouble
(
request
.
getNowLatitude
());
SStore
store
=
new
SStore
();
store
.
setStatus
(
request
.
getStatus
());
List
<
SStore
>
storeList
=
sStoreMapper
.
selectSStoreList
(
store
);
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
)){
SpatialContext
geo
=
SpatialContext
.
GEO
;
storeList
.
stream
().
forEach
(
o
->
{
double
distance
=
geo
.
calcDistance
(
geo
.
makePoint
(
nowLng
,
nowLat
)
,
geo
.
makePoint
(
Double
.
parseDouble
(
o
.
getLongitude
()),
Double
.
parseDouble
(
o
.
getLatitude
())))
*
DistanceUtils
.
DEG_TO_KM
;
SStoreVo
vo
=
new
SStoreVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
vo
.
setDistance
(
distance
+
""
);
voList
.
add
(
vo
);
});
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
storeVo
->
Double
.
parseDouble
(
storeVo
.
getDistance
())));
}
handleSStoreVoList
(
voList
);
return
voList
;
}
private
void
listVoCheck
(
SStoreRequest
request
)
throws
BaseException
{
if
(
StringUtils
.
isNotBlank
(
request
.
getNowLongitude
())||
StringUtils
.
isNotBlank
(
request
.
getNowLatitude
()))
{
try
{
Double
.
parseDouble
(
request
.
getNowLongitude
());
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
"请求参数当前经度异常!"
);
}
try
{
Double
.
parseDouble
(
request
.
getNowLatitude
());
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
"请求参数当前纬度异常!"
);
}
}
try
{
if
(
StringUtils
.
isNotBlank
(
request
.
getStatus
())
&&
Integer
.
compare
(
Integer
.
parseInt
(
request
.
getStatus
()),
0
)
!=
0
&&
Integer
.
compare
(
Integer
.
parseInt
(
request
.
getStatus
()),
1
)
!=
0
)
{
throw
new
BaseException
(
"请求参数门店状态异常!"
);
}
}
catch
(
Exception
e
){
throw
new
BaseException
(
"请求参数门店状态异常!"
);
}
}
public
void
handleSStoreVoList
(
List
<
SStoreVo
>
voList
){
if
(
CollectionUtils
.
isNotEmpty
(
voList
))
{
List
<
Long
>
storeIds
=
voList
.
stream
().
map
(
SStoreVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SRoomVo
>
roomVoList
=
sRoomService
.
listByStoreIds
(
storeIds
);
voList
.
stream
().
forEach
(
storeVo
->
{
storeVo
.
setRoomVoList
(
roomVoList
.
stream
().
filter
(
roomVo
->
{
if
(
Long
.
compare
(
roomVo
.
getStoreId
(),
storeVo
.
getId
())==
0
){
return
true
;
}
return
false
;
}).
collect
(
Collectors
.
toList
()));
});
}
}
private
List
<
Map
>
convertOptionList
(
List
<
SStore
>
storeList
){
private
List
<
Map
>
convertOptionList
(
List
<
SStore
>
storeList
){
List
<
Map
>
result
=
new
ArrayList
<>();
List
<
Map
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
...
...
share-system/src/main/java/share/system/service/impl/SmsServiceImpl.java
View file @
485d61a4
...
@@ -80,7 +80,7 @@ public class SmsServiceImpl implements SmsService {
...
@@ -80,7 +80,7 @@ public class SmsServiceImpl implements SmsService {
@Override
@Override
public
boolean
sendSmsCode
(
String
phone
)
{
public
boolean
sendSmsCode
(
String
phone
)
{
redisUtil
.
set
(
sConsumerService
.
getValidateCodeRedisKey
(
phone
),
"1234"
,
Long
.
valueOf
(
Constants
.
CONFIG_KEY_SMS_CODE_EXPIRE
),
TimeUnit
.
MINUTES
);
redisUtil
.
set
(
sConsumerService
.
getValidateCodeRedisKey
(
phone
),
"1234
56
"
,
Long
.
valueOf
(
Constants
.
CONFIG_KEY_SMS_CODE_EXPIRE
),
TimeUnit
.
MINUTES
);
return
true
;
//TODO 手机验证吗待对接短信平台 sendSms(phone, SmsConstants.SMS_CONFIG_TYPE_VERIFICATION_CODE);
return
true
;
//TODO 手机验证吗待对接短信平台 sendSms(phone, SmsConstants.SMS_CONFIG_TYPE_VERIFICATION_CODE);
}
}
...
...
share-system/src/main/resources/mapper/system/SConsumerMapper.xml
View file @
485d61a4
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"share.system.mapper.SConsumerMapper"
>
<mapper
namespace=
"share.system.mapper.SConsumerMapper"
>
<resultMap
type=
"SConsumer"
id=
"SConsumerResult"
>
<resultMap
type=
"SConsumer"
id=
"SConsumerResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"
openId"
column=
"open_id
"
/>
<result
property=
"
account"
column=
"account
"
/>
<result
property=
"nickName"
column=
"nick_name"
/>
<result
property=
"nickName"
column=
"nick_name"
/>
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"phone"
column=
"phone"
/>
<result
property=
"level"
column=
"level"
/>
<result
property=
"level"
column=
"level"
/>
<result
property=
"roleType"
column=
"role_type"
/>
<result
property=
"roleType"
column=
"role_type"
/>
<result
property=
"sex"
column=
"sex"
/>
<result
property=
"sex"
column=
"sex"
/>
<result
property=
"addres"
column=
"addres"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"freeAmount"
column=
"free_amount"
/>
<result
property=
"freeAmount"
column=
"free_amount"
/>
<result
property=
"totalTimes"
column=
"total_times"
/>
<result
property=
"totalTimes"
column=
"total_times"
/>
<result
property=
"duration"
column=
"duration"
/>
<result
property=
"duration"
column=
"duration"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"pwd"
column=
"pwd"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"lastLoginTime"
column=
"last_login_time"
/>
</resultMap>
</resultMap>
<sql
id=
"selectSConsumerVo"
>
<sql
id=
"selectSConsumerVo"
>
select id,
open_id, nick_name, phone, level, role_type, sex, amount, free_amount, total_times, duration
from s_consumer
select id,
account, nick_name, avatar, phone, level, role_type, sex, addres, amount, free_amount, total_times, duration, status, pwd, create_time, last_login_time
from s_consumer
</sql>
</sql>
<select
id=
"selectSConsumerList"
parameterType=
"SConsumer"
resultMap=
"SConsumerResult"
>
<select
id=
"selectSConsumerList"
parameterType=
"SConsumer"
resultMap=
"SConsumerResult"
>
<include
refid=
"selectSConsumerVo"
/>
<include
refid=
"selectSConsumerVo"
/>
<where>
<where>
<if
test=
"account != null and account != ''"
>
and account = #{account}
</if>
<if
test=
"nickName != null and nickName != ''"
>
and nick_name like concat('%', #{nickName}, '%')
</if>
<if
test=
"nickName != null and nickName != ''"
>
and nick_name like concat('%', #{nickName}, '%')
</if>
<if
test=
"avatar != null and avatar != ''"
>
and avatar = #{avatar}
</if>
<if
test=
"phone != null and phone != ''"
>
and phone = #{phone}
</if>
<if
test=
"phone != null and phone != ''"
>
and phone = #{phone}
</if>
<if
test=
"level != null "
>
and level = #{level}
</if>
<if
test=
"level != null "
>
and level = #{level}
</if>
<if
test=
"roleType != null "
>
and role_type = #{roleType}
</if>
<if
test=
"roleType != null "
>
and role_type = #{roleType}
</if>
<if
test=
"sex != null "
>
and sex = #{sex}
</if>
<if
test=
"sex != null "
>
and sex = #{sex}
</if>
<if
test=
"addres != null and addres != ''"
>
and addres = #{addres}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"freeAmount != null "
>
and free_amount = #{freeAmount}
</if>
<if
test=
"freeAmount != null "
>
and free_amount = #{freeAmount}
</if>
<if
test=
"totalTimes != null "
>
and total_times = #{totalTimes}
</if>
<if
test=
"totalTimes != null "
>
and total_times = #{totalTimes}
</if>
<if
test=
"duration != null "
>
and duration = #{duration}
</if>
<if
test=
"duration != null "
>
and duration = #{duration}
</if>
<if
test=
"status != null "
>
and status = #{status}
</if>
<if
test=
"pwd != null and pwd != ''"
>
and pwd = #{pwd}
</if>
<if
test=
"lastLoginTime != null "
>
and last_login_time = #{lastLoginTime}
</if>
</where>
</where>
</select>
</select>
<select
id=
"selectSConsumerById"
parameterType=
"Long"
resultMap=
"SConsumerResult"
>
<select
id=
"selectSConsumerById"
parameterType=
"Long"
resultMap=
"SConsumerResult"
>
<include
refid=
"selectSConsumerVo"
/>
<include
refid=
"selectSConsumerVo"
/>
where id = #{id}
where id = #{id}
</select>
</select>
<insert
id=
"insertSConsumer"
parameterType=
"SConsumer"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertSConsumer"
parameterType=
"SConsumer"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_consumer
insert into s_consumer
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"
openId != null and openId != ''"
>
open_id
,
</if>
<if
test=
"
account != null and account != ''"
>
account
,
</if>
<if
test=
"nickName != null and nickName != ''"
>
nick_name,
</if>
<if
test=
"nickName != null and nickName != ''"
>
nick_name,
</if>
<if
test=
"avatar != null"
>
avatar,
</if>
<if
test=
"phone != null and phone != ''"
>
phone,
</if>
<if
test=
"phone != null and phone != ''"
>
phone,
</if>
<if
test=
"level != null"
>
level,
</if>
<if
test=
"level != null"
>
level,
</if>
<if
test=
"roleType != null"
>
role_type,
</if>
<if
test=
"roleType != null"
>
role_type,
</if>
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"addres != null"
>
addres,
</if>
<if
test=
"amount != null"
>
amount,
</if>
<if
test=
"amount != null"
>
amount,
</if>
<if
test=
"freeAmount != null"
>
free_amount,
</if>
<if
test=
"freeAmount != null"
>
free_amount,
</if>
<if
test=
"totalTimes != null"
>
total_times,
</if>
<if
test=
"totalTimes != null"
>
total_times,
</if>
<if
test=
"duration != null"
>
duration,
</if>
<if
test=
"duration != null"
>
duration,
</if>
</trim>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"pwd != null and pwd != ''"
>
pwd,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"lastLoginTime != null"
>
last_login_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"
openId != null and openId != ''"
>
#{openId
},
</if>
<if
test=
"
account != null and account != ''"
>
#{account
},
</if>
<if
test=
"nickName != null and nickName != ''"
>
#{nickName},
</if>
<if
test=
"nickName != null and nickName != ''"
>
#{nickName},
</if>
<if
test=
"avatar != null"
>
#{avatar},
</if>
<if
test=
"phone != null and phone != ''"
>
#{phone},
</if>
<if
test=
"phone != null and phone != ''"
>
#{phone},
</if>
<if
test=
"level != null"
>
#{level},
</if>
<if
test=
"level != null"
>
#{level},
</if>
<if
test=
"roleType != null"
>
#{roleType},
</if>
<if
test=
"roleType != null"
>
#{roleType},
</if>
<if
test=
"sex != null"
>
#{sex},
</if>
<if
test=
"sex != null"
>
#{sex},
</if>
<if
test=
"addres != null"
>
#{addres},
</if>
<if
test=
"amount != null"
>
#{amount},
</if>
<if
test=
"amount != null"
>
#{amount},
</if>
<if
test=
"freeAmount != null"
>
#{freeAmount},
</if>
<if
test=
"freeAmount != null"
>
#{freeAmount},
</if>
<if
test=
"totalTimes != null"
>
#{totalTimes},
</if>
<if
test=
"totalTimes != null"
>
#{totalTimes},
</if>
<if
test=
"duration != null"
>
#{duration},
</if>
<if
test=
"duration != null"
>
#{duration},
</if>
</trim>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"pwd != null and pwd != ''"
>
#{pwd},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"lastLoginTime != null"
>
#{lastLoginTime},
</if>
</trim>
</insert>
</insert>
<update
id=
"updateSConsumer"
parameterType=
"SConsumer"
>
<update
id=
"updateSConsumer"
parameterType=
"SConsumer"
>
update s_consumer
update s_consumer
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"
openId != null and openId != ''"
>
open_id = #{openId
},
</if>
<if
test=
"
account != null and account != ''"
>
account = #{account
},
</if>
<if
test=
"nickName != null and nickName != ''"
>
nick_name = #{nickName},
</if>
<if
test=
"nickName != null and nickName != ''"
>
nick_name = #{nickName},
</if>
<if
test=
"avatar != null"
>
avatar = #{avatar},
</if>
<if
test=
"phone != null and phone != ''"
>
phone = #{phone},
</if>
<if
test=
"phone != null and phone != ''"
>
phone = #{phone},
</if>
<if
test=
"level != null"
>
level = #{level},
</if>
<if
test=
"level != null"
>
level = #{level},
</if>
<if
test=
"roleType != null"
>
role_type = #{roleType},
</if>
<if
test=
"roleType != null"
>
role_type = #{roleType},
</if>
<if
test=
"sex != null"
>
sex = #{sex},
</if>
<if
test=
"sex != null"
>
sex = #{sex},
</if>
<if
test=
"addres != null"
>
addres = #{addres},
</if>
<if
test=
"amount != null"
>
amount = #{amount},
</if>
<if
test=
"amount != null"
>
amount = #{amount},
</if>
<if
test=
"freeAmount != null"
>
free_amount = #{freeAmount},
</if>
<if
test=
"freeAmount != null"
>
free_amount = #{freeAmount},
</if>
<if
test=
"totalTimes != null"
>
total_times = #{totalTimes},
</if>
<if
test=
"totalTimes != null"
>
total_times = #{totalTimes},
</if>
<if
test=
"duration != null"
>
duration = #{duration},
</if>
<if
test=
"duration != null"
>
duration = #{duration},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"pwd != null and pwd != ''"
>
pwd = #{pwd},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"lastLoginTime != null"
>
last_login_time = #{lastLoginTime},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
...
@@ -92,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -92,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
</delete>
<delete
id=
"deleteSConsumerByIds"
parameterType=
"String"
>
<delete
id=
"deleteSConsumerByIds"
parameterType=
"String"
>
delete from s_consumer where id in
delete from s_consumer where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
#{id}
</foreach>
</foreach>
...
...
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