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
1d28778c
Commit
1d28778c
authored
Apr 02, 2019
by
liuchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://fywlsoft.cn:50379/other-project/tjmdp
parents
1638949f
66f79ca5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
248 additions
and
6 deletions
+248
-6
.gitignore
.gitignore
+3
-0
RainbowPlanController.java
...qiankun/controller/rainbowplan/RainbowPlanController.java
+56
-6
RainbowPlanUserDaoImpl.java
src/main/java/com/qiankun/dao/RainbowPlanUserDaoImpl.java
+13
-0
WishDaoImpl.java
src/main/java/com/qiankun/dao/WishDaoImpl.java
+13
-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.
.gitignore
View file @
1d28778c
...
...
@@ -3,3 +3,5 @@
.project
.gitignore
.classpath
.idea
udata
\ No newline at end of file
src/main/java/com/qiankun/controller/rainbowplan/RainbowPlanController.java
View file @
1d28778c
...
...
@@ -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"
;
...
...
@@ -77,7 +82,8 @@ public class RainbowPlanController {
result
.
put
(
"userInfo"
,
userInfo
);
}
else
{
result
.
put
(
"sKey"
,
""
);
result
.
put
(
"userInfo"
,
null
);
result
.
put
(
"userInfo"
,
""
);
result
.
put
(
"openid"
,
session
.
getOpenid
());
}
return
result
;
...
...
@@ -96,6 +102,7 @@ public class RainbowPlanController {
user
.
setPhone
(
info
.
getPhone
());
user
.
setName
(
info
.
getName
());
user
.
setGender
(
info
.
getGender
());
user
.
setOpenid
(
info
.
getOpenid
());
if
(
Strings
.
isNullOrEmpty
(
info
.
getInviter
())){
user
.
setStatus
(
RainbowPlanUser
.
STATUS_UNAUDIT
);
}
else
if
(
inviterExist
(
info
.
getInviter
())){
...
...
@@ -140,12 +147,14 @@ public class RainbowPlanController {
if
(
user
!=
null
){
user
.
setPhone
(
info
.
getPhone
());
user
.
setName
(
info
.
getName
());
user
.
setNickName
(
info
.
getNickName
());
user
.
setGender
(
info
.
getGender
());
user
.
setBirthday
(
info
.
getBirthday
());
user
.
setBedNum
(
info
.
getBedNum
());
user
.
setReceiveName
(
info
.
getReceiveName
());
user
.
setConnectTel
(
info
.
getConnectTel
());
user
.
setReceiveAddress
(
info
.
getReceiveAddress
());
userDao
.
update
(
user
);
}
else
{
throw
new
Exception
(
"保存失败,请求用户不存在"
);
}
...
...
@@ -169,6 +178,7 @@ public class RainbowPlanController {
FileUtils
.
writeByteArrayToFile
(
destFile
,
info
.
getFile
().
getBytes
());
user
.
setPhone
(
info
.
getPhone
());
user
.
setName
(
info
.
getName
());
user
.
setNickName
(
info
.
getNickName
());
user
.
setGender
(
info
.
getGender
());
user
.
setBirthday
(
info
.
getBirthday
());
user
.
setBedNum
(
info
.
getBedNum
());
...
...
@@ -226,24 +236,64 @@ public class RainbowPlanController {
RainbowPlanUser
user
=
userDao
.
findByOpenid
(
openid
);
List
<
Wish
>
resultList
=
Lists
.
newArrayList
();
if
(
user
!=
null
){
wishDao
.
findByRainbowPlanUserId
(
user
.
getId
());
}
else
{
throw
new
Exception
(
"获取数据失败,请求用户不存在"
);
resultList
=
wishDao
.
findByRainbowPlanUserId
(
user
.
getId
());
}
return
resultList
;
}
@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
)
public
boolean
isActivity
(
@RequestHeader
String
sKey
)
throws
Exception
{
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
RainbowPlanUser
user
=
userDao
.
findByOpenid
(
openid
);
if
(
user
!=
null
){
//TODO 获取活动开放标识
return
true
;
}
else
{
throw
new
Exception
(
"获取数据失败,请求用户不存在"
);
}
}
...
...
src/main/java/com/qiankun/dao/RainbowPlanUserDaoImpl.java
View file @
1d28778c
...
...
@@ -4,6 +4,7 @@ import com.qiankun.dao.core.AbsDao;
import
com.qiankun.dao.core.Hints
;
import
com.qiankun.entity.RainbowPlanUser
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
@Repository
public
class
RainbowPlanUserDaoImpl
extends
AbsDao
<
RainbowPlanUser
,
String
>
implements
RainbowPlanUserDao
{
...
...
@@ -11,4 +12,16 @@ public class RainbowPlanUserDaoImpl extends AbsDao<RainbowPlanUser,String> imple
public
RainbowPlanUser
findByOpenid
(
String
openid
)
{
return
findUnique
(
"from RainbowPlanUser where openid=?"
,
new
Hints
(),
openid
);
}
@Transactional
@Override
public
RainbowPlanUser
save
(
RainbowPlanUser
entity
)
{
return
super
.
save
(
entity
);
}
@Transactional
@Override
public
void
update
(
RainbowPlanUser
entity
)
{
super
.
update
(
entity
);
}
}
src/main/java/com/qiankun/dao/WishDaoImpl.java
View file @
1d28778c
...
...
@@ -4,6 +4,7 @@ import com.qiankun.dao.core.AbsDao;
import
com.qiankun.dao.core.Hints
;
import
com.qiankun.entity.Wish
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
...
...
@@ -18,4 +19,16 @@ public class WishDaoImpl extends AbsDao<Wish,String> implements WishDao {
public
Wish
findById
(
String
id
)
{
return
findUnique
(
"from Wish where id = ?"
,
new
Hints
(),
id
);
}
@Transactional
@Override
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 @
1d28778c
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 @
1d28778c
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 @
1d28778c
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 @
1d28778c
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