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
ed08c194
Commit
ed08c194
authored
Nov 02, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-chw' of
http://113.105.137.151:22280/youjj/cloud-platform
into dev-chw
parents
99b3c6a9
01f42db2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
75 deletions
+75
-75
OrderViolationController.java
...om/xxfc/platform/order/rest/OrderViolationController.java
+75
-75
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderViolationController.java
View file @
ed08c194
...
@@ -34,88 +34,88 @@ import java.util.List;
...
@@ -34,88 +34,88 @@ import java.util.List;
@Slf4j
@Slf4j
public
class
OrderViolationController
extends
BaseController
<
OrderViolationBiz
,
OrderViolation
>
implements
UserRestInterface
{
public
class
OrderViolationController
extends
BaseController
<
OrderViolationBiz
,
OrderViolation
>
implements
UserRestInterface
{
@Autowired
@Autowired
private
UserFeign
userFeign
;
private
UserFeign
userFeign
;
@Autowired
@Autowired
OrderDepositRefundRecordBiz
orderDepositRefundRecordBiz
;
OrderDepositRefundRecordBiz
orderDepositRefundRecordBiz
;
@Override
public
UserFeign
getUserFeign
()
{
return
userFeign
;
}
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
50L
;
@Override
public
UserFeign
getUserFeign
()
{
return
userFeign
;
}
private
final
String
FILE_TYPE
=
"JPG"
;
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
50L
;
/**
private
final
String
FILE_TYPE
=
"JPG"
;
* 保存违章记录
*
* @param orderViolation
* @param request
* @return
*/
@PostMapping
(
"/saveOrderViolation"
)
public
ObjectRestResponse
saveOrderViolation
(
@RequestBody
OrderViolation
orderViolation
,
HttpServletRequest
request
)
{
log
.
info
(
"保存违章记录:orderViolation = {}"
,
orderViolation
.
toString
());
UserDTO
userDTOD
=
getAdminUserInfo
();
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
);
return
ObjectRestResponse
.
succ
();
}
/**
/**
* 通过订单id查询违章记录
* 保存违章记录
*
*
* @param detailId
* @param orderViolation
* @return
* @param request
*/
* @return
@GetMapping
(
"/getOne/{detailId}"
)
*/
public
ObjectRestResponse
<
OrderViolation
>
getOne
(
@PathVariable
Integer
detailId
)
{
@PostMapping
(
"/saveOrderViolation"
)
Example
exa
=
Example
.
builder
(
OrderViolation
.
class
)
public
ObjectRestResponse
saveOrderViolation
(
@RequestBody
OrderViolation
orderViolation
,
HttpServletRequest
request
)
{
.
where
(
WeekendSqls
.<
OrderViolation
>
custom
().
andEqualTo
(
OrderViolation:
:
getDetailId
,
detailId
)
log
.
info
(
"保存违章记录:orderViolation = {}"
,
orderViolation
.
toString
());
.
andEqualTo
(
OrderViolation:
:
getIsDel
,
0
)).
build
();
UserDTO
userDTOD
=
getBusinessUserByAppUser
();
List
<
OrderViolation
>
orderViolations
=
getBaseBiz
().
selectByExample
(
exa
);
if
(
orderViolation
.
getId
()
==
null
)
{
if
(
orderViolations
.
size
()
>
1
)
{
orderViolation
.
setIsDel
(
0
);
throw
new
BaseException
(
"The database has multiple records"
);
orderViolation
.
setCrtHost
(
request
.
getRemoteHost
());
}
orderViolation
.
setCrtName
(
userDTOD
.
getName
());
OrderViolation
orderViolation
=
new
OrderViolation
();
orderViolation
.
setCrtUserId
(
userDTOD
.
getId
());
orderViolation
=(
orderViolations
.
size
()==
0
)?
null
:
orderViolations
.
get
(
0
);
orderViolation
.
setCrtTime
(
new
BigInteger
(
String
.
valueOf
(
System
.
currentTimeMillis
())));
return
ObjectRestResponse
.
succ
(
orderViolation
);
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
);
return
ObjectRestResponse
.
succ
();
}
/**
* 通过订单id查询违章记录
*
* @param detailId
* @return
*/
@GetMapping
(
"/getOne/{detailId}"
)
public
ObjectRestResponse
<
OrderViolation
>
getOne
(
@PathVariable
Integer
detailId
)
{
Example
exa
=
Example
.
builder
(
OrderViolation
.
class
)
.
where
(
WeekendSqls
.<
OrderViolation
>
custom
().
andEqualTo
(
OrderViolation:
:
getDetailId
,
detailId
)
.
andEqualTo
(
OrderViolation:
:
getIsDel
,
0
)).
build
();
List
<
OrderViolation
>
orderViolations
=
getBaseBiz
().
selectByExample
(
exa
);
if
(
orderViolations
.
size
()
>
1
)
{
throw
new
BaseException
(
"The database has multiple records"
);
}
OrderViolation
orderViolation
=
new
OrderViolation
();
orderViolation
=
(
orderViolations
.
size
()
==
0
)
?
null
:
orderViolations
.
get
(
0
);
return
ObjectRestResponse
.
succ
(
orderViolation
);
}
@PostMapping
(
value
=
"/upload/violation"
)
@PostMapping
(
value
=
"/upload/violation"
)
public
ObjectRestResponse
uploadViolation
(
@RequestParam
(
"file"
)
MultipartFile
file
)
public
ObjectRestResponse
uploadViolation
(
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
throws
Exception
{
Assert
.
notNull
(
file
);
Assert
.
notNull
(
file
);
//文件类型
//文件类型
String
contentType
=
file
.
getContentType
();
String
contentType
=
file
.
getContentType
();
if
(!
FILE_TYPE
.
equalsIgnoreCase
(
contentType
)||
"png"
.
equalsIgnoreCase
(
contentType
))
{
if
(!
FILE_TYPE
.
equalsIgnoreCase
(
contentType
)
||
"png"
.
equalsIgnoreCase
(
contentType
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture format error"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture format error"
);
}
}
if
(
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
)
{
if
(
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture is too large"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture is too large"
);
}
}
return
baseBiz
.
uploadViolation
(
file
);
return
baseBiz
.
uploadViolation
(
file
);
}
}
@GetMapping
(
value
=
"/download/Violation/{realFileRelPath}"
)
//匹配的是href中的download请求
@GetMapping
(
value
=
"/download/Violation/{realFileRelPath}"
)
//匹配的是href中的download请求
public
ResponseEntity
<
byte
[]>
downloadViolation
(
@RequestParam
(
"realFileRelPath"
)
String
realFileRelPath
)
throws
Exception
{
public
ResponseEntity
<
byte
[]>
downloadViolation
(
@RequestParam
(
"realFileRelPath"
)
String
realFileRelPath
)
throws
Exception
{
return
baseBiz
.
downloadViolation
(
realFileRelPath
);
return
baseBiz
.
downloadViolation
(
realFileRelPath
);
}
}
}
}
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