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
80c0fd45
Commit
80c0fd45
authored
Jun 25, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改查询
parent
66095540
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
565 additions
and
478 deletions
+565
-478
pom.xml
xx-im/xx-im-api/pom.xml
+7
-2
pom.xml
xx-im/xx-im-server/pom.xml
+39
-2
ImApplication.java
...ver/src/main/java/com/xxfc/platform/im/ImApplication.java
+1
-1
ImCommentBiz.java
.../src/main/java/com/xxfc/platform/im/biz/ImCommentBiz.java
+68
-12
ImPraiseBiz.java
...r/src/main/java/com/xxfc/platform/im/biz/ImPraiseBiz.java
+86
-12
ImQuestionBiz.java
...src/main/java/com/xxfc/platform/im/biz/ImQuestionBiz.java
+103
-27
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+50
-24
UserBiz.java
...erver/src/main/java/com/xxfc/platform/im/biz/UserBiz.java
+19
-0
ImPraiseDto.java
...r/src/main/java/com/xxfc/platform/im/dto/ImPraiseDto.java
+10
-0
MsgTypeEnum.java
...r/src/main/java/com/xxfc/platform/im/dto/MsgTypeEnum.java
+6
-0
QuestionParamDto.java
.../main/java/com/xxfc/platform/im/dto/QuestionParamDto.java
+56
-0
UpdateTypeEnum.java
...rc/main/java/com/xxfc/platform/im/dto/UpdateTypeEnum.java
+6
-0
ImComment.java
.../src/main/java/com/xxfc/platform/im/entity/ImComment.java
+0
-86
ImPraise.java
...r/src/main/java/com/xxfc/platform/im/entity/ImPraise.java
+0
-73
ImQuestion.java
...src/main/java/com/xxfc/platform/im/entity/ImQuestion.java
+0
-99
ImCommentMapper.java
...ain/java/com/xxfc/platform/im/mapper/ImCommentMapper.java
+0
-15
ImPraiseMapper.java
...main/java/com/xxfc/platform/im/mapper/ImPraiseMapper.java
+0
-15
ImQuestionMapper.java
...in/java/com/xxfc/platform/im/mapper/ImQuestionMapper.java
+0
-20
ImCommentController.java
...n/java/com/xxfc/platform/im/rest/ImCommentController.java
+24
-5
ImPraiseController.java
...in/java/com/xxfc/platform/im/rest/ImPraiseController.java
+26
-6
ImQuestionController.java
.../java/com/xxfc/platform/im/rest/ImQuestionController.java
+30
-12
MsgController.java
...rc/main/java/com/xxfc/platform/im/rest/MsgController.java
+6
-2
Count.java
...m-server/src/main/java/com/xxfc/platform/im/vo/Count.java
+9
-0
QuestionListVo.java
...src/main/java/com/xxfc/platform/im/vo/QuestionListVo.java
+14
-0
generatorConfig.xml
...-im-server/src/main/resources/builder/generatorConfig.xml
+5
-5
ImCommentMapper.xml
...x-im-server/src/main/resources/mapper/ImCommentMapper.xml
+0
-19
ImPraiseMapper.xml
...xx-im-server/src/main/resources/mapper/ImPraiseMapper.xml
+0
-17
ImQuestionMapper.xml
...-im-server/src/main/resources/mapper/ImQuestionMapper.xml
+0
-24
No files found.
xx-im/xx-im-api/pom.xml
View file @
80c0fd45
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.xxfc.platform
</groupId>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-im-api
</artifactId>
<artifactId>
xx-im-api
</artifactId>
<dependencies>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-admin-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
</project>
\ No newline at end of file
xx-im/xx-im-server/pom.xml
View file @
80c0fd45
...
@@ -17,9 +17,9 @@
...
@@ -17,9 +17,9 @@
<!-- MyBatis Generator -->
<!-- MyBatis Generator -->
<!-- Java接口和实体类 -->
<!-- Java接口和实体类 -->
<targetJavaProject>
${basedir}/src/main/java
</targetJavaProject>
<targetJavaProject>
${basedir}/src/main/java
</targetJavaProject>
<targetMapperPackage>
com.xxfc.platform.
order
.mapper
<targetMapperPackage>
com.xxfc.platform.
im
.mapper
</targetMapperPackage>
</targetMapperPackage>
<targetModelPackage>
com.xxfc.platform.
order
.entity
<targetModelPackage>
com.xxfc.platform.
im
.entity
</targetModelPackage>
</targetModelPackage>
<!-- XML生成路径 -->
<!-- XML生成路径 -->
<targetResourcesProject>
${basedir}/src/main/resources
<targetResourcesProject>
${basedir}/src/main/resources
...
@@ -73,6 +73,11 @@
...
@@ -73,6 +73,11 @@
<groupId>
com.aliyun.oss
</groupId>
<groupId>
com.aliyun.oss
</groupId>
<artifactId>
aliyun-sdk-oss
</artifactId>
<artifactId>
aliyun-sdk-oss
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
4.1.14
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
@@ -88,6 +93,38 @@
...
@@ -88,6 +93,38 @@
<target>
1.8
</target>
<target>
1.8
</target>
</configuration>
</configuration>
</plugin>
</plugin>
<!-- 此插件用来生成通用mapper的代码 -->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.2
</version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/builder/generatorConfig.xml
</configurationFile>
<overwrite>
true
</overwrite>
<verbose>
true
</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.30
</version>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
commons-beanutils
</groupId>
<artifactId>
commons-beanutils
</artifactId>
<version>
1.9.3
</version>
</dependency>
<dependency>
<groupId>
tk.mybatis
</groupId>
<artifactId>
mapper
</artifactId>
<version>
${mapper.version}
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
</project>
\ No newline at end of file
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/ImApplication.java
View file @
80c0fd45
...
@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
...
@@ -18,7 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableDiscoveryClient
@EnableScheduling
@EnableScheduling
@EnableAceAuthClient
@EnableAceAuthClient
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.xxfc.platform"
})
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.admin.feign"
,
"com.xxfc.platform"
})
@EnableAceCache
@EnableAceCache
@EnableCaching
@EnableCaching
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.im.mapper"
)
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.im.mapper"
)
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/ImCommentBiz.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
biz
;
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
org.springframework.stereotype.Service
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.im.dto.MsgTypeEnum
;
import
com.xxfc.platform.im.dto.UpdateTypeEnum
;
import
com.xxfc.platform.im.entity.ImComment
;
import
com.xxfc.platform.im.entity.ImComment
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.mapper.ImCommentMapper
;
import
com.xxfc.platform.im.mapper.ImCommentMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 评论表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
@Service
@Service
public
class
ImCommentBiz
extends
BaseBiz
<
ImCommentMapper
,
ImComment
>
{
@Slf4j
}
public
class
ImCommentBiz
extends
BaseBiz
<
ImCommentMapper
,
ImComment
>
{
\ No newline at end of file
@Autowired
ImQuestionBiz
imQuestionBiz
;
@Autowired
UserBiz
userBiz
;
/**
* 添加评论
*
* @param imComment
* @return
*/
public
ObjectRestResponse
add
(
ImComment
imComment
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
imComment
.
setUserId
(
Long
.
parseLong
(
appUserDTO
.
getImUserid
()
+
""
));
if
(
imComment
==
null
||
imComment
.
getQuestionId
()
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
ImQuestion
imQuestion
=
imQuestionBiz
.
selectById
(
imComment
.
getQuestionId
());
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
mapper
.
insert
(
imComment
);
//修改评论数
imQuestionBiz
.
update
(
imComment
.
getQuestionId
(),
MsgTypeEnum
.
comment
,
UpdateTypeEnum
.
add
);
return
ObjectRestResponse
.
succ
();
}
/**
* 删除评论
*
* @param imComment
* @return
*/
public
ObjectRestResponse
deleteById
(
ImComment
imComment
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
if
(
imComment
==
null
||
imComment
.
getId
()
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
ImComment
oldValue
=
mapper
.
selectByPrimaryKey
(
imComment
);
if
(
oldValue
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
oldValue
.
setIsDel
(
true
);
mapper
.
updateByPrimaryKeySelective
(
oldValue
);
imQuestionBiz
.
update
(
oldValue
.
getQuestionId
(),
MsgTypeEnum
.
comment
,
UpdateTypeEnum
.
subtraction
);
return
ObjectRestResponse
.
succ
();
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/ImPraiseBiz.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
biz
;
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
org.springframework.stereotype.Service
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.im.dto.ImPraiseDto
;
import
com.xxfc.platform.im.dto.MsgTypeEnum
;
import
com.xxfc.platform.im.dto.UpdateTypeEnum
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.mapper.ImPraiseMapper
;
import
com.xxfc.platform.im.mapper.ImPraiseMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
lombok.extern.slf4j.Slf4j
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
@Slf4j
* 点赞表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
@Service
@Service
public
class
ImPraiseBiz
extends
BaseBiz
<
ImPraiseMapper
,
ImPraise
>
{
public
class
ImPraiseBiz
extends
BaseBiz
<
ImPraiseMapper
,
ImPraise
>
{
}
\ No newline at end of file
@Autowired
ImQuestionBiz
imQuestionBiz
;
@Autowired
UserBiz
userBiz
;
/**
* 点赞
* @param imPraiseDto
* @return
*/
public
ObjectRestResponse
add
(
ImPraiseDto
imPraiseDto
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
imPraiseDto
.
setUserId
(
Long
.
parseLong
(
appUserDTO
.
getImUserid
()
+
""
));
if
(
imPraiseDto
==
null
||
imPraiseDto
.
getQuestionId
()
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
ImQuestion
imQuestion
=
imQuestionBiz
.
selectById
(
imPraiseDto
.
getQuestionId
());
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
List
<
ImPraise
>
list
=
getImPraiseList
(
imPraiseDto
);
if
(
list
.
size
()
>=
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
504
,
"今日已点赞,请明日再点!"
);
}
mapper
.
insert
(
imPraiseDto
);
imQuestionBiz
.
update
(
imPraiseDto
.
getQuestionId
(),
MsgTypeEnum
.
praise
,
UpdateTypeEnum
.
add
);
return
ObjectRestResponse
.
succ
();
}
/**
* 取消点赞
* @param imPraiseDto
* @return
*/
public
ObjectRestResponse
deleteById
(
ImPraiseDto
imPraiseDto
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
if
(
imPraiseDto
==
null
||
imPraiseDto
.
getQuestionId
()
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
List
<
ImPraise
>
list
=
getImPraiseList
(
imPraiseDto
);
if
(
list
.
size
()
==
1
)
{
list
.
get
(
0
).
setIsDel
(
true
);
mapper
.
updateByPrimaryKey
(
list
.
get
(
0
));
imQuestionBiz
.
update
(
list
.
get
(
0
).
getQuestionId
(),
MsgTypeEnum
.
praise
,
UpdateTypeEnum
.
subtraction
);
}
return
ObjectRestResponse
.
succ
();
}
/**
* 添加筛选当前天的点赞
* @param imPraiseDto
* @return
*/
public
List
<
ImPraise
>
getImPraiseList
(
ImPraiseDto
imPraiseDto
)
{
DateTime
dateTime
=
new
DateTime
();
Long
startTime
=
dateTime
.
withTime
(
0
,
0
,
0
,
0
).
toDate
().
getTime
();
Long
endTime
=
dateTime
.
plusDays
(
1
).
withTime
(
0
,
0
,
0
,
0
).
toDate
().
getTime
();
imPraiseDto
.
setStartTime
(
startTime
);
imPraiseDto
.
setEndTime
(
endTime
);
List
<
ImPraise
>
list
=
mapper
.
selectByQuestionIdAndTime
(
imPraiseDto
);
return
list
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/ImQuestionBiz.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
biz
;
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.im.dto.MsgTypeEnum
;
import
com.xxfc.platform.im.dto.QuestionParamDto
;
import
com.xxfc.platform.im.dto.UpdateTypeEnum
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.mapper.ImQuestionMapper
;
import
com.xxfc.platform.im.mapper.ImQuestionMapper
;
import
com.xxfc.platform.im.model.Msg
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
*
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 10:45:05
*/
@Service
@Service
public
class
ImQuestionBiz
extends
BaseBiz
<
ImQuestionMapper
,
ImQuestion
>
{
@Slf4j
@Autowired
public
class
ImQuestionBiz
extends
BaseBiz
<
ImQuestionMapper
,
ImQuestion
>
{
private
ImQuestionMapper
imQuestionMapper
;
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
UserBiz
userBiz
;
public
Object
getQuestionList
(
Map
<
String
,
Object
>
map
){
/**
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
* 获取列表
List
<
Msg
>
list
=
mongoTemplate
.
findAll
(
Msg
.
class
,
"s_msg"
);
*
returnMap
.
put
(
"msg"
,
list
);
* @param questionParamDto
returnMap
.
put
(
"question"
,
imQuestionMapper
.
getQuestionList
(
map
));
* @return
return
returnMap
;
*/
public
ObjectRestResponse
getList
(
QuestionParamDto
questionParamDto
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
Query
query
=
new
Query
(
questionParamDto
);
PageDataVO
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getQuestionList
(
query
.
getSuper
()));
return
new
ObjectRestResponse
<>().
data
(
pageDataVO
);
}
/**
* 添加问题
*
* @param imQuestion
* @return
*/
public
ObjectRestResponse
<
ImQuestion
>
add
(
ImQuestion
imQuestion
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
imQuestion
.
setUserId
(
Long
.
parseLong
(
appUserDTO
.
getImUserid
()
+
""
));
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
mapper
.
insertSelective
(
imQuestion
);
return
ObjectRestResponse
.
succ
();
}
/**
* 删除消息,修改isDel为true
*
* @param id
* @return
*/
public
ObjectRestResponse
delete
(
Long
id
)
{
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
if
(
id
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
ImQuestion
imQuestion
=
mapper
.
selectByPrimaryKey
(
id
);
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
imQuestion
.
setIsDel
(
true
);
mapper
.
updateByPrimaryKeySelective
(
imQuestion
);
return
ObjectRestResponse
.
succ
();
}
public
ObjectRestResponse
update
(
Long
id
,
MsgTypeEnum
type
,
UpdateTypeEnum
updateType
)
{
if
(
id
==
null
||
type
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
ImQuestion
imQuestion
=
mapper
.
selectByPrimaryKey
(
id
);
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
if
(
type
==
MsgTypeEnum
.
comment
)
{
//评论
synchronized
(
imQuestion
)
{
if
(
updateType
==
UpdateTypeEnum
.
add
)
{
//添加
imQuestion
.
setCommentCount
(
imQuestion
.
getCommentCount
()
+
1
);
}
else
{
imQuestion
.
setCommentCount
((
imQuestion
.
getCommentCount
()
>
0
?
imQuestion
.
getCommentCount
()
-
1
:
0
));
}
}
}
if
(
type
==
MsgTypeEnum
.
praise
)
{
//点赞
synchronized
(
imQuestion
)
{
if
(
updateType
==
UpdateTypeEnum
.
add
)
{
//添加
imQuestion
.
setPraiseCount
(
imQuestion
.
getPraiseCount
()
+
1
);
}
else
{
imQuestion
.
setPraiseCount
(
imQuestion
.
getPraiseCount
()
>
0
?
imQuestion
.
getPraiseCount
()
-
1
:
0
);
}
}
}
mapper
.
updateByPrimaryKeySelective
(
imQuestion
);
return
ObjectRestResponse
.
succ
();
}
}
}
}
\ No newline at end of file
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
biz
;
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.github.wxiaoqi.security.
common.constant.RestCode
;
import
com.github.wxiaoqi.security.
admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.mongodb.DBCollection
;
import
com.mongodb.DBCursor
;
import
com.mongodb.DBObject
;
import
com.xxfc.platform.im.model.Comment
;
import
com.xxfc.platform.im.model.Comment
;
import
com.xxfc.platform.im.model.Msg
;
import
com.xxfc.platform.im.model.Msg
;
import
com.xxfc.platform.im.model.Praise
;
import
com.xxfc.platform.im.model.Praise
;
import
org.bson.types.ObjectId
;
import
org.bson.types.ObjectId
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -31,67 +25,99 @@ public class MsgBiz {
...
@@ -31,67 +25,99 @@ public class MsgBiz {
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Autowired
UserBiz
userBiz
;
/**
/**
* 获取消息列表
* 获取消息列表
*
* @param map
* @param map
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
public
ObjectRestResponse
getMsgList
(
Map
<
String
,
Object
>
map
)
throws
Exception
{
public
ObjectRestResponse
getMsgList
(
Map
<
String
,
Object
>
map
)
throws
Exception
{
//获取所有朋友圈
//获取所有朋友圈
String
userId
=
map
.
get
(
"userId"
).
toString
();
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
PageHelper
.
startPage
(
Integer
.
parseInt
(
map
.
get
(
"page"
).
toString
()),
Integer
.
parseInt
(
map
.
get
(
"limit"
).
toString
()));
if
(
appUserDTO
==
null
)
{
List
<
Msg
>
msgList
=
fetchAndAttach
(
mongoTemplate
.
findAll
(
Msg
.
class
,
"s_msg"
),
userId
);
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
Integer
page
=
map
.
get
(
"page"
)
==
null
?
1
:
Integer
.
parseInt
(
map
.
get
(
"page"
).
toString
());
Integer
limit
=
map
.
get
(
"limit"
)
==
null
?
10
:
Integer
.
parseInt
(
map
.
get
(
"limit"
).
toString
());
PageHelper
.
startPage
(
page
,
limit
);
Query
query
=
null
;
List
<
Msg
>
msgList
=
null
;
if
(
map
.
get
(
"type"
)
!=
null
)
{
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
is
(
Integer
.
parseInt
(
map
.
get
(
"type"
).
toString
())));
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
appUserDTO
.
getImUserid
());
}
else
{
msgList
=
fetchAndAttach
(
mongoTemplate
.
findAll
(
Msg
.
class
,
"s_msg"
),
appUserDTO
.
getImUserid
());
}
PageInfo
<
Msg
>
goodPageInfo
=
new
PageInfo
<>(
msgList
);
PageInfo
<
Msg
>
goodPageInfo
=
new
PageInfo
<>(
msgList
);
return
new
ObjectRestResponse
().
status
(
RestCode
.
SUCCESS
.
getStatus
()).
msg
(
RestCode
.
SUCCESS
.
getMsg
()).
data
(
goodPageInfo
);
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
}
public
ObjectRestResponse
getHotMsgList
(
Map
<
String
,
Object
>
param
)
{
Integer
page
=
param
.
get
(
"page"
)
==
null
?
1
:
Integer
.
parseInt
(
param
.
get
(
"page"
).
toString
());
Integer
limit
=
param
.
get
(
"limit"
)
==
null
?
10
:
Integer
.
parseInt
(
param
.
get
(
"limit"
).
toString
());
PageHelper
.
startPage
(
page
,
limit
);
Query
query
=
new
Query
();
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
"count.praise"
));
List
<
Msg
>
msgList
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
);
PageInfo
<
Msg
>
goodPageInfo
=
new
PageInfo
<>(
msgList
);
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
/**
/**
* 添加评论和点赞
* 添加评论和点赞
*
* @param list
* @param list
* @param userId
* @param userId
* @return
* @return
*/
*/
private
List
<
Msg
>
fetchAndAttach
(
List
<
Msg
>
list
,
String
userId
)
{
private
List
<
Msg
>
fetchAndAttach
(
List
<
Msg
>
list
,
Integer
userId
)
{
for
(
Msg
msg:
list
)
{
if
(
userId
==
null
)
{
return
new
ArrayList
<>();
}
for
(
Msg
msg
:
list
)
{
//添加评论
//添加评论
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msg
.
getMsgId
()));
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msg
.
getMsgId
()));
List
<
Comment
>
comments
=
mongoTemplate
.
find
(
query
,
Comment
.
class
,
"s_comment"
);
List
<
Comment
>
comments
=
mongoTemplate
.
find
(
query
,
Comment
.
class
,
"s_comment"
);
msg
.
setComments
(
comments
);
msg
.
setComments
(
comments
);
//添加点赞
//添加点赞
List
<
Praise
>
praise
=
mongoTemplate
.
find
(
query
,
Praise
.
class
,
"s_praise"
);
List
<
Praise
>
praise
=
mongoTemplate
.
find
(
query
,
Praise
.
class
,
"s_praise"
);
msg
.
setPraises
(
praise
);
msg
.
setPraises
(
praise
);
msg
.
setIsPraise
(
this
.
exists
(
Integer
.
parseInt
(
userId
),
msg
.
getMsgId
())
?
1
:
0
);
msg
.
setIsPraise
(
this
.
exists
(
userId
,
msg
.
getMsgId
())
?
1
:
0
);
msg
.
setIsCollect
(
this
.
existsCollect
(
Integer
.
parseInt
(
userId
),
msg
.
getMsgId
())
?
1
:
0
);
msg
.
setIsCollect
(
this
.
existsCollect
(
userId
,
msg
.
getMsgId
())
?
1
:
0
);
}
}
return
list
;
return
list
;
}
}
/**
/**
* 判断是否点赞
* 判断是否点赞
*
* @param userId
* @param userId
* @param msgId
* @param msgId
* @return
* @return
*/
*/
public
boolean
exists
(
int
userId
,
ObjectId
msgId
)
{
public
boolean
exists
(
int
userId
,
ObjectId
msgId
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msgId
).
and
(
"userId"
).
is
(
userId
));
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msgId
).
and
(
"userId"
).
is
(
userId
));
List
<
Praise
>
praise
=
mongoTemplate
.
find
(
query
,
Praise
.
class
,
"s_praise"
);
List
<
Praise
>
praise
=
mongoTemplate
.
find
(
query
,
Praise
.
class
,
"s_praise"
);
return
0
!=
praise
.
size
();
return
0
!=
praise
.
size
();
}
}
/**
/**
* 判断是否评论
* 判断是否评论
*
* @param userId
* @param userId
* @param msgId
* @param msgId
* @return
* @return
*/
*/
public
boolean
existsCollect
(
int
userId
,
ObjectId
msgId
)
{
public
boolean
existsCollect
(
int
userId
,
ObjectId
msgId
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msgId
).
and
(
"userId"
).
is
(
userId
));
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
msgId
).
and
(
"userId"
).
is
(
userId
));
List
<
Comment
>
comments
=
mongoTemplate
.
find
(
query
,
Comment
.
class
,
"s_comment"
);
List
<
Comment
>
comments
=
mongoTemplate
.
find
(
query
,
Comment
.
class
,
"s_comment"
);
return
0
!=
comments
.
size
();
return
0
!=
comments
.
size
();
}
}
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/UserBiz.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
biz
;
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.xxfc.platform.im.model.User
;
import
com.xxfc.platform.im.model.User
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.codec.digest.DigestUtils
;
...
@@ -9,7 +11,10 @@ import org.springframework.data.mongodb.core.MongoTemplate;
...
@@ -9,7 +11,10 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.*
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
...
@@ -23,6 +28,9 @@ public class UserBiz {
...
@@ -23,6 +28,9 @@ public class UserBiz {
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Autowired
UserFeign
userFeign
;
/**
/**
* 注册
* 注册
* @param map
* @param map
...
@@ -171,4 +179,15 @@ public class UserBiz {
...
@@ -171,4 +179,15 @@ public class UserBiz {
}
}
return
result
;
return
result
;
}
}
public
AppUserDTO
getUserInfo
()
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
if
(
request
.
getHeader
(
"Authorization"
)
!=
null
)
{
return
userFeign
.
userDetailByToken
(
request
.
getHeader
(
"Authorization"
)).
getData
();
}
else
if
(
request
.
getHeader
(
"access_token"
)
!=
null
)
{
return
userFeign
.
userDetailByToken
(
request
.
getHeader
(
"access_token"
)).
getData
();
}
return
null
;
}
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/dto/ImPraiseDto.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
dto
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
lombok.Data
;
@Data
public
class
ImPraiseDto
extends
ImPraise
{
private
Long
startTime
;
private
Long
endTime
;
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/dto/MsgTypeEnum.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
dto
;
public
enum
MsgTypeEnum
{
praise
,
comment
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/dto/QuestionParamDto.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
dto
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
/**
* 查询类
*/
@Data
public
class
QuestionParamDto
extends
PageParam
{
private
Long
id
;
/**
* 标题
*/
private
String
title
;
/**
* 纬度
*/
private
String
latitude
;
/**
* 经度
*/
private
String
longitude
;
/**
* 手机型号
*/
private
String
model
;
/**
* 添加时间
*/
private
Long
time
;
private
Long
userId
;
/**
* 是否显示
*/
private
Integer
visible
;
/**
* 状态
*/
private
Integer
state
;
/**
* 是否删除
*/
private
Boolean
isDel
=
false
;
}
\ No newline at end of file
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/dto/UpdateTypeEnum.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
dto
;
public
enum
UpdateTypeEnum
{
add
,
subtraction
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/entity/ImComment.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 评论表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
@Data
@Table
(
name
=
"im_comment"
)
public
class
ImComment
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
""
)
private
Long
id
;
/**
* 问题Id
*/
@Column
(
name
=
"question_id"
)
@ApiModelProperty
(
value
=
"问题Id"
)
private
Long
questionId
;
/**
* 评论类容
*/
@Column
(
name
=
"content"
)
@ApiModelProperty
(
value
=
"评论类容"
)
private
String
content
;
/**
*
*/
@Column
(
name
=
"time"
)
@ApiModelProperty
(
value
=
""
)
private
Long
time
;
/**
* 用户id
*/
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
"用户id"
)
private
Long
userId
;
/**
* 是否显示
*/
@Column
(
name
=
"visible"
)
@ApiModelProperty
(
value
=
"是否显示"
)
private
String
visible
;
/**
* 是否只有自己可见(评论审核时仅自己可见)
*/
@Column
(
name
=
"visible_own"
)
@ApiModelProperty
(
value
=
"是否只有自己可见(评论审核时仅自己可见)"
)
private
String
visibleOwn
;
/**
* 状态
*/
@Column
(
name
=
"state"
)
@ApiModelProperty
(
value
=
"状态"
)
private
String
state
;
/**
* 是否删除0-正常,1-删除
*/
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除"
)
private
String
isDel
;
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/entity/ImPraise.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 点赞表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
@Data
@Table
(
name
=
"im_praise"
)
public
class
ImPraise
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
""
)
private
Long
id
;
/**
* 问题id
*/
@Column
(
name
=
"question_id"
)
@ApiModelProperty
(
value
=
"问题id"
)
private
Long
questionId
;
/**
* 用户id
*/
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
"用户id"
)
private
Long
userId
;
/**
* 时间
*/
@Column
(
name
=
"time"
)
@ApiModelProperty
(
value
=
"时间"
)
private
Long
time
;
/**
* 状态
*/
@Column
(
name
=
"state"
)
@ApiModelProperty
(
value
=
"状态"
)
private
String
state
;
/**
* 是否显示
*/
@Column
(
name
=
"visible"
)
@ApiModelProperty
(
value
=
"是否显示"
)
private
String
visible
;
/**
* 是否删除0-正常,1-删除
*/
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除"
)
private
String
isDel
;
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/entity/ImQuestion.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
*
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 10:45:05
*/
@Data
@Table
(
name
=
"im_question"
)
public
class
ImQuestion
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
""
)
private
Long
id
;
/**
* 标题
*/
@Column
(
name
=
"title"
)
@ApiModelProperty
(
value
=
"标题"
)
private
String
title
;
/**
* 内容
*/
@Column
(
name
=
"content"
)
@ApiModelProperty
(
value
=
"内容"
)
private
String
content
;
/**
* 纬度
*/
@Column
(
name
=
"latitude"
)
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
/**
* 经度
*/
@Column
(
name
=
"longitude"
)
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
/**
* 手机型号
*/
@Column
(
name
=
"model"
)
@ApiModelProperty
(
value
=
"手机型号"
)
private
String
model
;
/**
* 添加时间
*/
@Column
(
name
=
"time"
)
@ApiModelProperty
(
value
=
"添加时间"
)
private
Long
time
;
/**
*
*/
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
""
)
private
Long
userId
;
/**
* 是否显示
*/
@Column
(
name
=
"visible"
)
@ApiModelProperty
(
value
=
"是否显示"
)
private
String
visible
;
/**
* 状态
*/
@Column
(
name
=
"state"
)
@ApiModelProperty
(
value
=
"状态"
)
private
String
state
;
/**
* 是否删除0-正常,1-删除
*/
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除"
)
private
String
isDel
;
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/mapper/ImCommentMapper.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
mapper
;
import
com.xxfc.platform.im.entity.ImComment
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 评论表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
public
interface
ImCommentMapper
extends
Mapper
<
ImComment
>
{
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/mapper/ImPraiseMapper.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
mapper
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 点赞表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-24 19:14:43
*/
public
interface
ImPraiseMapper
extends
Mapper
<
ImPraise
>
{
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/mapper/ImQuestionMapper.java
deleted
100644 → 0
View file @
66095540
package
com
.
xxfc
.
platform
.
im
.
mapper
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
/**
* 旅游商品表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
public
interface
ImQuestionMapper
extends
Mapper
<
ImQuestion
>
{
List
<
ImQuestion
>
getQuestionList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/ImCommentController.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
rest
;
package
com
.
xxfc
.
platform
.
im
.
rest
;
import
com.github.wxiaoqi.security.common.
rest.BaseController
;
import
com.github.wxiaoqi.security.common.
msg.ObjectRestResponse
;
import
com.xxfc.platform.im.biz.ImCommentBiz
;
import
com.xxfc.platform.im.biz.ImCommentBiz
;
import
com.xxfc.platform.im.entity.ImComment
;
import
com.xxfc.platform.im.entity.ImComment
;
import
org.springframework.stereotype.Controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"imComment"
)
@RequestMapping
(
value
=
"imComment"
)
public
class
ImCommentController
extends
BaseController
<
ImCommentBiz
,
ImComment
>
{
@Api
(
value
=
"评论"
)
public
class
ImCommentController
{
}
@Autowired
\ No newline at end of file
ImCommentBiz
imCommentBiz
;
@PostMapping
(
value
=
"/add"
)
@ApiOperation
(
value
=
"添加评论"
)
public
ObjectRestResponse
add
(
ImComment
imComment
)
{
return
imCommentBiz
.
add
(
imComment
);
}
@DeleteMapping
(
value
=
"/delete"
)
@ApiOperation
(
value
=
"删除评论"
)
public
ObjectRestResponse
deleteById
(
ImComment
imComment
)
{
return
imCommentBiz
.
deleteById
(
imComment
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/ImPraiseController.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
rest
;
package
com
.
xxfc
.
platform
.
im
.
rest
;
import
com.github.wxiaoqi.security.common.
rest.BaseController
;
import
com.github.wxiaoqi.security.common.
msg.ObjectRestResponse
;
import
com.xxfc.platform.im.biz.ImPraiseBiz
;
import
com.xxfc.platform.im.biz.ImPraiseBiz
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
com.xxfc.platform.im.dto.ImPraiseDto
;
import
org.springframework.stereotype.Controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"imPraise"
)
@RequestMapping
(
value
=
"imPraise"
)
public
class
ImPraiseController
extends
BaseController
<
ImPraiseBiz
,
ImPraise
>
{
@Api
(
value
=
"点赞"
)
public
class
ImPraiseController
{
}
@Autowired
\ No newline at end of file
ImPraiseBiz
imPraiseBiz
;
@PostMapping
(
value
=
"/add"
)
@ApiOperation
(
value
=
"添加点赞"
)
public
ObjectRestResponse
add
(
ImPraiseDto
imPraise
)
{
return
imPraiseBiz
.
add
(
imPraise
);
}
@DeleteMapping
(
value
=
"/delete"
)
@ApiOperation
(
value
=
"取消点赞"
)
public
ObjectRestResponse
deleteById
(
ImPraiseDto
imPraiseDto
)
{
return
imPraiseBiz
.
deleteById
(
imPraiseDto
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/ImQuestionController.java
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
rest
;
package
com
.
xxfc
.
platform
.
im
.
rest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.im.biz.ImQuestionBiz
;
import
com.xxfc.platform.im.biz.ImQuestionBiz
;
import
com.xxfc.platform.im.dto.QuestionParamDto
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.vo.QuestionListVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.
Map
;
import
java.util.
List
;
@RestController
@RestController
@RequestMapping
(
"imQuestion"
)
@RequestMapping
(
value
=
"imQuestion"
)
public
class
ImQuestionController
extends
BaseController
<
ImQuestionBiz
,
ImQuestion
>
{
@Api
(
value
=
"问答信息模块"
)
public
class
ImQuestionController
{
@Autowired
@Autowired
private
ImQuestionBiz
q
uestionBiz
;
ImQuestionBiz
imQ
uestionBiz
;
@
RequestMapping
(
value
=
"/app/unauth/getQuestionList"
,
method
=
RequestMethod
.
POST
)
@
GetMapping
(
value
=
"/list"
)
@
ResponseBody
@
ApiOperation
(
value
=
"获取问答列表信息"
)
public
Object
getQuestionList
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
public
Object
RestResponse
<
List
<
QuestionListVo
>>
getList
(
QuestionParamDto
questionParamDto
)
{
return
questionBiz
.
getQuestionList
(
map
);
return
imQuestionBiz
.
getList
(
questionParamDto
);
}
}
}
\ No newline at end of file
@PostMapping
(
value
=
"/add"
)
@ApiOperation
(
value
=
"添加问答信息"
)
public
ObjectRestResponse
add
(
ImQuestion
imQuestion
)
{
return
imQuestionBiz
.
add
(
imQuestion
);
}
@PostMapping
(
value
=
"/delete"
)
@ApiOperation
(
value
=
"删除问答信息"
)
public
ObjectRestResponse
delete
(
Long
id
)
{
return
imQuestionBiz
.
delete
(
id
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/MsgController.java
View file @
80c0fd45
...
@@ -18,9 +18,13 @@ public class MsgController {
...
@@ -18,9 +18,13 @@ public class MsgController {
@Autowired
@Autowired
private
MsgBiz
msgBiz
;
private
MsgBiz
msgBiz
;
@RequestMapping
(
value
=
"/app/unauth/list"
,
method
=
RequestMethod
.
POST
)
@PostMapping
(
value
=
"/app/unauth/list"
)
@ResponseBody
public
ObjectRestResponse
getMsgList
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
public
ObjectRestResponse
getMsgList
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
return
msgBiz
.
getMsgList
(
map
);
return
msgBiz
.
getMsgList
(
map
);
}
}
@PostMapping
(
value
=
"/hotMsg/list"
)
public
ObjectRestResponse
getHotMsgList
(
Map
<
String
,
Object
>
map
)
{
return
msgBiz
.
getHotMsgList
(
map
);
}
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/vo/Count.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
vo
;
import
lombok.Data
;
@Data
public
class
Count
{
Integer
praiseTotal
;
Integer
commentTotal
;
}
\ No newline at end of file
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/vo/QuestionListVo.java
0 → 100644
View file @
80c0fd45
package
com
.
xxfc
.
platform
.
im
.
vo
;
import
com.xxfc.platform.im.entity.ImComment
;
import
com.xxfc.platform.im.entity.ImPraise
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
QuestionListVo
extends
ImQuestion
{
List
<
ImComment
>
imComment
;
List
<
ImPraise
>
imPraise
;
}
xx-im/xx-im-server/src/main/resources/builder/generatorConfig.xml
View file @
80c0fd45
...
@@ -15,11 +15,10 @@
...
@@ -15,11 +15,10 @@
</plugin>
</plugin>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://
localhost:3306/vehicle
?useUnicode=true&characterEncoding=UTF8"
connectionURL=
"jdbc:mysql://
10.5.52.3:3306/xxfc_im
?useUnicode=true&characterEncoding=UTF8"
userId=
"root"
userId=
"root"
password=
"
xx2019fc
"
>
password=
"
sslcloud123*()
"
>
</jdbcConnection>
</jdbcConnection>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
<sqlMapGenerator
targetPackage=
"${targetXMLPackage}"
targetProject=
"${targetResourcesProject}"
/>
<sqlMapGenerator
targetPackage=
"${targetXMLPackage}"
targetProject=
"${targetResourcesProject}"
/>
...
@@ -37,7 +36,8 @@
...
@@ -37,7 +36,8 @@
<!-- </table>-->
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table
tableName=
"vehicle_upkeep_item"
domainObjectName=
"VehicleUpkeepItem"
></table>
<table
tableName=
"im_question"
domainObjectName=
"ImQuestion"
></table>
<table
tableName=
"vehicle_upkeep_log"
domainObjectName=
"VehicleUpkeepLog"
></table>
<table
tableName=
"im_comment"
domainObjectName=
"ImComment"
></table>
<table
tableName=
"im_praise"
domainObjectName=
"ImPraise"
></table>
</context>
</context>
</generatorConfiguration>
</generatorConfiguration>
\ No newline at end of file
xx-im/xx-im-server/src/main/resources/mapper/ImCommentMapper.xml
deleted
100644 → 0
View file @
66095540
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.im.mapper.ImCommentMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.im.entity.ImComment"
id=
"imCommentMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"questionId"
column=
"question_id"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"time"
column=
"time"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"visible"
column=
"visible"
/>
<result
property=
"visibleOwn"
column=
"visible_own"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-im/xx-im-server/src/main/resources/mapper/ImPraiseMapper.xml
deleted
100644 → 0
View file @
66095540
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.im.mapper.ImPraiseMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.im.entity.ImPraise"
id=
"imPraiseMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"questionId"
column=
"question_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"time"
column=
"time"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"visible"
column=
"visible"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-im/xx-im-server/src/main/resources/mapper/ImQuestionMapper.xml
deleted
100644 → 0
View file @
66095540
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.im.mapper.ImQuestionMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.im.entity.ImQuestion"
id=
"imQuestionMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"latitude"
column=
"latitude"
/>
<result
property=
"longitude"
column=
"longitude"
/>
<result
property=
"model"
column=
"model"
/>
<result
property=
"time"
column=
"time"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"visible"
column=
"visible"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
<select
id=
"getQuestionList"
resultMap=
"imQuestionMap"
parameterType=
"java.util.Map"
>
select * from im_question
</select>
</mapper>
\ 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