Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-golf-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
422e9885
authored
Nov 07, 2017
by
Huang Linyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'f-6.6.4' of 192.168.10.6:caosy/fun-golf-service into f-6.6.4
parents
0c78f31d
e79c514d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
10 deletions
src/main/java/com/ctrip/fun/golf/dao/order/EventCustomerInfoDao.java
src/main/java/com/ctrip/fun/golf/dao/product/CourseResourceDao.java
src/main/java/com/ctrip/fun/golf/service/order/EventCustomerInfoService.java
src/main/java/com/ctrip/fun/golf/service/order/OpEventActivityOrderService.java
src/main/java/com/ctrip/fun/golf/service/product/CourseResourceService.java
src/main/java/com/ctrip/fun/golf/dao/order/EventCustomerInfoDao.java
View file @
422e9885
...
...
@@ -392,7 +392,7 @@ public class EventCustomerInfoDao extends GenericHibernateDao<EventCustomerInfo,
sql1
.
append
(
" AND ol.productId = "
+
productId
+
" "
);
sql
=
new
StringBuffer
(
sql
).
append
(
" union "
).
append
(
sql1
);
}
sql
.
append
(
" ORDER BY playDate DESC,teeTime ASC,orderId desc "
);
sql
.
append
(
" ORDER BY playDate DESC,teeTime ASC,
resourceId ASC,
orderId desc "
);
Query
query
=
this
.
getSession
().
createSQLQuery
(
sql
.
toString
());
query
.
setResultTransformer
(
Transformers
.
ALIAS_TO_ENTITY_MAP
);
Set
<
String
>
orderNoSet
=
new
HashSet
<
String
>();
...
...
src/main/java/com/ctrip/fun/golf/dao/product/CourseResourceDao.java
View file @
422e9885
...
...
@@ -195,13 +195,13 @@ public class CourseResourceDao extends GenericHibernateDao<CourseResource, Integ
return
false
;
return
true
;
}
public
List
<
Integer
>
checkEventActivityValidResource
(
int
productId
,
int
teetime
,
Date
playDate
)
{
public
List
<
Integer
>
checkEventActivityValidResource
(
int
productId
,
int
teetime
,
Date
playDate
,
Double
communePrice
,
Double
guestPrice
)
{
String
dateStr
=
DateUtil
.
getDateStr
(
playDate
);
String
sql
=
"select cr.ID from prd_courseResource as cr, prd_resourceprice as rp where cr.productId = "
+
productId
+
" and cr.teeTime="
+
teetime
+
" and cr.status != "
+
CourseResourceStatusEnum
.
INVALID
.
getValue
()
+
" and cr.id = rp.ResourceID "
+
" and rp.priceDate = \""
+
dateStr
+
"\""
;
+
" and cr.id = rp.ResourceID "
+
" and rp.priceDate = \""
+
dateStr
+
"\""
+
" and rp.communePrice="
+
communePrice
+
" and rp.communeGuestPrice="
+
guestPrice
;
List
<
Integer
>
list
=
this
.
getSession
().
createSQLQuery
(
sql
).
list
();
return
list
;
}
...
...
src/main/java/com/ctrip/fun/golf/service/order/EventCustomerInfoService.java
View file @
422e9885
...
...
@@ -106,6 +106,17 @@ public class EventCustomerInfoService extends
eventCustomerInfoDao
.
Update
(
eventCustomerInfo
);
}
}
public
int
getEventCustomerNum
(
Integer
orderId
){
int
num
=
0
;
List
<
EventCustomerInfo
>
eventCustomerInfos
=
eventCustomerInfoDao
.
getCustomerInfoListByOrderId
(
orderId
);
if
(
eventCustomerInfos
!=
null
){
num
=
eventCustomerInfos
.
size
();
}
return
num
;
}
public
List
<
EventCustomerInfoBean
>
getEventCustomerInfoRankList
(
EventCustomerInfoQuery
eventCustomerInfoQuery
)
{
...
...
src/main/java/com/ctrip/fun/golf/service/order/OpEventActivityOrderService.java
View file @
422e9885
...
...
@@ -1060,15 +1060,23 @@ public class OpEventActivityOrderService
String
[]
teetimes
=
newTeeTime
.
split
(
":"
);
if
(
teetimes
!=
null
&&
teetimes
.
length
==
2
){
int
groupNum
=
Integer
.
valueOf
(
teetimes
[
0
])*
60
+
Integer
.
valueOf
(
teetimes
[
1
]);
List
<
Integer
>
resourceIds
=
this
.
courseResourceService
.
getResourceByTeeTimeAndDate
(
orderProcessBean
.
getProductId
(),
groupNum
,
orderItem
.
getPlayDate
());
List
<
Integer
>
resourceIds
=
this
.
courseResourceService
.
getResourceByTeeTimeAndDate
(
orderProcessBean
.
getProductId
(),
groupNum
,
orderItem
.
getPlayDate
()
,
orderItem
.
getCommunePrice
(),
orderItem
.
getCommuneGuestPrice
()
);
if
(
resourceIds
!=
null
&&
resourceIds
.
size
()
>
0
){
orderProcessBean
.
setProcessDesc
(
desc
.
toString
());
Integer
oldResourceId
=
orderItem
.
getResourceId
();
Integer
newResourceId
=
resourceIds
.
get
(
0
);
this
.
changeCustomerInfo
(
orderProcessBean
,
newResourceId
);
//打球 人数
int
size
=
orderItem
.
getQuantity
();
//先清除老的资源id对应的库存
this
.
changeResourceInventory
(
oldResourceId
,
orderItem
.
getPlayDate
(),
size
);
//增加新的资源id对应的库存
this
.
changeResourceInventory
(
newResourceId
,
orderItem
.
getPlayDate
(),
-
size
);
//变更后,在orderItem表里面将资源id变更掉
orderItem
.
setResourceId
(
resourceIds
.
get
(
0
)
);
orderItem
.
setResourceId
(
newResourceId
);
this
.
eventActivityOrderItemDao
.
update
(
orderItem
);
orderProcessBean
.
setProcessDesc
(
desc
.
toString
());
this
.
changeCustomerInfo
(
orderProcessBean
,
resourceIds
.
get
(
0
));
}
else
{
throw
new
OrderException
(
ResponseStatusEnum
.
FAIL
.
getValue
(),
"该teetime没有资源,请更换!"
);
throw
new
OrderException
(
ResponseStatusEnum
.
FAIL
.
getValue
(),
"该teetime没有资源
或者价格不一样
,请更换!"
);
}
}
...
...
@@ -1076,6 +1084,16 @@ public class OpEventActivityOrderService
}
}
private
void
changeResourceInventory
(
Integer
resourceId
,
Date
priceDate
,
int
num
){
ResourceInventoryQuery
resourceInventoryQuery
=
new
ResourceInventoryQuery
();
resourceInventoryQuery
.
setResourceCategory
(
ResourceCategoryEnum
.
COURSE
.
getValue
());
resourceInventoryQuery
.
setResourceId
(
resourceId
);
resourceInventoryQuery
.
setTheDate
(
priceDate
);
logger
.
info
(
"changeResourceInventory resourceId="
+
resourceId
+
",priceDate="
+
priceDate
+
", num="
+
num
);
courseResourceService
.
addInventory
(
resourceInventoryQuery
,
num
);
}
private
void
changeCustomerInfo
(
EventActivityOrderProcessBean
orderProcessBean
,
int
resourceId
){
int
groupNum
=
0
;
String
teetime
=
orderProcessBean
.
getTeeTime
();
...
...
src/main/java/com/ctrip/fun/golf/service/product/CourseResourceService.java
View file @
422e9885
...
...
@@ -1311,8 +1311,8 @@ public class CourseResourceService extends
*add by caosy: get the resource by teetime
*
* */
public
List
<
Integer
>
getResourceByTeeTimeAndDate
(
int
productId
,
int
teetime
,
Date
playDate
){
return
this
.
courseResourceDao
.
checkEventActivityValidResource
(
productId
,
teetime
,
playDate
);
public
List
<
Integer
>
getResourceByTeeTimeAndDate
(
int
productId
,
int
teetime
,
Date
playDate
,
Double
communePrice
,
Double
guestPrice
){
return
this
.
courseResourceDao
.
checkEventActivityValidResource
(
productId
,
teetime
,
playDate
,
communePrice
,
guestPrice
);
}
/**
...
...
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