Skip to content
切换导航面板
项目
群组
代码片段
帮助
zhangtai
/
zzhnc
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
设置
活动
图像
图表
创建新的问题
作业
提交
问题看板
文件
提交
分支
标签
贡献者
图像
比较
图表
Commit d981c86b
由
zxt@theyeasy.com
编写于
Dec 26, 2017
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
add 部分接口
1 个父辈
b24b0ab4
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
417 行增加
和
114 行删除
build/classes/com/w1hd/zzhnc/controller/wx/WxMiniController.class
build/classes/com/w1hd/zzhnc/model/Goods.class
build/classes/com/w1hd/zzhnc/model/Saller.class
build/classes/com/w1hd/zzhnc/service/ArticleService.class
build/classes/com/w1hd/zzhnc/service/FansService.class
build/classes/com/w1hd/zzhnc/util/PageResults.class
src/com/w1hd/zzhnc/controller/pc/GoodsController.java
src/com/w1hd/zzhnc/controller/pc/PrizeController.java
src/com/w1hd/zzhnc/controller/pc/SellerController.java
src/com/w1hd/zzhnc/controller/wx/WxMiniController.java
src/com/w1hd/zzhnc/dao/SallerDao.java → src/com/w1hd/zzhnc/dao/SellerDao.java
src/com/w1hd/zzhnc/model/Goods.java
src/com/w1hd/zzhnc/model/Saller.java → src/com/w1hd/zzhnc/model/Seller.java
src/com/w1hd/zzhnc/service/ArticleService.java
src/com/w1hd/zzhnc/service/BannerService.java
src/com/w1hd/zzhnc/service/FansService.java
src/com/w1hd/zzhnc/service/GoodsService.java
src/com/w1hd/zzhnc/service/PrizeService.java
src/com/w1hd/zzhnc/service/SallerService.java
src/com/w1hd/zzhnc/service/SellerService.java
src/com/w1hd/zzhnc/util/PageResults.java
src/com/w1hd/zzhnc/vo/MiniHomeVO.java
build/classes/com/w1hd/zzhnc/controller/wx/WxMiniController.class
查看文件 @
d981c86
此文件类型无法预览
build/classes/com/w1hd/zzhnc/model/Goods.class
查看文件 @
d981c86
此文件类型无法预览
build/classes/com/w1hd/zzhnc/model/Saller.class
deleted
100644 → 0
查看文件 @
b24b0ab
此文件类型无法预览
build/classes/com/w1hd/zzhnc/service/ArticleService.class
查看文件 @
d981c86
此文件类型无法预览
build/classes/com/w1hd/zzhnc/service/FansService.class
查看文件 @
d981c86
此文件类型无法预览
build/classes/com/w1hd/zzhnc/util/PageResults.class
查看文件 @
d981c86
此文件类型无法预览
src/com/w1hd/zzhnc/controller/pc/GoodsController.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.w1hd.zzhnc.model.Goods
;
import
com.w1hd.zzhnc.service.GoodsService
;
import
com.w1hd.zzhnc.vo.Vo_msg
;
@Controller
@Controller
@RequestMapping
(
"/goods"
)
@RequestMapping
(
"/goods"
)
public
class
GoodsController
{
public
class
GoodsController
{
@Autowired
GoodsService
goodsService
;
@RequestMapping
(
"/goodsList"
)
@RequestMapping
(
"/goodsList"
)
public
ModelAndView
goodsList
()
{
public
ModelAndView
goodsList
()
{
return
new
ModelAndView
(
"/pc/goods/goodsList"
);
return
new
ModelAndView
(
"/pc/goods/goodsList"
);
}
}
@ResponseBody
@RequestMapping
(
"/update"
)
public
Object
update
(
@RequestBody
Goods
goods
)
{
return
new
Vo_msg
(
0
,
goodsService
.
update
(
goods
));
}
@ResponseBody
@RequestMapping
(
"/search"
)
public
Object
search
(
@RequestParam
(
value
=
"key"
,
required
=
false
)
String
key
,
@RequestParam
(
value
=
"sellerId"
,
required
=
false
,
defaultValue
=
"0"
)
Integer
sellerId
,
@RequestParam
(
value
=
"page"
,
required
=
false
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
required
=
false
,
defaultValue
=
"10"
)
Integer
size
)
{
return
new
Vo_msg
(
0
,
goodsService
.
seacrh
(
key
,
sellerId
,
page
,
size
));
}
}
}
src/com/w1hd/zzhnc/controller/pc/PrizeController.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.w1hd.zzhnc.model.Prize
;
import
com.w1hd.zzhnc.service.PrizeService
;
import
com.w1hd.zzhnc.vo.Vo_msg
;
@Controller
@Controller
@RequestMapping
(
"/prize"
)
@RequestMapping
(
"/prize"
)
public
class
PrizeController
{
public
class
PrizeController
{
@Autowired
PrizeService
prizeService
;
@RequestMapping
(
"/prizeList"
)
@RequestMapping
(
"/prizeList"
)
public
ModelAndView
prizeList
()
{
public
ModelAndView
prizeList
()
{
return
new
ModelAndView
(
"/pc/prize/prizeList"
);
return
new
ModelAndView
(
"/pc/prize/prizeList"
);
}
}
@RequestMapping
(
value
=
"/add"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
prizeList
(
String
name
,
Integer
num
)
{
Prize
p
=
new
Prize
();
p
.
setName
(
name
);
p
.
setNum
(
num
);
p
.
setCreatetime
(
new
Date
());
p
.
setDeleted
(
false
);
boolean
result
=
prizeService
.
add
(
p
);
return
new
Vo_msg
(
0
,
result
);
}
@RequestMapping
(
"/edit"
)
@ResponseBody
public
Object
edit
(
Integer
id
,
String
name
,
Integer
num
)
{
Prize
p
=
new
Prize
();
p
.
setName
(
name
);
p
.
setNum
(
num
);
p
.
setId
(
id
);
boolean
result
=
prizeService
.
update
(
p
);
return
new
Vo_msg
(
0
,
result
);
}
}
}
src/com/w1hd/zzhnc/controller/pc/SellerController.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
package
com
.
w1hd
.
zzhnc
.
controller
.
pc
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.w1hd.zzhnc.model.Seller
;
import
com.w1hd.zzhnc.service.SellerService
;
import
com.w1hd.zzhnc.vo.Vo_msg
;
@Controller
@Controller
@RequestMapping
(
"/seller"
)
@RequestMapping
(
"/seller"
)
public
class
SellerController
{
public
class
SellerController
{
@Autowired
SellerService
sellerService
;
@RequestMapping
(
"/sellerList"
)
@RequestMapping
(
"/sellerList"
)
public
ModelAndView
sellerList
()
{
public
ModelAndView
sellerList
()
{
return
new
ModelAndView
(
"/pc/seller/sellerList"
);
return
new
ModelAndView
(
"/pc/seller/sellerList"
);
}
}
@RequestMapping
(
"/update"
)
public
Object
update
(
@RequestBody
Seller
s
)
{
boolean
b
=
sellerService
.
update
(
s
);
return
new
Vo_msg
(
0
,
true
);
}
}
}
src/com/w1hd/zzhnc/controller/wx/WxMiniController.java
查看文件 @
d981c86
...
@@ -5,6 +5,7 @@ import java.io.PrintWriter;
...
@@ -5,6 +5,7 @@ import java.io.PrintWriter;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
...
@@ -21,14 +22,19 @@ import org.theyeasy.weixin.model.WxMiniSessionInfo;
...
@@ -21,14 +22,19 @@ import org.theyeasy.weixin.model.WxMiniSessionInfo;
import
org.theyeasy.weixin.service.WxMiniService
;
import
org.theyeasy.weixin.service.WxMiniService
;
import
org.theyeasy.weixin.util.WxMiniUtil
;
import
org.theyeasy.weixin.util.WxMiniUtil
;
import
com.beust.jcommander.internal.Maps
;
import
com.w1hd.zzhnc.controller.pc.BaseController
;
import
com.w1hd.zzhnc.controller.pc.BaseController
;
import
com.w1hd.zzhnc.dao.FansDao
;
import
com.w1hd.zzhnc.dao.FansDao
;
import
com.w1hd.zzhnc.model.Articles
;
import
com.w1hd.zzhnc.model.Articles
;
import
com.w1hd.zzhnc.model.Banner
;
import
com.w1hd.zzhnc.model.Fans
;
import
com.w1hd.zzhnc.model.Fans
;
import
com.w1hd.zzhnc.service.ActivityService
;
import
com.w1hd.zzhnc.service.ActivityService
;
import
com.w1hd.zzhnc.service.ArticleService
;
import
com.w1hd.zzhnc.service.ArticleService
;
import
com.w1hd.zzhnc.service.BannerService
;
import
com.w1hd.zzhnc.service.FansService
;
import
com.w1hd.zzhnc.service.FansService
;
import
com.w1hd.zzhnc.service.GoodsService
;
import
com.w1hd.zzhnc.util.RedisUtil
;
import
com.w1hd.zzhnc.util.RedisUtil
;
import
com.w1hd.zzhnc.vo.MiniHomeVO
;
import
com.w1hd.zzhnc.vo.Vo_msg
;
import
com.w1hd.zzhnc.vo.Vo_msg
;
@Controller
@Controller
...
@@ -40,16 +46,14 @@ public class WxMiniController extends BaseController {
...
@@ -40,16 +46,14 @@ public class WxMiniController extends BaseController {
@Autowired
@Autowired
WxMiniService
wxMiniService
;
WxMiniService
wxMiniService
;
@Autowired
@Autowired
ArticleService
articleService
;
ArticleService
articleService
;
@Autowired
@Autowired
ActivityService
activityService
;
ActivityService
activityService
;
@Autowired
@Autowired
FansDao
fansDao
;
FansDao
fansDao
;
@RequestMapping
(
"/wxmsg"
)
@RequestMapping
(
"/wxmsg"
)
public
void
WxMsg
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
public
void
WxMsg
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
...
@@ -91,21 +95,17 @@ public class WxMiniController extends BaseController {
...
@@ -91,21 +95,17 @@ public class WxMiniController extends BaseController {
@RequestMapping
(
"/login"
)
// 购房助手登录 double lng,double lat
@RequestMapping
(
"/login"
)
// 购房助手登录 double lng,double lat
public
@ResponseBody
Vo_msg
login
(
@RequestParam
(
value
=
"code"
)
String
code
,
public
@ResponseBody
Vo_msg
login
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"share
FansId"
)
Integer
shareFansId
,
@RequestParam
(
value
=
"saleId"
)
Integer
saleId
,
@RequestParam
(
value
=
"share
Id"
)
Integer
shareId
,
@RequestParam
(
value
=
"nickname"
)
String
nickname
,
@RequestParam
(
value
=
"
nickname"
)
String
nickname
,
@RequestParam
(
value
=
"logo"
)
String
logo
,
@RequestParam
(
value
=
"
logo"
)
String
logo
,
@RequestParam
(
value
=
"lng"
)
double
lng
,
@RequestParam
(
value
=
"l
ng"
)
double
lng
,
@RequestParam
(
value
=
"l
at"
)
double
lat
)
{
@RequestParam
(
value
=
"lat"
)
double
lat
)
{
logger
.
info
(
"小程序登录:code="
+
code
);
logger
.
info
(
"小程序登录:code="
+
code
);
// 取openid
// 取openid
WxMiniSessionInfo
sessionInfo
=
WxMiniUtil
.
jscode2session
(
code
);
WxMiniSessionInfo
sessionInfo
=
WxMiniUtil
.
jscode2session
(
code
);
// 添加粉丝记录
// 添加粉丝记录
Fans
fans
=
fansService
.
addFans
(
sessionInfo
,
share
FansId
,
nickname
,
logo
,
saleId
,
lng
,
lat
);
Fans
fans
=
fansService
.
addFans
(
sessionInfo
,
share
Id
,
nickname
,
logo
,
lng
,
lat
);
if
(
fans
!=
null
)
{
if
(
fans
!=
null
)
{
String
salephone
=
"4008718710"
;
// 默认电话
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"fansid"
,
fans
.
getId
());
map
.
put
(
"miniOpenId"
,
sessionInfo
.
getOpenid
());
map
.
put
(
"miniOpenId"
,
sessionInfo
.
getOpenid
());
RedisUtil
.
setFansChatStatus
(
fans
.
getId
(),
1
);
return
new
Vo_msg
(
0
,
map
);
return
new
Vo_msg
(
0
,
map
);
}
else
{
}
else
{
return
new
Vo_msg
(-
1
,
"登录失败,服务器异常"
);
return
new
Vo_msg
(-
1
,
"登录失败,服务器异常"
);
...
@@ -147,7 +147,6 @@ public class WxMiniController extends BaseController {
...
@@ -147,7 +147,6 @@ public class WxMiniController extends BaseController {
return
WxMiniUtil
.
refreshToken
();
return
WxMiniUtil
.
refreshToken
();
}
}
// 文章列表
// 文章列表
@RequestMapping
(
value
=
"/getArticlesList"
)
@RequestMapping
(
value
=
"/getArticlesList"
)
@ResponseBody
@ResponseBody
...
@@ -176,68 +175,99 @@ public class WxMiniController extends BaseController {
...
@@ -176,68 +175,99 @@ public class WxMiniController extends BaseController {
}
}
}
}
// //用户隐藏了小程序时调用此接口,将会向用户发送一个小程序卡片,一天只发送一次。
// //用户隐藏了小程序时调用此接口,将会向用户发送一个小程序卡片,一天只发送一次。
// @RequestMapping(value = "/leave")
// @RequestMapping(value = "/leave")
// @ResponseBody
// @ResponseBody
// public String leaveMini(@RequestParam(value = "fansId") Integer fansId) {
// public String leaveMini(@RequestParam(value = "fansId") Integer fansId) {
// if (fansId<1) return "Failed: fansId < 1";
// if (fansId<1) return "Failed: fansId < 1";
//
//
// Activity activitySetting = activityService.getActivitySetting();
// Activity activitySetting = activityService.getActivitySetting();
// if (activitySetting != null && activitySetting.getStatus() == ActivityStatus.进行中.getIndex() ) //抽奖活动进行中
// if (activitySetting != null && activitySetting.getStatus() ==
// {
// ActivityStatus.进行中.getIndex() ) //抽奖活动进行中
// Fans fans = fansDao.selectByPrimaryKey(fansId);
// {
// if (null==fans) return "Failed:fans is null";
// Fans fans = fansDao.selectByPrimaryKey(fansId);
//
// if (null==fans) return "Failed:fans is null";
// //一天最多发送一次
//
// SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
// //一天最多发送一次
// Date last = fans.getLastSendProgram();
// SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
// if(last!=null && fmt.format(last).equals(fmt.format(DateTime.now().toDate()))) return "faild: allowed send one time everyday.";
// Date last = fans.getLastSendProgram();
//
// if(last!=null &&
// //发送小程序卡片
// fmt.format(last).equals(fmt.format(DateTime.now().toDate()))) return "faild:
// String media_id = RedisUtil.get("zzhnc_leave_program_media_id");
// allowed send one time everyday.";
// String thumb_url = RedisUtil.get("zzhnc_leave_program_thumb_url");
//
//
// //发送小程序卡片
// if (null==media_id || media_id.length()<1 || null==thumb_url || thumb_url.length()<1)
// String media_id = RedisUtil.get("zzhnc_leave_program_media_id");
// {
// String thumb_url = RedisUtil.get("zzhnc_leave_program_thumb_url");
// //获取默认首页的海报
//
// Example example = new Example(Postertemplet.class);
// if (null==media_id || media_id.length()<1 || null==thumb_url ||
// example.createCriteria().andEqualTo("postertype", 2).andEqualTo("deleted",false);
// thumb_url.length()<1)
// java.util.List<Postertemplet> posterList = postertempletDao.selectByExample(example);
// {
// if (posterList.size() < 1) return "failed: Postertemplet Img not exists!";
// //获取默认首页的海报
// thumb_url = posterList.get(0).getImgurl();
// Example example = new Example(Postertemplet.class);
//
// example.createCriteria().andEqualTo("postertype",
// Vo_msg imgMsg = WxMiniUtil.uploadImage(thumb_url, false);
// 2).andEqualTo("deleted",false);
// if (imgMsg.code==0)
// java.util.List<Postertemplet> posterList =
// {
// postertempletDao.selectByExample(example);
// media_id = imgMsg.data.toString();
// if (posterList.size() < 1) return "failed: Postertemplet Img not exists!";
// RedisUtil.set("zzhnc_leave_program_media_id",media_id,60*60);
// thumb_url = posterList.get(0).getImgurl();
// RedisUtil.set("zzhnc_leave_program_thumb_url",thumb_url,60*60);
//
// }
// Vo_msg imgMsg = WxMiniUtil.uploadImage(thumb_url, false);
// else
// if (imgMsg.code==0)
// {
// {
// return "failed: upload media img failed,errmsg=" + imgMsg.msg;
// media_id = imgMsg.data.toString();
// }
// RedisUtil.set("zzhnc_leave_program_media_id",media_id,60*60);
// }
// RedisUtil.set("zzhnc_leave_program_thumb_url",thumb_url,60*60);
//
// }
//
// else
// String result = WxMiniUtil.sendCustoMiniprogrampage(fans.getMiniopenid(), "买房就找万小二","pages/openAnimation/openAnimation", thumb_url, media_id);
// {
// System.out.println("粉丝离开小程序时发送小程序卡片:" + result);
// return "failed: upload media img failed,errmsg=" + imgMsg.msg;
// fans.setLastSendProgram(DateTime.now().toDate());
// }
// fansDao.updateByPrimaryKeySelective(fans);
// }
// return result;
//
// }
//
// return "ok";
// String result = WxMiniUtil.sendCustoMiniprogrampage(fans.getMiniopenid(),
// }
// "买房就找万小二","pages/openAnimation/openAnimation", thumb_url, media_id);
//
// System.out.println("粉丝离开小程序时发送小程序卡片:" + result);
//清除小程序卡片的media_id的方法
// fans.setLastSendProgram(DateTime.now().toDate());
// fansDao.updateByPrimaryKeySelective(fans);
// return result;
// }
// return "ok";
// }
//
// 清除小程序卡片的media_id的方法
@RequestMapping
(
value
=
"/cleanProgramMedia"
)
@RequestMapping
(
value
=
"/cleanProgramMedia"
)
@ResponseBody
@ResponseBody
public
String
cleanProgramMedia
(
@RequestParam
(
value
=
"code"
)
String
code
)
{
public
String
cleanProgramMedia
(
@RequestParam
(
value
=
"code"
)
String
code
)
{
if
(!
code
.
equals
(
"nmdzpsmhs"
))
return
"error pwd"
;
if
(!
code
.
equals
(
"nmdzpsmhs"
))
return
"error pwd"
;
RedisUtil
.
remove
(
"zzhnc_leave_program_media_id"
);
RedisUtil
.
remove
(
"zzhnc_leave_program_media_id"
);
RedisUtil
.
remove
(
"zzhnc_leave_program_thumb_url"
);
RedisUtil
.
remove
(
"zzhnc_leave_program_thumb_url"
);
return
"ok"
;
return
"ok"
;
}
}
@Autowired
BannerService
bannerService
;
@Autowired
GoodsService
goodsService
;
@RequestMapping
(
value
=
"/index"
)
@ResponseBody
public
Object
index
(
@RequestParam
String
openId
)
{
try
{
Map
<
String
,
Object
>
result
=
Maps
.
newHashMap
();
List
<
Banner
>
bannerList
=
bannerService
.
getAll
();
List
<
Articles
>
homeData
=
articleService
.
getHomeData
();
goodsService
.
getHomeData
();
result
.
put
(
"banner"
,
bannerList
);
MiniHomeVO
.
getData
(
homeData
,
goodsService
.
getHomeData
());
result
.
put
(
"data"
,
bannerList
);
return
new
Vo_msg
(
0
,
result
);
}
catch
(
Exception
e
)
{
return
new
Vo_msg
(-
1
,
"系统繁忙"
);
}
}
}
}
src/com/w1hd/zzhnc/dao/S
a
llerDao.java
→
src/com/w1hd/zzhnc/dao/S
e
llerDao.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
dao
;
package
com
.
w1hd
.
zzhnc
.
dao
;
import
com.w1hd.zzhnc.model.S
a
ller
;
import
com.w1hd.zzhnc.model.S
e
ller
;
import
com.w1hd.zzhnc.util.MyMapper
;
import
com.w1hd.zzhnc.util.MyMapper
;
public
interface
S
allerDao
extends
MyMapper
<
Sa
ller
>{
public
interface
S
ellerDao
extends
MyMapper
<
Se
ller
>{
}
}
src/com/w1hd/zzhnc/model/Goods.java
查看文件 @
d981c86
...
@@ -8,17 +8,18 @@ import javax.persistence.Id;
...
@@ -8,17 +8,18 @@ import javax.persistence.Id;
public
class
Goods
{
public
class
Goods
{
@Id
@Id
private
Integer
id
;
private
Integer
id
;
private
Integer
sellerId
;
private
String
name
;
private
String
name
;
private
String
description
;
private
String
description
;
private
BigDecimal
primePrice
;
private
BigDecimal
primePrice
;
private
BigDecimal
price
;
private
BigDecimal
price
;
private
String
imageUrl
;
private
String
imageUrl
;
private
String
bannerUrl
;
private
String
bannerUrl
;
private
Boolean
isHot
;
private
Boolean
isHome
;
private
Date
createtime
;
private
Date
createtime
;
private
Date
updateTime
;
private
Date
updateTime
;
private
Boolean
deleted
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
...
@@ -227,4 +228,37 @@ public class Goods {
...
@@ -227,4 +228,37 @@ public class Goods {
public
void
setUpdateTime
(
Date
updateTime
)
{
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
this
.
updateTime
=
updateTime
;
}
}
public
Integer
getSellerId
()
{
return
sellerId
;
}
public
void
setSellerId
(
Integer
sellerId
)
{
this
.
sellerId
=
sellerId
;
}
public
Boolean
getIsHot
()
{
return
isHot
;
}
public
void
setIsHot
(
Boolean
isHot
)
{
this
.
isHot
=
isHot
;
}
public
Boolean
getIsHome
()
{
return
isHome
;
}
public
void
setIsHome
(
Boolean
isHome
)
{
this
.
isHome
=
isHome
;
}
public
Boolean
getDeleted
()
{
return
deleted
;
}
public
void
setDeleted
(
Boolean
deleted
)
{
this
.
deleted
=
deleted
;
}
}
}
\ No newline at end of file
\ No newline at end of file
src/com/w1hd/zzhnc/model/S
a
ller.java
→
src/com/w1hd/zzhnc/model/S
e
ller.java
查看文件 @
d981c86
...
@@ -4,7 +4,7 @@ import java.util.Date;
...
@@ -4,7 +4,7 @@ import java.util.Date;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
public
class
S
a
ller
{
public
class
S
e
ller
{
@Id
@Id
private
Integer
id
;
private
Integer
id
;
private
String
name
;
private
String
name
;
...
...
src/com/w1hd/zzhnc/service/ArticleService.java
查看文件 @
d981c86
...
@@ -56,10 +56,6 @@ public class ArticleService{
...
@@ -56,10 +56,6 @@ public class ArticleService{
@Autowired
@Autowired
ArticlesDao
articleDao
;
ArticlesDao
articleDao
;
/* (非 Javadoc)
* Description:
* @see com.w1hd.zzhnc.service.ArticleService#getArticlesList(java.lang.Integer, java.lang.Integer, java.lang.String)
*/
public
PageResults
<
Articles
>
getArticlesList
(
Integer
page
,
Integer
pagesize
,
String
keyword
)
{
public
PageResults
<
Articles
>
getArticlesList
(
Integer
page
,
Integer
pagesize
,
String
keyword
)
{
if
(
StringUtil
.
isZearoOrNull
(
pagesize
))
pagesize
=
10
;
if
(
StringUtil
.
isZearoOrNull
(
pagesize
))
pagesize
=
10
;
...
@@ -79,11 +75,6 @@ public class ArticleService{
...
@@ -79,11 +75,6 @@ public class ArticleService{
pageresult
.
setPageSize
(
pagesize
);
pageresult
.
setPageSize
(
pagesize
);
return
pageresult
;
return
pageresult
;
}
}
/* (非 Javadoc)
* Description:
* @see com.w1hd.zzhnc.service.ArticleService#addArticle(java.lang.String, java.lang.String, java.lang.String)
*/
public
String
addArticle
(
String
title
,
String
content
,
String
imgurl
)
{
public
String
addArticle
(
String
title
,
String
content
,
String
imgurl
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
...
@@ -135,4 +126,13 @@ public class ArticleService{
...
@@ -135,4 +126,13 @@ public class ArticleService{
}
}
}
}
public
List
<
Articles
>
getHomeData
()
{
Example
example
=
new
Example
(
Articles
.
class
);
example
.
createCriteria
().
andEqualTo
(
"deleted"
,
false
);
RowBounds
row
=
new
RowBounds
(
0
,
5
);
example
.
setOrderByClause
(
" id desc "
);
List
<
Articles
>
list
=
articleDao
.
selectByExampleAndRowBounds
(
example
,
row
);
return
list
;
}
}
}
src/com/w1hd/zzhnc/service/BannerService.java
查看文件 @
d981c86
...
@@ -2,6 +2,7 @@ package com.w1hd.zzhnc.service;
...
@@ -2,6 +2,7 @@ package com.w1hd.zzhnc.service;
import
java.util.List
;
import
java.util.List
;
import
org.apache.ibatis.session.RowBounds
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -29,4 +30,9 @@ public class BannerService {
...
@@ -29,4 +30,9 @@ public class BannerService {
public
List
<
Banner
>
getAll
()
{
public
List
<
Banner
>
getAll
()
{
return
bannerDao
.
selectAll
();
return
bannerDao
.
selectAll
();
}
}
public
List
<
Banner
>
getAll
(
int
page
,
int
size
)
{
List
<
Banner
>
all
=
bannerDao
.
selectByRowBounds
(
new
Banner
(),
new
RowBounds
(
page
,
size
));
return
all
;
}
}
}
src/com/w1hd/zzhnc/service/FansService.java
查看文件 @
d981c86
...
@@ -60,8 +60,6 @@ public class FansService {
...
@@ -60,8 +60,6 @@ public class FansService {
@Autowired
@Autowired
FansDao
fansDao
;
FansDao
fansDao
;
public
PageResults
<
Fans_Vo
>
getFansList
(
Integer
page
,
String
keyword
)
{
public
PageResults
<
Fans_Vo
>
getFansList
(
Integer
page
,
String
keyword
)
{
List
<
Fans_Vo
>
list
=
fansDao
.
getFansList
((
page
-
1
)
*
10
,
10
,
keyword
);
List
<
Fans_Vo
>
list
=
fansDao
.
getFansList
((
page
-
1
)
*
10
,
10
,
keyword
);
int
total
=
fansDao
.
getFansCount
(
keyword
);
int
total
=
fansDao
.
getFansCount
(
keyword
);
...
@@ -72,7 +70,7 @@ public class FansService {
...
@@ -72,7 +70,7 @@ public class FansService {
pageResults
.
setTotal
(
total
);
pageResults
.
setTotal
(
total
);
return
pageResults
;
return
pageResults
;
}
}
public
Fans
getFansByMiniOpenid
(
String
miniOpenid
)
{
public
Fans
getFansByMiniOpenid
(
String
miniOpenid
)
{
Example
example
=
new
Example
(
Fans
.
class
);
Example
example
=
new
Example
(
Fans
.
class
);
example
.
createCriteria
().
andEqualTo
(
"miniopenid"
,
miniOpenid
);
example
.
createCriteria
().
andEqualTo
(
"miniopenid"
,
miniOpenid
);
...
@@ -83,16 +81,11 @@ public class FansService {
...
@@ -83,16 +81,11 @@ public class FansService {
return
null
;
return
null
;
}
}
public
Fans
getFansById
(
Integer
id
)
{
public
Fans
getFansById
(
Integer
id
)
{
return
fansDao
.
selectByPrimaryKey
(
id
);
return
fansDao
.
selectByPrimaryKey
(
id
);
}
}
public
Fans
addFans
(
String
miniOpenid
)
{
public
Fans
addFans
(
String
miniOpenid
)
{
Fans
fans
=
getFansByMiniOpenid
(
miniOpenid
);
Fans
fans
=
getFansByMiniOpenid
(
miniOpenid
);
if
(
null
!=
fans
)
if
(
null
!=
fans
)
...
@@ -111,21 +104,14 @@ public class FansService {
...
@@ -111,21 +104,14 @@ public class FansService {
}
}
public
Fans
addFans
(
WxMiniSessionInfo
info
,
Integer
shareFansId
,
String
nickname
,
String
logo
,
double
lng
,
public
Fans
addFans
(
WxMiniSessionInfo
info
,
Integer
shareFansId
,
String
nickname
,
String
logo
,
Integer
salesid
,
double
lat
)
{
double
lng
,
double
lat
)
{
if
(
info
==
null
)
if
(
info
==
null
)
return
null
;
return
null
;
if
(
Strings
.
isNullOrEmpty
(
info
.
getOpenid
()))
if
(
Strings
.
isNullOrEmpty
(
info
.
getOpenid
()))
return
null
;
return
null
;
// 通过转发进来,获取转发者的销售id
if
(!
StringUtil
.
isZearoOrNull
(
shareFansId
))
{
Fans
sharefans
=
getFansById
(
shareFansId
);
}
// 判断粉丝是否存在
// 判断粉丝是否存在
System
.
out
.
println
(
"miniopenid:"
+
info
.
getOpenid
());
System
.
out
.
println
(
"miniopenid:"
+
info
.
getOpenid
());
Fans
myfans
=
getFansByMiniOpenid
(
info
.
getOpenid
());
Fans
myfans
=
getFansByMiniOpenid
(
info
.
getOpenid
());
...
@@ -139,13 +125,13 @@ public class FansService {
...
@@ -139,13 +125,13 @@ public class FansService {
fans
.
setMiniopenid
(
info
.
getOpenid
());
fans
.
setMiniopenid
(
info
.
getOpenid
());
fans
.
setParentfansid
(
shareFansId
);
fans
.
setParentfansid
(
shareFansId
);
fans
.
setLogo
(
logo
);
fans
.
setLogo
(
logo
);
fans
.
setGoodsId
(
shareFansId
);
fans
.
setNickname
(
nickname
);
fans
.
setNickname
(
nickname
);
fans
.
setFanstype
(
1
);
fans
.
setFanstype
(
1
);
fans
.
setLng
(
lng
);
fans
.
setLng
(
lng
);
fans
.
setLat
(
lat
);
fans
.
setLat
(
lat
);
JSONObject
locationResult
=
CusAccessObjectUtil2
.
locationResult
(
lng
,
lat
);
JSONObject
locationResult
=
CusAccessObjectUtil2
.
locationResult
(
lng
,
lat
);
if
(
null
!=
locationResult
)
if
(
null
!=
locationResult
)
{
{
fans
.
setProvince
(
CusAccessObjectUtil2
.
getProvince
(
locationResult
));
fans
.
setProvince
(
CusAccessObjectUtil2
.
getProvince
(
locationResult
));
fans
.
setCity
(
CusAccessObjectUtil2
.
getCity
(
locationResult
));
fans
.
setCity
(
CusAccessObjectUtil2
.
getCity
(
locationResult
));
fans
.
setDistrict
(
CusAccessObjectUtil2
.
getDistrict
(
locationResult
));
fans
.
setDistrict
(
CusAccessObjectUtil2
.
getDistrict
(
locationResult
));
...
@@ -178,7 +164,6 @@ public class FansService {
...
@@ -178,7 +164,6 @@ public class FansService {
return
fans
;
return
fans
;
}
}
public
void
updateFans
(
Fans
fans
)
{
public
void
updateFans
(
Fans
fans
)
{
fansDao
.
updateByPrimaryKeySelective
(
fans
);
fansDao
.
updateByPrimaryKeySelective
(
fans
);
}
}
...
...
src/com/w1hd/zzhnc/service/GoodsService.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
service
;
package
com
.
w1hd
.
zzhnc
.
service
;
import
java.sql.Date
;
import
java.util.List
;
import
org.apache.ibatis.session.RowBounds
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.testng.util.Strings
;
import
com.w1hd.zzhnc.dao.GoodsDao
;
import
com.w1hd.zzhnc.model.Goods
;
import
com.w1hd.zzhnc.util.PageResults
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
@Service
@Service
public
class
GoodsService
{
public
class
GoodsService
{
@Autowired
GoodsDao
goodsDao
;
public
List
<
Goods
>
getHomeData
()
{
Example
ex
=
new
Example
(
Goods
.
class
);
ex
.
createCriteria
().
andEqualTo
(
"deleted"
,
false
).
andEqualTo
(
"isHome"
,
true
);
RowBounds
r
=
new
RowBounds
(
0
,
5
);
return
goodsDao
.
selectByExampleAndRowBounds
(
ex
,
r
);
}
public
Goods
update
(
Goods
goods
)
{
goods
.
setUpdateTime
(
new
Date
(
System
.
currentTimeMillis
()));
if
(
goods
.
getId
()
==
null
||
goods
.
getId
()
==
0
)
{
goods
.
setCreatetime
(
new
Date
(
System
.
currentTimeMillis
()));
goodsDao
.
insert
(
goods
);
}
else
{
goodsDao
.
updateByPrimaryKey
(
goods
);
}
return
goods
;
}
public
PageResults
<
Goods
>
seacrh
(
String
key
,
Integer
sellerId
,
Integer
page
,
Integer
size
)
{
Example
ex
=
new
Example
(
Goods
.
class
);
Criteria
c
=
ex
.
createCriteria
();
if
(!
Strings
.
isNullOrEmpty
(
key
))
{
c
.
andCondition
(
" (description like \"%"
+
key
+
"%\" or name like \"%"
+
key
+
"%\")"
);
}
if
(
sellerId
!=
null
&&
sellerId
>
0
)
{
c
.
andEqualTo
(
"sellerId"
,
sellerId
);
}
c
.
andEqualTo
(
"deleted"
,
false
);
RowBounds
row
=
new
RowBounds
(
page
,
size
);
List
<
Goods
>
list
=
goodsDao
.
selectByExampleAndRowBounds
(
ex
,
row
);
PageResults
<
Goods
>
pageResults
=
new
PageResults
<>();
return
pageResults
;
}
}
}
src/com/w1hd/zzhnc/service/PrizeService.java
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
service
;
package
com
.
w1hd
.
zzhnc
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.w1hd.zzhnc.dao.PrizeDao
;
import
com.w1hd.zzhnc.model.Prize
;
@Service
@Service
public
class
PrizeService
{
public
class
PrizeService
{
@Autowired
PrizeDao
prizeDao
;
public
boolean
add
(
Prize
prize
)
{
return
prizeDao
.
insert
(
prize
)
>
0
;
}
public
boolean
update
(
Prize
p
)
{
return
prizeDao
.
updateByPrimaryKeySelective
(
p
)
>
0
;
}
}
}
src/com/w1hd/zzhnc/service/SallerService.java
deleted
100644 → 0
查看文件 @
b24b0ab
package
com
.
w1hd
.
zzhnc
.
service
;
import
org.springframework.stereotype.Service
;
@Service
public
class
SallerService
{
}
src/com/w1hd/zzhnc/service/SellerService.java
0 → 100644
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.w1hd.zzhnc.dao.SellerDao
;
import
com.w1hd.zzhnc.model.Seller
;
@Service
public
class
SellerService
{
@Autowired
SellerDao
sellerDao
;
public
boolean
update
(
Seller
s
)
{
if
(
s
.
getId
()
==
null
)
{
return
sellerDao
.
insert
(
s
)
>
0
;
}
else
{
return
sellerDao
.
updateByPrimaryKey
(
s
)
>
0
;
}
}
}
src/com/w1hd/zzhnc/util/PageResults.java
查看文件 @
d981c86
...
@@ -83,7 +83,6 @@ public class PageResults<T> {
...
@@ -83,7 +83,6 @@ public class PageResults<T> {
}
}
public
int
getSum
()
{
public
int
getSum
()
{
return
sum
;
return
sum
;
}
}
...
...
src/com/w1hd/zzhnc/vo/MiniHomeVO.java
0 → 100644
查看文件 @
d981c86
package
com
.
w1hd
.
zzhnc
.
vo
;
import
java.util.Date
;
import
java.util.List
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.w1hd.zzhnc.model.Articles
;
import
com.w1hd.zzhnc.model.Goods
;
public
class
MiniHomeVO
{
private
Integer
id
;
private
Integer
type
;
private
String
title
;
private
String
subTitle
;
private
String
imageUrl
;
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getSubTitle
()
{
return
subTitle
;
}
public
void
setSubTitle
(
String
subTitle
)
{
this
.
subTitle
=
subTitle
;
}
public
String
getImageUrl
()
{
return
imageUrl
;
}
public
void
setImageUrl
(
String
imageUrl
)
{
this
.
imageUrl
=
imageUrl
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
static
List
<
MiniHomeVO
>
getData
(
List
<
Articles
>
homeData
,
List
<
Goods
>
goodsList
){
MiniHomeVO
item
=
null
;
List
<
MiniHomeVO
>
data
=
Lists
.
newArrayList
();
for
(
Articles
a:
homeData
)
{
item
=
new
MiniHomeVO
();
item
.
setType
(
1
);
item
.
setTitle
(
a
.
getTitle
());
item
.
setImageUrl
(
a
.
getImgurl
());
item
.
setCreateTime
(
a
.
getCreatedtime
());
String
content
=
a
.
getContent
();
if
(
Strings
.
isNullOrEmpty
(
content
))
{
if
(
content
.
length
()>
20
)
{
item
.
setSubTitle
(
content
.
substring
(
0
,
15
)+
"..."
);
}
}
data
.
add
(
item
);
}
for
(
Goods
g
:
goodsList
)
{
item
=
new
MiniHomeVO
();
item
.
setType
(
2
);
item
.
setTitle
(
g
.
getName
());
item
.
setImageUrl
(
g
.
getBannerUrl
());
item
.
setCreateTime
(
g
.
getCreatetime
());
String
content
=
g
.
getDescription
();
if
(
Strings
.
isNullOrEmpty
(
content
))
{
if
(
content
.
length
()>
20
)
{
item
.
setSubTitle
(
content
.
substring
(
0
,
15
)+
"..."
);
}
}
data
.
add
(
item
);
}
return
data
;
}
}
编写
预览
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
请先完成此消息的编辑!
取消
请
注册
或
登录
后发表评论