Skip to content
切换导航面板
项目
群组
代码片段
帮助
zhangtai
/
zzhnc
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
设置
活动
图像
图表
创建新的问题
作业
提交
问题看板
文件
提交
分支
标签
贡献者
图像
比较
图表
Commit 1af58920
由
zxt@theyeasy.com
编写于
Dec 29, 2017
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
update
1 个父辈
fd340ce7
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
69 行增加
和
118 行删除
src/com/w1hd/zzhnc/controller/wx/WxMiniController.java
src/com/w1hd/zzhnc/model/Lotterylog.java
src/com/w1hd/zzhnc/service/GoodsService.java
src/com/w1hd/zzhnc/service/PrizeService.java
src/com/w1hd/zzhnc/controller/wx/WxMiniController.java
查看文件 @
1af5892
...
...
@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -25,15 +26,18 @@ import org.theyeasy.weixin.util.WxMiniUtil;
import
com.beust.jcommander.internal.Maps
;
import
com.w1hd.zzhnc.controller.pc.BaseController
;
import
com.w1hd.zzhnc.dao.FansDao
;
import
com.w1hd.zzhnc.dao.LotteryLogDao
;
import
com.w1hd.zzhnc.model.Articles
;
import
com.w1hd.zzhnc.model.Banner
;
import
com.w1hd.zzhnc.model.Fans
;
import
com.w1hd.zzhnc.model.Goods
;
import
com.w1hd.zzhnc.model.Lotterylog
;
import
com.w1hd.zzhnc.service.ActivityService
;
import
com.w1hd.zzhnc.service.ArticleService
;
import
com.w1hd.zzhnc.service.BannerService
;
import
com.w1hd.zzhnc.service.FansService
;
import
com.w1hd.zzhnc.service.GoodsService
;
import
com.w1hd.zzhnc.service.PrizeService
;
import
com.w1hd.zzhnc.util.PageResults
;
import
com.w1hd.zzhnc.util.RedisUtil
;
import
com.w1hd.zzhnc.vo.MiniHomeVO
;
...
...
@@ -55,9 +59,9 @@ public class WxMiniController extends BaseController {
ActivityService
activityService
;
@Autowired
FansDao
fansDao
;
PrizeService
prizeService
;
@RequestMapping
(
value
=
"/wxmsg"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/wxmsg"
,
method
=
RequestMethod
.
GET
)
public
void
WxMsg
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
signature
=
request
.
getParameter
(
"signature"
);
String
timestamp
=
request
.
getParameter
(
"timestamp"
);
...
...
@@ -95,7 +99,7 @@ public class WxMiniController extends BaseController {
}
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
GET
)
// 购房助手登录 double lng,double lat
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
GET
)
// 购房助手登录 double lng,double lat
public
@ResponseBody
Vo_msg
login
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"shareId"
)
Integer
shareId
,
@RequestParam
(
value
=
"nickname"
)
String
nickname
,
@RequestParam
(
value
=
"logo"
)
String
logo
,
@RequestParam
(
value
=
"lng"
)
double
lng
,
...
...
@@ -142,7 +146,7 @@ public class WxMiniController extends BaseController {
}
// 强制刷新Token
@RequestMapping
(
value
=
"/refresh_token"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/refresh_token"
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
String
refreshToken
(
String
pwd
)
{
if
(!
pwd
.
equals
(
"nmdzpsmhs"
))
return
"error pwd"
;
...
...
@@ -150,7 +154,7 @@ public class WxMiniController extends BaseController {
}
// 文章列表
@RequestMapping
(
value
=
"/getArticlesList"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getArticlesList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getArticlesList
(
Integer
page
,
Integer
pagesize
)
{
...
...
@@ -158,7 +162,7 @@ public class WxMiniController extends BaseController {
}
// 增加文章浏览数
@RequestMapping
(
value
=
"/addArticleViewCount"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/addArticleViewCount"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
addArticleViewCount
(
Integer
id
)
{
articleService
.
addArticleViewCount
(
id
);
...
...
@@ -166,7 +170,7 @@ public class WxMiniController extends BaseController {
}
// 获取
@RequestMapping
(
value
=
"/getArticle"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getArticle"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getArticle
(
Integer
id
)
{
Articles
article
=
articleService
.
getArticle
(
id
);
...
...
@@ -238,7 +242,7 @@ public class WxMiniController extends BaseController {
// }
//
// 清除小程序卡片的media_id的方法
@RequestMapping
(
value
=
"/cleanProgramMedia"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/cleanProgramMedia"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
String
cleanProgramMedia
(
@RequestParam
(
value
=
"code"
)
String
code
)
{
if
(!
code
.
equals
(
"nmdzpsmhs"
))
...
...
@@ -254,7 +258,7 @@ public class WxMiniController extends BaseController {
@Autowired
GoodsService
goodsService
;
@RequestMapping
(
value
=
"/index"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/index"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
index
(
@RequestParam
(
"openId"
)
String
openId
)
{
try
{
...
...
@@ -262,27 +266,26 @@ public class WxMiniController extends BaseController {
List
<
Banner
>
bannerList
=
bannerService
.
getAll
();
List
<
Articles
>
homeData
=
articleService
.
getHomeData
();
List
<
Goods
>
homeData2
=
goodsService
.
getHomeData
();
result
.
put
(
"banner"
,
bannerList
);
List
<
MiniHomeVO
>
data
=
MiniHomeVO
.
getData
(
homeData
,
homeData2
);
result
.
put
(
"
data"
,
data
);
result
.
put
(
"banner
List
"
,
bannerList
);
result
.
put
(
"articlesList"
,
homeData
);
result
.
put
(
"
goodsList"
,
homeData2
);
return
new
Vo_msg
(
0
,
result
);
}
catch
(
Exception
e
)
{
return
new
Vo_msg
(-
1
,
"系统繁忙"
);
}
}
@RequestMapping
(
value
=
"/second"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/second"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
second
(
@RequestParam
(
value
=
"openId"
)
String
openId
,
@RequestParam
(
value
=
"key"
,
defaultValue
=
""
,
required
=
false
)
String
key
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"20"
,
required
=
false
)
Integer
size
)
{
public
Object
second
(
@RequestParam
(
value
=
"openId"
)
String
openId
,
@RequestParam
(
value
=
"key"
,
defaultValue
=
""
,
required
=
false
)
String
key
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"20"
,
required
=
false
)
Integer
size
)
{
try
{
Map
<
String
,
Object
>
result
=
Maps
.
newHashMap
();
List
<
Banner
>
bannerList
=
bannerService
.
getAll
();
PageResults
<
Goods
>
seacrh
=
goodsService
.
seacrh
(
null
,
key
,
null
,
page
,
size
);
List
<
Goods
>
rows
=
seacrh
.
getRows
();
PageResults
<
Goods
>
seacrh
=
goodsService
.
seacrh
(
null
,
key
,
null
,
page
,
size
);
List
<
Goods
>
rows
=
seacrh
.
getRows
();
result
.
put
(
"banner"
,
bannerList
);
result
.
put
(
"data"
,
rows
);
return
new
Vo_msg
(
0
,
result
);
...
...
@@ -291,4 +294,19 @@ public class WxMiniController extends BaseController {
}
}
@RequestMapping
(
value
=
"/prizes"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
prizes
(
@RequestParam
(
value
=
"openId"
)
String
openId
)
{
Fans
fans
=
fansService
.
getFansByMiniOpenid
(
openId
);
List
<
Lotterylog
>
list
=
prizeService
.
getMyLotteryLog
(
fans
.
getId
());
return
new
Vo_msg
(
0
,
list
);
}
@RequestMapping
(
value
=
"/prizes/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
prizes
(
@RequestParam
(
value
=
"openId"
)
String
openId
,
@PathVariable
(
value
=
"id"
)
Integer
id
)
{
Fans
fans
=
fansService
.
getFansByMiniOpenid
(
openId
);
return
prizeService
.
updateLotteryLog
(
id
,
fans
.
getId
());
}
}
src/com/w1hd/zzhnc/model/Lotterylog.java
查看文件 @
1af5892
...
...
@@ -30,141 +30,45 @@ public class Lotterylog {
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.id
*
* @param id
* the value for lotterylog.id
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value
* of the database column lotterylog.fansid
*
* @return the value of lotterylog.fansid
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
Integer
getFansid
()
{
return
fansid
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.fansid
*
* @param fansid
* the value for lotterylog.fansid
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setFansid
(
Integer
fansid
)
{
this
.
fansid
=
fansid
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value
* of the database column lotterylog.mny
*
* @return the value of lotterylog.mny
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
BigDecimal
getMny
()
{
return
mny
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.mny
*
* @param mny
* the value for lotterylog.mny
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setMny
(
BigDecimal
mny
)
{
this
.
mny
=
mny
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value
* of the database column lotterylog.status
*
* @return the value of lotterylog.status
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
Integer
getStatus
()
{
return
status
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.status
*
* @param status
* the value for lotterylog.status
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value
* of the database column lotterylog.turn
*
* @return the value of lotterylog.turn
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
Integer
getTurn
()
{
return
turn
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.turn
*
* @param turn
* the value for lotterylog.turn
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setTurn
(
Integer
turn
)
{
this
.
turn
=
turn
;
}
/**
* This method was generated by MyBatis Generator. This method returns the value
* of the database column lotterylog.createdtime
*
* @return the value of lotterylog.createdtime
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
Date
getCreatedtime
()
{
return
createdtime
;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of
* the database column lotterylog.createdtime
*
* @param createdtime
* the value for lotterylog.createdtime
*
* @mbggenerated Thu Nov 30 17:43:59 CST 2017
*/
public
void
setCreatedtime
(
Date
createdtime
)
{
this
.
createdtime
=
createdtime
;
}
...
...
src/com/w1hd/zzhnc/service/GoodsService.java
查看文件 @
1af5892
...
...
@@ -24,7 +24,7 @@ public class GoodsService {
@Autowired
GoodsDao
goodsDao
;
final
String
GOODSID_
=
RedisUtil
.
PROJECTNAME
.
concat
(
"_"
).
concat
(
"goods"
);
// 娲诲姩璁剧疆淇濆瓨key
final
String
GOODSID_
=
RedisUtil
.
PROJECTNAME
.
concat
(
"_"
).
concat
(
"goods"
);
public
List
<
Goods
>
getHomeData
()
{
Example
ex
=
new
Example
(
Goods
.
class
);
...
...
src/com/w1hd/zzhnc/service/PrizeService.java
查看文件 @
1af5892
...
...
@@ -7,10 +7,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.testng.util.Strings
;
import
com.w1hd.zzhnc.dao.LotteryLogDao
;
import
com.w1hd.zzhnc.dao.PrizeDao
;
import
com.w1hd.zzhnc.model.Goods
;
import
com.w1hd.zzhnc.model.Lotterylog
;
import
com.w1hd.zzhnc.model.Prize
;
import
com.w1hd.zzhnc.util.PageResults
;
import
com.w1hd.zzhnc.util.RedisUtil
;
import
com.w1hd.zzhnc.vo.Lotterylog_Vo
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
...
...
@@ -18,8 +22,13 @@ import tk.mybatis.mapper.entity.Example.Criteria;
@Service
public
class
PrizeService
{
final
String
LotteryLogID_
=
RedisUtil
.
PROJECTNAME
.
concat
(
"_"
).
concat
(
"lotteryLog_"
);
//中奖记里
@Autowired
PrizeDao
prizeDao
;
@Autowired
LotteryLogDao
lotteryLogDao
;
public
boolean
add
(
Prize
prize
)
{
return
prizeDao
.
insert
(
prize
)
>
0
;
...
...
@@ -51,5 +60,25 @@ public class PrizeService {
public
boolean
delete
(
String
id
)
{
return
prizeDao
.
deleteByPrimaryKey
(
id
)
>
0
;
}
/**获取我的奖品*/
public
List
<
Lotterylog
>
getMyLotteryLog
(
Integer
fansId
){
Example
ex
=
new
Example
(
Lotterylog
.
class
);
Criteria
c
=
ex
.
createCriteria
();
c
.
andEqualTo
(
"fansid"
,
fansId
);
List
<
Lotterylog
>
list
=
lotteryLogDao
.
selectByExample
(
ex
);
return
list
;
}
/**核销一个奖品记录*/
public
Lotterylog
updateLotteryLog
(
Integer
id
,
Integer
fansId
)
{
Lotterylog
lotterylog
=
lotteryLogDao
.
selectByPrimaryKey
(
id
);
lotterylog
.
setStatus
(
2
);
lotteryLogDao
.
updateByPrimaryKey
(
lotterylog
);
return
lotterylog
;
}
}
编写
预览
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
请先完成此消息的编辑!
取消
请
注册
或
登录
后发表评论