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
00939e26
Commit
00939e26
authored
Jun 22, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://113.105.137.151:22280/youjj/cloud-platform
into base-modify
parents
008339bb
10925dc8
Changes
73
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
73 changed files
with
3337 additions
and
204 deletions
+3337
-204
pom.xml
ace-auth/ace-auth-server/pom.xml
+2
-2
bootstrap.yml
ace-auth/ace-auth-server/src/main/resources/bootstrap.yml
+1
-1
pom.xml
ace-common/pom.xml
+2
-2
BaseBiz.java
.../java/com/github/wxiaoqi/security/common/biz/BaseBiz.java
+4
-5
VersionMapper.java
.../github/wxiaoqi/security/common/mapper/VersionMapper.java
+23
-0
ResultCode.java
...thub/wxiaoqi/security/common/util/process/ResultCode.java
+2
-0
resultcod.properties
...common/src/main/resources/properties/resultcod.properties
+5
-0
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+8
-2
AppUserDTO.java
...m/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
+1
-0
pom.xml
ace-modules/ace-admin/pom.xml
+11
-6
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
+35
-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
+111
-0
UserCouponVo.java
...main/java/com/xxfc/platform/activity/vo/UserCouponVo.java
+148
-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
+122
-0
CouponMapper.java
.../java/com/xxfc/platform/activity/mapper/CouponMapper.java
+15
-0
UserCouponMapper.java
...a/com/xxfc/platform/activity/mapper/UserCouponMapper.java
+25
-0
ActivityBaseController.java
...m/xxfc/platform/activity/rest/ActivityBaseController.java
+34
-0
CouponController.java
...ava/com/xxfc/platform/activity/rest/CouponController.java
+13
-0
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+51
-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
+71
-0
pom.xml
xx-common/xx-common-platform/pom.xml
+6
-6
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
BaseOrder.java
...c/main/java/com/xxfc/platform/order/entity/BaseOrder.java
+6
-6
OrderPageVO.java
.../java/com/xxfc/platform/order/pojo/order/OrderPageVO.java
+4
-0
pom.xml
xx-order/xx-order-server/pom.xml
+5
-0
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+37
-11
RabbitUserConfig.java
...java/com/xxfc/platform/order/config/RabbitUserConfig.java
+52
-0
OrderRentVehicleService.java
.../xxfc/platform/order/service/OrderRentVehicleService.java
+14
-0
OrderTest.java
...rver/src/test/java/com/xxfc/platform/order/OrderTest.java
+37
-0
RabbitmqTest.java
...r/src/test/java/com/xxfc/platform/order/RabbitmqTest.java
+63
-0
RabbitmqTest2.java
.../src/test/java/com/xxfc/platform/order/RabbitmqTest2.java
+52
-0
RabbitmqTest3.java
.../src/test/java/com/xxfc/platform/order/RabbitmqTest3.java
+36
-0
RegionTest.java
...ver/src/test/java/com/xxfc/platform/order/RegionTest.java
+7
-0
pom.xml
xx-tour/xx-tour-server/pom.xml
+1
-0
TourBannerController.java
...ava/com/xxfc/platform/tour/rest/TourBannerController.java
+1
-1
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
VehicleModelVo.java
...n/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
+12
-2
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
VehicleModelBiz.java
...n/java/com/xxfc/platform/vehicle/biz/VehicleModelBiz.java
+2
-1
VehicleBookHourInfoMapper.java
...fc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
+7
-0
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+4
-4
VehicleModelController.java
...om/xxfc/platform/vehicle/rest/VehicleModelController.java
+6
-0
VehicleBookHourInfoMapper.xml
...r/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
+29
-0
VehicleBookInfoMapper.xml
...erver/src/main/resources/mapper/VehicleBookInfoMapper.xml
+1
-1
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+54
-44
VehicleModelMapper.xml
...e-server/src/main/resources/mapper/VehicleModelMapper.xml
+6
-2
No files found.
ace-auth/ace-auth-server/pom.xml
View file @
00939e26
...
@@ -91,13 +91,13 @@
...
@@ -91,13 +91,13 @@
<dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper-spring-boot-starter
</artifactId>
<artifactId>
mapper-spring-boot-starter
</artifactId>
<version>
1.1.2
</version>
<version>
2.1.5
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.
3
</version>
<version>
1.2.
10
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
ace-auth/ace-auth-server/src/main/resources/bootstrap.yml
View file @
00939e26
...
@@ -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-common/pom.xml
View file @
00939e26
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper
</artifactId>
<artifactId>
mapper
</artifactId>
<version>
3.4.0
</version>
<version>
4.1.5
</version>
</dependency>
</dependency>
<!-- <dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<groupId>org.springframework</groupId>
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
<dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
<artifactId>
pagehelper
</artifactId>
<version>
5.
0.3
</version>
<version>
5.
1.8
</version>
</dependency>
</dependency>
<!-- <dependency>
<!-- <dependency>
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/biz/BaseBiz.java
View file @
00939e26
...
@@ -74,16 +74,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
...
@@ -74,16 +74,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
}
}
public
void
updateById
(
T
entity
)
{
public
int
updateById
(
T
entity
)
{
EntityUtils
.
setUpdatedInfo
(
entity
);
EntityUtils
.
setUpdatedInfo
(
entity
);
mapper
.
updateByPrimaryKey
(
entity
);
return
mapper
.
updateByPrimaryKey
(
entity
);
}
}
public
void
updateSelectiveById
(
T
entity
)
{
public
int
updateSelectiveById
(
T
entity
)
{
EntityUtils
.
setUpdatedInfo
(
entity
);
EntityUtils
.
setUpdatedInfo
(
entity
);
mapper
.
updateByPrimaryKeySelective
(
entity
);
return
mapper
.
updateByPrimaryKeySelective
(
entity
);
}
}
public
List
<
T
>
selectByExample
(
Object
example
)
{
public
List
<
T
>
selectByExample
(
Object
example
)
{
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/mapper/VersionMapper.java
0 → 100644
View file @
00939e26
package
com
.
github
.
wxiaoqi
.
security
.
common
.
mapper
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
tk.mybatis.mapper.common.Mapper
;
public
interface
VersionMapper
<
T
>
extends
Mapper
<
T
>
{
default
int
deleteWithVersion
(
T
t
)
{
int
result
=
delete
(
t
);
if
(
result
==
0
)
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
return
result
;
}
default
int
updateByPrimaryKeyWithVersion
(
T
t
){
int
result
=
updateByPrimaryKey
(
t
);
if
(
result
==
0
)
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
return
result
;
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/ResultCode.java
View file @
00939e26
...
@@ -21,6 +21,8 @@ public class ResultCode {
...
@@ -21,6 +21,8 @@ public class ResultCode {
public
static
int
RSTOKEN_EXPIRED_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"RSTOKEN_EXPIRED_CODE"
));
public
static
int
RSTOKEN_EXPIRED_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"RSTOKEN_EXPIRED_CODE"
));
// rstoken不合法
// rstoken不合法
public
static
int
RSTOKEN_NULL_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"RSTOKEN_NULL_CODE"
));
public
static
int
RSTOKEN_NULL_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"RSTOKEN_NULL_CODE"
));
// 数据库操作失败
public
static
int
DB_OPERATION_FAIL_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"DB_OPERATION_FAIL_CODE"
));
// 请求微信接口错误
// 请求微信接口错误
public
static
int
WXAPI_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"WXAPI_CODE"
));
public
static
int
WXAPI_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"WXAPI_CODE"
));
// 微信用户不存在
// 微信用户不存在
...
...
ace-common/src/main/resources/properties/resultcod.properties
View file @
00939e26
...
@@ -27,6 +27,11 @@ RSTOKEN_EXPIRED_CODE=1006
...
@@ -27,6 +27,11 @@ RSTOKEN_EXPIRED_CODE=1006
#rstoken为空
#rstoken为空
RSTOKEN_NULL_CODE
=
1007
RSTOKEN_NULL_CODE
=
1007
1007
=
rstoken为空
1007
=
rstoken为空
#数据库操作失败
DB_OPERATION_FAIL_CODE
=
1008
1008
=
数据库操作失败
#请求微信接口失败
#请求微信接口失败
WXAPI_CODE
=
2001
WXAPI_CODE
=
2001
#微信用不不存在
#微信用不不存在
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
00939e26
...
@@ -19,6 +19,11 @@ import java.util.List;
...
@@ -19,6 +19,11 @@ import java.util.List;
*/
*/
@FeignClient
(
value
=
"ace-admin"
)
@FeignClient
(
value
=
"ace-admin"
)
public
interface
UserFeign
{
public
interface
UserFeign
{
public
static
final
int
MEMBER_DAYS_LOCK
=
1
;
public
static
final
int
MEMBER_DAYS_CONFIRM
=
2
;
public
static
final
int
MEMBER_DAYS_WITHDRAW
=
3
;
@RequestMapping
(
value
=
"/public/userinfo-by-token"
)
@RequestMapping
(
value
=
"/public/userinfo-by-token"
)
public
ObjectRestResponse
<
UserDTO
>
userinfoByToken
(
@RequestParam
(
"token"
)
String
token
);
public
ObjectRestResponse
<
UserDTO
>
userinfoByToken
(
@RequestParam
(
"token"
)
String
token
);
...
@@ -38,6 +43,7 @@ public interface UserFeign {
...
@@ -38,6 +43,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
);
...
@@ -70,7 +76,7 @@ public interface UserFeign {
...
@@ -70,7 +76,7 @@ public interface UserFeign {
* @throws Exception
* @throws Exception
*/
*/
@RequestMapping
(
value
=
"/member/user/buyMember"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/member/user/buyMember"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
buyMember
(
@RequestBody
UserMemberDTO
userMemberDTO
)
throws
Exception
;
public
ObjectRestResponse
buyMember
(
@RequestBody
UserMemberDTO
userMemberDTO
);
/**
/**
* 订单更改会员
* 订单更改会员
...
@@ -85,7 +91,7 @@ public interface UserFeign {
...
@@ -85,7 +91,7 @@ public interface UserFeign {
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"days"
,
defaultValue
=
"0"
)
Integer
days
,
@RequestParam
(
value
=
"days"
,
defaultValue
=
"0"
)
Integer
days
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
)
throws
Exception
;
);
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
View file @
00939e26
...
@@ -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 @
00939e26
...
@@ -24,10 +24,10 @@
...
@@ -24,10 +24,10 @@
</targetResourcesProject>
</targetResourcesProject>
<targetXMLPackage>
mapper
</targetXMLPackage>
<targetXMLPackage>
mapper
</targetXMLPackage>
<!-- 依赖版本 -->
<!-- 依赖版本 -->
<mapper.version>
3.4.0
</mapper.version>
<mapper.version>
4.1.5
</mapper.version>
<mybatis.version>
3.
3.1
</mybatis.version>
<mybatis.version>
3.
4.6
</mybatis.version>
<mybatis.spring.version>
1.
2.4
</mybatis.spring.version>
<mybatis.spring.version>
1.
3.2
</mybatis.spring.version>
<pagehelper.version>
4.1.1
</pagehelper.version>
<pagehelper.version>
5.1.8
</pagehelper.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
...
@@ -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>
...
@@ -134,13 +139,13 @@
...
@@ -134,13 +139,13 @@
<dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper-spring-boot-starter
</artifactId>
<artifactId>
mapper-spring-boot-starter
</artifactId>
<version>
1.1.2
</version>
<version>
2.1.5
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.
3
</version>
<version>
1.2.
10
</version>
</dependency>
</dependency>
<!-- swagger -->
<!-- swagger -->
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
00939e26
...
@@ -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 @
00939e26
...
@@ -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 @
00939e26
...
@@ -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 @
00939e26
...
@@ -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 @
00939e26
<?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 @
00939e26
<?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 @
00939e26
package
com
.
xxfc
.
platform
.
activity
.
Feign
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.activity.vo.UserCouponVo
;
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
);
@ApiOperation
(
"单个优惠卷信息"
)
@RequestMapping
(
value
=
"/info/{no}"
,
method
=
RequestMethod
.
GET
)
public
UserCouponVo
info
(
@PathVariable
String
no
);
@ApiOperation
(
"优惠卷使用"
)
@RequestMapping
(
value
=
"/use"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
use
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"TickerNo"
)
String
TickerNo
,
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
);
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/constant/CouponUsed.java
0 → 100644
View file @
00939e26
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 @
00939e26
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 @
00939e26
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
=
"start_time"
)
@ApiModelProperty
(
value
=
"开始时间"
,
hidden
=
true
)
private
Long
startTime
;
/**
* 到期时间
*/
@Column
(
name
=
"expire_time"
)
@ApiModelProperty
(
value
=
"到期时间"
,
hidden
=
true
)
private
Long
expireTime
;
/**
* 使用时间
*/
@Column
(
name
=
"use_time"
)
@ApiModelProperty
(
value
=
"使用时间"
)
private
Long
useTime
;
/**
* 是否删除;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/vo/UserCouponVo.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
activity
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 我的优惠卷
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
@Data
public
class
UserCouponVo
{
/**
* 优惠卡券id
*/
@ApiModelProperty
(
value
=
"优惠卡券id"
)
private
Integer
couponId
;
/**
* 用户id
*/
@ApiModelProperty
(
value
=
"用户id"
)
private
Integer
userId
;
/**
* 券号
*/
@ApiModelProperty
(
value
=
"券号"
)
private
String
tickerNo
;
/**
* 0-未使用;1-已使用
*/
@ApiModelProperty
(
value
=
"0-未使用;1-已使用"
)
private
Integer
isUse
;
/**
* 使用订单号
*/
@ApiModelProperty
(
value
=
"使用订单号"
)
private
String
orderNo
;
/**
* 领卷时间
*/
@ApiModelProperty
(
value
=
"领卷时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 开始时间
*/
@ApiModelProperty
(
value
=
"开始时间"
,
hidden
=
true
)
private
Long
startTime
;
/**
* 到期时间
*/
@ApiModelProperty
(
value
=
"到期时间"
,
hidden
=
true
)
private
Long
expireTime
;
/**
* 使用时间
*/
@ApiModelProperty
(
value
=
"使用时间"
)
private
Long
useTime
;
/**
* 优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元
*/
@ApiModelProperty
(
value
=
"优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元"
)
private
String
title
;
/**
* 图片
*/
@ApiModelProperty
(
value
=
"图片"
)
private
String
icon
;
/**
* 可用于:10店铺优惠券 11新人店铺券 20商品优惠券 30类目优惠券 60平台优惠券 61新人平台券
*/
@ApiModelProperty
(
value
=
"可用于:10店铺优惠券 11新人店铺券 20商品优惠券 30类目优惠券 60平台优惠券 61新人平台券"
)
private
Integer
used
;
/**
* 0-全平台;1-租车;2-旅游;3-营地
*/
@ApiModelProperty
(
value
=
"0-全平台;1-租车;2-旅游;3-营地"
)
private
Integer
channel
;
/**
* 0-普通用户;1-会员用户
*/
@ApiModelProperty
(
value
=
"0-普通用户;1-会员用户"
)
private
Integer
userType
;
/**
* 1满减券 2叠加满减券 3无门槛券(需要限制大小)
*/
@ApiModelProperty
(
value
=
"1满减券 2叠加满减券 3无门槛券(需要限制大小)"
)
private
Integer
type
;
/**
* 1可用于特价商品 2不能 默认不能(商品优惠卷除外)
*/
@ApiModelProperty
(
value
=
"1可用于特价商品 2不能 默认不能(商品优惠卷除外)"
)
private
Integer
withSpecial
;
/**
* 店铺或商品流水号
*/
@ApiModelProperty
(
value
=
"店铺或商品流水号"
)
private
String
withSn
;
/**
* 满多少金额
*/
@ApiModelProperty
(
value
=
"满多少金额"
)
private
BigDecimal
withAmount
;
/**
* 用券抵扣金额
*/
@ApiModelProperty
(
value
=
"用券抵扣金额"
)
private
BigDecimal
usedAmount
;
/**
* 1生效 2失效 3已结束
*/
@ApiModelProperty
(
value
=
"1生效 2失效 3已结束"
)
private
Integer
status
;
/**
* 跳转链接
*/
@ApiModelProperty
(
value
=
"跳转链接"
)
private
String
url
;
}
xx-activity/xx-activity-server/pom.xml
0 → 100644
View file @
00939e26
<?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 @
00939e26
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 @
00939e26
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 @
00939e26
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.activity.vo.UserCouponVo
;
import
com.xxfc.platform.universal.weixin.util.Snowflake
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
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
;
private
static
final
Long
DAY
=
86400000L
;
//自动发送优惠卷
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
;
}
int
type
=
coupon
.
getValidType
();
Long
expireTime
=
System
.
currentTimeMillis
();
Long
startTime
=
0L
;
if
(
type
==
1
){
startTime
=
coupon
.
getStartTime
();
expireTime
=
coupon
.
getValidEndTime
();
}
else
{
startTime
=
expireTime
;
expireTime
+=
DAY
*
coupon
.
getValidDays
();
}
String
ticker_no
=
Snowflake
.
build
()+
""
;
UserCoupon
userCoupon
=
new
UserCoupon
();
userCoupon
.
setUserId
(
userId
);
userCoupon
.
setCouponId
(
couponId
);
userCoupon
.
setTickerNo
(
ticker_no
);
userCoupon
.
setStartTime
(
startTime
);
userCoupon
.
setExpireTime
(
expireTime
);
insertSelective
(
userCoupon
);
return
ticker_no
;
}
//获取我的优惠卷
public
ObjectRestResponse
getCouponList
(
Integer
userId
,
int
type
){
if
(
userId
==
null
||
userId
==
0
){
log
.
error
(
"----参数不能为空"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数不能为空"
);
}
Long
time
=
System
.
currentTimeMillis
();
return
ObjectRestResponse
.
succ
(
mapper
.
getUserCouponsByType
(
userId
,
type
,
time
));
}
//获取单个优惠卷
public
UserCouponVo
getUserCoupon
(
String
tickerNo
){
if
(
StringUtils
.
isBlank
(
tickerNo
)){
log
.
error
(
"----参数不能为空"
);
return
null
;
}
return
mapper
.
getUserCoupon
(
tickerNo
);
}
//支付后更新优惠卷状态
public
void
useTickerNo
(
Integer
userId
,
String
TickerNo
,
String
orderNo
){
if
(
userId
==
null
||
userId
==
0
||
StringUtils
.
isBlank
(
TickerNo
)){
log
.
error
(
"----参数不能为空"
);
return
;
}
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"TickerNo"
,
TickerNo
).
andEqualTo
(
"isDel"
,
0
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()==
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
return
;
}
UserCoupon
userCoupon
=
list
.
get
(
0
);
userCoupon
.
setIsUse
(
1
);
userCoupon
.
setOrderNo
(
orderNo
);
userCoupon
.
setUseTime
(
System
.
currentTimeMillis
());
updateSelectiveById
(
userCoupon
);
}
}
\ 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 @
00939e26
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 @
00939e26
package
com
.
xxfc
.
platform
.
activity
.
mapper
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
import
com.xxfc.platform.activity.vo.UserCouponVo
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
/**
* 我的优惠卷
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-21 14:34:49
*/
public
interface
UserCouponMapper
extends
Mapper
<
UserCoupon
>
{
//我的优惠卷
public
List
<
UserCouponVo
>
getUserCouponsByType
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"type"
)
int
type
,
@Param
(
"time"
)
Long
time
);
//单个优惠卷
public
UserCouponVo
getUserCoupon
(
@Param
(
"tickerNo"
)
String
tickerNo
);
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/ActivityBaseController.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.rest.CommonBaseController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
@Slf4j
public
class
ActivityBaseController
<
Biz
extends
BaseBiz
>
extends
CommonBaseController
{
@Autowired
protected
Biz
baseBiz
;
@Autowired
protected
UserFeign
userFeign
;
@Autowired
protected
UserAuthConfig
userAuthConfig
;
public
AppUserDTO
getUserInfo
(){
return
userFeign
.
userDetailByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
}
public
Biz
getBaseBiz
()
{
return
baseBiz
;
}
public
UserDTO
userinfoByToken
(){
return
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/CouponController.java
0 → 100644
View file @
00939e26
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 @
00939e26
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.activity.biz.UserCouponBiz
;
import
com.xxfc.platform.activity.vo.UserCouponVo
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"user"
)
public
class
UserCouponController
extends
ActivityBaseController
<
UserCouponBiz
>
{
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
)
{
return
baseBiz
.
authledCoupon
(
userId
);
}
@ApiOperation
(
"我的优惠卷"
)
@RequestMapping
(
value
=
"/list/{type}"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
list
(
@PathVariable
Integer
type
)
{
AppUserDTO
userInfo
=
getUserInfo
();
Integer
userId
=
userInfo
.
getId
();
if
(
userId
==
null
){
return
ObjectRestResponse
.
createDefaultFail
();
}
return
baseBiz
.
getCouponList
(
userId
,
type
);
}
@ApiOperation
(
"单个优惠卷信息"
)
@RequestMapping
(
value
=
"/info/{no}"
,
method
=
RequestMethod
.
GET
)
public
UserCouponVo
info
(
@PathVariable
String
no
)
{
return
baseBiz
.
getUserCoupon
(
no
);
}
@ApiOperation
(
"优惠卷使用"
)
@RequestMapping
(
value
=
"/use"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
use
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"TickerNo"
,
defaultValue
=
""
)
String
TickerNo
,
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
""
)
String
orderNo
)
{
baseBiz
.
useTickerNo
(
userId
,
TickerNo
,
orderNo
);
return
ObjectRestResponse
.
succ
();
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/bootstrap.yml
0 → 100644
View file @
00939e26
#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 @
00939e26
<?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 @
00939e26
<?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 @
00939e26
<?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.vo.UserCouponVo"
id=
"userCouponMap"
>
<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=
"startTime"
column=
"start_time"
/>
<result
property=
"expireTime"
column=
"expire_time"
/>
<result
property=
"useTime"
column=
"use_time"
/>
<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=
"status"
column=
"status"
/>
<result
property=
"url"
column=
"url"
/>
</resultMap>
<select
id=
"getUserCouponsByType"
resultMap=
"userCouponMap"
>
SELECT
*
FROM
user_coupon u
LEFT JOIN coupon c ON u.coupon_id = c.id
WHERE
u.is_del = 0 and u.user_id=#{userId}
<if
test=
"type==0"
>
and u.is_use=0 and u.expire_time >=#{time}
</if>
<if
test=
"type==1"
>
and u.is_use=1
</if>
<if
test=
"type==2"
>
and u.is_use=0 and u.expire_time
<
#{time}
</if>
<choose>
<when
test=
"type==1"
>
ORDER BY u.use_time DESC
</when>
<otherwise>
ORDER BY c.used_amount DESC
</otherwise>
</choose>
</select>
<select
id=
"getUserCoupon"
resultMap=
"userCouponMap"
>
SELECT
*
FROM
user_coupon u
LEFT JOIN coupon c ON u.coupon_id = c.id
WHERE
u.is_del = 0 and u.ticker_no=#{tickerNo} limit 1
</select>
</mapper>
\ No newline at end of file
xx-common/xx-common-platform/pom.xml
View file @
00939e26
...
@@ -25,12 +25,12 @@
...
@@ -25,12 +25,12 @@
<groupId>
com.github.wxiaoqi
</groupId>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-common
</artifactId>
<artifactId>
ace-common
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<version>
2.0-SNAPSHOT
</version>
<exclusions
>
<!-- <exclusions>--
>
<exclusion
>
<!-- <exclusion>--
>
<groupId>
tk.mybatis
</groupId
>
<!-- <groupId>tk.mybatis</groupId>--
>
<artifactId>
mapper
</artifactId
>
<!-- <artifactId>mapper</artifactId>--
>
</exclusion
>
<!-- </exclusion>--
>
</exclusions
>
<!-- </exclusions>--
>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
javax.persistence
</groupId>
<groupId>
javax.persistence
</groupId>
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
0 → 100644
View file @
00939e26
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 @
00939e26
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 @
00939e26
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 @
00939e26
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 @
00939e26
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 @
00939e26
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 @
00939e26
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 @
00939e26
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-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/BaseOrder.java
View file @
00939e26
...
@@ -203,10 +203,10 @@ public class BaseOrder implements Serializable {
...
@@ -203,10 +203,10 @@ public class BaseOrder implements Serializable {
@ApiModelProperty
(
value
=
"是否已支付"
)
@ApiModelProperty
(
value
=
"是否已支付"
)
private
Integer
hasPay
;
private
Integer
hasPay
;
/**
@Transient
* 乐观锁,修改版本号
private
String
username
;
*/
@Version
@Transient
@ApiModelProperty
(
value
=
"乐观锁,修改版本号"
)
private
String
vehicalNumberPlat
;
private
Integer
version
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/OrderPageVO.java
View file @
00939e26
...
@@ -11,4 +11,8 @@ import java.util.Map;
...
@@ -11,4 +11,8 @@ import java.util.Map;
public
class
OrderPageVO
extends
BaseOrder
{
public
class
OrderPageVO
extends
BaseOrder
{
OrderRentVehicleDetail
orderRentVehicleDetail
;
OrderRentVehicleDetail
orderRentVehicleDetail
;
OrderTourDetail
orderTourDetail
;
OrderTourDetail
orderTourDetail
;
private
String
username
;
private
String
vehicalNumberPlat
;
}
}
xx-order/xx-order-server/pom.xml
View file @
00939e26
...
@@ -33,6 +33,11 @@
...
@@ -33,6 +33,11 @@
<version>
2.0.2
</version>
<version>
2.0.2
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-amqp
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
00939e26
...
@@ -87,6 +87,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -87,6 +87,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
}});
}});
}
}
/**
* 取消订单
* @param baseOrder
*/
public
void
cancel
(
BaseOrder
baseOrder
)
{
public
void
cancel
(
BaseOrder
baseOrder
)
{
if
(
cancelAble
.
get
(
baseOrder
.
getType
()).
contains
(
baseOrder
.
getStatus
()))
{
if
(
cancelAble
.
get
(
baseOrder
.
getType
()).
contains
(
baseOrder
.
getStatus
()))
{
this
.
updateSelectiveById
(
new
BaseOrder
(){{
this
.
updateSelectiveById
(
new
BaseOrder
(){{
...
@@ -138,7 +142,18 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -138,7 +142,18 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//处理取消流程
//处理取消流程
if
(
OrderTypeEnum
.
RentVehicle
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
if
(
OrderTypeEnum
.
RentVehicle
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
OrderRentVehicleDetail
orvd
=
orderRentVehicleBiz
.
selectOne
(
new
OrderRentVehicleDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//取消租车预定
//取消租车预定
//取消租车免费天数使用
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
int
result
=
userFeign
.
memberDays
(
baseOrder
.
getUserId
(),
orvd
.
getFreeDays
(),
UserFeign
.
MEMBER_DAYS_WITHDRAW
);
if
(
result
<
0
)
{
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
}
else
if
(
OrderTypeEnum
.
TOUR
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
}
else
if
(
OrderTypeEnum
.
TOUR
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
OrderTourDetail
otd
=
orderTourDetailBiz
.
selectOne
(
new
OrderTourDetail
(){{
OrderTourDetail
otd
=
orderTourDetailBiz
.
selectOne
(
new
OrderTourDetail
(){{
...
@@ -153,6 +168,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -153,6 +168,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
}
}
}
}
/**
* 支付回调处理
* @param orderNo
* @param tradeNo
*/
public
void
payNotifyHandle
(
String
orderNo
,
String
tradeNo
)
{
public
void
payNotifyHandle
(
String
orderNo
,
String
tradeNo
)
{
BaseOrder
baseOrder
=
this
.
selectOne
(
new
BaseOrder
()
{{
BaseOrder
baseOrder
=
this
.
selectOne
(
new
BaseOrder
()
{{
setNo
(
orderNo
);
setNo
(
orderNo
);
...
@@ -173,21 +193,27 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
...
@@ -173,21 +193,27 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
OrderMemberDetail
omd
=
orderMemberDetailBiz
.
selectOne
(
new
OrderMemberDetail
(){{
OrderMemberDetail
omd
=
orderMemberDetailBiz
.
selectOne
(
new
OrderMemberDetail
(){{
setOrderId
(
baseOrder
.
getId
());
setOrderId
(
baseOrder
.
getId
());
}});
}});
try
{
userFeign
.
buyMember
(
new
UserMemberDTO
()
{{
//触发会员效益
setUserId
(
baseOrder
.
getUserId
());
userFeign
.
buyMember
(
new
UserMemberDTO
()
{{
setDiscount
(
omd
.
getRebate
());
setUserId
(
baseOrder
.
getUserId
());
setIsBind
(
ISBIND_BIND
);
setDiscount
(
omd
.
getRebate
());
setMemberLevel
(
omd
.
getMemberLevel
());
setIsBind
(
ISBIND_BIND
);
setRentFreeDays
(
omd
.
getRentFreeNum
());
setMemberLevel
(
omd
.
getMemberLevel
());
}});
setRentFreeDays
(
omd
.
getRentFreeNum
());
}
catch
(
Exception
e
){
}});
log
.
error
(
e
.
getMessage
(),
e
);
}
}
else
if
(
OrderTypeEnum
.
RentVehicle
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
}
else
if
(
OrderTypeEnum
.
RentVehicle
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
());
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
());
OrderRentVehicleDetail
orvd
=
orderRentVehicleBiz
.
selectOne
(
new
OrderRentVehicleDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//车辆预定审核通过
//车辆预定审核通过
//确认免费天数
if
(
orvd
.
getFreeDays
()
>
0
)
{
userFeign
.
memberDays
(
baseOrder
.
getUserId
(),
orvd
.
getFreeDays
(),
UserFeign
.
MEMBER_DAYS_CONFIRM
);
}
}
else
if
(
OrderTypeEnum
.
TOUR
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
}
else
if
(
OrderTypeEnum
.
TOUR
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
());
updateOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
());
//暂无处理
//暂无处理
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/config/RabbitUserConfig.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
order
.
config
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.BindingBuilder
;
import
org.springframework.amqp.core.CustomExchange
;
import
org.springframework.amqp.core.Queue
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* rabbitmq配置类
* 过期订单取消延时队列
* @author zhanghang
* @date 2019/1/7
*/
@Configuration
public
class
RabbitUserConfig
{
/**
* 延时队列交换机
* 注意这里的交换机类型:CustomExchange
* @return
*/
@Bean
public
CustomExchange
delayExchange
(){
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
"x-delayed-type"
,
"direct"
);
return
new
CustomExchange
(
"delay_exchange"
,
"x-delayed-message"
,
true
,
false
,
args
);
}
/**
* 延时队列
* @return
*/
@Bean
public
Queue
delayQueue
(){
return
new
Queue
(
"delay_queue"
,
true
);
}
/**
* 给延时队列绑定交换机
* @return
*/
@Bean
public
Binding
cfgDelayBinding
(
Queue
cfgDelayQueue
,
CustomExchange
cfgUserDelayExchange
){
return
BindingBuilder
.
bind
(
cfgDelayQueue
).
to
(
cfgUserDelayExchange
).
with
(
"delay_key"
).
noargs
();
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderRentVehicleService.java
View file @
00939e26
...
@@ -3,9 +3,12 @@ package com.xxfc.platform.order.service;
...
@@ -3,9 +3,12 @@ package com.xxfc.platform.order.service;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.lang.Dict
;
import
cn.hutool.core.lang.Dict
;
import
com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum
;
import
com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.context.BaseContextHandler
;
import
com.github.wxiaoqi.security.common.context.BaseContextHandler
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.order.biz.OrderCostDetailBiz
;
import
com.xxfc.platform.order.biz.OrderCostDetailBiz
;
import
com.xxfc.platform.order.biz.OrderRentVehicleBiz
;
import
com.xxfc.platform.order.biz.OrderRentVehicleBiz
;
import
com.xxfc.platform.order.biz.OrderTemplateBiz
;
import
com.xxfc.platform.order.biz.OrderTemplateBiz
;
...
@@ -51,6 +54,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
...
@@ -51,6 +54,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Autowired
@Autowired
OrderTemplateBiz
orderTemplateBiz
;
OrderTemplateBiz
orderTemplateBiz
;
@Autowired
UserFeign
userFeign
;
@PostConstruct
@PostConstruct
public
void
init
(){
public
void
init
(){
this
.
orderTypeEnum
=
OrderTypeEnum
.
RentVehicle
;
this
.
orderTypeEnum
=
OrderTypeEnum
.
RentVehicle
;
...
@@ -75,6 +81,14 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
...
@@ -75,6 +81,14 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//设置订单名称
//设置订单名称
bo
.
getOrder
().
setName
(
bo
.
getVehicleModel
().
getName
());
bo
.
getOrder
().
setName
(
bo
.
getVehicleModel
().
getName
());
//扣减免费天数
if
(
null
!=
bo
.
getFreeDays
()
&&
bo
.
getFreeDays
()
>
0
)
{
int
result
=
userFeign
.
memberDays
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getFreeDays
(),
UserFeign
.
MEMBER_DAYS_LOCK
);
if
(
result
<
0
)
{
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
super
.
handleDetail
(
bo
);
super
.
handleDetail
(
bo
);
}
}
...
...
xx-order/xx-order-server/src/test/java/com/xxfc/platform/order/OrderTest.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
order
;
import
cn.hutool.extra.template.Template
;
import
cn.hutool.extra.template.TemplateConfig
;
import
cn.hutool.extra.template.TemplateEngine
;
import
cn.hutool.extra.template.TemplateUtil
;
import
com.xxfc.platform.order.biz.BaseOrderBiz
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.HashMap
;
@Slf4j
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
={
OrderApplication
.
class
})
public
class
OrderTest
{
@Autowired
BaseOrderBiz
baseOrderBiz
;
@Test
public
void
test
()
{
BaseOrder
baseOrder
=
baseOrderBiz
.
selectById
(
93
);
baseOrder
.
setRefundTime
(
System
.
currentTimeMillis
());
baseOrder
.
setVersion
(
baseOrder
.
getVersion
()
-
1
);
baseOrderBiz
.
updateSelectiveById
(
baseOrder
);
log
.
info
(
"success"
);
}
}
xx-order/xx-order-server/src/test/java/com/xxfc/platform/order/RabbitmqTest.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
order
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.io.IOException
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeoutException
;
@Slf4j
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
={
OrderApplication
.
class
})
public
class
RabbitmqTest
{
static
final
String
exchangeName
=
"test_exchange"
;
static
final
String
queueName
=
"test_queue"
;
static
final
String
routingKey
=
"test_queue"
;
@Test
public
void
test
()
throws
IOException
,
TimeoutException
{
//建立连接,创建通道
ConnectionFactory
fc
=
new
ConnectionFactory
();
fc
.
setHost
(
"10.5.52.3"
);
fc
.
setPort
(
5672
);
fc
.
setUsername
(
"guest"
);
fc
.
setPassword
(
"guest"
);
fc
.
setVirtualHost
(
"my_vhost"
);
Connection
conn
=
fc
.
newConnection
();
Channel
channel
=
conn
.
createChannel
();
channel
.
exchangeDelete
(
exchangeName
);
//删除路由
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"x-delayed-type"
,
"direct"
);
channel
.
exchangeDeclare
(
exchangeName
,
"x-delayed-message"
,
false
,
false
,
map
);
//创建路由
channel
.
queueDelete
(
queueName
);
//删除队列
channel
.
queueDeclare
(
queueName
,
true
,
false
,
false
,
null
);
//创建队列
channel
.
queueBind
(
queueName
,
exchangeName
,
routingKey
);
//绑定路由、队列
channel
.
close
();
conn
.
close
();
// String msg = "测试延时de消息|"+ LocalDateTime.now();
//
// rabbitTemplate.convertAndSend(exchangeName, routingKey, msg, (message) ->{
// message.getMessageProperties().setHeader("x-delay", 9000); //延迟9秒
// return message;
// });
}
}
xx-order/xx-order-server/src/test/java/com/xxfc/platform/order/RabbitmqTest2.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
order
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.io.IOException
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeoutException
;
@Slf4j
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
={
OrderApplication
.
class
})
public
class
RabbitmqTest2
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Test
public
void
test
()
throws
IOException
,
TimeoutException
{
List
<
Integer
>
list
=
new
ArrayList
<
Integer
>(){{
add
(
1
);
add
(
2
);
add
(
3
);
add
(
4
);
add
(
5
);
add
(
6
);
}};
//这里的消息可以是任意对象,无需额外配置,直接传即可
log
.
info
(
"===============延时队列生产消息===================="
);
log
.
info
(
"发送时间:{},发送内容:{}"
,
LocalDateTime
.
now
(),
list
.
toString
());
rabbitTemplate
.
setMessageConverter
(
new
Jackson2JsonMessageConverter
());
rabbitTemplate
.
convertAndSend
(
"test_exchange"
,
"test_queue"
,
list
,
message
->
{
//注意这里时间可以使long,而且是设置header
message
.
getMessageProperties
().
setHeader
(
"x-delay"
,
60000
);
return
message
;
}
);
log
.
info
(
"{}ms后执行"
,
60000
);
}
}
xx-order/xx-order-server/src/test/java/com/xxfc/platform/order/RabbitmqTest3.java
0 → 100644
View file @
00939e26
package
com
.
xxfc
.
platform
.
order
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.io.IOException
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeoutException
;
@Slf4j
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
={
OrderApplication
.
class
})
public
class
RabbitmqTest3
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
// @Bean
// @RabbitListener(queues = "delay_queue")
// public
@Test
public
void
test
()
throws
IOException
,
TimeoutException
{
;
}
}
xx-order/xx-order-server/src/test/java/com/xxfc/platform/order/RegionTest.java
View file @
00939e26
...
@@ -4,9 +4,11 @@ import cn.hutool.extra.template.Template;
...
@@ -4,9 +4,11 @@ import cn.hutool.extra.template.Template;
import
cn.hutool.extra.template.TemplateConfig
;
import
cn.hutool.extra.template.TemplateConfig
;
import
cn.hutool.extra.template.TemplateEngine
;
import
cn.hutool.extra.template.TemplateEngine
;
import
cn.hutool.extra.template.TemplateUtil
;
import
cn.hutool.extra.template.TemplateUtil
;
import
com.xxfc.platform.order.biz.BaseOrderBiz
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
@@ -18,6 +20,8 @@ import java.util.HashMap;
...
@@ -18,6 +20,8 @@ import java.util.HashMap;
public
class
RegionTest
{
public
class
RegionTest
{
// @Autowired
// BaseOrderBiz baseOrderBiz;
@Test
@Test
public
void
test
()
{
public
void
test
()
{
...
@@ -49,6 +53,9 @@ public class RegionTest {
...
@@ -49,6 +53,9 @@ public class RegionTest {
// .driverAmount(new BigDecimal("1800"))
// .driverAmount(new BigDecimal("1800"))
// .deposit(new BigDecimal("20000")).build()
// .deposit(new BigDecimal("20000")).build()
//输出:Hello Hutool
//输出:Hello Hutool
log
.
info
(
result
);
log
.
info
(
result
);
}
}
}
}
xx-tour/xx-tour-server/pom.xml
View file @
00939e26
...
@@ -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-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourBannerController.java
View file @
00939e26
...
@@ -29,7 +29,7 @@ public class TourBannerController extends BaseController<TourBannerBiz,TourBanne
...
@@ -29,7 +29,7 @@ public class TourBannerController extends BaseController<TourBannerBiz,TourBanne
@GetMapping
(
"/app/unauth/findBannerlist"
)
@GetMapping
(
"/app/unauth/findBannerlist"
)
public
ObjectRestResponse
findBannerlist
(
@RequestParam
(
"type"
)
Integer
type
){
public
ObjectRestResponse
findBannerlist
(
@RequestParam
(
"type"
)
Integer
type
){
if
(
type
==
null
||
type
!=
0
||
type
==
1
)
{
if
(
type
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
List
<
TourBanner
>
bannerList
=
bannerBiz
.
findBannerList
(
type
);
List
<
TourBanner
>
bannerList
=
bannerBiz
.
findBannerList
(
type
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/IdInformation.java
View file @
00939e26
...
@@ -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 @
00939e26
...
@@ -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 @
00939e26
...
@@ -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 @
00939e26
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 @
00939e26
...
@@ -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 @
00939e26
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-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
View file @
00939e26
...
@@ -42,11 +42,11 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
...
@@ -42,11 +42,11 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
private
String
config
;
private
String
config
;
@Column
(
name
=
"number"
)
@Column
(
name
=
"number"
)
@ApiModelProperty
(
value
=
"乘卧数"
)
@ApiModelProperty
(
value
=
"乘卧数
id
"
)
private
String
number
;
private
String
number
;
@Column
(
name
=
"brand"
)
@Column
(
name
=
"brand"
)
@ApiModelProperty
(
value
=
"品牌"
)
@ApiModelProperty
(
value
=
"品牌
id
"
)
private
String
brand
;
private
String
brand
;
//关键标签,code逗号分割
//关键标签,code逗号分割
...
@@ -158,4 +158,14 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
...
@@ -158,4 +158,14 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
@ApiModelProperty
(
value
=
"车辆"
)
@ApiModelProperty
(
value
=
"车辆"
)
private
Vehicle
vehicle
;
private
Vehicle
vehicle
;
@Column
(
name
=
"numberName"
)
@ApiModelProperty
(
value
=
"乘卧数"
)
private
String
numberName
;
@Column
(
name
=
"brandName"
)
@ApiModelProperty
(
value
=
"品牌"
)
private
String
brandName
;
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
00939e26
...
@@ -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 @
00939e26
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/biz/VehicleModelBiz.java
View file @
00939e26
...
@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleModelMapper;
...
@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleModelMapper;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 车型
* 车型
...
@@ -41,7 +42,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
...
@@ -41,7 +42,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
try
{
try
{
PageDataVO
<
VehicleModel
>
mPageDataVO
=
PageDataVO
.
pageInfo
(
vmqc
.
getPage
(),
PageDataVO
<
VehicleModel
Vo
>
mPageDataVO
=
PageDataVO
.
pageInfo
(
vmqc
.
getPage
(),
vmqc
.
getLimit
(),
()
->
mapper
.
findVehicleModelPage
(
vmqc
));
vmqc
.
getLimit
(),
()
->
mapper
.
findVehicleModelPage
(
vmqc
));
return
ObjectRestResponse
.
succ
(
mPageDataVO
);
return
ObjectRestResponse
.
succ
(
mPageDataVO
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
View file @
00939e26
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 @
00939e26
...
@@ -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/java/com/xxfc/platform/vehicle/rest/VehicleModelController.java
View file @
00939e26
...
@@ -172,6 +172,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
...
@@ -172,6 +172,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
VehicleCata
vc
=
new
VehicleCata
();
VehicleCata
vc
=
new
VehicleCata
();
vc
.
setVehicleModelId
(
vmId
);
vc
.
setVehicleModelId
(
vmId
);
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
vcs
.
add
(
vc
);
}
}
...
@@ -179,6 +180,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
...
@@ -179,6 +180,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
...
@@ -266,6 +268,10 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
...
@@ -266,6 +268,10 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
// ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该车型,无法删除");
// ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该车型,无法删除");
// }
// }
if
(
id
==
1
||
id
==
14
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"The label cannot be deleted"
);
}
//2.进行逻辑删除
//2.进行逻辑删除
VehicleModel
vm
=
new
VehicleModel
();
VehicleModel
vm
=
new
VehicleModel
();
vm
.
setId
(
id
);
vm
.
setId
(
id
);
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
0 → 100644
View file @
00939e26
<?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 @
00939e26
...
@@ -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>
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
00939e26
...
@@ -17,7 +17,8 @@
...
@@ -17,7 +17,8 @@
<resultMap
id=
"searchModel"
type=
"com.xxfc.platform.vehicle.pojo.VehicleAndModelInfoVo"
>
<resultMap
id=
"searchModel"
type=
"com.xxfc.platform.vehicle.pojo.VehicleAndModelInfoVo"
>
<association
property=
"vehicleModel"
column=
"model_id"
<association
property=
"vehicleModel"
column=
"model_id"
select=
"com.xxfc.platform.vehicle.mapper.VehicleModelMapper.selectByPrimaryKey"
/>
select=
"com.xxfc.platform.vehicle.mapper.VehicleModelMapper.selectByPrimaryKey"
/>
<association
property=
"vehicleBookRecord"
column=
"id"
select=
"com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.getByVehicleId"
/>
<association
property=
"vehicleBookRecord"
column=
"id"
select=
"com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.getByVehicleId"
/>
</resultMap>
</resultMap>
<update
id=
"updateStatusById"
parameterType=
"java.util.Map"
>
<update
id=
"updateStatusById"
parameterType=
"java.util.Map"
>
...
@@ -108,6 +109,11 @@
...
@@ -108,6 +109,11 @@
<if
test=
"useType !=null"
>
<if
test=
"useType !=null"
>
and v.use_type = #{useType}
and v.use_type = #{useType}
</if>
</if>
-- 添加所属大区搜索条件
<if
test=
"zoneId !=null"
>
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if
test=
" yearMonthAndParam !=null "
>
<if
test=
" yearMonthAndParam !=null "
>
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
>
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
>
...
@@ -217,6 +223,10 @@
...
@@ -217,6 +223,10 @@
<if
test=
"useType !=null"
>
<if
test=
"useType !=null"
>
and v.use_type = #{useType}
and v.use_type = #{useType}
</if>
</if>
-- 添加所属大区搜索条件
<if
test=
"zoneId !=null"
>
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if
test=
" yearMonthAndParam !=null "
>
<if
test=
" yearMonthAndParam !=null "
>
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
>
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
>
...
@@ -310,7 +320,7 @@
...
@@ -310,7 +320,7 @@
</if>
</if>
</select>
</select>
<select
id=
"getAllVehicle"
parameterType=
"java.util.Map"
resultMap=
"searchModel"
>
<select
id=
"getAllVehicle"
parameterType=
"java.util.Map"
resultMap=
"searchModel"
>
select *
select *
from vehicle v1
from vehicle v1
<where>
<where>
<if
test=
"startTime != null"
>
<if
test=
"startTime != null"
>
...
@@ -333,30 +343,30 @@
...
@@ -333,30 +343,30 @@
<select
id=
"countVehicleByParam"
parameterType=
"com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
<select
id=
"countVehicleByParam"
parameterType=
"com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleCountVo"
>
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleCountVo"
>
SELECT count(*) total ,
SELECT count(*) total ,
CASE
CASE
WHEN travel_status = 1 THEN
WHEN travel_status = 1 THEN
'1'
'1'
WHEN travel_status = 2 THEN
WHEN travel_status = 2 THEN
'2'
'2'
WHEN travel_status = 3 THEN
WHEN travel_status = 3 THEN
'3'
'3'
WHEN travel_status = 4 THEN
WHEN travel_status = 4 THEN
'4'
'4'
ELSE
ELSE
'-1'
'-1'
END travel_status,
END travel_status,
CASE
CASE
WHEN travel_status = 1 THEN
WHEN travel_status = 1 THEN
'出行中'
'出行中'
WHEN travel_status = 2 THEN
WHEN travel_status = 2 THEN
'预约中'
'预约中'
WHEN travel_status = 3 THEN
WHEN travel_status = 3 THEN
'空闲中'
'空闲中'
WHEN travel_status = 4 THEN
WHEN travel_status = 4 THEN
'保养中'
'保养中'
ELSE
ELSE
'不可用'
'不可用'
END detail
END detail
from vehicle v1
from vehicle v1
<where>
<where>
<if
test=
"startTime != null"
>
<if
test=
"startTime != null"
>
...
@@ -377,7 +387,7 @@
...
@@ -377,7 +387,7 @@
</where>
</where>
GROUP BY travel_status
GROUP BY travel_status
union all
union all
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
<where>
<where>
<if
test=
"startTime != null"
>
<if
test=
"startTime != null"
>
and v2.create_time between #{startTime} and #{endTime}
and v2.create_time between #{startTime} and #{endTime}
...
@@ -396,23 +406,23 @@
...
@@ -396,23 +406,23 @@
</if>
</if>
</where>
</where>
union all
union all
SELECT count(*) total,
SELECT count(*) total,
CASE
CASE
WHEN status = 1 THEN
WHEN status = 1 THEN
'5'
'5'
WHEN status = 2 THEN
WHEN status = 2 THEN
'6'
'6'
ELSE
ELSE
'7'
'7'
END travel_status,
END travel_status,
CASE
CASE
WHEN status = 1 THEN
WHEN status = 1 THEN
'正常运行'
'正常运行'
WHEN status = 2 THEN
WHEN status = 2 THEN
'维修'
'维修'
ELSE
ELSE
'报废'
'报废'
END travel_status
END travel_status
FROM vehicle v3
FROM vehicle v3
<where>
<where>
<if
test=
"startTime != null"
>
<if
test=
"startTime != null"
>
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleModelMapper.xml
View file @
00939e26
...
@@ -4,11 +4,15 @@
...
@@ -4,11 +4,15 @@
<select
id=
"findVehicleModelPage"
parameterType=
"com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition"
<select
id=
"findVehicleModelPage"
parameterType=
"com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition"
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleModelVo"
>
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleModelVo"
>
SELECT * from
SELECT * from
(select vm.*,v.sum,v2.leasableQuantity from vehicle_model vm left JOIN
(select vm.*,v.sum,v2.leasableQuantity
,vpc.`name` brandName,vpc2.name numberName
from vehicle_model vm left JOIN
(select model_id as mid, count(1) as sum FROM vehicle GROUP BY mid) v
(select model_id as mid, count(1) as sum FROM vehicle GROUP BY mid) v
on vm.id=v.mid left JOIN
on vm.id=v.mid left JOIN
(select model_id as mid2, count(1) as leasableQuantity FROM vehicle where`use_type`=1 GROUP BY model_id) v2
(select model_id as mid2, count(1) as leasableQuantity FROM vehicle where`use_type`=1 GROUP BY model_id) v2
on v.mid=v2.mid2 ) vmqc WHERE 1=1
on v.mid=v2.mid2
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc on vm.brand=vpc.id
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc2 on vm.number=vpc2.id
where isdel = 0
) vmqc WHERE 1=1
<if
test=
"isDel !=null "
>
<if
test=
"isDel !=null "
>
and isdel=#{isDel}
and isdel=#{isDel}
...
...
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