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
a1748e7b
Commit
a1748e7b
authored
Jun 08, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
1635e387
1a48b14a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
144 additions
and
14 deletions
+144
-14
TourSpePriceDto.java
...main/java/com/xxfc/platform/tour/dto/TourSpePriceDto.java
+2
-2
TourFeign.java
...src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
+24
-0
TourSpePriceVo.java
...c/main/java/com/xxfc/platform/tour/vo/TourSpePriceVo.java
+48
-0
TourApplication.java
...src/main/java/com/xxfc/platform/tour/TourApplication.java
+1
-1
TourGoodSpeBiz.java
.../main/java/com/xxfc/platform/tour/biz/TourGoodSpeBiz.java
+64
-4
TourGoodSpeController.java
...va/com/xxfc/platform/tour/rest/TourGoodSpeController.java
+5
-7
No files found.
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/dto/TourSpePriceDto.java
View file @
a1748e7b
...
...
@@ -26,11 +26,11 @@ public class TourSpePriceDto {
//儿童人数
@ApiModelProperty
(
value
=
"儿童人数"
)
private
String
childNumber
;
private
Integer
childNumber
;
//"成人人数
@ApiModelProperty
(
value
=
"成人人数"
)
private
String
endTime
;
private
Integer
number
;
}
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
0 → 100644
View file @
a1748e7b
package
com
.
xxfc
.
platform
.
tour
.
feign
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.tour.dto.TourSpePriceDto
;
import
com.xxfc.platform.tour.vo.TourSpePriceVo
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-06-21 8:11
*/
@FeignClient
(
value
=
"xx-tour"
)
public
interface
TourFeign
{
@RequestMapping
(
value
=
"/spe/user/prices"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
<
TourSpePriceVo
>
refund
(
@RequestBody
TourSpePriceDto
spePriceDto
);
}
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/vo/TourSpePriceVo.java
0 → 100644
View file @
a1748e7b
package
com
.
xxfc
.
platform
.
tour
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 等级金额表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Data
public
class
TourSpePriceVo
{
//用户id
@ApiModelProperty
(
value
=
"/用户id"
)
private
Integer
userId
;
//等级
@ApiModelProperty
(
value
=
"等级"
)
private
Integer
level
;
//大人单价"
@ApiModelProperty
(
value
=
"大人单价"
)
private
BigDecimal
price
;
//大人总价
@ApiModelProperty
(
value
=
"大人总价"
)
private
BigDecimal
totalPrice
;
//儿童单价
@ApiModelProperty
(
value
=
"儿童单价"
)
private
BigDecimal
childPrice
;
//儿童总价
@ApiModelProperty
(
value
=
"儿童总价"
)
private
BigDecimal
totaiChildPrice
;
}
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/TourApplication.java
View file @
a1748e7b
...
...
@@ -14,7 +14,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.admin.feign"
})
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.github.wxiaoqi.security.admin.feign"
,
"com.xxfc.platform.tour.feign"
})
@EnableAceCache
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.tour.mapper"
)
public
class
TourApplication
{
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodSpeBiz.java
View file @
a1748e7b
package
com
.
xxfc
.
platform
.
tour
.
biz
;
import
com.xxfc.platform.tour.mapper.TourGoodSpeMapper
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.tour.dto.TourSpePriceDto
;
import
com.xxfc.platform.tour.entity.TourGoodSpePrice
;
import
com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper
;
import
com.xxfc.platform.tour.vo.TourSpePriceVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.tour.entity.TourGoodSpe
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
/**
* 旅游商品规格表
*
...
...
@@ -14,5 +24,55 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
* @date 2019-06-06 11:41:51
*/
@Service
public
class
TourGoodSpeBiz
extends
BaseBiz
<
TourGoodSpeMapper
,
TourGoodSpe
>
{
@Slf4j
public
class
TourGoodSpeBiz
extends
BaseBiz
<
TourGoodSpePriceMapper
,
TourGoodSpePrice
>
{
public
ObjectRestResponse
<
TourSpePriceVo
>
getPricesByuserid
(
TourSpePriceDto
priceDto
)
{
if
(
priceDto
==
null
||
priceDto
.
getUserId
()
==
null
||
priceDto
.
getUserId
()
==
0
||
priceDto
.
getNumber
()
==
null
||
priceDto
.
getNumber
()
==
0
||
priceDto
.
getSpeId
()==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
TourSpePriceVo
priceVo
=
new
TourSpePriceVo
();
Integer
speId
=
priceDto
.
getSpeId
();
Integer
number
=
priceDto
.
getNumber
();
Integer
childNumber
=
priceDto
.
getChildNumber
()
==
null
?
0
:
priceDto
.
getChildNumber
();
if
(
speId
!=
null
)
{
TourGoodSpePrice
spePrice
=
mapper
.
selectByPrimaryKey
(
speId
);
if
(
spePrice
!=
null
)
{
Integer
level
=
priceDto
.
getLevel
();
priceVo
.
setUserId
(
priceDto
.
getUserId
());
priceVo
.
setLevel
(
priceDto
.
getLevel
());
BigDecimal
price
=
spePrice
.
getPrice
();
BigDecimal
childPrice
=
spePrice
.
getChildPrice
();
if
(
level
!=
null
&&
level
>
0
)
{
String
memberPrice
=
spePrice
.
getMemberPrice
();
JSONArray
array
=
JSONArray
.
parseArray
(
memberPrice
);
if
(
array
.
size
()
>
0
)
{
for
(
Object
obj
:
array
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
obj
.
toString
());
Integer
levels
=
jsonObject
.
getInteger
(
"level"
);
if
(
level
==
levels
)
{
String
money
=
jsonObject
.
getString
(
"price"
);
price
=
new
BigDecimal
(
StringUtils
.
isNotBlank
(
money
)
?
money
:
"0.00"
);
String
childMoney
=
jsonObject
.
getString
(
"child_price"
);
childPrice
=
new
BigDecimal
(
StringUtils
.
isNotBlank
(
childMoney
)
?
childMoney
:
"0.00"
);
break
;
}
}
}
}
BigDecimal
totalPrice
=
price
.
multiply
(
new
BigDecimal
(
number
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
totalChildPrice
=
childNumber
>
0
?
price
.
multiply
(
new
BigDecimal
(
childNumber
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
):
new
BigDecimal
(
"0.00"
);
priceVo
.
setPrice
(
price
);
priceVo
.
setChildPrice
(
childPrice
);
priceVo
.
setTotalPrice
(
totalPrice
);
priceVo
.
setTotaiChildPrice
(
totalChildPrice
);
return
ObjectRestResponse
.
succ
(
priceVo
);
}
}
return
ObjectRestResponse
.
createDefaultFail
();
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodSpeController.java
View file @
a1748e7b
...
...
@@ -6,10 +6,9 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.tour.biz.TourGoodSpeBiz
;
import
com.xxfc.platform.tour.common.TourBaseController
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.xxfc.platform.tour.dto.TourSpePriceDto
;
import
com.xxfc.platform.tour.vo.TourSpePriceVo
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"spe"
)
...
...
@@ -20,9 +19,8 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> {
//获取商品详情
@RequestMapping
(
value
=
"/user/prices"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
user
()
{
AppUserDTO
userDTO
=
getUserInfo
();
return
ObjectRestResponse
.
succ
(
userDTO
);
public
ObjectRestResponse
<
TourSpePriceVo
>
user
(
@RequestBody
TourSpePriceDto
priceDto
)
{
return
baseBiz
.
getPricesByuserid
(
priceDto
);
}
}
\ 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