Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
tjmdp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
other-project
tjmdp
Commits
66f79ca5
Commit
66f79ca5
authored
Apr 02, 2019
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加愿望相关功能
parent
1af1a654
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
203 additions
and
2 deletions
+203
-2
RainbowPlanController.java
...qiankun/controller/rainbowplan/RainbowPlanController.java
+34
-2
WishDaoImpl.java
src/main/java/com/qiankun/dao/WishDaoImpl.java
+6
-0
WishReplyDao.java
src/main/java/com/qiankun/dao/WishReplyDao.java
+10
-0
WishReplyDaoImpl.java
src/main/java/com/qiankun/dao/WishReplyDaoImpl.java
+23
-0
WishReply.java
src/main/java/com/qiankun/entity/WishReply.java
+96
-0
WishDetailVo.java
src/main/java/com/qiankun/vo/WishDetailVo.java
+34
-0
No files found.
src/main/java/com/qiankun/controller/rainbowplan/RainbowPlanController.java
View file @
66f79ca5
...
...
@@ -10,12 +10,15 @@ import com.qiankun.config.WxMaConfiguration;
import
com.qiankun.config.WxMaProperties
;
import
com.qiankun.dao.RainbowPlanUserDao
;
import
com.qiankun.dao.WishDao
;
import
com.qiankun.dao.WishReplyDao
;
import
com.qiankun.entity.RainbowPlanUser
;
import
com.qiankun.entity.Wish
;
import
com.qiankun.entity.WishReply
;
import
com.qiankun.utils.JwtTokenUtil
;
import
com.qiankun.vo.PublishWish
;
import
com.qiankun.vo.RegisterInfo
;
import
com.qiankun.vo.UserInfo
;
import
com.qiankun.vo.WishDetailVo
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -45,6 +48,8 @@ public class RainbowPlanController {
@Autowired
private
WishDao
wishDao
;
@Autowired
private
WishReplyDao
wishReplyDao
;
@Autowired
private
WxMaProperties
propertis
;
private
ResourceBundle
rb
=
ResourceBundle
.
getBundle
(
"system"
);
private
String
uploadAvatarPath
=
File
.
separator
+
"rainbowplan"
+
File
.
separator
+
"uploadAvatar"
;
...
...
@@ -237,16 +242,43 @@ public class RainbowPlanController {
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/wish"
,
method
=
RequestMethod
.
GET
)
public
Wish
getWish
(
@RequestParam
String
id
,
@RequestHeader
String
sKey
){
public
Wish
DetailVo
getWish
(
@RequestParam
String
id
,
@RequestHeader
String
sKey
){
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
Wish
wish
=
wishDao
.
findById
(
id
);
List
<
WishReply
>
replys
=
wishReplyDao
.
findByWishId
(
wish
.
getId
());
WishDetailVo
vo
=
new
WishDetailVo
(
wish
,
replys
);
return
vo
;
return
wish
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/reply"
,
method
=
RequestMethod
.
POST
)
public
String
reply
(
@RequestBody
WishReply
reply
,
@RequestHeader
String
sKey
){
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
//TODO 验证
wishReplyDao
.
save
(
reply
);
return
"OK"
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/completeWish"
,
method
=
RequestMethod
.
GET
)
public
String
completeWish
(
String
wishId
,
@RequestHeader
String
sKey
){
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
Wish
wish
=
wishDao
.
findById
(
wishId
);
if
(
wish
!=
null
){
wish
.
setStatus
(
Wish
.
STATUS_COMPLETE
);
}
wishDao
.
update
(
wish
);
return
"OK"
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/isActivity"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/com/qiankun/dao/WishDaoImpl.java
View file @
66f79ca5
...
...
@@ -25,4 +25,10 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao {
public
Wish
save
(
Wish
entity
)
{
return
super
.
save
(
entity
);
}
@Transactional
@Override
public
void
update
(
Wish
entity
)
{
super
.
update
(
entity
);
}
}
src/main/java/com/qiankun/dao/WishReplyDao.java
0 → 100644
View file @
66f79ca5
package
com
.
qiankun
.
dao
;
import
com.qiankun.dao.core.IDao
;
import
com.qiankun.entity.WishReply
;
import
java.util.List
;
public
interface
WishReplyDao
extends
IDao
<
WishReply
,
String
>
{
List
<
WishReply
>
findByWishId
(
String
wishId
);
}
src/main/java/com/qiankun/dao/WishReplyDaoImpl.java
0 → 100644
View file @
66f79ca5
package
com
.
qiankun
.
dao
;
import
com.qiankun.dao.core.AbsDao
;
import
com.qiankun.dao.core.Hints
;
import
com.qiankun.entity.WishReply
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Repository
public
class
WishReplyDaoImpl
extends
AbsDao
<
WishReply
,
String
>
implements
WishReplyDao
{
@Override
public
List
<
WishReply
>
findByWishId
(
String
wishId
)
{
return
find
(
"from WishReply where wishId = ? order by createTime asc"
,
new
Hints
(
0
),
wishId
);
}
@Transactional
@Override
public
WishReply
save
(
WishReply
entity
)
{
return
super
.
save
(
entity
);
}
}
src/main/java/com/qiankun/entity/WishReply.java
0 → 100644
View file @
66f79ca5
package
com
.
qiankun
.
entity
;
import
org.hibernate.annotations.GenericGenerator
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
java.util.Date
;
@Entity
public
class
WishReply
{
@Id
@GenericGenerator
(
name
=
"systemUUID"
,
strategy
=
"uuid2"
)
@GeneratedValue
(
generator
=
"systemUUID"
)
private
String
id
;
//愿望ID
private
String
content
;
//回复内容
private
String
uploadImage
;
//上传的图片
private
String
volunteerId
;
//志愿者ID
private
String
volunteerName
;
//志愿者名称
private
String
volunteerAvatar
;
//志愿者头像
private
String
rainbowplanUserId
;
//小朋友ID
private
String
wishId
;
//愿望ID
private
Date
createTime
=
new
Date
();
public
String
getVolunteerName
()
{
return
volunteerName
;
}
public
void
setVolunteerName
(
String
volunteerName
)
{
this
.
volunteerName
=
volunteerName
;
}
public
String
getVolunteerAvatar
()
{
return
volunteerAvatar
;
}
public
void
setVolunteerAvatar
(
String
volunteerAvatar
)
{
this
.
volunteerAvatar
=
volunteerAvatar
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getWishId
()
{
return
wishId
;
}
public
void
setWishId
(
String
wishId
)
{
this
.
wishId
=
wishId
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getUploadImage
()
{
return
uploadImage
;
}
public
void
setUploadImage
(
String
uploadImage
)
{
this
.
uploadImage
=
uploadImage
;
}
public
String
getVolunteerId
()
{
return
volunteerId
;
}
public
void
setVolunteerId
(
String
volunteerId
)
{
this
.
volunteerId
=
volunteerId
;
}
public
String
getRainbowplanUserId
()
{
return
rainbowplanUserId
;
}
public
void
setRainbowplanUserId
(
String
rainbowplanUserId
)
{
this
.
rainbowplanUserId
=
rainbowplanUserId
;
}
}
src/main/java/com/qiankun/vo/WishDetailVo.java
0 → 100644
View file @
66f79ca5
package
com
.
qiankun
.
vo
;
import
com.qiankun.entity.Wish
;
import
com.qiankun.entity.WishReply
;
import
java.util.List
;
public
class
WishDetailVo
{
private
Wish
wish
;
private
List
<
WishReply
>
replys
;
public
WishDetailVo
(){
}
public
WishDetailVo
(
Wish
wish
,
List
<
WishReply
>
replys
){
this
.
wish
=
wish
;
this
.
replys
=
replys
;
}
public
Wish
getWish
()
{
return
wish
;
}
public
void
setWish
(
Wish
wish
)
{
this
.
wish
=
wish
;
}
public
List
<
WishReply
>
getReplys
()
{
return
replys
;
}
public
void
setReplys
(
List
<
WishReply
>
replys
)
{
this
.
replys
=
replys
;
}
}
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