Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
1c3e0710
提交
1c3e0710
authored
11月 19, 2019
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成商品评价、回复等功能
上级
43a1fcc8
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
409 行增加
和
92 行删除
+409
-92
ShopifyController.java
...diaoyun/zion/chinafrica/controller/ShopifyController.java
+86
-1
TbCfItemCommentDao.java
...a/com/diaoyun/zion/chinafrica/dao/TbCfItemCommentDao.java
+3
-0
TbCfReplyDao.java
...in/java/com/diaoyun/zion/chinafrica/dao/TbCfReplyDao.java
+4
-0
TbCfItemCommentEntity.java
...diaoyun/zion/chinafrica/entity/TbCfItemCommentEntity.java
+5
-11
TbCfReplyEntityExtends.java
...iaoyun/zion/chinafrica/entity/TbCfReplyEntityExtends.java
+27
-0
TbCfItemCommentService.java
...aoyun/zion/chinafrica/service/TbCfItemCommentService.java
+12
-0
TbCfReplyService.java
...com/diaoyun/zion/chinafrica/service/TbCfReplyService.java
+7
-0
TbCfItemCommentServiceImpl.java
...n/chinafrica/service/impl/TbCfItemCommentServiceImpl.java
+83
-0
TbCfReplyServiceImpl.java
...un/zion/chinafrica/service/impl/TbCfReplyServiceImpl.java
+68
-0
TbCfUserInfoServiceImpl.java
...zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
+24
-20
TbCfItemCommentDao.xml
src/main/resources/mapper/TbCfItemCommentDao.xml
+19
-6
TbCfReplyDao.xml
src/main/resources/mapper/TbCfReplyDao.xml
+71
-54
没有找到文件。
src/main/java/com/diaoyun/zion/chinafrica/controller/ShopifyController.java
浏览文件 @
1c3e0710
package
com
.
diaoyun
.
zion
.
chinafrica
.
controller
;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.chinafrica.service.ShopifyService
;
import
com.diaoyun.zion.chinafrica.service.TbCfItemCommentService
;
import
com.diaoyun.zion.chinafrica.service.TbCfReplyService
;
import
com.diaoyun.zion.master.base.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -12,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
/**
* @Auther: wudepeng
* @Date: 2019/11/15
* @Description: 调用shopify API,获取商品信息
* @Description: 调用shopify API,获取商品信息
;查看商品评价、回复
*/
@Api
(
tags
=
"获取shopify的商品信息"
)
@RestController
...
...
@@ -23,6 +26,8 @@ public class ShopifyController {
private
ShopifyService
shopifyService
;
@Autowired
private
TbCfItemCommentService
tbCfItemCommentService
;
@Autowired
private
TbCfReplyService
tbCfReplyService
;
/**
* 查询商品
...
...
@@ -77,4 +82,84 @@ public class ShopifyController {
return
tbCfItemCommentService
.
queryLastComment
(
itemId
);
}
/**
* 查看商品的更多评论
*
* @param itemId
* @param pageNum
* @param pageSize
* @return
*/
@ApiOperation
(
value
=
"查看更多评论"
)
@GetMapping
(
"/querycomments"
)
public
Result
queryComments
(
@ApiParam
(
"商品ID"
)
@RequestParam
(
"itemId"
)
String
itemId
,
@ApiParam
(
value
=
"页数 默认1"
)
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@ApiParam
(
value
=
"每页大小 默认10"
)
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
return
tbCfItemCommentService
.
querycomments
(
itemId
,
pageNum
,
pageSize
);
}
/**
* 查看回复信息
*
* @param commentId
* @param pageNum
* @param pageSize
* @return
*/
@ApiOperation
(
value
=
"查看回复信息"
)
@GetMapping
(
"/queryreplys"
)
public
Result
queryReplys
(
@ApiParam
(
"评论ID"
)
@RequestParam
(
"commentId"
)
String
commentId
,
@ApiParam
(
value
=
"页数 默认1"
)
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@ApiParam
(
value
=
"每页大小 默认10"
)
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
return
tbCfReplyService
.
queryReplys
(
commentId
,
pageNum
,
pageSize
);
}
/**
* 商品评价
*
* @param comment
* @return
*/
@ApiOperation
(
value
=
"商品评价"
)
@PostMapping
(
"/addcomment"
)
public
Result
addComment
(
@ApiParam
(
"评论"
)
@RequestBody
TbCfItemCommentEntity
comment
)
{
return
tbCfItemCommentService
.
addComment
(
comment
);
}
/**
* 删除评论
*
* @param commentId
* @return
*/
@DeleteMapping
(
value
=
"/delcomment"
)
public
Result
delComment
(
@ApiParam
(
"评论ID"
)
@RequestParam
(
"commentId"
)
String
commentId
)
{
return
tbCfItemCommentService
.
delComment
(
commentId
);
}
/**
* 回复消息
*
* @param reply
* @return
*/
@ApiOperation
(
value
=
"回复消息"
)
@PostMapping
(
"/addreply"
)
public
Result
addReply
(
@ApiParam
(
"回复消息"
)
@RequestBody
TbCfReplyEntity
reply
)
{
return
tbCfReplyService
.
addReply
(
reply
);
}
/**
* 删除回复
*
* @param replyId
* @return
*/
@ApiOperation
(
"删除回复"
)
@DeleteMapping
(
"/delreply"
)
public
Result
delReply
(
@ApiParam
(
"回复ID"
)
@RequestParam
(
"replyId"
)
String
replyId
)
{
return
tbCfReplyService
.
delReply
(
replyId
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfItemCommentDao.java
浏览文件 @
1c3e0710
...
...
@@ -5,6 +5,8 @@ import com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntityExtends
;
import
com.diaoyun.zion.master.dao.BaseDao
;
import
java.util.List
;
/**
* Dao
*
...
...
@@ -14,4 +16,5 @@ import com.diaoyun.zion.master.dao.BaseDao;
public
interface
TbCfItemCommentDao
extends
BaseDao
<
TbCfItemCommentEntity
>
{
public
TbCfItemCommentEntityExtends
queryLastComment
(
String
itemId
);
List
<
TbCfItemCommentEntity
>
querycomments
(
String
itemId
);
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfReplyDao.java
浏览文件 @
1c3e0710
...
...
@@ -2,8 +2,11 @@ package com.diaoyun.zion.chinafrica.dao;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntityExtends
;
import
com.diaoyun.zion.master.dao.BaseDao
;
import
java.util.List
;
/**
* Dao
*
...
...
@@ -11,5 +14,6 @@ import com.diaoyun.zion.master.dao.BaseDao;
* @date 2019-11-18 15:10:45
*/
public
interface
TbCfReplyDao
extends
BaseDao
<
TbCfReplyEntity
>
{
List
<
TbCfReplyEntityExtends
>
queryReplys
(
String
commentId
);
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfItemCommentEntity.java
浏览文件 @
1c3e0710
...
...
@@ -64,7 +64,7 @@ public class TbCfItemCommentEntity implements Serializable {
/**
* 回复时间
*/
private
Date
reply
Time
;
private
Date
update
Time
;
private
String
username
;
...
...
@@ -244,17 +244,11 @@ public class TbCfItemCommentEntity implements Serializable {
return
createTime
;
}
/**
* 设置:回复时间
*/
public
void
setReplyTime
(
Date
replyTime
)
{
this
.
replyTime
=
replyTime
;
public
Date
getUpdateTime
()
{
return
updateTime
;
}
/**
* 获取:回复时间
*/
public
Date
getReplyTime
()
{
return
replyTime
;
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfReplyEntityExtends.java
0 → 100644
浏览文件 @
1c3e0710
package
com
.
diaoyun
.
zion
.
chinafrica
.
entity
;
/**
* @Auther: wudepeng
* @Date: 2019/11/19
* @Description:
*/
public
class
TbCfReplyEntityExtends
extends
TbCfReplyEntity
{
private
String
user
;
private
String
touser
;
public
String
getUser
()
{
return
user
;
}
public
void
setUser
(
String
user
)
{
this
.
user
=
user
;
}
public
String
getTouser
()
{
return
touser
;
}
public
void
setTouser
(
String
touser
)
{
this
.
touser
=
touser
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfItemCommentService.java
浏览文件 @
1c3e0710
...
...
@@ -2,7 +2,11 @@ package com.diaoyun.zion.chinafrica.service;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntityExtends
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.master.base.Result
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
...
...
@@ -73,4 +77,12 @@ public interface TbCfItemCommentService {
int
deleteBatch
(
String
[]
ids
);
public
Result
queryLastComment
(
String
itemId
);
Result
querycomments
(
String
itemId
,
Integer
pageNum
,
Integer
pageSize
);
Result
addComment
(
TbCfItemCommentEntity
comment
);
Result
delComment
(
String
commentId
);
}
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfReplyService.java
浏览文件 @
1c3e0710
...
...
@@ -2,6 +2,10 @@ package com.diaoyun.zion.chinafrica.service;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntityExtends
;
import
com.diaoyun.zion.master.base.Result
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -69,4 +73,7 @@ public interface TbCfReplyService {
* @return 删除条数
*/
int
deleteBatch
(
String
[]
ids
);
Result
queryReplys
(
String
commentId
,
Integer
pageNum
,
Integer
pageSize
);
Result
addReply
(
TbCfReplyEntity
reply
);
Result
delReply
(
String
replyId
);
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfItemCommentServiceImpl.java
浏览文件 @
1c3e0710
...
...
@@ -4,18 +4,23 @@ package com.diaoyun.zion.chinafrica.service.impl;
import
com.diaoyun.zion.chinafrica.dao.TbCfItemCommentDao
;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntityExtends
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.chinafrica.service.TbCfItemCommentService
;
import
com.diaoyun.zion.master.base.Result
;
import
com.diaoyun.zion.master.enums.ResultCodeEnum
;
import
com.diaoyun.zion.master.util.IdUtil
;
import
com.github.pagehelper.PageInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
github
.
pagehelper
.
page
.
PageMethod
.
startPage
;
/**
* Service实现类
*
...
...
@@ -88,4 +93,82 @@ public class TbCfItemCommentServiceImpl implements TbCfItemCommentService {
}
return
result
;
}
/**
* 查询更多评论
*
* @param itemId
* @param pageNum
* @param pageSize
* @return
*/
@Override
public
Result
querycomments
(
String
itemId
,
Integer
pageNum
,
Integer
pageSize
)
{
Result
<
PageInfo
>
result
=
new
Result
();
try
{
startPage
(
pageNum
,
pageSize
);
List
<
TbCfItemCommentEntity
>
comments
=
tbCfItemCommentDao
.
querycomments
(
itemId
);
PageInfo
<
TbCfItemCommentEntity
>
pageInfo
=
new
PageInfo
<>(
comments
);
result
.
setData
(
pageInfo
);
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
/**
* 商品评价
*
* @param comment
* @return
*/
public
Result
addComment
(
TbCfItemCommentEntity
comment
)
{
Result
result
=
new
Result
();
try
{
comment
.
setId
(
IdUtil
.
createIdbyUUID
());
comment
.
setDelFlag
(
0
);
comment
.
setLikeNum
(
0L
);
comment
.
setCreateTime
(
new
Date
());
comment
.
setUpdateTime
(
new
Date
());
int
i
=
tbCfItemCommentDao
.
save
(
comment
);
if
(
i
>
0
)
{
result
.
setCode
(
ResultCodeEnum
.
SUCCESS
.
getCode
()).
setMessage
(
"Comment on success!"
);
}
else
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Comment on failure!"
);
}
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
/**
* 删除商品评论
*
* @param commentId
* @return
*/
@Override
public
Result
delComment
(
String
commentId
)
{
Result
result
=
new
Result
();
try
{
TbCfItemCommentEntity
comment
=
tbCfItemCommentDao
.
queryObject
(
commentId
);
comment
.
setDelFlag
(
1
);
comment
.
setUpdateTime
(
new
Date
());
int
i
=
tbCfItemCommentDao
.
update
(
comment
);
if
(
i
>
0
)
{
result
.
setCode
(
ResultCodeEnum
.
SUCCESS
.
getCode
()).
setMessage
(
"Deleted successfully!"
);
}
else
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Deletion failed!"
);
}
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfReplyServiceImpl.java
浏览文件 @
1c3e0710
...
...
@@ -2,15 +2,25 @@ package com.diaoyun.zion.chinafrica.service.impl;
import
com.diaoyun.zion.chinafrica.dao.TbCfReplyDao
;
import
com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfReplyEntityExtends
;
import
com.diaoyun.zion.chinafrica.service.TbCfReplyService
;
import
com.diaoyun.zion.master.base.Result
;
import
com.diaoyun.zion.master.enums.ResultCodeEnum
;
import
com.diaoyun.zion.master.util.IdUtil
;
import
com.github.pagehelper.PageInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
github
.
pagehelper
.
page
.
PageMethod
.
startPage
;
/**
* Service实现类
*
...
...
@@ -19,6 +29,7 @@ import java.util.Map;
*/
@Service
(
"tbCfReplyService"
)
public
class
TbCfReplyServiceImpl
implements
TbCfReplyService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
TbCfReplyServiceImpl
.
class
);
@Autowired
private
TbCfReplyDao
tbCfReplyDao
;
...
...
@@ -57,4 +68,61 @@ public class TbCfReplyServiceImpl implements TbCfReplyService {
public
int
deleteBatch
(
String
[]
ids
)
{
return
tbCfReplyDao
.
deleteBatch
(
ids
);
}
@Override
public
Result
queryReplys
(
String
commentId
,
Integer
pageNum
,
Integer
pageSize
)
{
Result
result
=
new
Result
();
try
{
startPage
(
pageNum
,
pageSize
);
List
<
TbCfReplyEntityExtends
>
replys
=
tbCfReplyDao
.
queryReplys
(
commentId
);
PageInfo
<
TbCfReplyEntityExtends
>
pageInfo
=
new
PageInfo
<>(
replys
);
result
.
setData
(
pageInfo
);
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
@Override
public
Result
addReply
(
TbCfReplyEntity
reply
)
{
Result
result
=
new
Result
();
try
{
reply
.
setId
(
IdUtil
.
createIdbyUUID
());
reply
.
setReplyType
(
0
);
reply
.
setDelFlag
(
0
);
reply
.
setCreateTime
(
new
Date
());
reply
.
setUpdateTime
(
new
Date
());
int
i
=
tbCfReplyDao
.
save
(
reply
);
if
(
i
>
0
)
{
result
.
setCode
(
ResultCodeEnum
.
SUCCESS
.
getCode
()).
setMessage
(
"Reply successful!"
);
}
else
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Reply failed!"
);
}
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
@Override
public
Result
delReply
(
String
replyId
)
{
Result
result
=
new
Result
();
try
{
TbCfReplyEntity
reply
=
tbCfReplyDao
.
queryObject
(
replyId
);
reply
.
setDelFlag
(
1
);
reply
.
setUpdateTime
(
new
Date
());
int
i
=
tbCfReplyDao
.
update
(
reply
);
if
(
i
>
0
)
{
result
.
setCode
(
ResultCodeEnum
.
SUCCESS
.
getCode
()).
setMessage
(
"Deleted successfully!"
);
}
else
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Deletion failed!"
);
}
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
}
return
result
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
浏览文件 @
1c3e0710
...
...
@@ -34,6 +34,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -91,7 +92,6 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
private
RedisCache
<
Object
>
captchaRedisCache
;
@Override
public
TbCfUserInfoEntity
queryObject
(
String
userId
)
{
return
tbCfUserInfoDao
.
queryObject
(
userId
);
...
...
@@ -213,16 +213,16 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
@Override
public
Result
<
TbCfUserInfoVo
>
registerByPhone
(
TbCfUserInfoVo
tbCfUserInfoVo
,
String
code
)
{
String
phone
=
"+"
+
tbCfUserInfoVo
.
getPhone
();
public
Result
<
TbCfUserInfoVo
>
registerByPhone
(
TbCfUserInfoVo
tbCfUserInfoVo
,
String
code
)
{
String
phone
=
"+"
+
tbCfUserInfoVo
.
getPhone
();
Result
result
=
new
Result
();
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
phone
);
String
phoneCode
=
(
String
)
captchaRedisCache
.
get
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
);
if
(
code
==
null
||!
code
.
equals
(
phoneCode
))
{
if
(
code
==
null
||
!
code
.
equals
(
phoneCode
))
{
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
());
result
.
setMessage
(
"Verification code error"
);
}
else
{
if
(
user
==
null
)
{
}
else
{
if
(
user
==
null
)
{
TbCfUserInfoEntity
tbCfUserInfoEntity
=
new
TbCfUserInfoEntity
();
String
userid
=
IdUtil
.
createIdbyUUID
();
tbCfUserInfoVo
.
setUserId
(
userid
);
...
...
@@ -280,14 +280,15 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
throw
new
ApplicationException
(
ResultCodeEnum
.
NEED_LOGIN
.
getCode
(),
"Invalid username/password supplied or account is disable"
);
}
}
public
Result
loginByPhone
(
String
ip
,
String
phoneNum
,
String
code
){
String
phone
=
"+"
+
phoneNum
.
trim
();
Result
result
=
new
Result
();
public
Result
loginByPhone
(
String
ip
,
String
phoneNum
,
String
code
)
{
String
phone
=
"+"
+
phoneNum
.
trim
();
Result
result
=
new
Result
();
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
phone
);
String
phoneCode
=
(
String
)
captchaRedisCache
.
get
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
);
if
(
user
!=
null
&&
phoneCode
.
equals
(
code
))
{
result
=
loginByPhoneCode
(
ip
,
phone
);
}
else
{
}
else
{
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
());
result
.
setMessage
(
"Login failed"
);
}
...
...
@@ -295,12 +296,13 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
public
String
getUserPhoneCode
(
String
phone
)
throws
IOException
{
phone
=
"+"
+
phone
.
trim
();
phone
=
"+"
+
phone
.
trim
();
SMSUtil
smsUtil
=
new
SMSUtil
();
String
code
=
smsUtil
.
yzCode
(
phone
);
captchaRedisCache
.
set
(
KeyConstant
.
CAPTCHA_PHONE
+
phone
,
code
,
300
);
return
code
;
}
/**
* 登录
*
...
...
@@ -324,6 +326,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
result
.
setData
(
loginUser
).
setMessage
(
ResultCodeEnum
.
SUCCESS
.
getDesc
());
return
result
;
}
public
Result
loginByPhoneCode
(
String
ip
,
String
phone
)
{
Result
<
TbCfUserInfoVo
>
result
=
new
Result
<>();
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
checkUserByPhone
(
phone
);
...
...
@@ -341,6 +344,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
result
.
setMessage
(
ResultCodeEnum
.
SUCCESS
.
getDesc
());
return
result
;
}
@Override
public
TbCfUserInfoEntity
findByAccount
(
String
account
)
{
TbCfUserInfoEntity
tbCfUserInfoEntity
=
tbCfUserInfoDao
.
findByAccount
(
account
);
...
...
@@ -465,7 +469,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
@Override
public
Result
resetPassWord
(
String
account
,
String
newPassword
,
Integer
captcha
)
{
public
Result
resetPassWord
(
String
account
,
String
newPassword
,
Integer
captcha
)
{
Result
result
=
new
Result
();
Integer
identifyCode
=
(
Integer
)
captchaRedisCache
.
get
(
KeyConstant
.
CAPTCHA
+
account
);
if
(
identifyCode
==
null
||
identifyCode
.
intValue
()
!=
captcha
)
{
...
...
src/main/resources/mapper/TbCfItemCommentDao.xml
浏览文件 @
1c3e0710
...
...
@@ -16,7 +16,7 @@
<result
property=
"likeNum"
column=
"like_num"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"
replyTime"
column=
"reply
_time"
/>
<result
property=
"
updateTime"
column=
"update
_time"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity"
>
...
...
@@ -33,10 +33,22 @@
`like_num`,
`del_flag`,
`create_time`,
`
reply_time`,nick
`
update_time`
from tb_cf_item_comment
where id = #{id}
</select>
<select
id=
"querycomments"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity"
>
SELECT
u.nick username,
c.*
FROM
tb_cf_item_comment c
LEFT JOIN tb_cf_user_info u ON c.user_id = u.user_id
WHERE
item_id =#{itemId}
AND c.del_flag = 0
ORDER BY c.create_time DESC
</select>
<select
id=
"queryLastComment"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntityExtends"
>
SELECT
c.id,
...
...
@@ -51,6 +63,7 @@
WHERE
c.item_id = #{itemId}
AND c.del_flag = 0
AND c.del_flag = 0
ORDER BY
c.create_time DESC
LIMIT 1
...
...
@@ -69,7 +82,7 @@
`like_num`,
`del_flag`,
`create_time`,
`
reply
_time`
`
update
_time`
from tb_cf_item_comment
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
...
...
@@ -110,7 +123,7 @@
`like_num`,
`del_flag`,
`create_time`,
`
reply
_time`)
`
update
_time`)
values(
#{id},
#{userId},
...
...
@@ -124,7 +137,7 @@
#{likeNum},
#{delFlag},
#{createTime},
#{
reply
Time})
#{
update
Time})
</insert>
<update
id=
"update"
parameterType=
"com.diaoyun.zion.chinafrica.entity.TbCfItemCommentEntity"
>
...
...
@@ -141,7 +154,7 @@
<if
test=
"likeNum != null"
>
`like_num` = #{likeNum},
</if>
<if
test=
"delFlag != null"
>
`del_flag` = #{delFlag},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"
replyTime != null"
>
`reply_time` = #{reply
Time}
</if>
<if
test=
"
updateTime != null"
>
`update_time` = #{update
Time}
</if>
</set>
where id = #{id}
</update>
...
...
src/main/resources/mapper/TbCfReplyDao.xml
浏览文件 @
1c3e0710
...
...
@@ -58,7 +58,24 @@
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryReplys"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfReplyEntityExtends"
>
SELECT
u.nick user ,
c.id commentId,
i.touser touser,
r.*
FROM
tb_cf_reply r
LEFT JOIN tb_cf_item_comment c ON r.comment_id = c.id
LEFT JOIN tb_cf_user_info u ON r.user_id = u.user_id
LEFT JOIN ( SELECT u.user_id, u.nick touser FROM tb_cf_user_info u ) i ON r.to_user_id = i.user_id
WHERE
r.reply_type = 0
AND r.del_flag = 0
AND c.id = #{id}
ORDER BY
r.create_time DESC
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from tb_cf_reply
WHERE 1=1
...
...
@@ -93,13 +110,13 @@
<update
id=
"update"
parameterType=
"com.diaoyun.zion.chinafrica.entity.TbCfReplyEntity"
>
update tb_cf_reply
<set>
<if
test=
"replyType != null"
>
`reply_type` = #{replyType},
</if>
<if
test=
"commentId != null"
>
`comment_id` = #{commentId},
</if>
<if
test=
"userId != null"
>
`user_id` = #{userId},
</if>
<if
test=
"toUserId != null"
>
`to_user_id` = #{toUserId},
</if>
<if
test=
"replyMessage != null"
>
`reply_message` = #{replyMessage},
</if>
<if
test=
"delFlag != null"
>
`del_flag` = #{delFlag},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"replyType != null"
>
`reply_type` = #{replyType},
</if>
<if
test=
"commentId != null"
>
`comment_id` = #{commentId},
</if>
<if
test=
"userId != null"
>
`user_id` = #{userId},
</if>
<if
test=
"toUserId != null"
>
`to_user_id` = #{toUserId},
</if>
<if
test=
"replyMessage != null"
>
`reply_message` = #{replyMessage},
</if>
<if
test=
"delFlag != null"
>
`del_flag` = #{delFlag},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where id = #{id}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论