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
8c97559c
Commit
8c97559c
authored
Oct 09, 2019
by
hezhen
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
46a90a40
c2a07d94
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
409 additions
and
154 deletions
+409
-154
SummitStatus.java
...main/java/com/xxfc/platform/summit/pojo/SummitStatus.java
+20
-0
ActivityBiz.java
...c/main/java/com/xxfc/platform/summit/biz/ActivityBiz.java
+15
-1
RedisKey.java
...n/java/com/xxfc/platform/universal/constant/RedisKey.java
+5
-0
UploadController.java
.../xxfc/platform/universal/controller/UploadController.java
+3
-3
UploadZipService.java
...com/xxfc/platform/universal/service/UploadZipService.java
+1
-1
UploadZipServiceImpl.java
...platform/universal/service/impl/UploadZipServiceImpl.java
+49
-28
DepartureLogVo.java
...n/java/com/xxfc/platform/vehicle/pojo/DepartureLogVo.java
+10
-0
VehicleCountRecordBiz.java
.../com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
+229
-119
VehicleDepartureService.java
...om/xxfc/platform/vehicle/biz/VehicleDepartureService.java
+5
-0
VehicleCountRecordMapper.java
...xfc/platform/vehicle/mapper/VehicleCountRecordMapper.java
+1
-0
VehicleDepartureLogMapper.java
...fc/platform/vehicle/mapper/VehicleDepartureLogMapper.java
+3
-0
VehicleCountRecordController.java
...c/platform/vehicle/rest/VehicleCountRecordController.java
+7
-1
VehicleCountRecordMapper.xml
...er/src/main/resources/mapper/VehicleCountRecordMapper.xml
+8
-0
VehicleDepartureLogMapper.xml
...r/src/main/resources/mapper/VehicleDepartureLogMapper.xml
+53
-1
No files found.
xx-summit/xx-summit-api/src/main/java/com/xxfc/platform/summit/pojo/SummitStatus.java
0 → 100644
View file @
8c97559c
package
com
.
xxfc
.
platform
.
summit
.
pojo
;
public
enum
SummitStatus
{
ENROLL
(
"报名中"
,
1
),
IN_PROGRESS
(
"进行中"
,
2
),
End
(
"已结束"
,
3
);
private
String
msg
;
private
Integer
code
;
SummitStatus
(
String
msg
,
Integer
code
)
{
this
.
msg
=
msg
;
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
}
xx-summit/xx-summit-server/src/main/java/com/xxfc/platform/summit/biz/ActivityBiz.java
View file @
8c97559c
...
...
@@ -7,6 +7,7 @@ import com.xxfc.platform.summit.entity.Activity;
import
com.xxfc.platform.summit.mapper.ActivityMapper
;
import
com.xxfc.platform.summit.pojo.AccessType
;
import
com.xxfc.platform.summit.pojo.ActivityQuery
;
import
com.xxfc.platform.summit.pojo.SummitStatus
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -40,10 +41,23 @@ public class ActivityBiz extends BaseBiz<ActivityMapper, Activity> {
criteria
.
andLike
(
"title"
,
String
.
format
(
"%%%s%%"
,
query
.
getTitle
().
trim
()));
}
if
(
query
.
getStartTime
()
!=
null
)
{
criteria
.
andLike
(
"startTime"
,
query
.
getStartTime
()
/(
1000
*
60
*
60
)+
"%"
);
criteria
.
andLike
(
"startTime"
,
query
.
getStartTime
()
/
(
1000
*
60
*
60
)
+
"%"
);
}
if
(
query
.
getStatus
()
!=
null
)
{
criteria
.
andEqualTo
(
"status"
,
query
.
getStatus
());
switch
(
query
.
getStatus
())
{
case
1
:
criteria
.
orLessThan
(
"startTime"
,
System
.
currentTimeMillis
());
break
;
case
2
:
criteria
.
orBetween
(
"startTime"
,
System
.
currentTimeMillis
(),
"endTime"
);
break
;
case
3
:
criteria
.
orGreaterThan
(
"endTime"
,
System
.
currentTimeMillis
());
break
;
default
:
throw
new
IllegalStateException
(
"Unexpected value: "
+
query
.
getStatus
());
}
}
if
(
query
.
getType
()
!=
null
&&
AccessType
.
PUBLIC
.
getCode
().
equals
(
query
.
getType
()))
{
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/RedisKey.java
View file @
8c97559c
...
...
@@ -98,4 +98,9 @@ public class RedisKey {
public
static
final
String
CACHE_DICTIONARY_ALL
=
CACHE_DICTIONARY_PREFIX
+
"all:"
;
public
static
final
String
CACHE_DICTIONARY_ALL_MAP
=
CACHE_DICTIONARY_ALL
+
"map:"
;
public
static
final
String
ILLEGAL_VEHICLE_ENQUIRIES
=
"cache:violation"
;
/**
* 服务器上传压缩包文件序号
*/
public
static
final
String
UPLOAD_ZIP_NO_PREFIX
=
"upload:zip:no:"
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/UploadController.java
View file @
8c97559c
...
...
@@ -183,9 +183,9 @@ public class UploadController{
@PostMapping
(
value
=
"/app/unauth/pictureZip"
)
public
ObjectRestResponse
pictureZip
(
@Request
Body
MultipartFile
file
,
@Request
Body
String
password
)
throws
Exception
{
return
uploadZipService
.
uploadPictureZip
(
file
,
p
assword
);
@Request
Param
(
"file"
)
MultipartFile
file
,
@Request
Param
(
value
=
"prefix"
,
defaultValue
=
"summit"
)
String
prefix
)
throws
Exception
{
return
uploadZipService
.
uploadPictureZip
(
file
,
p
refix
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/UploadZipService.java
View file @
8c97559c
...
...
@@ -7,5 +7,5 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.IOException
;
public
interface
UploadZipService
{
ObjectRestResponse
uploadPictureZip
(
MultipartFile
file
,
String
p
assword
)
throws
IOException
;
ObjectRestResponse
uploadPictureZip
(
MultipartFile
file
,
String
p
refix
)
throws
IOException
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/impl/UploadZipServiceImpl.java
View file @
8c97559c
package
com
.
xxfc
.
platform
.
universal
.
service
.
impl
;
import
com.alibaba.druid.sql.visitor.functions.If
;
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.universal.constant.RedisKey
;
import
com.xxfc.platform.universal.constant.enumerate.FileTypeEnum
;
import
com.xxfc.platform.universal.service.UploadZipService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.codehaus.plexus.util.IOUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.nio.charset.Charset
;
import
java.util.Enumeration
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
...
...
@@ -22,60 +29,74 @@ public class UploadZipServiceImpl implements UploadZipService {
@Value
(
"${universal.uploadPath}"
)
private
String
uploadPath
;
@Value
(
"${universal.url}"
)
private
String
xx_url
;
private
static
final
String
APK_SUFFIX
=
".apk"
;
private
static
final
String
APK_NAME
=
"xxfc.apk"
;
private
static
final
String
JPG
=
".jpg"
;
private
static
final
String
PNG
=
".png"
;
@Value
(
"${photo.format}"
)
private
String
PHOTO_FORMAT
=
".png/.jpg/.git/.bmp"
;
@Autowired
RedisTemplate
redisTemplate
;
@Override
public
ObjectRestResponse
uploadPictureZip
(
MultipartFile
file
,
String
password
)
throws
IOException
{
if
(
Objects
.
isNull
(
f
ile
))
{
public
ObjectRestResponse
uploadPictureZip
(
MultipartFile
uFile
,
String
prefix
)
throws
IOException
{
if
(
Objects
.
isNull
(
uF
ile
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"请上传压缩文件!"
);
}
String
fileContentType
=
file
.
getContentType
();
String
fileContentType
=
uFile
.
getContentType
();
//将压缩包保存在指定路径
String
packFilePath
=
uploadPath
+
File
.
separator
+
f
ile
.
getName
();
String
packFilePath
=
uploadPath
+
File
.
separator
+
uF
ile
.
getName
();
if
(
FileTypeEnum
.
FILE_TYPE_ZIP
.
type
.
equals
(
fileContentType
)||
FileTypeEnum
.
FILE_TYPE_X_ZIP
.
type
.
equals
(
fileContentType
))
{
//zip解压缩处理
packFilePath
+=
FileTypeEnum
.
FILE_TYPE_ZIP
.
fileStufix
;
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"上传的压缩包格式不正确,仅支持zip压缩文件!"
);
}
File
fi
=
new
File
(
packFilePath
);
File
fi
le
=
new
File
(
packFilePath
);
try
{
file
.
transferTo
(
fi
);
//保存压缩包
FileOutputStream
os
=
new
FileOutputStream
(
file
);
IOUtil
.
copy
(
uFile
.
getInputStream
(),
os
);
os
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"zip file save to "
+
uploadPath
+
" error"
,
e
.
getMessage
(),
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"保存压缩文件到:"
+
uploadPath
+
" 失败!"
);
}
//zip压缩包
return
unPackZip
(
fi
,
password
,
uploadPath
);
//zip压缩包
解压
return
unPackZip
(
fi
le
,
prefix
);
}
public
ObjectRestResponse
unPackZip
(
File
file
,
String
password
,
String
destPath
)
throws
IOException
{
ZipFile
zipFile
=
new
ZipFile
(
file
);
public
ObjectRestResponse
<
String
>
unPackZip
(
File
file
,
String
prefix
)
throws
IOException
{
ZipFile
zipFile
=
new
ZipFile
(
file
,
Charset
.
forName
(
"GBK"
)
);
Enumeration
<?
extends
ZipEntry
>
entries
=
zipFile
.
entries
();
long
millis
=
System
.
currentTimeMillis
();
String
dirPathToday
=
prefix
+
File
.
separator
+
millis
;
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
millis
;
StringBuffer
result
=
new
StringBuffer
();
Integer
index
=
0
;
while
(
entries
.
hasMoreElements
())
{
ZipEntry
entry
=
entries
.
nextElement
();
if
(
entry
.
isDirectory
())
{
destPath
=
destPath
+
File
.
separator
+
entry
.
getName
();
File
dir
=
new
File
(
destPath
);
if
(
entry
.
isDirectory
()
&&
index
++
==
0
)
{
File
dir
=
new
File
(
uploadPath
+
dirPathToday
);
dir
.
mkdir
();
}
else
{
File
targetFile
=
new
File
(
destPath
+
File
.
separator
+
entry
.
getName
());
if
(
targetFile
.
getParentFile
().
exists
()){
}
}
}
else
if
(!
entry
.
isDirectory
())
{
Long
no
=
redisTemplate
.
opsForValue
().
increment
(
redisNoKey
);
if
(
no
.
equals
(
1
l
)){
redisTemplate
.
expire
(
redisNoKey
,
1
,
TimeUnit
.
DAYS
);
}
String
name
=
entry
.
getName
();
String
format
=
name
.
substring
(
name
.
lastIndexOf
(
"."
));
if
(
PHOTO_FORMAT
.
contains
(
format
))
{
String
realFileRelPath
=
dirPathToday
+
File
.
separator
+
no
+
format
;
File
targetFile
=
new
File
(
uploadPath
+
realFileRelPath
);
FileUtils
.
copyInputStreamToFile
(
zipFile
.
getInputStream
(
entry
),
targetFile
);
realFileRelPath
=
xx_url
+
SystemConfig
.
XXMP_URL
+
realFileRelPath
;
result
.
append
(
realFileRelPath
+
","
);
}
}
}
return
null
;
return
ObjectRestResponse
.
succ
(
result
.
substring
(
0
,
result
.
length
()-
1
));
}
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/DepartureLogVo.java
0 → 100644
View file @
8c97559c
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookRecord
;
import
com.xxfc.platform.vehicle.entity.VehicleDepartureLog
;
import
lombok.Data
;
@Data
public
class
DepartureLogVo
extends
VehicleDepartureLog
{
VehicleBookRecord
vehicleBookRecord
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
View file @
8c97559c
This diff is collapsed.
Click to expand it.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleDepartureService.java
View file @
8c97559c
...
...
@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle;
import
com.xxfc.platform.vehicle.entity.VehicleDepartureLog
;
import
com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper
;
import
com.xxfc.platform.vehicle.mapper.VehicleMapper
;
import
com.xxfc.platform.vehicle.pojo.DepartureLogVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -24,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Slf4j
...
...
@@ -103,6 +105,9 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
}
public
Integer
selectAllDepartureLog
(
Map
<
String
,
Object
>
param
)
{
return
mapper
.
selectAllDepartureLog
(
param
);
}
public
ObjectRestResponse
findOne
(
Integer
vid
)
throws
Exception
{
Example
exm
=
Example
.
builder
(
VehicleDepartureLog
.
class
)
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleCountRecordMapper.java
View file @
8c97559c
...
...
@@ -10,4 +10,5 @@ public interface VehicleCountRecordMapper extends Mapper<VehicleCountRecord> {
List
<
VehicleCountRecord
>
countDepartureVehicle
(
VehicleCountRecord
vehicleCountRecord
);
List
<
VehicleCountRecord
>
selectByTypeAndTime
(
Map
<
String
,
Object
>
param
);
List
<
VehicleCountRecord
>
selectByTime
(
Map
<
String
,
Object
>
param
);
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleDepartureLogMapper.java
View file @
8c97559c
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
import
com.xxfc.platform.vehicle.entity.VehicleDepartureLog
;
import
com.xxfc.platform.vehicle.pojo.DepartureLogVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
public
interface
VehicleDepartureLogMapper
extends
BaseMapper
<
VehicleDepartureLog
>,
Mapper
<
VehicleDepartureLog
>
{
...
...
@@ -32,4 +34,5 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
String
selectDayByVehicleId
(
String
vehicleId
);
VehicleDepartureLogVo
selectByBookRecordId
(
Long
bookRecordId
);
Integer
selectAllDepartureLog
(
Map
<
String
,
Object
>
param
);
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleCountRecordController.java
View file @
8c97559c
...
...
@@ -30,7 +30,7 @@ public class VehicleCountRecordController {
@GetMapping
(
"/app/unauth/get"
)
@ResponseBody
public
ObjectRestResponse
getByTypeAndDate
(
VehicleCountRecord
vehicleCountRecord
)
{
return
vehicleCountRecordBiz
.
countDepartureVehicl
e
(
vehicleCountRecord
);
return
vehicleCountRecordBiz
.
selectByTim
e
(
vehicleCountRecord
);
}
@PostMapping
(
"/app/unauth/export"
)
...
...
@@ -43,4 +43,10 @@ public class VehicleCountRecordController {
public
void
download
(
ExcelParamDto
excelParamDto
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
DownloadUtil
.
downloadFile
(
excelParamDto
.
getPath
(),
"export.xls"
,
response
,
request
);
}
@GetMapping
(
"/app/unauth/selectByTime"
)
public
ObjectRestResponse
selectByTime
(
VehicleCountRecord
vehicleCountRecord
)
{
return
vehicleCountRecordBiz
.
selectByTime
(
vehicleCountRecord
);
}
}
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleCountRecordMapper.xml
View file @
8c97559c
...
...
@@ -35,4 +35,12 @@
order by id DESC
</select>
<select
id=
"selectByTime"
parameterType =
"Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleCountRecord"
>
select * from vehicle_count_record
where count_date
>
= #{startTime} and count_date
<
= #{endTime}
<if
test=
"type != null"
>
and type = #{type}
</if>
order by id DESC
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleDepartureLogMapper.xml
View file @
8c97559c
...
...
@@ -2,7 +2,11 @@
<!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.VehicleDepartureLogMapper"
>
<resultMap
id=
"searchBookRecord"
type=
"com.xxfc.platform.vehicle.pojo.DepartureLogVo"
>
<result
column=
"book_record_id"
property=
"bookRecordId"
jdbcType=
"INTEGER"
javaType=
"java.lang.Integer"
/>
<association
property=
"vehicleBookRecord"
column=
"id"
select=
"com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"
/>
</resultMap>
<select
id=
"selectLastByVehicleId"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleDepartureLog"
>
select * from vehicle_departure_log
where vehicle_id = #{vehicleId}
...
...
@@ -30,7 +34,55 @@
where vehicle_departure_log.book_record_id = #{id}
order by create_time desc
</select>
<select
id=
"selectAllDepartureLog"
resultType=
"java.lang.Integer"
parameterType=
"Map"
>
SELECT
count(*)
FROM
vehicle_departure_log v1
LEFT JOIN vehicle_book_record v2 on v1.book_record_id = v2.id
<where>
<if
test=
"startTime != null and status == 1"
>
and (v1.departure_time between #{startTime} and #{endTime})
</if>
<if
test=
"startTime != null and status == 2"
>
and (v1.arrival_time between #{startTime} and #{endTime})
</if>
<!--正常出车-->
<if
test=
"startTime != null and status == 1 and type == 1"
>
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前出车-->
<if
test=
"endTime != null and status == 1 and type == 2"
>
and v2.book_start_date
>
= #{endTime}
</if>
<!--延期出车-->
<if
test=
"startTime != null and status == 1 and type == 3"
>
and v2.book_start_date
<
= #{startTime}
</if>
<!--正常还车-->
<if
test=
"startTime != null and status == 2 and type == 1"
>
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前还车-->
<if
test=
"endTime != null and status == 2 and type == 2"
>
and v2.book_start_date
>
= #{endTime}
</if>
<!--延期还车-->
<if
test=
"startTime != null and status == 2 and type == 3"
>
and v2.book_start_date
<
= #{startTime}
</if>
<!--统计客户用车-->
<if
test=
"bookUser != null"
>
and v2.book_user = #{bookUser}
</if>
<if
test=
"bookUser == null"
>
and v2.book_user != -2
</if>
</where>
</select>
<select
id=
"selectVoAll"
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"
>
select vehicle_departure_log.*,vehicle.number_plate,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
...
...
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