Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
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
liqin
chnmuseum-party
Commits
54bdac3f
Commit
54bdac3f
authored
Apr 20, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
468a6d44
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
96 deletions
+98
-96
ChinaMobileRestApiController.java
...um/party/web/controller/ChinaMobileRestApiController.java
+10
-1
TAppVersionController.java
...chnmuseum/party/web/controller/TAppVersionController.java
+88
-95
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ChinaMobileRestApiController.java
View file @
54bdac3f
...
...
@@ -662,8 +662,17 @@ public class ChinaMobileRestApiController extends BaseController {
Map
map
=
new
HashMap
();
if
(
StringUtils
.
isNotBlank
(
versionNo
))
{
if
(
Long
.
parseLong
(
versionNo
)
>=
Long
.
parseLong
(
current
.
getAppVersion
()))
{
final
String
prefix
=
StringUtils
.
substring
(
versionNo
,
0
,
StringUtils
.
indexOf
(
versionNo
,
"."
));
final
String
suffix
=
StringUtils
.
substring
(
versionNo
,
StringUtils
.
indexOf
(
versionNo
,
"."
)).
replaceAll
(
"\\."
,
""
);
String
currAppVersion
=
current
.
getAppVersion
();
final
String
prefix1
=
StringUtils
.
substring
(
currAppVersion
,
0
,
StringUtils
.
indexOf
(
currAppVersion
,
"."
));
final
String
suffix1
=
StringUtils
.
substring
(
currAppVersion
,
StringUtils
.
indexOf
(
currAppVersion
,
"."
)).
replaceAll
(
"\\."
,
""
);
if
(
Double
.
parseDouble
(
prefix
+
"."
+
suffix
)
>=
Double
.
parseDouble
(
prefix1
+
"."
+
suffix1
))
{
map
.
put
(
"isLatest"
,
true
);
}
else
{
map
.
put
(
"isLatest"
,
false
);
}
}
else
{
map
.
put
(
"isLatest"
,
false
);
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/TAppVersionController.java
View file @
54bdac3f
...
...
@@ -11,6 +11,7 @@ import cn.wisenergy.chnmuseum.party.service.TAppVersionService;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -44,39 +45,31 @@ public class TAppVersionController extends BaseController {
@Resource
private
TAppVersionService
tAppVersionService
;
@PostMapping
(
"/batchSave"
)
@RequiresAuthentication
//@RequiresPermissions("t:app:version:batch:save")
@ApiOperation
(
value
=
"批量添加"
,
notes
=
"批量添加"
)
public
Map
<
String
,
Object
>
batchSaveTAppVersion
(
@Validated
(
value
=
{
Add
.
class
})
List
<
TAppVersion
>
tAppVersionList
)
{
// 保存业务节点信息
boolean
result
=
tAppVersionService
.
saveBatch
(
tAppVersionList
);
// 返回操作结果
if
(
result
)
{
return
getSuccessResult
();
}
else
{
// 保存失败
return
getFailResult
();
}
}
@PostMapping
(
"/save"
)
@RequiresAuthentication
//@RequiresPermissions("t:app:version:save")
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
@MethodLog
(
operModule
=
OperModule
.
APPVERSION
,
operType
=
OperType
.
ADD
)
public
Map
<
String
,
Object
>
saveTAppVersion
(
@Validated
(
value
=
{
Add
.
class
})
TAppVersion
tAppVersion
)
{
final
LambdaQueryWrapper
<
TAppVersion
>
eq
=
Wrappers
.<
TAppVersion
>
lambdaQuery
().
eq
(
TAppVersion:
:
getAppVersion
,
tAppVersion
.
getAppVersion
().
trim
());
final
List
<
TAppVersion
>
list
=
this
.
tAppVersionService
.
list
(
eq
);
if
(!
list
.
isEmpty
()
&&
list
.
size
()
>
1
)
{
// 保存失败
return
getFailResult
(
"版本号不能重复"
);
}
TUser
user
=
getcurUser
();
// 默认不为当前版本
if
(
tAppVersion
.
getIsCurrent
()
==
null
)
{
if
(
tAppVersion
.
getIsCurrent
()
==
null
)
{
tAppVersion
.
setIsCurrent
(
0
);
}
tAppVersion
.
setUserId
(
user
.
getId
());
tAppVersion
.
setUserName
(
user
.
getUserName
());
// 如果有其他版本是当前版本状态,将其当前版本状态取消
QueryWrapper
<
TAppVersion
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"is_current"
,
1
);
qw
.
eq
(
"is_current"
,
1
);
List
<
TAppVersion
>
currentList
=
tAppVersionService
.
list
(
qw
);
if
(
currentList
!=
null
&&
currentList
.
size
()
>
0
&&
tAppVersion
.
getIsCurrent
()
==
1
)
{
currentList
.
stream
().
forEach
(
c
->
{
if
(
currentList
!=
null
&&
currentList
.
size
()
>
0
&&
tAppVersion
.
getIsCurrent
()
==
1
)
{
currentList
.
forEach
(
c
->
{
c
.
setIsCurrent
(
0
);
});
tAppVersionService
.
updateBatchById
(
currentList
);
...
...
@@ -98,15 +91,15 @@ public class TAppVersionController extends BaseController {
@MethodLog
(
operModule
=
OperModule
.
APPVERSION
,
operType
=
OperType
.
UPDATE
)
public
Map
<
String
,
Object
>
updateTAppVersion
(
@Validated
(
value
=
{
Update
.
class
})
TAppVersion
tAppVersion
)
{
// 默认不为当前版本
if
(
tAppVersion
.
getIsCurrent
()
==
null
)
{
if
(
tAppVersion
.
getIsCurrent
()
==
null
)
{
tAppVersion
.
setIsCurrent
(
0
);
}
// 如果有其他版本是当前版本状态,将其当前版本状态取消
QueryWrapper
<
TAppVersion
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"is_current"
,
1
);
qw
.
eq
(
"is_current"
,
1
);
List
<
TAppVersion
>
currentList
=
tAppVersionService
.
list
(
qw
);
if
(
currentList
!=
null
&&
currentList
.
size
()
>
0
&&
tAppVersion
.
getIsCurrent
()
==
1
)
{
currentList
.
stream
().
forEach
(
c
->
{
if
(
currentList
!=
null
&&
currentList
.
size
()
>
0
&&
tAppVersion
.
getIsCurrent
()
==
1
)
{
currentList
.
stream
().
forEach
(
c
->
{
c
.
setIsCurrent
(
0
);
});
tAppVersionService
.
updateBatchById
(
currentList
);
...
...
@@ -144,7 +137,7 @@ public class TAppVersionController extends BaseController {
@MethodLog
(
operModule
=
OperModule
.
APPVERSION
,
operType
=
OperType
.
SELECT
)
public
Map
<
String
,
Object
>
getTAppVersionList
(
String
isCurrent
)
{
QueryWrapper
qw
=
new
QueryWrapper
();
qw
.
eq
(
StringUtils
.
isNotEmpty
(
isCurrent
),
"is_current"
,
isCurrent
).
orderByDesc
(
"update_time"
);
qw
.
eq
(
StringUtils
.
isNotEmpty
(
isCurrent
),
"is_current"
,
isCurrent
).
orderByDesc
(
"update_time"
);
List
<
TAppVersion
>
tAppVersionList
=
tAppVersionService
.
list
(
qw
);
return
getResult
(
tAppVersionList
);
}
...
...
@@ -167,9 +160,9 @@ public class TAppVersionController extends BaseController {
queryWrapper
.
like
(
TAppVersion:
:
getIsCurrent
,
isCurrent
);
}
// 查询时间范围
if
(
startDate
!=
null
&&
endDate
!=
null
)
{
queryWrapper
.
ge
(
TAppVersion:
:
getUpdateTime
,
startDate
.
atTime
(
0
,
0
,
0
))
.
le
(
TAppVersion:
:
getUpdateTime
,
endDate
.
atTime
(
23
,
59
,
59
));
if
(
startDate
!=
null
&&
endDate
!=
null
)
{
queryWrapper
.
ge
(
TAppVersion:
:
getUpdateTime
,
startDate
.
atTime
(
0
,
0
,
0
))
.
le
(
TAppVersion:
:
getUpdateTime
,
endDate
.
atTime
(
23
,
59
,
59
));
}
queryWrapper
.
select
().
orderByDesc
(
TAppVersion:
:
getUpdateTime
);
...
...
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