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
26286c97
Commit
26286c97
authored
Jul 21, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改改app用户管理和app自动更新
parent
32a6175e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
121 additions
and
31 deletions
+121
-31
AppFormat.java
...com/github/wxiaoqi/security/admin/constant/AppFormat.java
+14
-0
BaseUserMemberBiz.java
.../github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
+28
-12
MemberLevelController.java
...ub/wxiaoqi/security/admin/rest/MemberLevelController.java
+2
-2
AppUserDetailMapper.xml
...e-admin/src/main/resources/mapper/AppUserDetailMapper.xml
+3
-4
AppVersionBiz.java
...rc/main/java/com/xxfc/platform/app/biz/AppVersionBiz.java
+2
-2
FileUploadConfig.java
...n/java/com/xxfc/platform/app/config/FileUploadConfig.java
+21
-0
AppVersionController.java
...java/com/xxfc/platform/app/rest/AppVersionController.java
+30
-10
application.yml
xx-app/xx-app-server/src/main/resources/application.yml
+10
-0
AppVersionMapper.xml
...app-server/src/main/resources/mapper/AppVersionMapper.xml
+0
-0
application.yml
...al/xx-universal-server/src/main/resources/application.yml
+11
-1
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/constant/AppFormat.java
0 → 100644
View file @
26286c97
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
constant
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
public
class
AppFormat
{
private
static
final
String
[]
format
=
{
"ipa"
,
"apk"
,
"pxl"
};
private
static
final
Set
formatSet
=
new
HashSet
(
Arrays
.
asList
(
format
));
public
static
Set
<
String
>
getFormatSet
()
{
return
formatSet
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
View file @
26286c97
...
@@ -193,6 +193,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
...
@@ -193,6 +193,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
* @return
* @return
*/
*/
public
BaseUserMemberVO
findOneByUserId
(
Integer
userId
)
{
public
BaseUserMemberVO
findOneByUserId
(
Integer
userId
)
{
BaseUserMemberVO
baseUserMemberVO
=
mapper
.
getBaseUserMemberVOByUserId
(
userId
);
BaseUserMemberVO
baseUserMemberVO
=
mapper
.
getBaseUserMemberVOByUserId
(
userId
);
if
(
baseUserMemberVO
!=
null
)
{
if
(
baseUserMemberVO
!=
null
)
{
return
baseUserMemberVO
;
return
baseUserMemberVO
;
...
@@ -218,23 +219,38 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
...
@@ -218,23 +219,38 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
BaseUserMember
baseUserMember
=
new
BaseUserMember
();
BaseUserMember
baseUserMember
=
new
BaseUserMember
();
BeanUtilsBean
.
getInstance
().
copyProperties
(
baseUserMember
,
baseUserMemberVO
);
BeanUtilsBean
.
getInstance
().
copyProperties
(
baseUserMember
,
baseUserMemberVO
);
if
(
baseUserMembers
==
null
||
baseUserMembers
.
size
()==
0
)
{
if
(
baseUserMembers
==
null
||
baseUserMembers
.
size
()==
0
)
{
if
(
baseUserMemberVO
.
getMemberLevel
()==
null
||
baseUserMember
.
getValidTime
()==
null
)
return
;
baseUserMember
.
setCrtTime
(
System
.
currentTimeMillis
());
if
(
baseUserMemberVO
.
getMemberLevel
()
==
null
||
baseUserMember
.
getValidTime
()
==
null
)
return
;
baseUserMember
.
setIsDel
(
0
);
baseUserMember
.
setCrtTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setPayCount
(
0
);
baseUserMember
.
setIsDel
(
0
);
baseUserMember
.
setCardLeave
(
1
);
baseUserMember
.
setPayCount
(
0
);
baseUserMember
.
setRecentRecharge
(
System
.
currentTimeMillis
());
baseUserMember
.
setCardLeave
(
1
);
Integer
buyCount
=
baseUserMember
.
getBuyCount
()==
null
?
0
:
baseUserMember
.
getBuyCount
();
baseUserMember
.
setRecentRecharge
(
System
.
currentTimeMillis
());
baseUserMember
.
setBuyCount
(
buyCount
+
1
);
Integer
buyCount
=
baseUserMember
.
getBuyCount
()
==
null
?
0
:
baseUserMember
.
getBuyCount
();
insertSelective
(
baseUserMember
);
baseUserMember
.
setBuyCount
(
buyCount
+
1
);
return
;
insertSelective
(
baseUserMember
);
return
;
}
else
if
(
baseUserMembers
.
size
()==
1
){
}
else
if
(
baseUserMembers
.
size
()==
1
){
baseUserMember
.
setUpdTime
(
System
.
currentTimeMillis
());
if
(
baseUserMemberVO
.
getMemberLevel
()
==
null
||
baseUserMember
.
getValidTime
()
==
null
){
getMyBiz
().
updateSelectiveById
(
baseUserMember
);
baseUserMember
.
setIsDel
(
1
);
}
else
{
baseUserMember
.
setIsDel
(
0
);
}
baseUserMember
.
setUpdTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setBuyCount
(
baseUserMembers
.
get
(
0
).
getBuyCount
()+
1
);
baseUserMember
.
setId
(
baseUserMembers
.
get
(
0
).
getId
());
mapper
.
updateByPrimaryKeySelective
(
baseUserMember
);
}
else
{
}
else
{
throw
new
BaseException
(
"Member purchase repeat!"
);
throw
new
BaseException
(
"Member purchase repeat!"
);
}
}
}
}
}
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/MemberLevelController.java
View file @
26286c97
...
@@ -54,7 +54,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
...
@@ -54,7 +54,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
return
null
;
return
null
;
}
}
@GetMapping
(
"/
M
anage/getMembers"
)
@GetMapping
(
"/
m
anage/getMembers"
)
public
ObjectRestResponse
getMembers
(){
public
ObjectRestResponse
getMembers
(){
Example
exa
=
Example
.
builder
(
BaseUserMemberLevel
.
class
).
where
(
Example
exa
=
Example
.
builder
(
BaseUserMemberLevel
.
class
).
where
(
WeekendSqls
.<
BaseUserMemberLevel
>
custom
()
WeekendSqls
.<
BaseUserMemberLevel
>
custom
()
...
@@ -66,7 +66,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
...
@@ -66,7 +66,7 @@ public class MemberLevelController extends BaseController<UserMemberLevelBiz, Ba
@DeleteMapping
(
"/
M
anage/delMembershipGrade/{id}"
)
@DeleteMapping
(
"/
m
anage/delMembershipGrade/{id}"
)
public
ObjectRestResponse
delMembershipGrade
(
@PathVariable
Integer
id
){
public
ObjectRestResponse
delMembershipGrade
(
@PathVariable
Integer
id
){
BaseUserMemberLevel
baseUserMemberLevel
=
new
BaseUserMemberLevel
();
BaseUserMemberLevel
baseUserMemberLevel
=
new
BaseUserMemberLevel
();
baseUserMemberLevel
.
setId
(
id
);
baseUserMemberLevel
.
setId
(
id
);
...
...
ace-modules/ace-admin/src/main/resources/mapper/AppUserDetailMapper.xml
View file @
26286c97
...
@@ -95,10 +95,7 @@
...
@@ -95,10 +95,7 @@
) m
) m
on
on
l.id = m.user_id
l.id = m.user_id
and m.is_del=0
where 1=1
<if
test=
"mobile !=null"
>
<if
test=
"mobile !=null"
>
and l.username like CONCAT('%',#{mobile},'%')
and l.username like CONCAT('%',#{mobile},'%')
...
@@ -118,6 +115,8 @@
...
@@ -118,6 +115,8 @@
<if
test=
"source !=null"
>
<if
test=
"source !=null"
>
and d.source = #{source}
and d.source = #{source}
</if>
</if>
order by l.id ASC
order by l.id ASC
</select>
</select>
...
...
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/biz/AppVersionBiz.java
View file @
26286c97
...
@@ -97,7 +97,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
...
@@ -97,7 +97,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
public
RestResponse
uploadDrivingLicense
(
MultipartFile
file
)
throws
IOException
{
public
Object
RestResponse
uploadDrivingLicense
(
MultipartFile
file
)
throws
IOException
{
DateTime
now
=
DateTime
.
now
();
DateTime
now
=
DateTime
.
now
();
String
dirPathToday
=
File
.
separator
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
dirPathToday
=
File
.
separator
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
...
@@ -111,7 +111,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
...
@@ -111,7 +111,7 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
String
filePath
=
uploadPath
+
realFileRelPath
;
String
filePath
=
uploadPath
+
realFileRelPath
;
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
return
RestResponse
.
su
c
(
filePath
);
return
ObjectRestResponse
.
suc
c
(
filePath
);
}
}
...
...
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/config/FileUploadConfig.java
0 → 100644
View file @
26286c97
package
com
.
xxfc
.
platform
.
app
.
config
;
import
org.springframework.boot.web.servlet.MultipartConfigFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.servlet.MultipartConfigElement
;
@Configuration
public
class
FileUploadConfig
{
@Bean
public
MultipartConfigElement
multipartConfigElement
()
{
MultipartConfigFactory
factory
=
new
MultipartConfigFactory
();
// 单个数据大小
factory
.
setMaxFileSize
(
"51200KB"
);
/// 总上传数据大小
factory
.
setMaxRequestSize
(
"51200KB"
);
return
factory
.
createMultipartConfig
();
}
}
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/rest/AppVersionController.java
View file @
26286c97
package
com
.
xxfc
.
platform
.
app
.
rest
;
package
com
.
xxfc
.
platform
.
app
.
rest
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.github.wxiaoqi.security.admin.constant.AppFormat
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
...
@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
...
@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Delete
;
...
@@ -36,6 +38,7 @@ import java.util.List;
...
@@ -36,6 +38,7 @@ import java.util.List;
@RestController
@RestController
@RequestMapping
(
"version"
)
@RequestMapping
(
"version"
)
@IgnoreClientToken
@IgnoreClientToken
@Slf4j
public
class
AppVersionController
extends
BaseController
<
AppVersionBiz
,
AppVersion
>
{
public
class
AppVersionController
extends
BaseController
<
AppVersionBiz
,
AppVersion
>
{
//最大上传500MB
//最大上传500MB
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
500L
;
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
500L
;
...
@@ -68,7 +71,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
...
@@ -68,7 +71,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
}
}
@ApiOperation
(
"查询"
)
@ApiOperation
(
"查询
一条
"
)
@RequestMapping
(
value
=
"/background/getAppVersion/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/background/getAppVersion/{id}"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
AppVersion
>
getAppVersion
(
@PathVariable
Integer
id
){
public
ObjectRestResponse
<
AppVersion
>
getAppVersion
(
@PathVariable
Integer
id
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
get
(
id
));
return
ObjectRestResponse
.
succ
(
baseBiz
.
get
(
id
));
...
@@ -82,7 +85,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
...
@@ -82,7 +85,7 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@Override
@Override
@ApiOperation
(
"修改"
)
@ApiOperation
(
"修改"
)
@RequestMapping
(
value
=
"/background/update
/{id}
"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/background/update"
,
method
=
RequestMethod
.
PUT
)
public
ObjectRestResponse
<
AppVersion
>
update
(
@RequestBody
AppVersion
appVersion
){
public
ObjectRestResponse
<
AppVersion
>
update
(
@RequestBody
AppVersion
appVersion
){
baseBiz
.
updateAppVersionById
(
appVersion
);
baseBiz
.
updateAppVersionById
(
appVersion
);
return
new
ObjectRestResponse
<
AppVersion
>();
return
new
ObjectRestResponse
<
AppVersion
>();
...
@@ -99,17 +102,17 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
...
@@ -99,17 +102,17 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
@PostMapping
(
value
=
"/upload/installationPackage"
)
@PostMapping
(
value
=
"/upload/installationPackage"
)
@ApiOperation
(
value
=
"上传app安装包"
)
@ApiOperation
(
value
=
"上传app安装包"
)
public
RestResponse
uploadInstallationPackage
(
@RequestParam
(
"file"
)
MultipartFile
file
)
public
Object
RestResponse
uploadInstallationPackage
(
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
throws
Exception
{
Assert
.
notNull
(
file
);
Assert
.
notNull
(
file
);
String
contentType
=
file
.
getContentType
();
//文件类型
//文件类型
//// String fileName = file.getOriginalFilename(); //文件名
String
contentType
=
file
.
getContentType
();
if
(!
contentType
.
equals
(
"apk"
)
&&
!
contentType
.
equals
(
"ipa"
))
{
log
.
debug
(
"contentType"
+
contentType
);
return
RestResponse
.
code
(
ResCode
.
INVALID_REST_REQ_PARAM
.
getCode
());
//判断上传的文件格式
}
if
(!
judgeFormat
(
contentType
)||
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
)
{
if
(
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
)
{
return
ObjectRestResponse
.
createDefaultFail
();
return
RestResponse
.
code
(
ResCode
.
INVALID_REST_REQ_PARAM
.
getCode
());
}
}
return
baseBiz
.
uploadDrivingLicense
(
file
);
return
baseBiz
.
uploadDrivingLicense
(
file
);
}
}
...
@@ -123,4 +126,21 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
...
@@ -123,4 +126,21 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
return
baseBiz
.
downloadInstallationPackage
(
realFileRelPath
);
return
baseBiz
.
downloadInstallationPackage
(
realFileRelPath
);
}
}
/**
* 判断上传的文件格式
* @param contentType
* @return
*/
private
boolean
judgeFormat
(
String
contentType
){
if
(
AppFormat
.
getFormatSet
().
size
()==
0
)
{
return
true
;
}
for
(
String
format
:
AppFormat
.
getFormatSet
())
{
if
(
format
.
equals
(
contentType
))
{
return
true
;
}
}
return
false
;
}
}
}
\ No newline at end of file
xx-app/xx-app-server/src/main/resources/application.yml
0 → 100644
View file @
26286c97
servlet
:
multipart
:
# 启用上传处理,默认是true
enabled
:
true
# 当上传文件达到1MB的时候进行磁盘写入
file-size-threshold
:
20MB
# 设置最大的请求文件的大小
max-request-size
:
50MB
# 设置单个文件的最大长度
max-file-size
:
50MB
\ No newline at end of file
xx-app/xx-app-server/src/main/resources/mapper/AppVersion
Controll
er.xml
→
xx-app/xx-app-server/src/main/resources/mapper/AppVersion
Mapp
er.xml
View file @
26286c97
File moved
xx-universal/xx-universal-server/src/main/resources/application.yml
View file @
26286c97
...
@@ -4,4 +4,14 @@ logging:
...
@@ -4,4 +4,14 @@ logging:
com.xxfc.platform.universal
:
com.xxfc.platform.universal
:
debug
debug
com.xxfc.platform.common
:
com.xxfc.platform.common
:
debug
debug
\ No newline at end of file
servlet
:
multipart
:
# 启用上传处理,默认是true
enabled
:
true
# 当上传文件达到1MB的时候进行磁盘写入
file-size-threshold
:
20MB
# 设置最大的请求文件的大小
max-request-size
:
50MB
# 设置单个文件的最大长度
max-file-size
:
50MB
\ 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