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
751c5de1
Commit
751c5de1
authored
Aug 06, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
770a6157
53b5616e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
173 additions
and
90 deletions
+173
-90
pom.xml
ace-gate/pom.xml
+6
-0
GatewayServerBootstrap.java
.../github/wxiaoqi/security/gate/GatewayServerBootstrap.java
+1
-2
AccessGatewayFilter.java
...hub/wxiaoqi/security/gate/filter/AccessGatewayFilter.java
+33
-0
BaseUserMemberBiz.java
.../github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
+11
-19
BaseUserMemberController.java
...wxiaoqi/security/admin/rest/BaseUserMemberController.java
+13
-0
BackStageOrderController.java
...om/xxfc/platform/order/rest/BackStageOrderController.java
+6
-3
BaseOrderController.java
...ava/com/xxfc/platform/order/rest/BaseOrderController.java
+4
-1
BaseOrderMapper.xml
...rder-server/src/main/resources/mapper/BaseOrderMapper.xml
+6
-2
VehicleModelVo.java
...n/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
+9
-0
VehicleCataBiz.java
...in/java/com/xxfc/platform/vehicle/biz/VehicleCataBiz.java
+1
-1
VehiclePlatCataBiz.java
...ava/com/xxfc/platform/vehicle/biz/VehiclePlatCataBiz.java
+1
-1
VehicleModelController.java
...om/xxfc/platform/vehicle/rest/VehicleModelController.java
+82
-61
No files found.
ace-gate/pom.xml
View file @
751c5de1
...
...
@@ -93,6 +93,12 @@
<artifactId>
ace-interface
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-admin-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-auth-client
</artifactId>
...
...
ace-gate/src/main/java/com/github/wxiaoqi/security/gate/GatewayServerBootstrap.java
View file @
751c5de1
...
...
@@ -4,7 +4,6 @@ import com.github.wxiaoqi.security.api.vo.config.HeaderConfig;
import
com.github.wxiaoqi.security.auth.client.EnableAceAuthClient
;
import
com.github.wxiaoqi.security.gate.utils.DBLog
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
...
...
@@ -17,7 +16,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringCloudApplication
@EnableDiscoveryClient
@EnableAceAuthClient
@EnableFeignClients
(
value
=
{
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.gate.feign"
},
defaultConfiguration
=
HeaderConfig
.
class
)
@EnableFeignClients
(
value
=
{
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.gate.feign"
,
"com.github.wxiaoqi.security.admin.feign"
},
defaultConfiguration
=
HeaderConfig
.
class
)
public
class
GatewayServerBootstrap
{
public
static
void
main
(
String
[]
args
)
{
DBLog
.
getInstance
().
start
();
...
...
ace-gate/src/main/java/com/github/wxiaoqi/security/gate/filter/AccessGatewayFilter.java
View file @
751c5de1
package
com
.
github
.
wxiaoqi
.
security
.
gate
.
filter
;
import
com.alibaba.fastjson.JSONObject
;
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.api.vo.authority.PermissionInfo
;
import
com.github.wxiaoqi.security.api.vo.log.LogInfo
;
import
com.github.wxiaoqi.security.auth.client.config.ServiceAuthConfig
;
...
...
@@ -67,6 +70,9 @@ public class AccessGatewayFilter implements GlobalFilter {
@Lazy
private
ILogService
logService
;
@Autowired
UserFeign
userFeign
;
@Value
(
"${gate.ignore.startWith}"
)
private
String
startWith
;
...
...
@@ -314,6 +320,8 @@ public class AccessGatewayFilter implements GlobalFilter {
private
void
recordLog
(
ServerHttpRequest
request
,
Object
body
)
{
// 记录要访问的url
if
(!
getNotLogUri
().
contains
(
request
.
getURI
().
getRawPath
()))
{
StringBuilder
builder
=
new
StringBuilder
();
log
.
info
(
"=================请求uri:"
+
request
.
getURI
().
getRawPath
());
// 记录访问的方法
...
...
@@ -325,6 +333,12 @@ public class AccessGatewayFilter implements GlobalFilter {
builder
.
append
(
", header { "
);
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
request
.
getHeaders
().
entrySet
())
{
builder
.
append
(
entry
.
getKey
()).
append
(
":"
).
append
(
StringUtils
.
join
(
entry
.
getValue
(),
","
)).
append
(
","
);
if
(
"Authorization"
.
equals
(
entry
.
getKey
()))
{
if
(
entry
.
getValue
()
!=
null
&&
entry
.
getValue
().
size
()
>
0
)
{
getAdminUserInfo
(
entry
.
getValue
().
get
(
0
));
}
}
}
log
.
info
(
"=================请求头header:"
+
builder
.
toString
());
// 记录参数
...
...
@@ -343,10 +357,29 @@ public class AccessGatewayFilter implements GlobalFilter {
log
.
info
(
"=================请求参数:"
+
builder
.
toString
());
}
}
private
void
getAdminUserInfo
(
String
token
)
{
if
(
token
!=
null
)
{
UserDTO
userDTO
=
userFeign
.
userinfoByToken
(
token
).
getData
();
if
(
userDTO
!=
null
)
{
log
.
info
(
"=================后台用户名:username = {}"
,
userDTO
.
getUsername
());
log
.
info
(
"=================后台姓名: name = {}"
,
userDTO
.
getName
());
}
else
{
AppUserDTO
appUserDTO
=
userFeign
.
userDetailByToken
(
token
).
getData
();
if
(
appUserDTO
!=
null
)
{
log
.
info
(
"=================APP用户名:userId = {}"
,
appUserDTO
.
getUserid
());
log
.
info
(
"=================APP姓名: name = {}"
,
appUserDTO
.
getRealname
());
log
.
info
(
"=================APP手机号: phone = {}"
,
appUserDTO
.
getUsername
());
}
}
}
}
@Value
(
"${logback.ignore-log-path}"
)
String
[]
path
;
public
List
<
String
>
getNotLogUri
()
{
return
Arrays
.
asList
(
path
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
View file @
751c5de1
...
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.beanutils.BeanUtilsBean
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.task.TaskExecutor
;
...
...
@@ -146,14 +147,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
if
(
freeDays
>
0
&&
freeDays
>=
days
)
{
freeDays
=
freeDays
-
days
;
baseUserMember
.
setRentFreeDays
(
freeDays
);
}
Integer
payCount
=
userMemberVo
.
getPayCount
()
==
null
?
0
:
userMemberVo
.
getPayCount
();
}
Integer
payCount
=
userMemberVo
.
getPayCount
()
==
null
?
0
:
userMemberVo
.
getPayCount
();
/* if (days > 0) {
payCount = payCount + 1;
}*/
baseUserMember
.
setPayCount
(
payCount
);
getMyBiz
().
updateSelectiveById
(
baseUserMember
);
num
=
freeDays
;
baseUserMember
.
setPayCount
(
payCount
);
getMyBiz
().
updateSelectiveById
(
baseUserMember
);
num
=
freeDays
;
}
else
if
(
type
==
2
)
{
/*Integer payCount=userMemberVo.getPayCount()==null?0:userMemberVo.getPayCount();
payCount=payCount+1;
...
...
@@ -220,15 +221,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
WeekendSqls
.<
BaseUserMember
>
custom
()
.
andEqualTo
(
BaseUserMember:
:
getUserId
,
baseUserMemberVO
.
getUserId
())
).
build
();
List
<
BaseUserMember
>
baseUserMembers
=
mapper
.
selectByExample
(
exa
);
BaseUserMember
baseUserMember
=
new
BaseUserMember
();
BeanUtilsBean
.
getInstance
().
copyProperties
(
baseUserMember
,
baseUserMemberVO
);
if
(
baseUserMembers
==
null
||
baseUserMembers
.
size
()
==
0
)
{
if
(
baseUserMemberVO
.
getMemberLevel
()
==
null
||
baseUserMember
.
getValidTime
()
==
null
)
return
;
if
(
CollectionUtils
.
isEmpty
(
baseUserMembers
))
{
if
(
baseUserMemberVO
.
getMemberLevel
()
==
null
||
baseUserMember
.
getValidTime
()
==
null
||
baseUserMember
.
getValidTime
()<
0
)
{
throw
new
BaseException
(
"设置无效!无会员等级、会员有效期或会员有效期为负数!"
);
}
baseUserMember
.
setCrtTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setIsDel
(
0
);
baseUserMember
.
setPayCount
(
0
);
...
...
@@ -238,21 +238,13 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper, BaseUserMem
baseUserMember
.
setBuyCount
(
buyCount
+
1
);
insertSelective
(
baseUserMember
);
return
;
}
else
if
(
baseUserMembers
.
size
()
==
1
)
{
if
(
baseUserMemberVO
.
getMemberLevel
()
==
null
||
baseUserMember
.
getValidTime
()
==
null
)
{
baseUserMember
.
setTotalNumber
(
0
);
baseUserMember
.
setRentFreeDays
(
0
);
}
else
{
}
baseUserMember
.
setUpdTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setBuyCount
(
baseUserMembers
.
get
(
0
).
getBuyCount
()
+
1
);
baseUserMember
.
setId
(
baseUserMembers
.
get
(
0
).
getId
());
mapper
.
updateByPrimaryKeySelective
(
baseUserMember
);
}
else
{
throw
new
BaseException
(
"
Member purchase repeat
!"
);
throw
new
BaseException
(
"
错误!该账号有多条会员信息
!"
);
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/BaseUserMemberController.java
View file @
751c5de1
...
...
@@ -32,6 +32,19 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
// /**
// * 设置用户会员
// * @param userMemberDTO
// * @return
// */
// @PutMapping("/setUserMember")
// public ObjectRestResponse UpdateUserMember(@RequestBody BaseUserMemberVO baseUserMemberVO)
// throws Exception {
// baseBiz.UpdateUserMember(baseUserMemberVO);
// return ObjectRestResponse.succ();
// }
/**
* 设置用户会员
* @param userMemberDTO
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BackStageOrderController.java
View file @
751c5de1
...
...
@@ -84,9 +84,12 @@ public class BackStageOrderController extends CommonBaseController implements Us
if
(
userDTO
==
null
)
{
return
ObjectRestResponse
.
succ
(
new
PageDataVO
<>());
}
List
<
BranchCompany
>
branchCompanies
=
vehicleFeign
.
companyAll
(
userDTO
.
getDataAll
(),
userDTO
.
getDataCompany
(),
userDTO
.
getDataZone
());
List
<
Integer
>
companyIds
=
branchCompanies
.
stream
().
map
(
BranchCompany:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setCompanyIds
(
companyIds
);
if
(
dto
.
getType
()
!=
3
)
{
List
<
BranchCompany
>
branchCompanies
=
vehicleFeign
.
companyAll
(
userDTO
.
getDataAll
(),
userDTO
.
getDataCompany
(),
userDTO
.
getDataZone
());
List
<
Integer
>
companyIds
=
branchCompanies
.
stream
().
map
(
BranchCompany:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setCompanyIds
(
companyIds
);
}
Query
query
=
new
Query
(
dto
);
PageDataVO
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseOrderBiz
.
listOrder
(
query
.
getSuper
()));
List
<
OrderListVo
>
list
=
pageDataVO
.
getData
();
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
View file @
751c5de1
...
...
@@ -301,7 +301,10 @@ public class BaseOrderController extends CommonBaseController implements UserRes
Integer
page
;
@ApiModelProperty
(
"每页限制"
)
Integer
limit
;
/**
* 会员等级
*/
Integer
memberLevel
;
List
<
Integer
>
companyIds
;
}
...
...
xx-order/xx-order-server/src/main/resources/mapper/BaseOrderMapper.xml
View file @
751c5de1
...
...
@@ -115,6 +115,7 @@
from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
LEFT JOIN order_tour_detail t on t.order_id = b.id
LEFT JOIN order_member_detail m on m.order_id = b.id
<where>
<if
test=
"crtUser != null"
>
and b.crt_user = #{crtUser}
...
...
@@ -128,7 +129,10 @@
<if
test=
"type != null"
>
and b.type = #{type}
</if>
<if
test=
"no != null"
>
<if
test=
"memberLevel != null and memberLevel != ''"
>
and m.member_level = #{memberLevel}
</if>
<if
test=
"no != null and no != '' "
>
and no like CONCAT ("%", #{no}, "%")
</if>
<if
test=
"name != null"
>
...
...
@@ -179,7 +183,7 @@
<if
test=
"status != null and status != -1"
>
and b.status = #{status}
</if>
<if
test=
"no != null"
>
<if
test=
"no != null
and no != ''
"
>
and no like CONCAT ("%", #{no}, "%")
</if>
<if
test=
"startTime != null and status == 4"
>
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
View file @
751c5de1
...
...
@@ -168,4 +168,13 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
@ApiModelProperty
(
value
=
"品牌"
)
private
String
brandName
;
// @Column(name = "status")
// @ApiModelProperty(value = "状态 0--下架;1--上架")
// private String status;
// @Column(name = "cover_pic")
// @ApiModelProperty(value = "封面图")
// private String coverPic;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCataBiz.java
View file @
751c5de1
...
...
@@ -54,7 +54,7 @@ public class VehicleCataBiz extends BaseBiz<VehicleCataMapper, VehicleCata> {
}
public
void
inserts
(
ArrayList
<
com
.
xxfc
.
platform
.
vehicle
.
entity
.
VehicleCata
>
vcs
)
{
public
void
inserts
(
ArrayList
<
VehicleCata
>
vcs
)
{
mapper
.
addCataList
(
vcs
);
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehiclePlatCataBiz.java
View file @
751c5de1
...
...
@@ -475,7 +475,7 @@ public class VehiclePlatCataBiz extends BaseBiz<VehiclePlatCataMapper, VehiclePl
* @param isMore
* @return
*/
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ObjectRestResponse
setIsore
(
Integer
id
,
Integer
isMore
)
{
VehiclePlatCata
vehiclePlatCata
=
new
VehiclePlatCata
();
vehiclePlatCata
.
setId
(
id
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleModelController.java
View file @
751c5de1
package
com
.
xxfc
.
platform
.
vehicle
.
rest
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.github.pagehelper.PageInfo
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface
;
...
...
@@ -10,38 +9,27 @@ import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.GoodDataVO
;
import
com.xxfc.platform.vehicle.biz.VehicleBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleCataBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleModelBiz
;
import
com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.entity.VehicleCata
;
import
com.xxfc.platform.vehicle.entity.VehicleModel
;
import
com.xxfc.platform.vehicle.mapper.VehicleModelMapper
;
import
com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition
;
import
com.xxfc.platform.vehicle.pojo.VModelDetailVO
;
import
com.xxfc.platform.vehicle.pojo.VehicleModelVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
net.bytebuddy.implementation.bytecode.Throw
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.TransactionManagementConfigurationSelector
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.bind.annotation.*
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
javax.servlet.http.HttpServletRequest
;
import
java.awt.print.Pageable
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -49,6 +37,9 @@ import java.util.List;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
/**
* @author Administrator
*/
@RestController
@RequestMapping
(
"vehicleModel"
)
@Api
(
value
=
"车型controller"
,
tags
=
{
"车型操作接口"
})
...
...
@@ -75,7 +66,9 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
private
UserAuthConfig
userAuthConfig
;
//修改评分
/**
* 修改评分
*/
@RequestMapping
(
value
=
"/app/addScore"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
addScore
(
@RequestParam
(
value
=
"id"
,
defaultValue
=
"0"
)
Integer
id
,
...
...
@@ -84,13 +77,18 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
return
RestResponse
.
suc
();
}
//订单
/**
* 订单
*
* @param id
* @return
*/
@ApiOperation
(
"车型详情"
)
@RequestMapping
(
value
=
"/app/unauth/detail/{id}"
,
method
=
RequestMethod
.
GET
)
@IgnoreUserToken
public
ObjectRestResponse
<
VModelDetailVO
>
detail
(
@PathVariable
(
"id"
)
@ApiParam
(
"车型id"
)
Integer
id
)
{
//查询车型信息,车型类型关系
//
,
公司信息,系统信息(购车须知,预定须知)
//公司信息,系统信息(购车须知,预定须知)
VehicleModel
vm
=
baseBiz
.
selectById
(
id
);
if
(
null
==
vm
)
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
...
...
@@ -111,25 +109,20 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
@PostMapping
(
value
=
"/app/unauth/findVehicleModelPage"
)
@IgnoreUserToken
public
ObjectRestResponse
<
VehicleModelVo
>
findVehicleModelPageUnauthfind
(
@RequestBody
@ApiParam
(
"查询条件"
)
VehicleModelQueryCondition
vmqc
,
HttpServletRequest
request
)
{
if
(
vmqc
.
getIsDel
()==
null
)
{
@RequestBody
@ApiParam
(
"查询条件"
)
VehicleModelQueryCondition
vmqc
,
HttpServletRequest
request
)
{
if
(
vmqc
.
getIsDel
()
==
null
)
{
vmqc
.
setIsDel
(
0
);
}
if
(
vmqc
.
getStatus
()==
null
)
{
vmqc
.
setStatus
(
SYS_TRUE
);
}
// if (vmqc.getStatus() == null) {
// vmqc.setStatus(SYS_TRUE);
// }
if
(
vmqc
==
null
||
vmqc
.
getPage
()
==
null
||
vmqc
.
getLimit
()
==
null
||
vmqc
.
getPage
()
<
0
||
vmqc
.
getLimit
()
<=
0
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
//结合车型
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
vmqc
.
getCatasStr
()))
{
vmqc
.
setCatas
(
vehiclePlatCataBiz
.
groupCatasByParent
(
vmqc
.
getCatasStr
()));
}
return
vehicleModelBiz
.
findVehicleModelPage
(
vmqc
);
}
...
...
@@ -148,18 +141,13 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
if
(
vm
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
if
(
StringUtils
.
isBlank
(
vm
.
getName
()))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"
无车名
"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"
车名不能为空
"
);
}
String
token
=
request
.
getHeader
(
"Authorization"
);
if
(
StringUtils
.
isBlank
(
token
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"请登录"
);
}
ObjectRestResponse
<
UserDTO
>
uorr
=
null
;
try
{
uorr
=
userFeign
.
userinfoByToken
(
token
);
uorr
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -167,6 +155,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
if
(
uorr
==
null
||
uorr
.
getData
()
==
null
||
StringUtils
.
isBlank
(
uorr
.
getData
().
getName
())
||
uorr
.
getData
().
getId
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"获取不到用户信息"
);
}
String
host
=
request
.
getRemoteHost
();
if
(
StringUtils
.
isBlank
(
host
))
{
return
ObjectRestResponse
.
createDefaultFail
();
...
...
@@ -178,6 +167,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vm
.
setCrtTime
(
new
Date
());
vm
.
setCrtHost
(
host
);
vm
.
setIsdel
(
0
);
vm
.
setStatus
(
0
);
vm
.
setVioDeposit
(
BigDecimal
.
valueOf
(
500
));
try
{
//插入数据到车型并返回id
...
...
@@ -185,7 +175,6 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
if
(
vmId
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"插入数据失败"
);
}
System
.
out
.
println
(
"vmId:"
+
vmId
);
//获取该车型所有的标签id
ArrayList
<
VehicleCata
>
vcs
=
new
ArrayList
<>();
...
...
@@ -198,7 +187,6 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
}
vehicleCataBiz
.
inserts
(
vcs
);
return
ObjectRestResponse
.
succ
();
}
catch
(
NumberFormatException
e
)
{
...
...
@@ -209,20 +197,16 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
}
@ApiOperation
(
"修改"
)
@PutMapping
(
value
=
"/app/update"
)
@Transactional
public
ObjectRestResponse
<
VehicleModel
>
update
(
@RequestBody
VehicleModel
vm
,
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
"Authorization"
);
ObjectRestResponse
<
UserDTO
>
uorr
=
null
;
try
{
uorr
=
userFeign
.
userinfoByToken
(
token
);
uorr
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
uorr
==
null
||
uorr
.
getData
()
==
null
||
StringUtils
.
isBlank
(
uorr
.
getData
().
getName
())
||
uorr
.
getData
().
getId
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"获取不到用户信息"
);
}
...
...
@@ -235,28 +219,28 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vm
.
setUpdUser
(
uorr
.
getData
().
getId
());
vm
.
setUpdHost
(
host
);
vm
.
setUpdTime
(
new
Date
());
try
{
//修改车型
vehicleModelBiz
.
updateByPrimaryKeySelective
(
vm
);
VehicleCata
vcDelete
=
new
VehicleCata
();
vcDelete
.
setVehicleModelId
(
vm
.
getId
());
// 删除车型对应的标签
vehicleCataBiz
.
delete
(
vcDelete
);
ArrayList
<
VehicleCata
>
vcs
=
new
ArrayList
<>();
//从新插入车型对应的标签
if
(
vm
.
getId
()
!=
null
)
{
vcDelete
.
setVehicleModelId
(
vm
.
getId
());
// 删除车型对应的标签
vehicleCataBiz
.
delete
(
vcDelete
);
ArrayList
<
VehicleCata
>
vcs
=
new
ArrayList
<>();
//从新插入车型对应的标签
// 获取cataid
String
[]
config
=
vm
.
getConfig
().
split
(
","
);
for
(
String
con
:
config
)
{
VehicleCata
vc
=
new
VehicleCata
();
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setVehicleModelId
(
vm
.
getId
());
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
String
[]
config
=
vm
.
getConfig
().
split
(
","
);
for
(
String
con
:
config
)
{
VehicleCata
vc
=
new
VehicleCata
();
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setVehicleModelId
(
vm
.
getId
());
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
}
vehicleCataBiz
.
inserts
(
vcs
);
}
vehicleCataBiz
.
inserts
(
vcs
);
return
ObjectRestResponse
.
succ
();
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
...
...
@@ -273,8 +257,8 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
@Transactional
public
ObjectRestResponse
<
VehicleModel
>
remove
(
@PathVariable
int
id
)
{
if
(
id
==
1
||
id
==
14
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"The label cannot be deleted"
);
if
(
id
==
1
||
id
==
14
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"The label cannot be deleted"
);
}
//2.进行逻辑删除
...
...
@@ -295,9 +279,9 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
@ApiOperation
(
"查询所有"
)
@RequestMapping
(
value
=
"/findAll"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/findAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ObjectRestResponse
findAll
(){
public
ObjectRestResponse
findAll
()
{
VehicleModel
vehicleModel
=
new
VehicleModel
();
vehicleModel
.
setIsdel
(
0
);
return
ObjectRestResponse
.
succ
(
baseBiz
.
selectList
(
vehicleModel
));
...
...
@@ -305,14 +289,51 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
/**
* 优质车型
*
* @param page
* @param limit
* @return
*/
@ApiOperation
(
"优质车型"
)
@GetMapping
(
value
=
"/goodList"
)
public
List
<
GoodDataVO
>
goodList
(
@RequestParam
(
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
)
{
return
baseBiz
.
goodList
(
page
,
limit
);
public
List
<
GoodDataVO
>
goodList
(
@RequestParam
(
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
)
{
return
baseBiz
.
goodList
(
page
,
limit
);
}
@ApiOperation
(
"上下架"
)
@PutMapping
(
value
=
"/setStatus/{id}/{status}"
)
@Transactional
public
ObjectRestResponse
<
VehicleModel
>
setStatus
(
@PathVariable
(
value
=
"id"
)
Integer
id
,
@PathVariable
(
value
=
"status"
)
Integer
status
)
{
ObjectRestResponse
<
UserDTO
>
uorr
=
null
;
try
{
uorr
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
uorr
==
null
||
uorr
.
getData
()
==
null
||
StringUtils
.
isBlank
(
uorr
.
getData
().
getName
())
||
uorr
.
getData
().
getId
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"获取不到用户信息"
);
}
String
host
=
request
.
getRemoteHost
();
if
(
StringUtils
.
isBlank
(
host
))
{
return
ObjectRestResponse
.
createDefaultFail
();
}
VehicleModel
vehicleModel
=
new
VehicleModel
();
vehicleModel
.
setId
(
id
);
vehicleModel
.
setStatus
(
status
);
vehicleModel
.
setUpdName
(
uorr
.
getData
().
getName
());
vehicleModel
.
setUpdUser
(
uorr
.
getData
().
getId
());
vehicleModel
.
setUpdHost
(
host
);
vehicleModel
.
setUpdTime
(
new
Date
());
try
{
//修改车型
vehicleModelBiz
.
updateByPrimaryKeySelective
(
vehicleModel
);
return
ObjectRestResponse
.
succ
();
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment