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
f991582a
Commit
f991582a
authored
Nov 02, 2020
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev-chw' into dev-chw
parents
568a1155
e99d6133
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
30 deletions
+49
-30
OrderViolationBiz.java
...n/java/com/xxfc/platform/order/biz/OrderViolationBiz.java
+46
-11
OrderViolationController.java
...om/xxfc/platform/order/rest/OrderViolationController.java
+3
-19
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderViolationBiz.java
View file @
f991582a
package
com
.
xxfc
.
platform
.
order
.
biz
;
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
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.entity.OrderViolation
;
import
com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper
;
...
...
@@ -26,6 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -36,14 +41,21 @@ import java.util.concurrent.TimeUnit;
*/
@Service
@Slf4j
public
class
OrderViolationBiz
extends
BaseBiz
<
OrderViolationMapper
,
OrderViolation
>
{
public
class
OrderViolationBiz
extends
BaseBiz
<
OrderViolationMapper
,
OrderViolation
>
implements
UserRestInterface
{
@Autowired
private
OrderRentVehicleDetailMapper
detailMapper
;
@Value
(
"order.violation.upload"
)
private
String
ovUpload
;
@Autowired
UserFeign
userFeign
;
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
@Override
public
UserFeign
getUserFeign
()
{
return
userFeign
;
}
@Autowired
private
RedisTemplate
redisTemplate
;
...
...
@@ -55,19 +67,34 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
insertOrderViolation
(
OrderViolation
orderViolation
)
{
OrderRentVehicleDetail
orderRentVehicleDetail
=
new
OrderRentVehicleDetail
();
orderRentVehicleDetail
.
setId
(
orderViolation
.
getDetailId
());
orderRentVehicleDetail
.
setHandelViolation
(
0
);
Map
<
String
,
Object
>
status
=
mapper
.
getOrderAndVehicleStatus
(
orderViolation
.
getDetailId
());
Integer
orderStatus
=
(
Integer
)
status
.
get
(
"status"
);
Integer
refundStatus
=
(
Integer
)
status
.
get
(
"refundStatus"
);
if
(
orderStatus
>=
6
||
(
refundStatus
<=
2
&&
refundStatus
!=
1
))
{
insertSelective
(
orderViolation
);
detailMapper
.
updateByPrimaryKeySelective
(
orderRentVehicleDetail
);
UserDTO
userDTO
=
getBusinessUserByAppUser
();
if
(
userDTO
==
null
)
{
throw
new
BaseException
(
ResultCode
.
RSTOKEN_EXPIRED_CODE
);
}
OrderViolation
old
=
mapper
.
selectOne
(
new
OrderViolation
(){{
setDetailId
(
orderViolation
.
getDetailId
());}});
if
(
old
!=
null
)
{
throw
new
BaseException
(
"违章记录已存在!"
);
}
else
{
throw
new
BaseException
(
"The operation cannot be changed at this time"
);
OrderRentVehicleDetail
orderRentVehicleDetail
=
new
OrderRentVehicleDetail
();
orderRentVehicleDetail
.
setId
(
orderViolation
.
getDetailId
());
orderRentVehicleDetail
.
setHandelViolation
(
0
);
Map
<
String
,
Object
>
status
=
mapper
.
getOrderAndVehicleStatus
(
orderViolation
.
getDetailId
());
Integer
orderStatus
=
(
Integer
)
status
.
get
(
"status"
);
Integer
refundStatus
=
(
Integer
)
status
.
get
(
"refundStatus"
);
if
(
orderStatus
>=
6
||
(
refundStatus
<=
2
&&
refundStatus
!=
1
))
{
orderViolation
.
setIsDel
(
0
);
orderViolation
.
setCrtHost
(
getRequest
().
getRemoteHost
());
orderViolation
.
setCrtName
(
userDTO
.
getName
());
orderViolation
.
setCrtUserId
(
userDTO
.
getId
());
orderViolation
.
setCrtTime
(
new
BigInteger
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
insertSelective
(
orderViolation
);
detailMapper
.
updateByPrimaryKeySelective
(
orderRentVehicleDetail
);
}
else
{
throw
new
BaseException
(
"The operation cannot be changed at this time"
);
}
}
}
/**
...
...
@@ -77,10 +104,18 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateOrderViolation
(
OrderViolation
orderViolation
)
{
UserDTO
userDTO
=
getBusinessUserByAppUser
();
if
(
userDTO
==
null
)
{
throw
new
BaseException
(
ResultCode
.
RSTOKEN_EXPIRED_CODE
);
}
Map
<
String
,
Object
>
status
=
mapper
.
getOrderAndVehicleStatus
(
orderViolation
.
getDetailId
());
Integer
orderStatus
=
(
Integer
)
status
.
get
(
"status"
);
Integer
refundStatus
=
(
Integer
)
status
.
get
(
"refundStatus"
);
if
(
orderStatus
>=
6
||
(
refundStatus
<=
2
&&
refundStatus
!=
1
))
{
orderViolation
.
setUpdHost
(
getRequest
().
getRemoteHost
());
orderViolation
.
setUpdName
(
userDTO
.
getName
());
orderViolation
.
setUpdUserId
(
userDTO
.
getId
());
orderViolation
.
setUpdTime
(
new
BigInteger
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
updateSelectiveByIdRe
(
orderViolation
);
}
else
{
throw
new
BaseException
(
"The operation cannot be changed at this time"
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderViolationController.java
View file @
f991582a
...
...
@@ -2,8 +2,6 @@ package com.xxfc.platform.order.rest;
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
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
...
...
@@ -21,7 +19,6 @@ import tk.mybatis.mapper.entity.Example;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigInteger
;
import
java.util.List
;
/**
...
...
@@ -30,19 +27,16 @@ import java.util.List;
* @author Administrator
*/
@RestController
@RequestMapping
(
"orderViolation"
)
@RequestMapping
(
"
/chw/
orderViolation"
)
@Slf4j
public
class
OrderViolationController
extends
BaseController
<
OrderViolationBiz
,
OrderViolation
>
implements
UserRestInterface
{
public
class
OrderViolationController
extends
BaseController
<
OrderViolationBiz
,
OrderViolation
>
{
@Autowired
private
UserFeign
userFeign
;
@Autowired
OrderDepositRefundRecordBiz
orderDepositRefundRecordBiz
;
@Override
public
UserFeign
getUserFeign
()
{
return
userFeign
;
}
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
50L
;
...
...
@@ -58,19 +52,9 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
@PostMapping
(
"/saveOrderViolation"
)
public
ObjectRestResponse
saveOrderViolation
(
@RequestBody
OrderViolation
orderViolation
,
HttpServletRequest
request
)
{
log
.
info
(
"保存违章记录:orderViolation = {}"
,
orderViolation
.
toString
());
UserDTO
userDTOD
=
getBusinessUserByAppUser
();
if
(
orderViolation
.
getId
()
==
null
)
{
orderViolation
.
setIsDel
(
0
);
orderViolation
.
setCrtHost
(
request
.
getRemoteHost
());
orderViolation
.
setCrtName
(
userDTOD
.
getName
());
orderViolation
.
setCrtUserId
(
userDTOD
.
getId
());
orderViolation
.
setCrtTime
(
new
BigInteger
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
getBaseBiz
().
insertOrderViolation
(
orderViolation
);
}
else
{
orderViolation
.
setUpdHost
(
request
.
getRemoteHost
());
orderViolation
.
setUpdName
(
userDTOD
.
getName
());
orderViolation
.
setUpdUserId
(
userDTOD
.
getId
());
orderViolation
.
setUpdTime
(
new
BigInteger
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
getBaseBiz
().
updateOrderViolation
(
orderViolation
);
}
orderDepositRefundRecordBiz
.
saveViolationDeposit
(
orderViolation
);
...
...
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