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
3a3f4a03
Commit
3a3f4a03
authored
Jun 22, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://10.5.52.3/youjj/cloud-platform
into base-modify
parents
74eeec93
82ea34b7
Changes
59
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
59 changed files
with
2673 additions
and
165 deletions
+2673
-165
bootstrap.yml
ace-auth/ace-auth-server/src/main/resources/bootstrap.yml
+1
-1
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+1
-0
AppUserDTO.java
...m/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
+1
-0
pom.xml
ace-modules/ace-admin/pom.xml
+5
-0
AppUserCollectController.java
...wxiaoqi/security/admin/rest/AppUserCollectController.java
+0
-1
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+2
-1
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+28
-8
bootstrap.yml
ace-modules/ace-admin/src/main/resources/bootstrap.yml
+1
-1
pom.xml
pom.xml
+1
-0
pom.xml
xx-activity/pom.xml
+20
-0
pom.xml
xx-activity/xx-activity-api/pom.xml
+28
-0
ActivityFeign.java
.../java/com/xxfc/platform/activity/Feign/ActivityFeign.java
+23
-0
CouponUsed.java
.../java/com/xxfc/platform/activity/constant/CouponUsed.java
+39
-0
Coupon.java
...c/main/java/com/xxfc/platform/activity/entity/Coupon.java
+238
-0
UserCoupon.java
...in/java/com/xxfc/platform/activity/entity/UserCoupon.java
+90
-0
pom.xml
xx-activity/xx-activity-server/pom.xml
+65
-0
ActivityApplication.java
.../java/com/xxfc/platform/activity/ActivityApplication.java
+35
-0
CouponBiz.java
...c/main/java/com/xxfc/platform/activity/biz/CouponBiz.java
+34
-0
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+64
-0
CouponMapper.java
.../java/com/xxfc/platform/activity/mapper/CouponMapper.java
+15
-0
UserCouponMapper.java
...a/com/xxfc/platform/activity/mapper/UserCouponMapper.java
+15
-0
CouponController.java
...ava/com/xxfc/platform/activity/rest/CouponController.java
+13
-0
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+24
-0
bootstrap.yml
...ivity/xx-activity-server/src/main/resources/bootstrap.yml
+35
-0
generatorConfig.xml
...ity-server/src/main/resources/builder/generatorConfig.xml
+43
-0
CouponMapper.xml
...ctivity-server/src/main/resources/mapper/CouponMapper.xml
+40
-0
UserCouponMapper.xml
...ity-server/src/main/resources/mapper/UserCouponMapper.xml
+19
-0
CampsiteTagDTO.java
...n/java/com/xxfc/platform/campsite/dto/CampsiteTagDTO.java
+2
-0
CampsiteTagVo.java
...ain/java/com/xxfc/platform/campsite/vo/CampsiteTagVo.java
+2
-17
CampsiteShopBiz.java
.../java/com/xxfc/platform/campsite/biz/CampsiteShopBiz.java
+18
-1
CampsiteTagBiz.java
...n/java/com/xxfc/platform/campsite/biz/CampsiteTagBiz.java
+20
-1
CampsiteShopMapper.java
...com/xxfc/platform/campsite/mapper/CampsiteShopMapper.java
+16
-0
CampsiteTagMapper.java
.../com/xxfc/platform/campsite/mapper/CampsiteTagMapper.java
+4
-0
CampsiteTagController.java
...om/xxfc/platform/campsite/rest/CampsiteTagController.java
+1
-15
CampsiteShopAdminController.java
...form/campsite/rest/admin/CampsiteShopAdminController.java
+29
-0
CampsiteTagAdminController.java
...tform/campsite/rest/admin/CampsiteTagAdminController.java
+25
-8
CampsiteShopMapper.xml
...e-server/src/main/resources/mapper/CampsiteShopMapper.xml
+14
-7
CampsiteTagMapper.xml
...te-server/src/main/resources/mapper/CampsiteTagMapper.xml
+18
-1
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+75
-0
AddMsgParam.java
...src/main/java/com/xxfc/platform/im/model/AddMsgParam.java
+217
-0
Comment.java
...ver/src/main/java/com/xxfc/platform/im/model/Comment.java
+123
-0
Givegift.java
...er/src/main/java/com/xxfc/platform/im/model/Givegift.java
+160
-0
Msg.java
...-server/src/main/java/com/xxfc/platform/im/model/Msg.java
+648
-0
Praise.java
...rver/src/main/java/com/xxfc/platform/im/model/Praise.java
+76
-0
MsgController.java
...rc/main/java/com/xxfc/platform/im/rest/MsgController.java
+27
-0
BeanUtil.java
...er/src/main/java/com/xxfc/platform/im/utils/BeanUtil.java
+80
-0
pom.xml
xx-tour/xx-tour-server/pom.xml
+1
-0
IdInformation.java
...ava/com/xxfc/platform/universal/entity/IdInformation.java
+1
-1
CertificationController.java
...latform/universal/controller/CertificationController.java
+1
-1
CertificationService.java
...xxfc/platform/universal/service/CertificationService.java
+1
-1
VehicleBookHourInfo.java
...com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
+3
-84
BookVehicleVO.java
...in/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
+1
-1
VehicleBookHourInfoDto.java
...om/xxfc/platform/vehicle/pojo/VehicleBookHourInfoDto.java
+8
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+44
-10
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+137
-0
VehicleBookHourInfoMapper.java
...fc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
+7
-0
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+4
-4
VehicleBookHourInfoMapper.xml
...r/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
+29
-0
VehicleBookInfoMapper.xml
...erver/src/main/resources/mapper/VehicleBookInfoMapper.xml
+1
-1
No files found.
ace-auth/ace-auth-server/src/main/resources/bootstrap.yml
View file @
3a3f4a03
...
@@ -15,7 +15,7 @@ spring:
...
@@ -15,7 +15,7 @@ spring:
config
:
config
:
server-addr
:
127.0.0.1:8848
server-addr
:
127.0.0.1:8848
#共用配置,暂定一个
#共用配置,暂定一个
shared-dataids
:
common-dev.yaml
#
shared-dataids: common-dev.yaml
---
---
spring
:
spring
:
profiles
:
pro
profiles
:
pro
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
3a3f4a03
...
@@ -38,6 +38,7 @@ public interface UserFeign {
...
@@ -38,6 +38,7 @@ public interface UserFeign {
*/
*/
@RequestMapping
(
value
=
"/api/app/user/authentication"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/api/app/user/authentication"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
authentication
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
public
ObjectRestResponse
authentication
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"name"
)
String
name
,
@RequestParam
(
value
=
"idNumber"
)
String
idNumber
,
@RequestParam
(
value
=
"idNumber"
)
String
idNumber
,
@RequestParam
(
value
=
"status"
)
Integer
status
);
@RequestParam
(
value
=
"status"
)
Integer
status
);
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
View file @
3a3f4a03
...
@@ -11,6 +11,7 @@ public class AppUserDTO {
...
@@ -11,6 +11,7 @@ public class AppUserDTO {
private
Integer
id
;
private
Integer
id
;
private
Integer
userid
;
private
Integer
userid
;
private
Integer
isMember
;
private
Integer
isMember
;
private
String
username
;
private
String
nickname
;
private
String
nickname
;
private
String
realname
;
private
String
realname
;
private
String
headimgurl
;
private
String
headimgurl
;
...
...
ace-modules/ace-admin/pom.xml
View file @
3a3f4a03
...
@@ -45,6 +45,11 @@
...
@@ -45,6 +45,11 @@
<artifactId>
xx-im-api
</artifactId>
<artifactId>
xx-im-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<version>
2.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-activity-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUserCollectController.java
View file @
3a3f4a03
...
@@ -106,5 +106,4 @@ public class AppUserCollectController extends CommonBaseController {
...
@@ -106,5 +106,4 @@ public class AppUserCollectController extends CommonBaseController {
return
collectBiz
.
upUserCollect
(
collectDTO
);
return
collectBiz
.
upUserCollect
(
collectDTO
);
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
3a3f4a03
...
@@ -164,10 +164,11 @@ public class AppUserRest {
...
@@ -164,10 +164,11 @@ public class AppUserRest {
@RequestMapping
(
value
=
"/user/authentication"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/user/authentication"
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ObjectRestResponse
authentication
(
public
@ResponseBody
ObjectRestResponse
authentication
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"name"
,
defaultValue
=
""
)
String
name
,
@RequestParam
(
value
=
"idNumber"
,
defaultValue
=
""
)
String
idNumber
,
@RequestParam
(
value
=
"idNumber"
,
defaultValue
=
""
)
String
idNumber
,
@RequestParam
(
value
=
"status"
,
defaultValue
=
"0"
)
Integer
status
@RequestParam
(
value
=
"status"
,
defaultValue
=
"0"
)
Integer
status
){
){
return
appPermissionService
.
upAuthentication
(
userId
,
idNumber
,
status
);
return
appPermissionService
.
upAuthentication
(
userId
,
name
,
idNumber
,
status
);
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
3a3f4a03
...
@@ -17,6 +17,7 @@ import com.github.wxiaoqi.security.common.util.VerificationUtils;
...
@@ -17,6 +17,7 @@ import com.github.wxiaoqi.security.common.util.VerificationUtils;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.activity.Feign.ActivityFeign
;
import
com.xxfc.platform.im.feign.ImFeign
;
import
com.xxfc.platform.im.feign.ImFeign
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -51,6 +52,9 @@ public class AppPermissionService {
...
@@ -51,6 +52,9 @@ public class AppPermissionService {
@Autowired
@Autowired
ImFeign
imFeign
;
ImFeign
imFeign
;
@Autowired
ActivityFeign
activityFeign
;
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
@Autowired
@Autowired
private
RedisTemplate
userRedisTemplate
;
private
RedisTemplate
userRedisTemplate
;
...
@@ -219,6 +223,8 @@ public class AppPermissionService {
...
@@ -219,6 +223,8 @@ public class AppPermissionService {
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setIsdel
(
0
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//自动登录获取优惠卷
authCoupn
(
userid
);
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
// 到im注册,获取返回结果
...
@@ -537,26 +543,36 @@ public class AppPermissionService {
...
@@ -537,26 +543,36 @@ public class AppPermissionService {
//实名认证
//实名认证
@Transactional
@Transactional
public
ObjectRestResponse
upAuthentication
(
Integer
userid
,
String
idNumber
,
Integer
status
)
{
public
ObjectRestResponse
upAuthentication
(
Integer
userid
,
String
name
,
String
idNumber
,
Integer
status
)
{
if
(
userid
==
null
||
userid
==
0
||
(
status
==
1
&&
StringUtils
.
isBlank
(
idNumber
)))
{
log
.
error
(
"userid===="
+
userid
+
"-----name===="
+
name
+
"----idNumber==="
+
idNumber
+
"---status==="
+
status
);
if
(
userid
==
null
||
userid
==
0
||
(
status
==
1
&&
StringUtils
.
isBlank
(
idNumber
)&&
StringUtils
.
isBlank
(
name
)))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
}
try
{
try
{
AppUser
Login
user
=
appUserLoginBiz
.
getUser
ById
(
userid
);
AppUser
Vo
userVo
=
appUserDetailBiz
.
getUserInfo
ById
(
userid
);
if
(
user
==
null
)
{
if
(
user
Vo
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"用户不存在"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"用户不存在"
);
}
}
if
(
user
.
getCertificationStatus
()
==
1
)
{
if
(
user
Vo
.
getCertificationStatus
()
==
1
)
{
return
ObjectRestResponse
.
createFailedResultWithObj
(
ResultCode
.
EXIST_CODE
,
"用户已认证"
,
user
.
getIdNumber
());
return
ObjectRestResponse
.
createFailedResultWithObj
(
ResultCode
.
EXIST_CODE
,
"用户已认证"
,
user
Vo
.
getIdNumber
());
}
}
if
(
status
==
1
)
{
if
(
status
==
1
)
{
String
username
=
user
.
getUsername
();
String
username
=
userVo
.
getUsername
();
user
=
new
AppUserLogin
();
AppUserLogin
user
=
new
AppUserLogin
();
user
.
setId
(
userid
);
user
.
setId
(
userid
);
user
.
setUsername
(
username
);
user
.
setUsername
(
username
);
user
.
setIdNumber
(
idNumber
);
user
.
setIdNumber
(
idNumber
);
user
.
setCertificationStatus
(
1
);
user
.
setCertificationStatus
(
1
);
appUserLoginBiz
.
updateSelectiveById
(
user
);
appUserLoginBiz
.
updateSelectiveById
(
user
);
if
(
StringUtils
.
isBlank
(
userVo
.
getRealname
())){
Integer
id
=
userVo
.
getId
();
userVo
=
new
AppUserVo
();
userVo
.
setId
(
id
);
userVo
.
setUserid
(
userid
);
userVo
.
setRealname
(
name
);
appUserDetailBiz
.
updUuserInfoById
(
userVo
);
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -625,6 +641,10 @@ public class AppPermissionService {
...
@@ -625,6 +641,10 @@ public class AppPermissionService {
log
.
error
(
"------im登录----access_token======"
+
access_token
);
log
.
error
(
"------im登录----access_token======"
+
access_token
);
return
access_token
;
return
access_token
;
}
}
//自动领取新人优惠卷
public
String
authCoupn
(
Integer
userId
){
return
activityFeign
.
led
(
userId
);
}
}
}
ace-modules/ace-admin/src/main/resources/bootstrap.yml
View file @
3a3f4a03
...
@@ -17,7 +17,7 @@ spring:
...
@@ -17,7 +17,7 @@ spring:
config
:
config
:
server-addr
:
127.0.0.1:8848
server-addr
:
127.0.0.1:8848
#共用配置,暂定一个
#共用配置,暂定一个
shared-dataids
:
common-dev.yaml
#
shared-dataids: common-dev.yaml
---
---
spring
:
spring
:
...
...
pom.xml
View file @
3a3f4a03
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
<module>
xx-tour
</module>
<module>
xx-tour
</module>
<module>
xx-im
</module>
<module>
xx-im
</module>
<module>
xx-campsite
</module>
<module>
xx-campsite
</module>
<module>
xx-activity
</module>
</modules>
</modules>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<developers>
<developers>
...
...
xx-activity/pom.xml
0 → 100644
View file @
3a3f4a03
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ace-security
</artifactId>
<groupId>
com.github.wxiaoqi
</groupId>
<version>
2.0-SNAPSHOT
</version>
</parent>
<groupId>
com.xxfc.platform
</groupId>
<modules>
<module>
xx-activity-api
</module>
<module>
xx-activity-server
</module>
</modules>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
xx-activity
</artifactId>
<packaging>
pom
</packaging>
</project>
\ No newline at end of file
xx-activity/xx-activity-api/pom.xml
0 → 100644
View file @
3a3f4a03
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
com.xxfc.common
</groupId>
<artifactId>
xx-common-platform
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-activity-api
</artifactId>
<dependencies>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-admin-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-universal-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/Feign/ActivityFeign.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
Feign
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-06-21 8:11
*/
@FeignClient
(
value
=
"xx-activity"
)
public
interface
ActivityFeign
{
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/user/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
);
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/constant/CouponUsed.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
constant
;
/**
* 优惠卷用处
*/
public
enum
CouponUsed
{
SHOP
(
10
,
"店铺优惠券"
),
SHOPNEW
(
11
,
"新人店铺券"
),
GOOD
(
20
,
"商品优惠券"
),
CATA
(
30
,
"类目优惠券"
),
ALL
(
60
,
"平台优惠券"
),
ALLNEW
(
61
,
"新人平台券"
);
Integer
code
;
String
msg
;
CouponUsed
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/Coupon.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 优惠券表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
@Data
@Table
(
name
=
"coupon"
)
public
class
Coupon
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元
*/
@Column
(
name
=
"title"
)
@ApiModelProperty
(
value
=
"优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元"
)
private
String
title
;
/**
* 图片
*/
@Column
(
name
=
"icon"
)
@ApiModelProperty
(
value
=
"图片"
)
private
String
icon
;
/**
* 可用于:10店铺优惠券 11新人店铺券 20商品优惠券 30类目优惠券 60平台优惠券 61新人平台券
*/
@Column
(
name
=
"used"
)
@ApiModelProperty
(
value
=
"可用于:10店铺优惠券 11新人店铺券 20商品优惠券 30类目优惠券 60平台优惠券 61新人平台券"
)
private
Integer
used
;
/**
* 0-全平台;1-租车;2-旅游;3-营地
*/
@Column
(
name
=
"channel"
)
@ApiModelProperty
(
value
=
"0-全平台;1-租车;2-旅游;3-营地"
)
private
Integer
channel
;
/**
* 0-普通用户;1-会员用户
*/
@Column
(
name
=
"user_type"
)
@ApiModelProperty
(
value
=
"0-普通用户;1-会员用户"
)
private
Integer
userType
;
/**
* 1满减券 2叠加满减券 3无门槛券(需要限制大小)
*/
@Column
(
name
=
"type"
)
@ApiModelProperty
(
value
=
"1满减券 2叠加满减券 3无门槛券(需要限制大小)"
)
private
Integer
type
;
/**
* 1可用于特价商品 2不能 默认不能(商品优惠卷除外)
*/
@Column
(
name
=
"with_special"
)
@ApiModelProperty
(
value
=
"1可用于特价商品 2不能 默认不能(商品优惠卷除外)"
)
private
Integer
withSpecial
;
/**
* 店铺或商品流水号
*/
@Column
(
name
=
"with_sn"
)
@ApiModelProperty
(
value
=
"店铺或商品流水号"
)
private
String
withSn
;
/**
* 满多少金额
*/
@Column
(
name
=
"with_amount"
)
@ApiModelProperty
(
value
=
"满多少金额"
)
private
BigDecimal
withAmount
;
/**
* 用券抵扣金额
*/
@Column
(
name
=
"used_amount"
)
@ApiModelProperty
(
value
=
"用券抵扣金额"
)
private
BigDecimal
usedAmount
;
/**
* 配额:发券数量
*/
@Column
(
name
=
"quota"
)
@ApiModelProperty
(
value
=
"配额:发券数量"
)
private
Integer
quota
;
/**
* 每人限领次数
*/
@Column
(
name
=
"limit_collar"
)
@ApiModelProperty
(
value
=
"每人限领次数"
)
private
Integer
limitCollar
;
/**
* 已领取的优惠券数量
*/
@Column
(
name
=
"take_count"
)
@ApiModelProperty
(
value
=
"已领取的优惠券数量"
)
private
Integer
takeCount
;
/**
* 已使用的优惠券数量
*/
@Column
(
name
=
"used_count"
)
@ApiModelProperty
(
value
=
"已使用的优惠券数量"
)
private
Integer
usedCount
;
/**
* 发放开始时间
*/
@Column
(
name
=
"start_time"
)
@ApiModelProperty
(
value
=
"发放开始时间"
)
private
Long
startTime
;
/**
* 发放结束时间
*/
@Column
(
name
=
"end_time"
)
@ApiModelProperty
(
value
=
"发放结束时间"
)
private
Long
endTime
;
/**
* 时效:1绝对时效(领取后XXX-XXX时间段有效) 2相对时效(领取后N天有效)
*/
@Column
(
name
=
"valid_type"
)
@ApiModelProperty
(
value
=
"时效:1绝对时效(领取后XXX-XXX时间段有效) 2相对时效(领取后N天有效)"
)
private
Integer
validType
;
/**
* 使用开始时间
*/
@Column
(
name
=
"valid_start_time"
)
@ApiModelProperty
(
value
=
"使用开始时间"
)
private
Long
validStartTime
;
/**
* 使用结束时间
*/
@Column
(
name
=
"valid_end_time"
)
@ApiModelProperty
(
value
=
"使用结束时间"
)
private
Long
validEndTime
;
/**
* 自领取之日起有效天数
*/
@Column
(
name
=
"valid_days"
)
@ApiModelProperty
(
value
=
"自领取之日起有效天数"
)
private
Integer
validDays
;
/**
* 1生效 2失效 3已结束
*/
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"1生效 2失效 3已结束"
)
private
Integer
status
;
/**
* 跳转链接
*/
@Column
(
name
=
"url"
)
@ApiModelProperty
(
value
=
"跳转链接"
)
private
String
url
;
/**
* 创建人
*/
@Column
(
name
=
"crt_user"
)
@ApiModelProperty
(
value
=
"创建人"
)
private
Integer
crtUser
;
/**
* 创建人名称
*/
@Column
(
name
=
"crt_name"
)
@ApiModelProperty
(
value
=
"创建人名称"
)
private
String
crtName
;
/**
* 创建时间
*/
@Column
(
name
=
"crt_time"
)
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 更新时间
*/
@Column
(
name
=
"upd_user"
)
@ApiModelProperty
(
value
=
"更新时间"
)
private
Integer
updUser
;
/**
* 更新人名称
*/
@Column
(
name
=
"upd_name"
)
@ApiModelProperty
(
value
=
"更新人名称"
)
private
String
updName
;
/**
* 创建时间
*/
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
updTime
;
/**
* 是否删除;0-正常;1-删除
*/
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除;0-正常;1-删除"
)
private
Integer
isDel
;
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/UserCoupon.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* 我的优惠卷
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
@Data
@Table
(
name
=
"user_coupon"
)
public
class
UserCoupon
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 优惠卡券id
*/
@Column
(
name
=
"coupon_id"
)
@ApiModelProperty
(
value
=
"优惠卡券id"
)
private
Integer
couponId
;
/**
* 用户id
*/
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
"用户id"
)
private
Integer
userId
;
/**
* 券号
*/
@Column
(
name
=
"ticker_no"
)
@ApiModelProperty
(
value
=
"券号"
)
private
String
tickerNo
;
/**
* 0-未使用;1-已使用
*/
@Column
(
name
=
"is_use"
)
@ApiModelProperty
(
value
=
"0-未使用;1-已使用"
)
private
Integer
isUse
;
/**
* 使用订单号
*/
@Column
(
name
=
"order_no"
)
@ApiModelProperty
(
value
=
"使用订单号"
)
private
String
orderNo
;
/**
* 领卷时间
*/
@Column
(
name
=
"crt_time"
)
@ApiModelProperty
(
value
=
"领卷时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 更新时间
*/
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
/**
* 使用时间
*/
@Column
(
name
=
"use_time"
)
@ApiModelProperty
(
value
=
"使用时间"
)
private
Long
useTime
;
}
xx-activity/xx-activity-server/pom.xml
0 → 100644
View file @
3a3f4a03
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
com.xxfc.common
</groupId>
<artifactId>
xx-common-platform-web
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-activity-server
</artifactId>
<dependencies>
<!-- 自己项目 -->
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-activity-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 此插件用来生成通用mapper的代码 -->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.2
</version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/builder/generatorConfig.xml
</configurationFile>
<overwrite>
true
</overwrite>
<verbose>
true
</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.30
</version>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper
</artifactId>
<version>
${mapper.version}
</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/ActivityApplication.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
;
import
com.ace.cache.EnableAceCache
;
import
com.github.wxiaoqi.security.auth.client.EnableAceAuthClient
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
tk.mybatis.spring.annotation.MapperScan
;
/**
* @author libin
* @version 1.0
* @description 活动
* @data 2019/6/14 11:19
*/
@SpringBootApplication
(
scanBasePackages
=
{
"com.xxfc.platform"
,
"com.github.wxiaoqi"
,
})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.admin.feign"
,
"com.xxfc.platform"
})
@EnableAceCache
@EnableCaching
@MapperScan
(
basePackages
=
"com.xxfc.platform.activity.mapper"
)
public
class
ActivityApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ActivityApplication
.
class
,
args
);
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/CouponBiz.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.xxfc.platform.activity.constant.CouponUsed
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.mapper.CouponMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
/**
* 优惠券表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
@Service
public
class
CouponBiz
extends
BaseBiz
<
CouponMapper
,
Coupon
>
{
//获取优惠卷
public
Coupon
getCouponByUsed
(
Integer
used
){
Example
example
=
new
Example
(
Coupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"used"
,
used
)
.
andEqualTo
(
"status"
,
1
).
andEqualTo
(
"isDel"
,
0
);
List
<
Coupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
return
list
.
get
(
0
);
}
return
null
;
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.xxfc.platform.activity.constant.CouponUsed
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
import
com.xxfc.platform.universal.weixin.util.Snowflake
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.mapper.UserCouponMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
/**
* 我的优惠卷
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
@Service
@Slf4j
public
class
UserCouponBiz
extends
BaseBiz
<
UserCouponMapper
,
UserCoupon
>
{
@Autowired
private
CouponBiz
couponBiz
;
//自动发送优惠卷
public
String
authledCoupon
(
Integer
userId
){
if
(
userId
==
null
||
userId
==
0
){
log
.
error
(
"----参数不能为空"
);
return
null
;
}
Coupon
coupon
=
couponBiz
.
getCouponByUsed
(
CouponUsed
.
ALLNEW
.
getCode
());
if
(
coupon
==
null
){
log
.
error
(
userId
+
"----无可领取优惠卷"
);
return
null
;
}
Integer
couponId
=
coupon
.
getId
();
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
couponId
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
return
null
;
}
String
ticker_no
=
Snowflake
.
build
()+
""
;
UserCoupon
userCoupon
=
new
UserCoupon
();
userCoupon
.
setUserId
(
userId
);
userCoupon
.
setCouponId
(
couponId
);
userCoupon
.
setTickerNo
(
ticker_no
);
insertSelective
(
userCoupon
);
return
ticker_no
;
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/CouponMapper.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
mapper
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 优惠券表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
public
interface
CouponMapper
extends
Mapper
<
Coupon
>
{
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/UserCouponMapper.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
mapper
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 我的优惠卷
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
public
interface
UserCouponMapper
extends
Mapper
<
UserCoupon
>
{
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/CouponController.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.activity.biz.CouponBiz
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"coupon"
)
public
class
CouponController
extends
BaseController
<
CouponBiz
,
Coupon
>
{
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.activity.biz.UserCouponBiz
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"user"
)
public
class
UserCouponController
extends
BaseController
<
UserCouponBiz
,
UserCoupon
>
{
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
)
{
return
baseBiz
.
authledCoupon
(
userId
);
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/bootstrap.yml
0 → 100644
View file @
3a3f4a03
#spring:
# application:
# name: vehicle
# cloud:
# nacos:
# config:
# server-addr: 127.0.0.1:8848
# file-extension: yaml
# profiles:
# active: dev
spring
:
profiles
:
active
:
dev
application
:
name
:
xx-activity
cloud
:
nacos
:
config
:
file-extension
:
yaml
---
spring
:
profiles
:
dev
cloud
:
nacos
:
config
:
server-addr
:
127.0.0.1:8848
---
spring
:
profiles
:
pro
cloud
:
nacos
:
config
:
server-addr
:
10.5.52.2:8848
xx-activity/xx-activity-server/src/main/resources/builder/generatorConfig.xml
0 → 100644
View file @
3a3f4a03
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--<properties resource="dev.properties"/>-->
<context
id=
"Mysql"
targetRuntime=
"MyBatis3Simple"
defaultModelType=
"flat"
>
<property
name=
"beginningDelimiter"
value=
"`"
/>
<property
name=
"endingDelimiter"
value=
"`"
/>
<property
name=
"mergeable"
value=
"false"
></property>
<plugin
type=
"tk.mybatis.mapper.generator.MapperPlugin"
>
<property
name=
"mappers"
value=
"tk.mybatis.mapper.common.Mapper"
/>
</plugin>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://localhost:3306/vehicle?useUnicode=true&characterEncoding=UTF8"
userId=
"root"
password=
"xx2019fc"
>
</jdbcConnection>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
<sqlMapGenerator
targetPackage=
"${targetXMLPackage}"
targetProject=
"${targetResourcesProject}"
/>
<javaClientGenerator
targetPackage=
"${targetMapperPackage}"
targetProject=
"${targetJavaProject}"
type=
"XMLMAPPER"
/>
<!-- <table tableName="vehicle" domainObjectName="Vehicle">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_info" domainObjectName="VehicleBookInfo">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_record" domainObjectName="VehicleBookRecord">-->
<!-- </table>-->
<!-- <table tableName="branch_company" domainObjectName="BranchCompany">-->
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table
tableName=
"vehicle_upkeep_item"
domainObjectName=
"VehicleUpkeepItem"
></table>
<table
tableName=
"vehicle_upkeep_log"
domainObjectName=
"VehicleUpkeepLog"
></table>
</context>
</generatorConfiguration>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/CouponMapper.xml
0 → 100644
View file @
3a3f4a03
<?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.xxfc.platform.activity.mapper.CouponMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.activity.entity.Coupon"
id=
"couponMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"icon"
column=
"icon"
/>
<result
property=
"used"
column=
"used"
/>
<result
property=
"channel"
column=
"channel"
/>
<result
property=
"userType"
column=
"user_type"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"withSpecial"
column=
"with_special"
/>
<result
property=
"withSn"
column=
"with_sn"
/>
<result
property=
"withAmount"
column=
"with_amount"
/>
<result
property=
"usedAmount"
column=
"used_amount"
/>
<result
property=
"quota"
column=
"quota"
/>
<result
property=
"limitCollar"
column=
"limit_collar"
/>
<result
property=
"takeCount"
column=
"take_count"
/>
<result
property=
"usedCount"
column=
"used_count"
/>
<result
property=
"startTime"
column=
"start_time"
/>
<result
property=
"endTime"
column=
"end_time"
/>
<result
property=
"validType"
column=
"valid_type"
/>
<result
property=
"validStartTime"
column=
"valid_start_time"
/>
<result
property=
"validEndTime"
column=
"valid_end_time"
/>
<result
property=
"validDays"
column=
"valid_days"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"url"
column=
"url"
/>
<result
property=
"crtUser"
column=
"crt_user"
/>
<result
property=
"crtName"
column=
"crt_name"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updUser"
column=
"upd_user"
/>
<result
property=
"updName"
column=
"upd_name"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/UserCouponMapper.xml
0 → 100644
View file @
3a3f4a03
<?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.xxfc.platform.activity.mapper.UserCouponMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.activity.entity.UserCoupon"
id=
"userCouponMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"tickerNo"
column=
"ticker_no"
/>
<result
property=
"isUse"
column=
"is_use"
/>
<result
property=
"orderNo"
column=
"order_no"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"useTime"
column=
"use_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-campsite/xx-campsite-api/src/main/java/com/xxfc/platform/campsite/dto/CampsiteTagDTO.java
View file @
3a3f4a03
...
@@ -66,4 +66,6 @@ public class CampsiteTagDTO implements Serializable {
...
@@ -66,4 +66,6 @@ public class CampsiteTagDTO implements Serializable {
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
private
Integer
isDel
;
@ApiModelProperty
(
value
=
"标签底图"
)
private
String
tagUrl
;
}
}
xx-campsite/xx-campsite-api/src/main/java/com/xxfc/platform/campsite/vo/CampsiteTagVo.java
View file @
3a3f4a03
...
@@ -24,12 +24,6 @@ public class CampsiteTagVo implements Serializable {
...
@@ -24,12 +24,6 @@ public class CampsiteTagVo implements Serializable {
@ApiModelProperty
(
"主键id"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
private
Integer
id
;
/**
* 父id
*/
@ApiModelProperty
(
value
=
"父id"
)
private
Integer
parentId
;
/**
/**
* 名称
* 名称
*/
*/
...
@@ -54,16 +48,7 @@ public class CampsiteTagVo implements Serializable {
...
@@ -54,16 +48,7 @@ public class CampsiteTagVo implements Serializable {
@ApiModelProperty
(
value
=
"创建时间"
)
@ApiModelProperty
(
value
=
"创建时间"
)
private
Long
ctrTime
;
private
Long
ctrTime
;
/**
@ApiModelProperty
(
value
=
"标签底图"
)
* 更新时间
private
String
tagUrl
;
*/
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
/**
* 是否删除:0-正常;1-删除
*/
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
}
}
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/biz/CampsiteShopBiz.java
View file @
3a3f4a03
...
@@ -194,6 +194,24 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> {
...
@@ -194,6 +194,24 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> {
return
effectRows
;
return
effectRows
;
}
}
/**
* 逻辑删除
* @param id
* @return
*/
public
int
updateCampsiteSatus
(
int
id
)
{
return
mapper
.
updateCampsiteStatus
(
id
,
1
);
}
/**
* 上下架
* @param id
* @param status
* @return
*/
public
int
updateCampsiteSaleStatus
(
Integer
id
,
Integer
status
)
{
return
mapper
.
updateCampsiteSaleStatus
(
id
,
status
);
}
/**
/**
* 根据经纬度,计算两点间的距离
* 根据经纬度,计算两点间的距离
*
*
...
@@ -222,5 +240,4 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> {
...
@@ -222,5 +240,4 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> {
return
s
;
return
s
;
}
}
}
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/biz/CampsiteTagBiz.java
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
campsite
.
biz
;
package
com
.
xxfc
.
platform
.
campsite
.
biz
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.campsite.dto.CampsiteTagListDTO
;
import
com.xxfc.platform.campsite.dto.CampsiteTagListDTO
;
import
com.xxfc.platform.campsite.vo.CampsiteTagListVo
;
import
com.xxfc.platform.campsite.vo.CampsiteTagListVo
;
import
com.xxfc.platform.campsite.vo.CampsiteTagVo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -12,6 +13,7 @@ import com.xxfc.platform.campsite.entity.CampsiteTag;
...
@@ -12,6 +13,7 @@ import com.xxfc.platform.campsite.entity.CampsiteTag;
import
com.xxfc.platform.campsite.mapper.CampsiteTagMapper
;
import
com.xxfc.platform.campsite.mapper.CampsiteTagMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -45,4 +47,21 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
...
@@ -45,4 +47,21 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
public
int
updateCampsiteTagStatus
(
Integer
tagId
)
{
public
int
updateCampsiteTagStatus
(
Integer
tagId
)
{
return
mapper
.
updateCampsiteTagStatus
(
tagId
,
1
);
return
mapper
.
updateCampsiteTagStatus
(
tagId
,
1
);
}
}
/**
* 分页查询
* @param page
* @param limit
* @return
*/
public
PageDataVO
<
CampsiteTagVo
>
findCampsiteTagsPage
(
Integer
page
,
Integer
limit
)
{
PageDataVO
<
CampsiteTagVo
>
tagVoPageDataVO
=
new
PageDataVO
<>();
PageDataVO
<
CampsiteTag
>
pageDataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()
->
mapper
.
finCampsiteTagsAll
());
List
<
CampsiteTag
>
campsiteTags
=
pageDataVO
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
campsiteTags
)){
return
tagVoPageDataVO
;
}
tagVoPageDataVO
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
pageDataVO
),
new
TypeReference
<
PageDataVO
<
CampsiteTagVo
>>(){});
return
tagVoPageDataVO
;
}
}
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/mapper/CampsiteShopMapper.java
View file @
3a3f4a03
...
@@ -39,4 +39,20 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
...
@@ -39,4 +39,20 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
* @return
* @return
*/
*/
List
<
CampsiteShopAdminPageDTO
>
findCampsiteShops
(
CampsiteShopAdminFindDTO
campsiteShopAdminFindDTO
);
List
<
CampsiteShopAdminPageDTO
>
findCampsiteShops
(
CampsiteShopAdminFindDTO
campsiteShopAdminFindDTO
);
/**
* 更新店铺的状态
* @param id
* @param status
* @return
*/
int
updateCampsiteStatus
(
@Param
(
"id"
)
int
id
,
@Param
(
"status"
)
int
status
);
/**
* 更新店铺的上下架状态
* @param id
* @param status
* @return
*/
int
updateCampsiteSaleStatus
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"status"
)
Integer
status
);
}
}
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/mapper/CampsiteTagMapper.java
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
campsite
.
mapper
;
package
com
.
xxfc
.
platform
.
campsite
.
mapper
;
import
com.xxfc.platform.campsite.dto.CampsiteTagDTO
;
import
com.xxfc.platform.campsite.dto.CampsiteTagListDTO
;
import
com.xxfc.platform.campsite.dto.CampsiteTagListDTO
;
import
com.xxfc.platform.campsite.entity.CampsiteTag
;
import
com.xxfc.platform.campsite.entity.CampsiteTag
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -32,4 +33,7 @@ public interface CampsiteTagMapper extends Mapper<CampsiteTag> {
...
@@ -32,4 +33,7 @@ public interface CampsiteTagMapper extends Mapper<CampsiteTag> {
*/
*/
@Update
(
"update `campsite_tag` set `is_del`=#{status} where `id`=#{tagId}"
)
@Update
(
"update `campsite_tag` set `is_del`=#{status} where `id`=#{tagId}"
)
int
updateCampsiteTagStatus
(
@Param
(
"tagId"
)
Integer
tagId
,
@Param
(
"status"
)
int
status
);
int
updateCampsiteTagStatus
(
@Param
(
"tagId"
)
Integer
tagId
,
@Param
(
"status"
)
int
status
);
List
<
CampsiteTagDTO
>
finCampsiteTagsAll
();
}
}
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/rest/CampsiteTagController.java
View file @
3a3f4a03
...
@@ -23,7 +23,7 @@ import java.util.List;
...
@@ -23,7 +23,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"campsiteTag"
)
@RequestMapping
(
"campsiteTag"
)
@Api
(
tags
=
"营地类型"
)
@Api
(
tags
=
"
App
营地类型"
)
public
class
CampsiteTagController
extends
BaseController
<
CampsiteTagBiz
,
CampsiteTag
>
{
public
class
CampsiteTagController
extends
BaseController
<
CampsiteTagBiz
,
CampsiteTag
>
{
/**
/**
...
@@ -37,18 +37,4 @@ public class CampsiteTagController extends BaseController<CampsiteTagBiz,Campsit
...
@@ -37,18 +37,4 @@ public class CampsiteTagController extends BaseController<CampsiteTagBiz,Campsit
List
<
CampsiteTagListVo
>
campsiteTagListVolist
=
getBaseBiz
().
findCampsiteTags
();
List
<
CampsiteTagListVo
>
campsiteTagListVolist
=
getBaseBiz
().
findCampsiteTags
();
return
ObjectRestResponse
.
succ
(
campsiteTagListVolist
);
return
ObjectRestResponse
.
succ
(
campsiteTagListVolist
);
}
}
/**
* 根据id逻辑删除
* @param id
* @return
*/
@Override
public
ObjectRestResponse
<
CampsiteTag
>
remove
(
@PathVariable
(
"id"
)
int
id
)
{
int
effectRows
=
getBaseBiz
().
updateCampsiteTagStatus
(
id
);
if
(
effectRows
>
0
){
ObjectRestResponse
.
succ
();
}
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/rest/admin/CampsiteShopAdminController.java
View file @
3a3f4a03
...
@@ -49,4 +49,33 @@ public class CampsiteShopAdminController extends BaseController<CampsiteShopBiz,
...
@@ -49,4 +49,33 @@ public class CampsiteShopAdminController extends BaseController<CampsiteShopBiz,
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
/**
* 营地逻辑删除
* @param id
* @return
*/
@Override
public
ObjectRestResponse
<
CampsiteShop
>
remove
(
@PathVariable
(
value
=
"id"
)
int
id
)
{
int
effectRows
=
getBaseBiz
().
updateCampsiteSatus
(
id
);
if
(
effectRows
>
0
){
return
ObjectRestResponse
.
succ
();
}
return
ObjectRestResponse
.
createDefaultFail
();
}
/**
* 营地上下架
* @param id
* @param status
* @return
*/
@ApiOperation
(
"营地上下架"
)
@PutMapping
(
"/saleStatus"
)
public
ObjectRestResponse
<
Void
>
updateSaleStatus
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"status"
)
Integer
status
){
int
effectRows
=
getBaseBiz
().
updateCampsiteSaleStatus
(
id
,
status
);
if
(
effectRows
>
0
){
return
ObjectRestResponse
.
succ
();
}
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/rest/admin/CampsiteTagAdminController.java
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
campsite
.
rest
.
admin
;
package
com
.
xxfc
.
platform
.
campsite
.
rest
.
admin
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.campsite.biz.CampsiteTagBiz
;
import
com.xxfc.platform.campsite.biz.CampsiteTagBiz
;
import
com.xxfc.platform.campsite.entity.CampsiteTag
;
import
com.xxfc.platform.campsite.entity.CampsiteTag
;
import
com.xxfc.platform.campsite.vo.CampsiteTag
List
Vo
;
import
com.xxfc.platform.campsite.vo.CampsiteTagVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* @author libin
* @author libin
...
@@ -23,7 +19,28 @@ import java.util.List;
...
@@ -23,7 +19,28 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/admin/campsiteTag"
)
@RequestMapping
(
"/admin/campsiteTag"
)
@Api
(
tags
=
"营地类型"
)
@Api
(
tags
=
"
后台*
营地类型"
)
public
class
CampsiteTagAdminController
extends
BaseController
<
CampsiteTagBiz
,
CampsiteTag
>
{
public
class
CampsiteTagAdminController
extends
BaseController
<
CampsiteTagBiz
,
CampsiteTag
>
{
/**
* 根据id逻辑删除
* @param id
* @return
*/
@Override
public
ObjectRestResponse
<
CampsiteTag
>
remove
(
@PathVariable
(
"id"
)
int
id
)
{
int
effectRows
=
getBaseBiz
().
updateCampsiteTagStatus
(
id
);
if
(
effectRows
>
0
){
return
ObjectRestResponse
.
succ
();
}
return
ObjectRestResponse
.
createDefaultFail
();
}
@ApiOperation
(
"营地类型的分页"
)
@GetMapping
(
"/pages"
)
public
ObjectRestResponse
<
CampsiteTagVo
>
pages
(
@RequestParam
(
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
){
PageDataVO
<
CampsiteTagVo
>
tagVoPageDataVO
=
getBaseBiz
().
findCampsiteTagsPage
(
page
,
limit
);
return
ObjectRestResponse
.
succ
(
tagVoPageDataVO
);
}
}
}
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/resources/mapper/CampsiteShopMapper.xml
View file @
3a3f4a03
...
@@ -40,8 +40,9 @@
...
@@ -40,8 +40,9 @@
FROM `campsite_shop_tag` cst
FROM `campsite_shop_tag` cst
left JOIN `campsite_shop` cs on cst.shop_id=cs.id
left JOIN `campsite_shop` cs on cst.shop_id=cs.id
left JOIN `campsite_tag` ct on cst.tag_id=ct.id
left JOIN `campsite_tag` ct on cst.tag_id=ct.id
where cs.sale_state=1
<if
test=
"typeId!=null"
>
<if
test=
"typeId!=null"
>
WHERE
cst.tag_id=#{typeId}
and
cst.tag_id=#{typeId}
</if>
</if>
</select>
</select>
...
@@ -53,18 +54,18 @@
...
@@ -53,18 +54,18 @@
<select
id=
"findCampsiteShops"
parameterType=
"com.xxfc.platform.campsite.dto.CampsiteShopAdminFindDTO"
resultType=
"com.xxfc.platform.campsite.dto.CampsiteShopAdminPageDTO"
>
<select
id=
"findCampsiteShops"
parameterType=
"com.xxfc.platform.campsite.dto.CampsiteShopAdminFindDTO"
resultType=
"com.xxfc.platform.campsite.dto.CampsiteShopAdminPageDTO"
>
SELECT `id`,`name`,`hot`,`crt_time` as `crtTime`,`sale_state` as
SELECT `id`,`name`,`hot`,`crt_time` as `crtTime`,`sale_state` as
`saleState` FROM `campsite_shop`
`saleState` FROM `campsite_shop`
<where>
where `is_del`=0
<if
test=
"startTime != null || endTime!=null"
>
<if
test=
"startTime != null || endTime!=null"
>
<choose>
<choose>
<when
test=
"startTime!=null and endTime!=null"
>
<when
test=
"startTime!=null and endTime!=null"
>
crt_time between #{startTime} and #{endTime}
and
crt_time between #{startTime} and #{endTime}
</when>
</when>
<otherwise>
<otherwise>
<if
test=
"startTime!=null"
>
<if
test=
"startTime!=null"
>
crt_time=#{startTime}
and
crt_time=#{startTime}
</if>
</if>
<if
test=
"endTime != null"
>
<if
test=
"endTime != null"
>
crt_time=#{endTime}
and
crt_time=#{endTime}
</if>
</if>
</otherwise>
</otherwise>
</choose>
</choose>
...
@@ -72,7 +73,13 @@
...
@@ -72,7 +73,13 @@
<if
test=
"name != null and name != ''"
>
<if
test=
"name != null and name != ''"
>
and `name` like concat('%',#{name},'%')
and `name` like concat('%',#{name},'%')
</if>
</if>
</where>
</select>
</select>
<update
id=
"updateCampsiteStatus"
>
update `campsite_shop` set `is_del`=#{status} where `id`=#{id}
</update>
<update
id=
"updateCampsiteSaleStatus"
>
update `campsite_shop` set `sale_state`=#{status} where `id`=#{id}
</update>
</mapper>
</mapper>
\ No newline at end of file
xx-campsite/xx-campsite-server/src/main/resources/mapper/CampsiteTagMapper.xml
View file @
3a3f4a03
...
@@ -13,9 +13,26 @@
...
@@ -13,9 +13,26 @@
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"tagUrl"
column=
"tag_url"
/>
</resultMap>
<resultMap
type=
"com.xxfc.platform.campsite.dto.CampsiteTagDTO"
id=
"campsiteTagDTOMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"parentId"
column=
"parent_id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"isSearch"
column=
"is_search"
/>
<result
property=
"rank"
column=
"rank"
/>
<result
property=
"ctrTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
<result
property=
"tagUrl"
column=
"tag_url"
/>
</resultMap>
</resultMap>
<select
id=
"findCampsiteTags"
resultType=
"com.xxfc.platform.campsite.dto.CampsiteTagListDTO"
>
<select
id=
"findCampsiteTags"
resultType=
"com.xxfc.platform.campsite.dto.CampsiteTagListDTO"
>
select `id`,`name` from `campsite_tag` where `is_del`=0;
select `id`,`name` from `campsite_tag` where `is_del`=0 and `is_search`=1;
</select>
<select
id=
"finCampsiteTagsAll"
resultMap=
"campsiteTagDTOMap"
>
select * from `campsite_tag` where `is_del`=0
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mongodb.DBCollection
;
import
com.mongodb.DBCursor
;
import
com.mongodb.DBObject
;
import
com.xxfc.platform.im.model.Comment
;
import
com.xxfc.platform.im.model.Praise
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
MsgBiz
{
@Autowired
private
MongoTemplate
mongoTemplate
;
DBCollection
collection
;
/**
* 获取消息列表
* @param map
* @return
* @throws Exception
*/
public
Object
getMsgList
(
Map
<
String
,
Object
>
map
)
throws
Exception
{
/* PageHelper.startPage(Integer.parseInt(map.get("page").toString()),Integer.parseInt(map.get("limit").toString()));
PageInfo<Msg> goodPageInfo = new PageInfo<>(mongoTemplate.findAll(Msg.class));
Query query = new Query(Criteria.where("userId").is(10000012));
List<Msg> msg= mongoTemplate.findAll(Msg.class, "s_msg");*/
if
(
null
==
collection
)
collection
=
MGDBCollection
.
getDB
().
getCollection
(
"s_msg"
);
DBCursor
cursor
=
collection
.
find
();
//collection.find()
//return PageDataVO.pageInfo(goodPageInfo);
JSONArray
array
=
new
JSONArray
();
DBObject
dbObject
=
null
;
while
(
cursor
.
hasNext
()){
dbObject
=
cursor
.
next
();
JSONObject
json
=
fetchAndAttach
(
JSONObject
.
parseObject
(
dbObject
.
toString
()));
array
.
add
(
json
);
}
return
array
;
}
private
JSONObject
fetchAndAttach
(
JSONObject
json
)
{
//查询评论
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
json
.
getString
(
"_id"
)));
List
<
Comment
>
msgComment
=
mongoTemplate
.
findAll
(
Comment
.
class
);
json
.
put
(
"comments"
,
msgComment
);
//查询点赞
Query
query1
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
json
.
getString
(
"_id"
)));
List
<
Praise
>
msgPraise
=
mongoTemplate
.
findAll
(
Praise
.
class
);
json
.
put
(
"praises"
,
msgPraise
);
/* msg.setComments(getComments(msg.getMsgId().toString()));
msg.setPraises(getPraises(msg.getMsgId().toString()));
msg.setGifts(SKBeanUtils.getMsgGiftRepository().find(msg.getMsgId(), null, 0, 10));
msg.setIsPraise(SKBeanUtils.getMsgPraiseRepository().exists(ReqUtil.getUserId(), msg.getMsgId()) ? 1 : 0);
msg.setIsCollect(SKBeanUtils.getMsgPraiseRepository().existsCollect(ReqUtil.getUserId(), msg.getMsgId()) ? 1 : 0);*/
return
json
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/AddMsgParam.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
model
;
import
java.util.List
;
public
class
AddMsgParam
extends
BaseExample
{
private
String
address
;
//地理位置
private
String
audios
;
// 语音地址
private
int
flag
;
//消息标记 :默认是3 普通消息
private
String
images
;
// 图片地址
private
String
messageId
;
// 消息id
private
String
remark
;
// 评论
private
int
source
;
// 来源
private
String
text
;
// 内容
private
long
time
;
// 发送的时间
private
String
title
;
// 标题
private
int
type
;
// 基础属性 1=文字消息、2=图文消息、3=语音消息、4=视频消息、 5=文件消息 、 6=SDK分享消息
private
String
videos
;
// 视频地址
private
String
files
;
// 文件地址
private
int
visible
=
1
;
// 默认 1 公开 2 私密 3 部分好友可见 4 不给谁看
private
String
lable
;
// 标签(目前用于短视频标签)
private
String
musicId
;
// 短视频的音乐Id
private
String
sdkUrl
;
// sdk分享url
private
String
sdkIcon
;
// sdk分享icon
private
String
sdkTitle
;
// sdk分享title
private
List
<
Integer
>
userLook
;
//谁可以看的玩家id
private
List
<
Integer
>
userNotLook
;
//谁不能看的玩家id
private
List
<
Integer
>
userRemindLook
;
//提醒谁看的玩家id
private
int
isAllowComment
;
// 是否允许评论 0:允许 1:禁止评论
public
String
getAddress
()
{
return
address
;
}
public
String
getAudios
()
{
return
audios
;
}
public
int
getFlag
()
{
return
flag
;
}
public
String
getImages
()
{
return
images
;
}
public
String
getMessageId
()
{
return
messageId
;
}
public
String
getRemark
()
{
return
remark
;
}
public
int
getSource
()
{
return
source
;
}
public
String
getText
()
{
return
text
;
}
public
long
getTime
()
{
return
time
;
}
public
String
getTitle
()
{
return
title
;
}
public
int
getType
()
{
return
type
;
}
public
String
getVideos
()
{
return
videos
;
}
public
int
getVisible
()
{
return
visible
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
void
setAudios
(
String
audios
)
{
this
.
audios
=
audios
;
}
public
void
setFlag
(
int
flag
)
{
this
.
flag
=
flag
;
}
public
void
setImages
(
String
images
)
{
this
.
images
=
images
;
}
public
void
setMessageId
(
String
messageId
)
{
this
.
messageId
=
messageId
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
void
setSource
(
int
source
)
{
this
.
source
=
source
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
void
setVideos
(
String
videos
)
{
this
.
videos
=
videos
;
}
public
void
setVisible
(
int
visible
)
{
this
.
visible
=
visible
;
}
public
List
<
Integer
>
getUserLook
()
{
return
userLook
;
}
public
void
setUserLook
(
List
<
Integer
>
userLook
)
{
this
.
userLook
=
userLook
;
}
public
List
<
Integer
>
getUserNotLook
()
{
return
userNotLook
;
}
public
void
setUserNotLook
(
List
<
Integer
>
userNotLook
)
{
this
.
userNotLook
=
userNotLook
;
}
public
List
<
Integer
>
getUserRemindLook
()
{
return
userRemindLook
;
}
public
void
setUserRemindLook
(
List
<
Integer
>
userRemindLook
)
{
this
.
userRemindLook
=
userRemindLook
;
}
public
String
getFiles
()
{
return
files
;
}
public
void
setFiles
(
String
files
)
{
this
.
files
=
files
;
}
public
String
getSdkUrl
()
{
return
sdkUrl
;
}
public
void
setSdkUrl
(
String
sdkUrl
)
{
this
.
sdkUrl
=
sdkUrl
;
}
public
String
getSdkIcon
()
{
return
sdkIcon
;
}
public
void
setSdkIcon
(
String
sdkIcon
)
{
this
.
sdkIcon
=
sdkIcon
;
}
public
String
getSdkTitle
()
{
return
sdkTitle
;
}
public
void
setSdkTitle
(
String
sdkTitle
)
{
this
.
sdkTitle
=
sdkTitle
;
}
public
String
getLable
()
{
return
lable
;
}
public
void
setLable
(
String
lable
)
{
this
.
lable
=
lable
;
}
public
String
getMusicId
()
{
return
musicId
;
}
public
void
setMusicId
(
String
musicId
)
{
this
.
musicId
=
musicId
;
}
public
int
getIsAllowComment
()
{
return
isAllowComment
;
}
public
void
setIsAllowComment
(
int
isAllowComment
)
{
this
.
isAllowComment
=
isAllowComment
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Comment.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
/**
* 朋友圈评论
* @author Administrator
*
*/
@Entity
(
value
=
"s_comment"
,
noClassnameStored
=
true
)
public
class
Comment
{
private
String
body
;
// 评论内容
private
@Id
ObjectId
commentId
;
// 评论Id
private
@Indexed
ObjectId
msgId
;
// 评论所属消息Id
private
String
nickname
;
// 评论用户昵称
private
long
time
;
// 评论时间
private
String
toBody
;
// 被回复内容
private
String
toNickname
;
// 被回复人用户昵称
private
int
toUserId
;
// 被回复用户Id
private
int
userId
;
// 评论用户Id
public
Comment
()
{
super
();
}
public
Comment
(
ObjectId
commentId
,
ObjectId
msgId
,
int
userId
,
String
nickname
,
String
body
,
int
toUserId
,
String
toNickname
,
String
toBody
,
long
time
)
{
super
();
this
.
commentId
=
commentId
;
this
.
msgId
=
msgId
;
this
.
userId
=
userId
;
this
.
nickname
=
nickname
;
this
.
body
=
body
;
this
.
toUserId
=
toUserId
;
this
.
toNickname
=
toNickname
;
this
.
toBody
=
toBody
;
this
.
time
=
time
;
}
public
String
getBody
()
{
return
body
;
}
public
ObjectId
getCommentId
()
{
return
commentId
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
long
getTime
()
{
return
time
;
}
public
String
getToBody
()
{
return
toBody
;
}
public
String
getToNickname
()
{
return
toNickname
;
}
public
int
getToUserId
()
{
return
toUserId
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
void
setCommentId
(
ObjectId
commentId
)
{
this
.
commentId
=
commentId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setToBody
(
String
toBody
)
{
this
.
toBody
=
toBody
;
}
public
void
setToNickname
(
String
toNickname
)
{
this
.
toNickname
=
toNickname
;
}
public
void
setToUserId
(
int
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
//@Override
/*public String toString() {
return JSONUtil.toJSONString(this);
}*/
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Givegift.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
import
org.mongodb.morphia.annotations.NotSaved
;
/**
* 送礼物记录
* @author Administrator
*
*/
@Entity
(
value
=
"givegift"
,
noClassnameStored
=
true
)
public
class
Givegift
{
private
@Id
ObjectId
id
;
// 送礼物记录Id
private
int
count
;
// 礼物数量
private
ObjectId
giftId
;
// 礼物Id
private
@Indexed
ObjectId
msgId
;
// 送礼物所属消息Id
private
String
nickname
;
// 送礼物用户昵称
private
Double
price
;
// 礼物价格
private
Double
actualPrice
;
// 实收金额
private
long
time
;
// 送礼物时间
private
@Indexed
int
userId
;
// 送礼物用户Id
private
int
toUserId
;
//接收礼物用户Id
@NotSaved
private
String
giftName
;
// 礼物名称
@NotSaved
private
String
liveRoomName
;
// 直播间名称
@NotSaved
private
String
userName
;
// 送礼物用户昵称
@NotSaved
private
String
toUserName
;
// 接收礼物用户昵称
public
Givegift
()
{}
public
Givegift
(
int
count
,
ObjectId
giftId
,
ObjectId
msgId
,
String
nickname
,
Double
price
,
long
time
,
int
userId
,
int
toUserId
)
{
this
.
count
=
count
;
this
.
giftId
=
giftId
;
this
.
msgId
=
msgId
;
this
.
nickname
=
nickname
;
this
.
price
=
price
;
this
.
time
=
time
;
this
.
userId
=
userId
;
this
.
toUserId
=
toUserId
;
}
public
int
getCount
()
{
return
count
;
}
public
ObjectId
getGiftId
()
{
return
giftId
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
Double
getPrice
()
{
return
price
;
}
public
long
getTime
()
{
return
time
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setCount
(
int
count
)
{
this
.
count
=
count
;
}
public
void
setGiftId
(
ObjectId
giftId
)
{
this
.
giftId
=
giftId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setPrice
(
Double
price
)
{
this
.
price
=
price
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
public
int
getToUserId
()
{
return
toUserId
;
}
public
void
setToUserId
(
int
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
/*@Override
public String toString() {
return JSONUtil.toJSONString(this);
}*/
public
String
getGiftName
()
{
return
giftName
;
}
public
void
setGiftName
(
String
giftName
)
{
this
.
giftName
=
giftName
;
}
public
Double
getActualPrice
()
{
return
actualPrice
;
}
public
void
setActualPrice
(
Double
actualPrice
)
{
this
.
actualPrice
=
actualPrice
;
}
public
String
getLiveRoomName
()
{
return
liveRoomName
;
}
public
void
setLiveRoomName
(
String
liveRoomName
)
{
this
.
liveRoomName
=
liveRoomName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getToUserName
()
{
return
toUserName
;
}
public
void
setToUserName
(
String
toUserName
)
{
this
.
toUserName
=
toUserName
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Msg.java
0 → 100644
View file @
3a3f4a03
This diff is collapsed.
Click to expand it.
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Praise.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
@Entity
(
value
=
"s_praise"
,
noClassnameStored
=
true
)
public
class
Praise
{
private
@Indexed
ObjectId
msgId
;
// 赞所属消息Id
private
String
nickname
;
// 赞用户昵称
private
@Id
ObjectId
praiseId
;
// 赞Id
private
long
time
;
// 赞时间
private
int
userId
;
// 赞用户Id
public
Praise
()
{
super
();
}
public
Praise
(
ObjectId
praiseId
,
ObjectId
msgId
,
int
userId
,
String
nickname
,
long
time
)
{
super
();
this
.
praiseId
=
praiseId
;
this
.
msgId
=
msgId
;
this
.
userId
=
userId
;
this
.
nickname
=
nickname
;
this
.
time
=
time
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
ObjectId
getPraiseId
()
{
return
praiseId
;
}
public
long
getTime
()
{
return
time
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setPraiseId
(
ObjectId
praiseId
)
{
this
.
praiseId
=
praiseId
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
/*@Override
public String toString() {
return JSONUtil.toJSONString(this);
}*/
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/MsgController.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
rest
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.mongodb.DBCursor
;
import
com.xxfc.platform.im.biz.MsgBiz
;
import
com.xxfc.platform.im.biz.UserBiz
;
import
com.xxfc.platform.im.model.Msg
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"msg"
)
public
class
MsgController
{
@Autowired
private
MsgBiz
msgBiz
;
@RequestMapping
(
value
=
"/app/unauth/list"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
getMsgList
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
//@RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "limit", required = true) Integer limit
return
msgBiz
.
getMsgList
(
map
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/utils/BeanUtil.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
im
.
utils
;
import
com.mongodb.DBObject
;
import
org.apache.commons.beanutils.BeanUtils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
public
class
BeanUtil
{
/**
* 将DBObject转换成Bean对象
*
*/
public
static
<
T
>
T
dbObjectToBean
(
DBObject
dbObject
,
T
bean
)
throws
IllegalAccessException
,
InvocationTargetException
,
NoSuchMethodException
{
if
(
bean
==
null
)
{
return
null
;
}
Field
[]
fields
=
bean
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
String
varName
=
field
.
getName
();
Object
object
=
dbObject
.
get
(
varName
);
if
(
object
!=
null
)
{
org
.
apache
.
commons
.
beanutils
.
BeanUtils
.
setProperty
(
bean
,
varName
,
object
);
}
}
return
bean
;
}
// 取出Mongo中的属性值,为bean赋值
public
static
<
T
>
void
setProperty
(
T
bean
,
String
varName
,
T
object
)
{
varName
=
varName
.
substring
(
0
,
1
).
toUpperCase
()
+
varName
.
substring
(
1
);
try
{
String
type
=
object
.
getClass
().
getName
();
// 类型为String
if
(
type
.
equals
(
"java.lang.String"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
()
.
getMethod
(
"set"
+
varName
,
String
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
// 类型为Integer
if
(
type
.
equals
(
"java.lang.Integer"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
().
getMethod
(
"set"
+
varName
,
Integer
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
// 类型为Boolean
if
(
type
.
equals
(
"java.lang.Boolean"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
().
getMethod
(
"set"
+
varName
,
Boolean
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
}
xx-tour/xx-tour-server/pom.xml
View file @
3a3f4a03
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<groupId>
com.xxfc.platform
</groupId>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-tour-api
</artifactId>
<artifactId>
xx-tour-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/IdInformation.java
View file @
3a3f4a03
...
@@ -19,7 +19,7 @@ import java.util.Date;
...
@@ -19,7 +19,7 @@ import java.util.Date;
/**
/**
* 证件信息表
* 证件信息表
*/
*/
@Table
(
name
=
"
app_user_logi
n"
)
@Table
(
name
=
"
id_informatio
n"
)
@Data
@Data
public
class
IdInformation
implements
Serializable
{
public
class
IdInformation
implements
Serializable
{
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/CertificationController.java
View file @
3a3f4a03
...
@@ -68,7 +68,7 @@ public class CertificationController {
...
@@ -68,7 +68,7 @@ public class CertificationController {
//获取用户认证信息
//获取用户认证信息
ObjectRestResponse
orr
=
userFeign
.
authentication
(
idInformation
.
getUserLonginId
(),
null
,
0
);
ObjectRestResponse
orr
=
userFeign
.
authentication
(
idInformation
.
getUserLonginId
(),
null
,
null
,
0
);
if
(
orr
==
null
)
{
if
(
orr
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
GET_AUTH_INFO_FAILED_CODE
,
"获取用户认证信息失败"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
GET_AUTH_INFO_FAILED_CODE
,
"获取用户认证信息失败"
);
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/CertificationService.java
View file @
3a3f4a03
...
@@ -474,7 +474,7 @@ public class CertificationService {
...
@@ -474,7 +474,7 @@ public class CertificationService {
//认证成功后修改用户,用户认证状态
//认证成功后修改用户,用户认证状态
ObjectRestResponse
authentication
=
userFeign
.
authentication
(
idInformation
.
getUserLonginId
(),
idInformation
.
getIdNumber
(),
1
);
ObjectRestResponse
authentication
=
userFeign
.
authentication
(
idInformation
.
getUserLonginId
(),
idInformation
.
get
Name
(),
idInformation
.
get
IdNumber
(),
1
);
return
authentication
.
getRel
();
return
authentication
.
getRel
();
}
}
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
java.util.Date
;
import
java.util.Date
;
@Table
(
name
=
"vehicle_book_hour_info"
)
@Table
(
name
=
"vehicle_book_hour_info"
)
@Data
public
class
VehicleBookHourInfo
{
public
class
VehicleBookHourInfo
{
@Id
@Id
private
Integer
id
;
private
Integer
id
;
...
@@ -24,88 +27,4 @@ public class VehicleBookHourInfo {
...
@@ -24,88 +27,4 @@ public class VehicleBookHourInfo {
@Column
(
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
private
Date
updateTime
;
/**
* @return id
*/
public
Integer
getId
()
{
return
id
;
}
/**
* @param id
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* @return vehicle_id
*/
public
String
getVehicleId
()
{
return
vehicleId
;
}
/**
* @param vehicleId
*/
public
void
setVehicleId
(
String
vehicleId
)
{
this
.
vehicleId
=
vehicleId
;
}
/**
* @return year_month_day
*/
public
String
getYearMonthDay
()
{
return
yearMonthDay
;
}
/**
* @param yearMonthDay
*/
public
void
setYearMonthDay
(
String
yearMonthDay
)
{
this
.
yearMonthDay
=
yearMonthDay
;
}
/**
* @return booked_hour
*/
public
Integer
getBookedHour
()
{
return
bookedHour
;
}
/**
* @param bookedHour
*/
public
void
setBookedHour
(
Integer
bookedHour
)
{
this
.
bookedHour
=
bookedHour
;
}
/**
* @return create_time
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* @param createTime
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* @return update_time
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
/**
* @param updateTime
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
View file @
3a3f4a03
...
@@ -11,7 +11,7 @@ public class BookVehicleVO {
...
@@ -11,7 +11,7 @@ public class BookVehicleVO {
* 车辆id
* 车辆id
*/
*/
@ApiModelProperty
(
"车辆id"
)
@ApiModelProperty
(
"车辆id"
)
private
String
vehicle
;
private
String
vehicle
Id
;
/**
/**
* 预定目标日期(开始)
* 预定目标日期(开始)
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleBookHourInfoDto.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
lombok.Data
;
@Data
public
class
VehicleBookHourInfoDto
extends
VehicleBookHourInfo
{
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
3a3f4a03
...
@@ -63,7 +63,8 @@ import java.util.stream.Collectors;
...
@@ -63,7 +63,8 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
VehicleBiz
extends
BaseBiz
<
VehicleMapper
,
Vehicle
>
{
public
class
VehicleBiz
extends
BaseBiz
<
VehicleMapper
,
Vehicle
>
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
YEARMONTH_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM"
);
public
static
final
DateTimeFormatter
YEARMONTH_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM"
);
/**
/**
* 允许查询预定信息的最大月份数
* 允许查询预定信息的最大月份数
...
@@ -82,7 +83,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -82,7 +83,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
@Autowired
@Autowired
private
RedisTemplate
customRedisTemplate
;
private
RedisTemplate
customRedisTemplate
;
@Autowired
private
VehicleBookHourInfoBiz
vehicleBookHourInfoBiz
;
@Value
(
"${vehicle.baseUploadPath}"
)
@Value
(
"${vehicle.baseUploadPath}"
)
private
String
baseUploadPath
;
private
String
baseUploadPath
;
...
@@ -286,10 +288,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -286,10 +288,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Transactional
@Transactional
public
VehicleBookRecord
applyVehicle4Employee
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
public
VehicleBookRecord
applyVehicle4Employee
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
//检查车辆信息是否合法
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicle
());
checkIfVehicleExists
(
bookVehicleVo
.
getVehicle
Id
());
//提取日期和相应的预定目标日期
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
...
@@ -297,14 +299,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -297,14 +299,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
}
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
}
}
//加入预定申请记录
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicle
());
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicle
Id
());
vehicleBookRecord
.
setBookType
(
BookType
.
EMPLOYEE_APPLY
.
getCode
());
vehicleBookRecord
.
setBookType
(
BookType
.
EMPLOYEE_APPLY
.
getCode
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUser
(
userId
);
...
@@ -319,6 +322,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -319,6 +322,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecordMapper
.
insertSelective
(
vehicleBookRecord
);
vehicleBookRecordMapper
.
insertSelective
(
vehicleBookRecord
);
//添加预定时间记录
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
());
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookHourInfoDto
.
setYearMonthDay
(
entry
.
getKey
());
vehicleBookHourInfoDto
.
setBookedHour
(
entry
.
getValue
());
vehicleBookHourInfoBiz
.
save
(
vehicleBookHourInfoDto
);
}
//修改相关车辆预定记录
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
if
(!
hasSuc
){
...
@@ -392,6 +406,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -392,6 +406,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
// return RestResponse.code(ResCode.VEHICLE_BOOKED_INFO_ALREADY_CHANGED.getCode());
// return RestResponse.code(ResCode.VEHICLE_BOOKED_INFO_ALREADY_CHANGED.getCode());
// }
// }
// }
// }
//如果拒绝预定,删除预定时间记录
if
(
VehicleBookRecordStatus
.
APPLY
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
()))
{
//删除预定时间记录
List
<
String
>
list
=
null
;
for
(
DateTime
curDate
=
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
());
curDate
.
compareTo
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()))<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
list
.
add
(
curDate
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
));
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
}
//成功后修改预定记录状态
//成功后修改预定记录状态
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
updateParam
.
put
(
"id"
,
bookRecordId
);
updateParam
.
put
(
"id"
,
bookRecordId
);
...
@@ -419,6 +442,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -419,6 +442,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
if
(
vehicleBookRecord
==
null
){
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
throw
new
CustomIllegalParamException
(
" invalid book record"
);
}
}
//已通过审核的可以取消预定
if
(!
VehicleBookRecordStatus
.
APPROVE
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
())){
if
(!
VehicleBookRecordStatus
.
APPROVE
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
())){
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
}
...
@@ -446,6 +470,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -446,6 +470,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
}
//删除预定时间记录
List
<
String
>
list
=
Lists
.
newArrayList
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
log
.
info
(
"当前日期:"
+
curDate
);
String
date
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
list
.
add
(
date
);
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
return
RestResponse
.
suc
();
return
RestResponse
.
suc
();
}
}
...
@@ -498,7 +532,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -498,7 +532,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
}
Boolean
rs
=
Boolean
.
TRUE
;
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
bookedVehiclePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
bookedVehiclePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
rs
=
Boolean
.
FALSE
;
rs
=
Boolean
.
FALSE
;
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
...
@@ -528,7 +562,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -528,7 +562,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
Integer
effected
=
vehicleBookInfoMapper
.
insertIgnore
(
vehicleBookInfo
);
Integer
effected
=
vehicleBookInfoMapper
.
insertIgnore
(
vehicleBookInfo
);
if
(
effected
==
0
){
//已存在则需要更新
if
(
effected
==
0
){
//已存在则需要更新
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"vehicle"
,
vehicleBookInfo
.
getVehicle
());
params
.
put
(
"vehicle
Id
"
,
vehicleBookInfo
.
getVehicle
());
params
.
put
(
"yearMonth"
,
yearMonth
);
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
bookedDates
)){
if
(
CollectionUtils
.
isEmpty
(
bookedDates
)){
...
@@ -606,7 +640,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -606,7 +640,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
}
Boolean
rs
=
Boolean
.
TRUE
;
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
unbookVehiclePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
unbookVehiclePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
rs
=
Boolean
.
FALSE
;
rs
=
Boolean
.
FALSE
;
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
...
@@ -619,7 +653,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -619,7 +653,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
public
Boolean
unbookVehiclePerMonth
(
String
vehicleId
,
List
<
String
>
unbookDates
,
String
yearMonth
){
public
Boolean
unbookVehiclePerMonth
(
String
vehicleId
,
List
<
String
>
unbookDates
,
String
yearMonth
){
checkIfVehicleExists
(
vehicleId
);
checkIfVehicleExists
(
vehicleId
);
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"vehicle"
,
vehicleId
);
params
.
put
(
"vehicle
Id
"
,
vehicleId
);
params
.
put
(
"yearMonth"
,
yearMonth
);
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
unbookDates
)){
if
(
CollectionUtils
.
isEmpty
(
unbookDates
)){
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
0 → 100644
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper
;
import
com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
public
class
VehicleBookHourInfoBiz
extends
BaseBiz
<
VehicleBookHourInfoMapper
,
VehicleBookHourInfo
>
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartdate
,
String
bookEndDate
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
startDate
=
null
;
Date
endDate
=
null
;
try
{
startDate
=
simpleDateFormat
.
parse
(
bookStartdate
);
endDate
=
simpleDateFormat
.
parse
(
bookEndDate
);
}
catch
(
Exception
e
)
{
}
//判定时间是否合法
if
(
bookStartdate
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))
<
0
)
{
throw
new
CustomIllegalParamException
(
"you can only book from today"
);
}
if
(
bookStartdate
.
compareTo
(
bookEndDate
)
>
0
)
{
throw
new
CustomIllegalParamException
(
"预定开始日期不能大于结束日期!"
);
}
Map
<
String
,
Integer
>
predictableHours
=
Maps
.
newHashMap
();
//预定开始小时
int
hour
=
new
DateTime
(
startDate
).
hourOfDay
().
get
();
int
endHour
=
new
DateTime
(
endDate
).
hourOfDay
().
get
();
//获取开始天的预定小时
int
startPredictableHour
=
0
;
for
(
int
curentHour
=
hour
;
curentHour
<
24
;
curentHour
++)
{
startPredictableHour
|=
1
<<
(
curentHour
-
1
);
}
//获取结束天的预定小时
int
endPredictableHour
=
0
;
for
(
int
curentHour
=
0
;
curentHour
<
endHour
;
curentHour
++)
{
endPredictableHour
|=
1
<<
(
curentHour
);
}
predictableHours
.
put
(
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
startPredictableHour
);
predictableHours
.
put
(
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
endPredictableHour
);
DateTime
startDay
=
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
);
if
(
startDay
.
getHourOfDay
()
-
endDay
.
getHourOfDay
()
>
1
){
//
for
(
DateTime
curDate
=
startDay
.
plusDays
(
1
);
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
String
curDateStr
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
//全天预定
predictableHours
.
put
(
curDateStr
,
16777215
);
}
}
return
predictableHours
;
}
// public static void main(String[] args) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date startDate = null;
// Date endDate = null;
// try{
// startDate = simpleDateFormat.parse("2019-06-21 16:30:30");
// endDate = simpleDateFormat.parse("2019-06-22 12:30:30");
// }catch (Exception e) {
//
// }
// Map<String, Integer> map = getPredictableHours(startDate, endDate);
// for(Map.Entry<String, Integer> entry : map.entrySet()) {
// System.out.println(entry.getKey());
// System.out.println(entry.getValue());
// }
// }
@Transactional
public
ObjectRestResponse
save
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
if
(
vehicleBookHourInfoDto
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
502
,
"参数为空"
);
}
List
<
VehicleBookHourInfo
>
vehicleBookHourInfos
=
mapper
.
selectByVehicleAndDate
(
vehicleBookHourInfoDto
);
//有数据直接更新
if
(
vehicleBookHourInfos
.
size
()
>=
1
)
{
for
(
VehicleBookHourInfo
vehicleBookHourInfo
:
vehicleBookHourInfos
)
{
if
(
vehicleBookHourInfo
.
getBookedHour
().
equals
(
vehicleBookHourInfoDto
.
getBookedHour
()))
{
return
ObjectRestResponse
.
createFailedResult
(
504
,
"当天时间段已经被预定"
);
}
else
{
vehicleBookHourInfo
.
setBookedHour
(
vehicleBookHourInfo
.
getBookedHour
()
|
vehicleBookHourInfoDto
.
getBookedHour
());
mapper
.
updateByPrimaryKeySelective
(
vehicleBookHourInfo
);
}
}
return
ObjectRestResponse
.
succ
();
}
//没有数据直接添加
mapper
.
insertSelective
(
vehicleBookHourInfoDto
);
return
ObjectRestResponse
.
succ
();
}
/**
* 删除预定车辆小时记录信息
* @param vehicleId 车辆Id
* @param dateList 日期列表
* @return
*/
@Transactional
public
ObjectRestResponse
delete
(
String
vehicleId
,
List
<
String
>
dateList
)
{
if
(
StringUtils
.
isBlank
(
vehicleId
)
||
dateList
.
size
()
<=
0
)
{
return
ObjectRestResponse
.
createFailedResult
(
502
,
"删除信息车辆Id为空"
);
}
Map
<
String
,
Object
>
param
=
Maps
.
newHashMap
();
param
.
put
(
"vehicleId"
,
vehicleId
);
param
.
put
(
"list"
,
dateList
);
List
<
VehicleBookHourInfo
>
list
=
mapper
.
selectByVehicleAndDateList
(
param
);
list
.
forEach
((
a
)
->
mapper
.
delete
(
a
));
return
ObjectRestResponse
.
succ
();
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
View file @
3a3f4a03
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
public
interface
VehicleBookHourInfoMapper
extends
Mapper
<
VehicleBookHourInfo
>
{
public
interface
VehicleBookHourInfoMapper
extends
Mapper
<
VehicleBookHourInfo
>
{
List
<
VehicleBookHourInfo
>
selectByVehicleAndDate
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
);
List
<
VehicleBookHourInfo
>
selectByVehicleAndDateList
(
Map
<
String
,
Object
>
param
);
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
3a3f4a03
...
@@ -185,7 +185,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -185,7 +185,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
*/
*/
@RequestMapping
(
value
=
"/book/4employee"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/book/4employee"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"申请预定车辆信息"
)
@ApiOperation
(
value
=
"申请预定车辆信息"
)
public
RestResponse
<
Integer
>
applyVehicle
(
@RequestBody
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
public
RestResponse
<
Integer
>
applyVehicle
(
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
String
userName
=
BaseContextHandler
.
getName
();
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
...
@@ -374,11 +374,11 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -374,11 +374,11 @@ public class VehicleController extends BaseController<VehicleBiz> {
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
}
}
bookVehicleVo
.
setVehicle
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
bookVehicleVo
.
setVehicle
Id
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
VehicleBookRecord
vehicleBookRecord
=
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
return
ObjectRestResponse
.
succ
(
vehicleBookRecord
);
return
ObjectRestResponse
.
succ
(
bookVehicleVo
.
getVehicleId
()
);
}
}
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
0 → 100644
View file @
3a3f4a03
<?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.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"vehicle_id"
property=
"vehicleId"
jdbcType=
"VARCHAR"
/>
<result
column=
"year_month_day"
property=
"yearMonthDay"
jdbcType=
"VARCHAR"
/>
<result
column=
"booked_hour"
property=
"bookedHour"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<select
id=
"selectByVehicleAndDate"
parameterType=
"com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day = #{yearMonthDay}
</select>
<select
id=
"selectByVehicleAndDateList"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day in
<foreach
collection=
"list"
item=
"yearMonthDay"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{yearMonthDay}
</foreach>
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookInfoMapper.xml
View file @
3a3f4a03
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
</choose>
</choose>
where
where
vehicle = #{vehicle} and `year_month`=#{yearMonth} and
vehicle = #{vehicle
Id
} and `year_month`=#{yearMonth} and
booked_date
&
#{andOperationFactor} = #{andOperationRs}
booked_date
&
#{andOperationFactor} = #{andOperationRs}
</update>
</update>
...
...
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