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
66aa6dd3
Commit
66aa6dd3
authored
Jun 23, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改-学习内容中的展板参考资料可指定是否在app中显示
parent
fec4da72
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
271 additions
and
38 deletions
+271
-38
AddressUtil.java
...main/java/cn/chnmuseum/party/common/util/AddressUtil.java
+6
-0
LearningContentAssetMapper.java
...cn/chnmuseum/party/mapper/LearningContentAssetMapper.java
+13
-0
LearningContent.java
src/main/java/cn/chnmuseum/party/model/LearningContent.java
+4
-0
LearningContentAsset.java
...n/java/cn/chnmuseum/party/model/LearningContentAsset.java
+50
-0
LearningContentAssetService.java
.../chnmuseum/party/service/LearningContentAssetService.java
+7
-0
LearningContentAssetServiceImpl.java
...m/party/service/impl/LearningContentAssetServiceImpl.java
+17
-0
AssetVo.java
src/main/java/cn/chnmuseum/party/vo/AssetVo.java
+30
-0
AssetController.java
...va/cn/chnmuseum/party/web/controller/AssetController.java
+31
-0
ChinaMobileRestApiController.java
...um/party/web/controller/ChinaMobileRestApiController.java
+38
-21
ExhibitionBoardController.java
...useum/party/web/controller/ExhibitionBoardController.java
+6
-4
LearningContentController.java
...useum/party/web/controller/LearningContentController.java
+63
-5
LearningProjectController.java
...useum/party/web/controller/LearningProjectController.java
+0
-2
StatisticController.java
...n/chnmuseum/party/web/controller/StatisticController.java
+4
-5
application-dev.properties
src/main/resources/application-dev.properties
+1
-0
application.properties
src/main/resources/application.properties
+1
-1
No files found.
src/main/java/cn/chnmuseum/party/common/util/AddressUtil.java
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
common
.
util
;
import
cn.hutool.core.net.NetUtil
;
import
net.sf.json.JSONObject
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -145,4 +146,9 @@ public class AddressUtil {
return
map
;
}
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
String
>
addressByIp1
=
getAddressByIp
(
"192.168.207.244"
);
System
.
out
.
println
(
addressByIp1
);
}
}
\ No newline at end of file
src/main/java/cn/chnmuseum/party/mapper/LearningContentAssetMapper.java
0 → 100644
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
mapper
;
import
cn.chnmuseum.party.model.LearningContentAsset
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* @description:
* @author: nh
* @create: 2021-06-22 09:58
**/
public
interface
LearningContentAssetMapper
extends
BaseMapper
<
LearningContentAsset
>
{
}
src/main/java/cn/chnmuseum/party/model/LearningContent.java
View file @
66aa6dd3
...
...
@@ -151,4 +151,8 @@ public class LearningContent implements Serializable {
@TableField
(
exist
=
false
)
private
List
<
Audit
>
auditHistoryList
;
@ApiModelProperty
(
"在app展示的学习资料"
)
@TableField
(
exist
=
false
)
private
List
<
String
>
fileList
;
}
src/main/java/cn/chnmuseum/party/model/LearningContentAsset.java
0 → 100644
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
model
;
import
cn.chnmuseum.party.common.validator.groups.Update
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @description: 学习内容下的展板参考资料是否在app显示
* @author: nh
* @create: 2021-06-22 09:38
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"learning_content_asset"
)
@ApiModel
(
value
=
"学习内容展板参考资料是否展示"
,
description
=
"学习内容展板参考资料是否展示"
)
public
class
LearningContentAsset
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"ID"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
ASSIGN_ID
)
@NotNull
(
message
=
"ID不能为空"
,
groups
=
{
Update
.
class
})
private
String
id
;
@ApiModelProperty
(
"学习内容"
)
@TableField
(
value
=
"learning_content_id"
)
private
String
learningContentId
;
@ApiModelProperty
(
"展板"
)
@TableField
(
value
=
"board_id"
)
private
String
boardId
;
@ApiModelProperty
(
"参考资料"
)
@TableField
(
value
=
"asset_id"
)
private
String
assetId
;
}
src/main/java/cn/chnmuseum/party/service/LearningContentAssetService.java
0 → 100644
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
service
;
import
cn.chnmuseum.party.model.LearningContentAsset
;
import
com.baomidou.mybatisplus.extension.service.IService
;
public
interface
LearningContentAssetService
extends
IService
<
LearningContentAsset
>
{
}
src/main/java/cn/chnmuseum/party/service/impl/LearningContentAssetServiceImpl.java
0 → 100644
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
service
.
impl
;
import
cn.chnmuseum.party.mapper.LearningContentAssetMapper
;
import
cn.chnmuseum.party.model.LearningContentAsset
;
import
cn.chnmuseum.party.service.LearningContentAssetService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
/**
* @description:
* @author: nh
* @create: 2021-06-22 09:57
**/
@Service
public
class
LearningContentAssetServiceImpl
extends
ServiceImpl
<
LearningContentAssetMapper
,
LearningContentAsset
>
implements
LearningContentAssetService
{
}
src/main/java/cn/chnmuseum/party/vo/AssetVo.java
0 → 100644
View file @
66aa6dd3
package
cn
.
chnmuseum
.
party
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* @description:
* @author: nh
* @create: 2021-06-22 11:08
**/
@ApiModel
(
"学习内容展板中的参考资料"
)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
AssetVo
implements
Serializable
{
private
String
id
;
private
String
boardName
;
private
String
fileName
;
private
String
fileType
;
}
src/main/java/cn/chnmuseum/party/web/controller/AssetController.java
View file @
66aa6dd3
...
...
@@ -9,11 +9,16 @@ import cn.chnmuseum.party.common.util.TimeUtils;
import
cn.chnmuseum.party.common.video.VideoEncryptUtil
;
import
cn.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.chnmuseum.party.model.Asset
;
import
cn.chnmuseum.party.model.ExhibitionBoard
;
import
cn.chnmuseum.party.model.TBoxOperation
;
import
cn.chnmuseum.party.service.AssetService
;
import
cn.chnmuseum.party.service.ExhibitionBoardService
;
import
cn.chnmuseum.party.vo.AssetVo
;
import
cn.chnmuseum.party.web.controller.base.BaseController
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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
;
...
...
@@ -35,6 +40,7 @@ import java.io.InputStream;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -56,6 +62,9 @@ public class AssetController extends BaseController {
@Resource
private
AssetService
assetService
;
@Resource
private
ExhibitionBoardService
exhibitionBoardService
;
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"_size"
,
value
=
"返回条数"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
...
...
@@ -157,5 +166,27 @@ public class AssetController extends BaseController {
ZipUtil
.
zip
(
response
.
getOutputStream
(),
map
.
keySet
().
toArray
(
new
String
[
0
]),
map
.
values
().
toArray
(
new
InputStream
[
0
]));
}
@ApiOperation
(
value
=
"获取展板中的参考资料"
,
notes
=
"后去展板中的参考资料"
)
@RequiresAuthentication
@GetMapping
(
"/getAssetByBoard"
)
public
Map
<
String
,
Object
>
getAssetByBoard
(
@RequestParam
(
value
=
"boardList"
,
required
=
true
)
List
<
String
>
boardList
){
LambdaQueryWrapper
<
Asset
>
assetLambdaQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
();
assetLambdaQueryWrapper
.
in
(
Asset:
:
getRefItemId
,
boardList
);
List
<
Asset
>
list
=
this
.
assetService
.
list
(
assetLambdaQueryWrapper
);
List
<
AssetVo
>
assetVos
=
new
ArrayList
<>();
for
(
Asset
asset
:
list
)
{
ExhibitionBoard
board
=
this
.
exhibitionBoardService
.
getById
(
asset
.
getRefItemId
());
AssetVo
assetVo
=
AssetVo
.
builder
()
.
id
(
asset
.
getId
())
.
fileName
(
asset
.
getFileName
())
.
fileType
(
asset
.
getFileExtName
())
.
boardName
(
board
.
getName
())
.
build
();
assetVos
.
add
(
assetVo
);
}
return
getResult
(
assetVos
);
}
}
src/main/java/cn/chnmuseum/party/web/controller/ChinaMobileRestApiController.java
View file @
66aa6dd3
...
...
@@ -32,6 +32,7 @@ import org.apache.shiro.authc.IncorrectCredentialsException;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -99,6 +100,9 @@ public class ChinaMobileRestApiController extends BaseController {
@Resource
private
TAppRunPicService
appRunPicService
;
@Resource
private
LearningContentAssetService
learningContentAssetService
;
private
static
final
String
SHIRO_JWT_TOKEN
=
"shiro:jwt:token:"
;
//用户登录次数计数 redisKey 前缀
private
static
final
String
SHIRO_LOGIN_COUNT
=
"shiro_login_count_"
;
...
...
@@ -498,14 +502,15 @@ public class ChinaMobileRestApiController extends BaseController {
final
IPage
<
ExhibitionBoard
>
page
=
this
.
learningContentBoardService
.
getBoardPageByLearningContentId
(
page1
,
learningContentId
,
null
);
for
(
ExhibitionBoard
exhibitionBoard
:
page
.
getRecords
())
{
exhibitionBoard
.
setLearningContentId
(
learningContentId
);
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()))
{
String
name
=
this
.
copyrightOwnerService
.
getById
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()).
getName
();
exhibitionBoard
.
setBoardCopyrightOwnerName
(
name
);
}
if
(
exhibitionBoard
.
getExhibitionBoardCatId
()
!=
null
)
{
String
name
=
this
.
exhibitionBoardCatService
.
getById
(
exhibitionBoard
.
getExhibitionBoardCatId
()).
getName
();
exhibitionBoard
.
setExhibitionBoardCatName
(
name
);
}
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()))
{
String
name
=
this
.
copyrightOwnerService
.
getById
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()).
getName
();
exhibitionBoard
.
setBoardCopyrightOwnerName
(
name
);
}
LambdaQueryWrapper
<
Asset
>
assetQueryWrapper
;
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentId
()))
{
final
VideoContent
videoContent
=
this
.
videoContentService
.
getById
(
exhibitionBoard
.
getVideoContentId
());
...
...
@@ -513,32 +518,43 @@ public class ChinaMobileRestApiController extends BaseController {
exhibitionBoard
.
setBoardVideoContentThumbnail
(
videoContent
.
getThumbnail
());
}
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
()
.
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getVideoContentId
())
;
assetQueryWrapper
.
eq
(
Asset:
:
get
Published
,
true
);
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
();
assetQueryWrapper
.
eq
(
Asset:
:
get
RefItemId
,
exhibitionBoard
.
getVideoContentId
()
);
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
VIDEO_CONTENT
.
name
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
List
<
Asset
>
videoList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
for
(
Asset
asset
:
videoList
)
{
videoList
.
forEach
(
asset
->
{
asset
.
setExhibitionBoardName
(
exhibitionBoard
.
getName
());
asset
.
setExhibitionBoardId
(
exhibitionBoard
.
getId
());
}
});
exhibitionBoard
.
setVideoList
(
videoList
);
assetQueryWrapper
.
clear
();
}
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getId
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
EXHIBITION_BOARD_DATUM
.
name
());
List
<
Asset
>
datumList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
for
(
Asset
asset
:
datumList
)
{
asset
.
setExhibitionBoardName
(
exhibitionBoard
.
getName
());
asset
.
setExhibitionBoardId
(
exhibitionBoard
.
getId
());
// 该学习内容下的展板参考资料哪些显示
LambdaQueryWrapper
<
LearningContentAsset
>
wrapper
=
Wrappers
.<
LearningContentAsset
>
lambdaQuery
().
eq
(
LearningContentAsset:
:
getLearningContentId
,
learningContentId
);
wrapper
.
eq
(
LearningContentAsset:
:
getBoardId
,
exhibitionBoard
.
getId
());
wrapper
.
select
(
LearningContentAsset:
:
getAssetId
);
List
<
String
>
list
=
this
.
learningContentAssetService
.
listObjs
(
wrapper
,
Object:
:
toString
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getId
());
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
EXHIBITION_BOARD_DATUM
.
name
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
assetQueryWrapper
.
in
(
Asset:
:
getId
,
list
);
List
<
Asset
>
datumList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
for
(
Asset
asset
:
datumList
)
{
asset
.
setExhibitionBoardId
(
exhibitionBoard
.
getId
());
asset
.
setExhibitionBoardName
(
exhibitionBoard
.
getName
());
}
exhibitionBoard
.
setDatumList
(
datumList
);
}
exhibitionBoard
.
setDatumList
(
datumList
);
//videoList.addAll(datumList.stream().filter(x -> FileTypeEnum.VIDEO.name().equalsIgnoreCase(x.getFileType())).collect(Collectors.toList()));
// 填充编号
setBoardSerial
(
exhibitionBoard
);
this
.
setBoardSerial
(
exhibitionBoard
);
}
return
getResult
(
page
);
}
...
...
@@ -555,14 +571,15 @@ public class ChinaMobileRestApiController extends BaseController {
@RequestParam
(
value
=
"videoLanguage"
,
required
=
false
)
LanguageEnum
videoLanguage
,
@RequestParam
(
value
=
"audioLanguage"
,
required
=
false
)
LanguageEnum
audioLanguage
)
{
ExhibitionBoard
exhibitionBoard
=
exhibitionBoardService
.
getById
(
id
);
String
exhibitionBoardCatId
=
exhibitionBoard
.
getExhibitionBoardCatId
();
if
(
exhibitionBoardCatId
!=
null
)
{
exhibitionBoard
.
setExhibitionBoardCatName
(
this
.
exhibitionBoardCatService
.
getById
(
exhibitionBoardCatId
).
getName
());
}
String
boardCopyrightOwnerId
=
exhibitionBoard
.
getBoardCopyrightOwnerId
();
if
(
boardCopyrightOwnerId
!=
null
)
{
exhibitionBoard
.
setBoardCopyrightOwnerName
(
this
.
copyrightOwnerService
.
getById
(
boardCopyrightOwnerId
).
getName
());
}
String
exhibitionBoardCatId
=
exhibitionBoard
.
getExhibitionBoardCatId
();
if
(
exhibitionBoardCatId
!=
null
)
{
exhibitionBoard
.
setExhibitionBoardCatName
(
this
.
exhibitionBoardCatService
.
getById
(
exhibitionBoardCatId
).
getName
());
}
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()))
{
String
name
=
this
.
copyrightOwnerService
.
getById
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()).
getName
();
exhibitionBoard
.
setVideoContentCopyrightOwnerName
(
name
);
...
...
src/main/java/cn/chnmuseum/party/web/controller/ExhibitionBoardController.java
View file @
66aa6dd3
...
...
@@ -412,18 +412,18 @@ public class ExhibitionBoardController extends BaseController {
exhibitionBoard
.
setBoardCopyrightOwnerName
(
copyrightOwner
.
getName
());
}
}
if
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
())
)
{
final
CopyrightOwner
copyrightOwner
=
this
.
copyrightOwnerService
.
getById
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
());
if
(
copyrightOwner
==
null
)
{
exhibitionBoard
.
setVideoContentCopyrightOwnerName
(
"对应的视频内容版权方已被删除"
);
}
else
{
exhibitionBoard
.
setVideoContentCopyrightOwnerName
(
copyrightOwner
.
getName
());
}
}
if
(
StringUtils
.
isEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()))
{
}
else
{
exhibitionBoard
.
setVideoContentCopyrightOwnerName
(
"无"
);
exhibitionBoard
.
setVideoContentName
(
"无"
);
}
if
(
exhibitionBoard
.
getExhibitionBoardCatId
()
!=
null
)
{
final
ExhibitionBoardCat
exhibitionBoardCat
=
this
.
exhibitionBoardCatService
.
getById
(
exhibitionBoard
.
getExhibitionBoardCatId
());
if
(
exhibitionBoardCat
==
null
)
{
...
...
@@ -432,7 +432,7 @@ public class ExhibitionBoardController extends BaseController {
exhibitionBoard
.
setExhibitionBoardCatName
(
exhibitionBoardCat
.
getName
());
}
}
if
(
exhibitionBoard
.
getVideoContentId
()
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentId
()
)
)
{
String
videoContentId
=
exhibitionBoard
.
getVideoContentId
();
final
VideoContent
videoContent
=
this
.
videoContentService
.
getById
(
videoContentId
);
if
(
videoContent
==
null
)
{
...
...
@@ -442,6 +442,8 @@ public class ExhibitionBoardController extends BaseController {
final
List
<
Asset
>
videoList
=
this
.
assetService
.
list
(
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
videoContentId
).
eq
(
Asset:
:
getPublished
,
true
));
exhibitionBoard
.
setVideoList
(
videoList
);
}
}
else
{
exhibitionBoard
.
setVideoContentName
(
"无"
);
}
}
return
getResult
(
page
);
...
...
src/main/java/cn/chnmuseum/party/web/controller/LearningContentController.java
View file @
66aa6dd3
...
...
@@ -7,6 +7,7 @@ import cn.chnmuseum.party.common.enums.FileCatEnum;
import
cn.chnmuseum.party.common.log.MethodLog
;
import
cn.chnmuseum.party.common.log.OperModule
;
import
cn.chnmuseum.party.common.log.OperType
;
import
cn.chnmuseum.party.common.util.ListUtil
;
import
cn.chnmuseum.party.common.validator.groups.Add
;
import
cn.chnmuseum.party.common.validator.groups.Update
;
import
cn.chnmuseum.party.common.vo.GenericPageParam
;
...
...
@@ -17,6 +18,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
...
...
@@ -27,6 +29,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -74,10 +77,14 @@ public class LearningContentController extends BaseController {
@Autowired
TOrganService
organService
;
@Resource
private
LearningContentAssetService
learningContentAssetService
;
@PostMapping
(
"/save"
)
@RequiresAuthentication
//@RequiresPermissions("learning:content:save")
@ApiOperation
(
value
=
"添加学习内容"
,
notes
=
"添加学习内容"
)
@MethodLog
(
operModule
=
OperModule
.
LEARNCONTENT
,
operType
=
OperType
.
ADD
)
@Transactional
public
Map
<
String
,
Object
>
saveLearningContent
(
@Validated
(
value
=
{
Add
.
class
})
LearningContent
learningContent
,
Boolean
isMajor
)
{
TUser
tUser1
=
getcurUser
();
if
(
"1"
.
equals
(
tUser1
.
getType
())){
...
...
@@ -154,6 +161,25 @@ public class LearningContentController extends BaseController {
this
.
learningContentBoardService
.
save
(
learningContentBoard
);
}
// 保存需要在app端显示的参考资料
List
<
String
>
fileList
=
learningContent
.
getFileList
();
if
(!
CollectionUtils
.
isEmpty
(
fileList
))
{
List
<
LearningContentAsset
>
learningContentAssets
=
new
ArrayList
<>();
List
<
Asset
>
assets
=
this
.
assetService
.
listByIds
(
fileList
);
assets
.
forEach
(
asset
->
{
LearningContentAsset
learningContentAsset
=
LearningContentAsset
.
builder
()
.
learningContentId
(
learningContentId
)
.
boardId
(
asset
.
getRefItemId
())
.
assetId
(
asset
.
getId
())
.
build
();
learningContentAssets
.
add
(
learningContentAsset
);
});
boolean
b
=
this
.
learningContentAssetService
.
saveBatch
(
learningContentAssets
);
if
(!
b
)
{
return
getFailResult
(
"添加数据失败!"
);
}
}
// 返回操作结果
if
(
result
&&
nonUnitRole
)
{
final
Audit
audit
=
Audit
.
builder
()
...
...
@@ -199,6 +225,7 @@ public class LearningContentController extends BaseController {
@RequiresAuthentication
//@RequiresPermissions("learning:content:update")
@ApiOperation
(
value
=
"修改学习内容信息"
,
notes
=
"修改学习内容信息"
)
@MethodLog
(
operModule
=
OperModule
.
LEARNCONTENT
,
operType
=
OperType
.
UPDATE
)
@Transactional
public
Map
<
String
,
Object
>
updateLearningContent
(
@Validated
(
value
=
{
Update
.
class
})
LearningContent
learningContent
)
{
final
LambdaQueryWrapper
<
LearningContent
>
lambdaQueryWrapper
=
Wrappers
.<
LearningContent
>
lambdaQuery
().
eq
(
LearningContent:
:
getName
,
learningContent
.
getName
().
trim
());
lambdaQueryWrapper
.
ne
(
LearningContent:
:
getId
,
learningContent
.
getId
());
...
...
@@ -218,6 +245,37 @@ public class LearningContentController extends BaseController {
return
getFailResult
(
"单位管理员只能修改所属机构及其子机构的学习内容"
);
}
}
// 学习内容下显示的参考信息被修改
LambdaQueryWrapper
<
LearningContentAsset
>
lambdaQuery
=
Wrappers
.
lambdaQuery
();
lambdaQuery
.
eq
(
LearningContentAsset:
:
getLearningContentId
,
one
.
getId
());
lambdaQuery
.
select
(
LearningContentAsset:
:
getAssetId
);
List
<
String
>
list
=
this
.
learningContentAssetService
.
listObjs
(
lambdaQuery
,
Object:
:
toString
);
if
(!
ListUtil
.
compareValue
(
list
,
learningContent
.
getFileList
()))
{
LambdaUpdateWrapper
<
LearningContentAsset
>
updateWrapper
=
Wrappers
.
lambdaUpdate
();
updateWrapper
.
eq
(
LearningContentAsset:
:
getLearningContentId
,
one
.
getId
());
boolean
remove
=
this
.
learningContentAssetService
.
remove
(
updateWrapper
);
if
(!
remove
)
{
return
getFailResult
(
"更新数据失败!"
);
}
List
<
String
>
fileList
=
learningContent
.
getFileList
();
if
(!
CollectionUtils
.
isEmpty
(
fileList
))
{
LambdaQueryWrapper
<
Asset
>
queryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
in
(
Asset:
:
getId
,
fileList
);
List
<
Asset
>
list1
=
this
.
assetService
.
list
(
queryWrapper
);
ArrayList
<
LearningContentAsset
>
learningContentAssets
=
new
ArrayList
<>();
list1
.
forEach
(
asset
->
{
LearningContentAsset
learningContentAsset
=
LearningContentAsset
.
builder
()
.
learningContentId
(
learningContent
.
getId
())
.
boardId
(
asset
.
getRefItemId
())
.
assetId
(
asset
.
getId
())
.
build
();
learningContentAssets
.
add
(
learningContentAsset
);
});
boolean
b
=
this
.
learningContentAssetService
.
saveBatch
(
learningContentAssets
);
if
(!
b
)
{
return
getFailResult
(
"更新数据失败!"
);
}
}
}
one
.
setAuditStatus
(
AuditStatusEnum
.
TBC
.
name
());
this
.
learningContentService
.
updateById
(
one
);
...
...
@@ -471,32 +529,32 @@ public class LearningContentController extends BaseController {
exhibitionBoard
.
setBoardCopyrightOwnerName
(
copyrightOwner
.
getName
());
}
}
if
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
())
)
{
String
name
=
this
.
copyrightOwnerService
.
getById
(
exhibitionBoard
.
getVideoContentCopyrightOwnerId
()).
getName
();
exhibitionBoard
.
setVideoContentCopyrightOwnerName
(
name
);
}
LambdaQueryWrapper
<
Asset
>
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getId
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
EXHIBITION_BOARD_AUDIO
.
name
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
final
List
<
Asset
>
audioList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
exhibitionBoard
.
setAudioList
(
audioList
);
assetQueryWrapper
.
clear
();
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
exhibitionBoard
.
getId
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
EXHIBITION_BOARD_DATUM
.
name
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
final
List
<
Asset
>
datumList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
exhibitionBoard
.
setDatumList
(
datumList
);
String
videoContentId
=
exhibitionBoard
.
getVideoContentId
();
if
(
videoContentId
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
videoContentId
)
)
{
final
VideoContent
videoContent
=
this
.
videoContentService
.
getOne
(
Wrappers
.<
VideoContent
>
lambdaQuery
().
eq
(
VideoContent:
:
getId
,
videoContentId
));
if
(
videoContent
!=
null
)
{
assetQueryWrapper
.
clear
();
assetQueryWrapper
=
Wrappers
.<
Asset
>
lambdaQuery
().
eq
(
Asset:
:
getRefItemId
,
videoContentId
);
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
assetQueryWrapper
.
eq
(
Asset:
:
getFileCat
,
FileCatEnum
.
VIDEO_CONTENT
.
name
());
assetQueryWrapper
.
eq
(
Asset:
:
getPublished
,
true
);
final
List
<
Asset
>
videoList
=
this
.
assetService
.
list
(
assetQueryWrapper
);
exhibitionBoard
.
setVideoList
(
videoList
);
exhibitionBoard
.
setVideoContentName
(
videoContent
.
getName
());
...
...
src/main/java/cn/chnmuseum/party/web/controller/LearningProjectController.java
View file @
66aa6dd3
...
...
@@ -337,8 +337,6 @@ public class LearningProjectController extends BaseController {
LearningContent
data
=
(
LearningContent
)
map
.
get
(
"data"
);
learningProject
.
setMajorLearning
(
data
);
}
return
getResult
(
learningProject
);
}
...
...
src/main/java/cn/chnmuseum/party/web/controller/StatisticController.java
View file @
66aa6dd3
...
...
@@ -69,7 +69,7 @@ public class StatisticController extends BaseController {
@GetMapping
(
"/recordVisitor"
)
@ApiOperation
(
value
=
"记录视频访问者的城市"
,
notes
=
"记录视频访问者的城市"
)
public
Map
recordVisitor
(
String
videoId
,
HttpServletRequest
request
){
public
Map
recordVisitor
(
String
videoId
,
String
ip
){
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
try
{
TVideoVisitor
tVideoVisitor
=
new
TVideoVisitor
();
...
...
@@ -79,13 +79,12 @@ public class StatisticController extends BaseController {
}
else
{
tVideoVisitor
.
setVideoId
(
StringUtils
.
trimToNull
(
videoId
));
}
String
ipAddress
=
AddressUtil
.
getIpAddress
(
request
);
if
(
StringUtils
.
isBlank
(
ipAddress
))
{
if
(
StringUtils
.
isBlank
(
ip
))
{
resultMap
.
put
(
"resultCoed"
,
"400"
);
resultMap
.
put
(
"message"
,
"获取数据异常"
);
}
tVideoVisitor
.
setUserIp
(
ip
Address
);
Map
<
String
,
String
>
addressByIp
=
AddressUtil
.
getAddressByIp
(
ip
Address
);
tVideoVisitor
.
setUserIp
(
ip
);
Map
<
String
,
String
>
addressByIp
=
AddressUtil
.
getAddressByIp
(
ip
);
if
(
StringUtils
.
isNotBlank
(
addressByIp
.
get
(
"region"
)))
{
tVideoVisitor
.
setAreaCode
(
addressByIp
.
get
(
"regionCode"
));
}
else
if
(
StringUtils
.
isNotBlank
(
addressByIp
.
get
(
"city"
))){
...
...
src/main/resources/application-dev.properties
View file @
66aa6dd3
...
...
@@ -43,6 +43,7 @@ spring.datasource.druid.test-while-idle=true
spring.datasource.druid.time-between-eviction-runs-millis
=
60000
spring.datasource.druid.url
=
jdbc:mysql://192.168.110.93:3306/chnmuseum-party?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
#spring.datasource.druid.url=jdbc:mysql://10.18.121.26:3306/chnmuseum-party?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.druid.username
=
root
spring.datasource.druid.password
=
password
spring.datasource.druid.validation-query
=
SELECT 1 FROM DUAL
...
...
src/main/resources/application.properties
View file @
66aa6dd3
...
...
@@ -35,7 +35,7 @@ fdfs.tracker-list[0]=192.168.110.85:22122
dfsFileAccessBasePath
=
http://111.203.232.175:8085
prefixPat
=
/data/fastdfs/data
IMAGE_BASE_URL
=
http://111.203.232.175:8085/
#
#fdfs.tracker-list[0]=10.18.121.26:22122
#dfsFileAccessBasePath=http://101.96.131.110:9999
...
...
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