Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
onionZunyi
beauty_ssm
提交
dac8d4c4
B
beauty_ssm
项目概览
onionZunyi
/
beauty_ssm
与 Fork 源项目一致
Fork自
爱吃血肠 / beauty_ssm
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beauty_ssm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dac8d4c4
编写于
7月 20, 2016
作者:
Y
yingjun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码完善
上级
412845c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
20 deletion
+14
-20
src/main/java/com/yingjun/ssm/service/GoodsService.java
src/main/java/com/yingjun/ssm/service/GoodsService.java
+3
-5
src/main/java/com/yingjun/ssm/web/GoodsController.java
src/main/java/com/yingjun/ssm/web/GoodsController.java
+11
-15
未找到文件。
src/main/java/com/yingjun/ssm/service/GoodsService.java
浏览文件 @
dac8d4c4
package
com.yingjun.ssm.service
;
import
java.util.List
;
import
org.springframework.cache.annotation.Cacheable
;
import
com.yingjun.ssm.entity.Goods
;
import
java.util.List
;
public
interface
GoodsService
{
/**
...
...
@@ -20,7 +18,7 @@ public interface GoodsService {
/**
* 商品购买
*
* @param user
Id
* @param user
Phone
* @param goodsId
* @param useProcedure
* 是否用存储过程提高并发能力
...
...
src/main/java/com/yingjun/ssm/web/GoodsController.java
浏览文件 @
dac8d4c4
package
com.yingjun.ssm.web
;
import
java.util.List
;
import
com.yingjun.ssm.dto.BaseResult
;
import
com.yingjun.ssm.entity.Goods
;
import
com.yingjun.ssm.enums.ResultEnum
;
import
com.yingjun.ssm.exception.BizException
;
import
com.yingjun.ssm.service.GoodsService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.CookieValue
;
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.ResponseBody
;
import
org.springframework.web.bind.annotation.*
;
import
com.yingjun.ssm.dto.BaseResult
;
import
com.yingjun.ssm.entity.Goods
;
import
com.yingjun.ssm.enums.ResultEnum
;
import
com.yingjun.ssm.service.GoodsService
;
import
java.util.List
;
@Controller
@RequestMapping
(
"/goods"
)
...
...
@@ -43,15 +39,15 @@ public class GoodsController {
@PathVariable
(
"goodsId"
)
Long
goodsId
){
LOG
.
info
(
"invoke----------/"
+
goodsId
+
"/buy userPhone:"
+
userPhone
);
if
(
userPhone
==
null
||
goodsId
==
null
)
{
return
new
BaseResult
<
Object
>(
false
,
ResultEnum
.
PARAM
_USER
.
getMsg
());
return
new
BaseResult
<
Object
>(
false
,
ResultEnum
.
INVALID
_USER
.
getMsg
());
}
try
{
goodsService
.
buyGoods
(
userPhone
,
goodsId
,
false
);
}
catch
(
MyException
e1
)
{
return
new
BaseResult
<
Object
>(
false
,
e
1
.
getMessage
());
}
catch
(
BizException
e
)
{
return
new
BaseResult
<
Object
>(
false
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
return
new
BaseResult
<
Object
>(
false
,
ResultEnum
.
INNER_ERROR
.
getMsg
());
}
return
new
BaseResult
<
Object
>(
true
,
"success"
);
return
new
BaseResult
<
Object
>(
true
,
null
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录