Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
youjj
cloud-platform
Commits
49f8f452
Commit
49f8f452
authored
Jun 08, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
减库存
parent
1a48b14a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
4 deletions
+44
-4
ResultCode.java
...thub/wxiaoqi/security/common/util/process/ResultCode.java
+3
-0
resultcod.properties
...common/src/main/resources/properties/resultcod.properties
+3
-1
TourFeign.java
...src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
+3
-1
TourSpePriceVo.java
...c/main/java/com/xxfc/platform/tour/vo/TourSpePriceVo.java
+4
-0
TourGoodSpeBiz.java
.../main/java/com/xxfc/platform/tour/biz/TourGoodSpeBiz.java
+12
-0
TourGoodSpePriceMapper.java
...com/xxfc/platform/tour/mapper/TourGoodSpePriceMapper.java
+3
-0
TourGoodSpeController.java
...va/com/xxfc/platform/tour/rest/TourGoodSpeController.java
+11
-2
TourGoodSpePriceMapper.xml
...rver/src/main/resources/mapper/TourGoodSpePriceMapper.xml
+5
-0
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/ResultCode.java
View file @
49f8f452
...
...
@@ -172,6 +172,9 @@ public class ResultCode {
// 未绑定社保卡
public
static
int
NOT_BIND_SOCIAL_CARD
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"NOT_BIND_SOCIAL_CARD"
));
// 操作失败
public
static
int
STOCK_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"STOCK_CODE"
));
public
static
String
getMsg
(
int
code
)
{
return
SystemProperty
.
getResultConfig
(
String
.
valueOf
(
code
));
...
...
ace-common/src/main/resources/properties/resultcod.properties
View file @
49f8f452
...
...
@@ -178,4 +178,6 @@ SCRM_RESULTINFO_SUCCESS_CODE=10344
#市接口无数据返回
NO_SELECT_BY_RS
=
1010
#还未绑定社保卡
NOT_BIND_SOCIAL_CARD
=
3010
\ No newline at end of file
NOT_BIND_SOCIAL_CARD
=
3010
#库存不足
STOCK_CODE
=
201
\ No newline at end of file
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
View file @
49f8f452
...
...
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient
(
value
=
"xx-tour"
)
public
interface
TourFeign
{
@RequestMapping
(
value
=
"/spe/user/prices"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
<
TourSpePriceVo
>
refund
(
@RequestBody
TourSpePriceDto
spePriceDto
);
public
ObjectRestResponse
<
TourSpePriceVo
>
prices
(
@RequestBody
TourSpePriceDto
spePriceDto
);
@RequestMapping
(
value
=
"/spe/stock"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
TourSpePriceVo
>
stock
(
Integer
speId
,
Integer
number
);
}
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/vo/TourSpePriceVo.java
View file @
49f8f452
...
...
@@ -42,6 +42,10 @@ public class TourSpePriceVo {
@ApiModelProperty
(
value
=
"儿童总价"
)
private
BigDecimal
totaiChildPrice
;
//库存
@ApiModelProperty
(
value
=
"库存"
)
private
Integer
stock
;
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodSpeBiz.java
View file @
49f8f452
...
...
@@ -42,6 +42,7 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
Integer
level
=
priceDto
.
getLevel
();
priceVo
.
setUserId
(
priceDto
.
getUserId
());
priceVo
.
setLevel
(
priceDto
.
getLevel
());
priceVo
.
setStock
(
spePrice
.
getStock
());
BigDecimal
price
=
spePrice
.
getPrice
();
BigDecimal
childPrice
=
spePrice
.
getChildPrice
();
if
(
level
!=
null
&&
level
>
0
)
{
...
...
@@ -74,5 +75,16 @@ public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpeP
}
//减库存
public
ObjectRestResponse
cutStock
(
Integer
speId
,
Integer
number
)
{
TourGoodSpePrice
spePrice
=
mapper
.
selectByPrimaryKey
(
speId
);
if
(
spePrice
!=
null
&&
spePrice
.
getStock
()
>
0
&&
spePrice
.
getStock
()
>=
number
)
{
mapper
.
updStockById
(
speId
,
number
);
return
ObjectRestResponse
.
succ
();
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
STOCK_CODE
,
"库存不足"
);
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/mapper/TourGoodSpePriceMapper.java
View file @
49f8f452
...
...
@@ -18,6 +18,9 @@ public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List
<
TourDepartTimeVo
>
getAllByGoodId
(
@Param
(
"goodId"
)
Integer
goodId
);
//减库存
int
updStockById
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"number"
)
Integer
number
);
}
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodSpeController.java
View file @
49f8f452
...
...
@@ -18,9 +18,18 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> {
//获取商品详情
@RequestMapping
(
value
=
"/user/prices"
,
method
=
RequestMethod
.
GE
T
)
public
ObjectRestResponse
<
TourSpePriceVo
>
user
(
@RequestBody
TourSpePriceDto
priceDto
)
{
@RequestMapping
(
value
=
"/user/prices"
,
method
=
RequestMethod
.
POS
T
)
public
ObjectRestResponse
<
TourSpePriceVo
>
prices
(
@RequestBody
TourSpePriceDto
priceDto
)
{
return
baseBiz
.
getPricesByuserid
(
priceDto
);
}
//减库存
@RequestMapping
(
value
=
"/stock"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
TourSpePriceVo
>
stock
(
@RequestParam
(
value
=
"speId"
,
defaultValue
=
"0"
)
Integer
speId
,
@RequestParam
(
value
=
"number"
,
defaultValue
=
"0"
)
Integer
number
){
return
baseBiz
.
cutStock
(
speId
,
number
);
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodSpePriceMapper.xml
View file @
49f8f452
...
...
@@ -40,6 +40,11 @@
FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0
</select>
<!-- 减库存-->
<update
id=
"updStockById"
>
update tour_good_spe_price set stock=stock-#{number} where id=#{id}
</update>
</mapper>
\ No newline at end of file
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