Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
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
huluobin
gogirl-miniapp-backend
Commits
5c9384a3
Commit
5c9384a3
authored
Jul 13, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
闲时折扣
parent
5d964a5e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
25 deletions
+93
-25
ScheduleManageServiceImpl.java
...plication/order/serve/impl/ScheduleManageServiceImpl.java
+46
-25
ScheduleServe.java
...ain/java/com/gogirl/domain/order/serve/ScheduleServe.java
+2
-0
LeisureDiscountConfigLimitMapper.java
...per/market/discount/LeisureDiscountConfigLimitMapper.java
+12
-0
LeisureDiscountConfigLimitMapper.xml
...ain/resources/mapper/LeisureDiscountConfigLimitMapper.xml
+33
-0
No files found.
src/main/java/com/gogirl/application/order/serve/impl/ScheduleManageServiceImpl.java
View file @
5c9384a3
...
@@ -55,6 +55,7 @@ import java.math.BigDecimal;
...
@@ -55,6 +55,7 @@ import java.math.BigDecimal;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneOffset
;
import
java.time.ZoneOffset
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutionException
;
...
@@ -1000,29 +1001,28 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
...
@@ -1000,29 +1001,28 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
//设置从服务的时间为主服务时间 因为主服务的时间已经包括的从服务的时间
//设置从服务的时间为主服务时间 因为主服务的时间已经包括的从服务的时间
subScheduleServeCommandList
subScheduleServeCommandList
.
forEach
(
scheduleServeCommand
->
{
.
forEach
(
scheduleServeCommand
->
{
ScheduleServeCommand
mainScheduleServeCommand
=
mainScheduleServeCommandList
.
stream
()
ScheduleServeCommand
mainScheduleServeCommand
=
mainScheduleServeCommandList
.
stream
()
.
filter
(
var
->
var
.
getServeId
().
equals
(
scheduleServeCommand
.
getMainServeId
()))
.
filter
(
var
->
var
.
getServeId
().
equals
(
scheduleServeCommand
.
getMainServeId
()))
.
findAny
()
.
findAny
()
.
orElseThrow
(
NullPointerException:
:
new
);
.
orElseThrow
(
NullPointerException:
:
new
);
//设置辅助服务美甲师为主服务美甲师
//设置辅助服务美甲师为主服务美甲师
scheduleServeCommand
.
setTechnicianId
(
mainScheduleServeCommand
.
getTechnicianId
());
scheduleServeCommand
.
setTechnicianId
(
mainScheduleServeCommand
.
getTechnicianId
());
scheduleServeCommand
.
setTechnicianIds
(
mainScheduleServeCommand
.
getTechnicianIds
());
scheduleServeCommand
.
setTechnicianIds
(
mainScheduleServeCommand
.
getTechnicianIds
());
scheduleServeCommand
.
setStartTime
(
mainScheduleServeCommand
.
getStartTime
());
scheduleServeCommand
.
setStartTime
(
mainScheduleServeCommand
.
getStartTime
());
scheduleServeCommand
.
setEndTime
(
mainScheduleServeCommand
.
getEndTime
());
scheduleServeCommand
.
setEndTime
(
mainScheduleServeCommand
.
getEndTime
());
//如果主服务已经开单 并且更新 同步主服务的开始时间
//如果主服务已经开单 并且更新 同步主服务的开始时间
ScheduleServe
mainScheduleServe
=
scheduleServeMapper
.
selectById
(
mainScheduleServeCommand
.
getId
());
ScheduleServe
mainScheduleServe
=
scheduleServeMapper
.
selectById
(
mainScheduleServeCommand
.
getId
());
if
(
mainScheduleServe
!=
null
&&
mainScheduleServe
.
getActualStartTime
()
!=
null
)
{
if
(
mainScheduleServe
!=
null
&&
mainScheduleServe
.
getActualStartTime
()
!=
null
)
{
scheduleServeCommand
.
setActualStartTime
(
mainScheduleServe
.
getActualStartTime
());
scheduleServeCommand
.
setActualStartTime
(
mainScheduleServe
.
getActualStartTime
());
}
}
//如果主服务已经结单 不能再添加辅助服务
//如果主服务已经结单 不能再添加辅助服务
if
(
mainScheduleServe
!=
null
&&
mainScheduleServe
.
getStatus
()
==
3
)
{
if
(
mainScheduleServe
!=
null
&&
mainScheduleServe
.
getStatus
()
==
3
)
{
throw
new
RRException
(
"不能再为已完成的服务添加辅助服务"
);
throw
new
RRException
(
"不能再为已完成的服务添加辅助服务"
);
}
}
});
});
ScheduleManage
scheduleManage
=
scheduleManageMapper
.
selectById
(
cmd
.
getId
());
ScheduleManage
scheduleManage
=
scheduleManageMapper
.
selectById
(
cmd
.
getId
());
StoreManage
storeManage
=
storeManageMapper
.
selectById
(
cmd
.
getDepartmentId
());
StoreManage
storeManage
=
storeManageMapper
.
selectById
(
cmd
.
getDepartmentId
());
...
@@ -1081,11 +1081,17 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
...
@@ -1081,11 +1081,17 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//预约结束时间
//预约结束时间
scheduleServe
.
setEndTime
(
scheduleServeCommand
.
getEndTime
());
scheduleServe
.
setEndTime
(
scheduleServeCommand
.
getEndTime
());
if
(
scheduleServe
.
getLeisureDiscountConfigId
()
!=
null
)
{
this
.
backLeisureDiscountConfig
(
scheduleServe
);
}
//闲时折扣
//闲时折扣
if
(
scheduleServeCommand
.
getLeisureDiscountConfigId
()
!=
null
)
{
if
(
scheduleServeCommand
.
getLeisureDiscountConfigId
()
!=
null
)
{
scheduleServe
.
setLeisureDiscountConfigId
(
scheduleServeCommand
.
getLeisureDiscountConfigId
());
scheduleServe
.
setLeisureDiscountConfigId
(
scheduleServeCommand
.
getLeisureDiscountConfigId
());
LeisureDiscountConfig
leisureDiscountConfig
=
leisureDiscountConfigMapper
.
selectById
(
scheduleServe
.
getLeisureDiscountConfigId
());
// LeisureDiscountConfig leisureDiscountConfig = leisureDiscountConfigMapper.selectById(scheduleServe.getLeisureDiscountConfigId());
scheduleServe
.
setDiscountRate
(
leisureDiscountConfig
.
getDiscountRate
());
// scheduleServe.setDiscountRate(leisureDiscountConfig.getDiscountRate());
}
}
if
(
scheduleServeCommand
.
getActualStartTime
()
!=
null
)
{
if
(
scheduleServeCommand
.
getActualStartTime
()
!=
null
)
{
scheduleServe
.
setActualStartTime
(
scheduleServeCommand
.
getActualStartTime
());
scheduleServe
.
setActualStartTime
(
scheduleServeCommand
.
getActualStartTime
());
...
@@ -1171,6 +1177,21 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
...
@@ -1171,6 +1177,21 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//计算价格
//计算价格
scheduleServe
.
calcPriceAndTimeLength
();
scheduleServe
.
calcPriceAndTimeLength
();
if
(
scheduleServe
.
getLeisureDiscountConfigId
()
!=
null
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
ofInstant
(
scheduleServe
.
getStartTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LeisureScheduleServeResp
leisureScheduleServeResp
=
leisureDiscountConfigLimitMapper
.
selectOneLeisureDiscountConfig
(
scheduleServe
.
getLeisureDiscountConfigId
(),
scheduleServe
.
getServeId
(),
localDateTime
.
toLocalTime
(),
localDateTime
.
toLocalDate
());
if
(
leisureScheduleServeResp
!=
null
)
{
scheduleServe
.
setDiscountRate
(
leisureScheduleServeResp
.
getDiscountRate
());
}
else
{
scheduleServe
.
setLeisurePrice
(
null
);
scheduleServe
.
setLeisureDiscountConfigId
(
null
);
}
}
return
scheduleServe
;
return
scheduleServe
;
})
})
//多个美甲师id拆分
//多个美甲师id拆分
...
...
src/main/java/com/gogirl/domain/order/serve/ScheduleServe.java
View file @
5c9384a3
...
@@ -132,6 +132,7 @@ public class ScheduleServe implements Serializable {
...
@@ -132,6 +132,7 @@ public class ScheduleServe implements Serializable {
@ApiModelProperty
(
"售后说明"
)
@ApiModelProperty
(
"售后说明"
)
private
String
explain
;
private
String
explain
;
@TableField
(
strategy
=
FieldStrategy
.
IGNORED
)
private
Integer
leisureDiscountConfigId
;
private
Integer
leisureDiscountConfigId
;
...
@@ -185,6 +186,7 @@ public class ScheduleServe implements Serializable {
...
@@ -185,6 +186,7 @@ public class ScheduleServe implements Serializable {
private
Integer
producePromotionTimeId
;
private
Integer
producePromotionTimeId
;
@TableField
(
strategy
=
FieldStrategy
.
IGNORED
)
private
BigDecimal
leisurePrice
;
private
BigDecimal
leisurePrice
;
@ApiModelProperty
(
"是否自带款式 1-是 2-否"
)
@ApiModelProperty
(
"是否自带款式 1-是 2-否"
)
...
...
src/main/java/com/gogirl/infrastructure/mapper/market/discount/LeisureDiscountConfigLimitMapper.java
View file @
5c9384a3
...
@@ -2,6 +2,11 @@ package com.gogirl.infrastructure.mapper.market.discount;
...
@@ -2,6 +2,11 @@ package com.gogirl.infrastructure.mapper.market.discount;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.gogirl.domain.market.discount.LeisureDiscountConfigLimit
;
import
com.gogirl.domain.market.discount.LeisureDiscountConfigLimit
;
import
com.gogirl.shared.product.LeisureScheduleServeResp
;
import
org.apache.ibatis.annotations.Param
;
import
java.time.LocalDate
;
import
java.time.LocalTime
;
/**
/**
* <p>
* <p>
...
@@ -16,4 +21,11 @@ public interface LeisureDiscountConfigLimitMapper extends BaseMapper<LeisureDisc
...
@@ -16,4 +21,11 @@ public interface LeisureDiscountConfigLimitMapper extends BaseMapper<LeisureDisc
void
syncWeekConfigLimit
();
void
syncWeekConfigLimit
();
LeisureDiscountConfigLimit
selectConfigLimit
(
String
date
,
Integer
leisureDiscountConfigId
);
LeisureDiscountConfigLimit
selectConfigLimit
(
String
date
,
Integer
leisureDiscountConfigId
);
LeisureScheduleServeResp
selectOneLeisureDiscountConfig
(
@Param
(
"leisureDiscountConfigId"
)
Integer
leisureDiscountConfigId
,
@Param
(
"serveId"
)
Integer
serveId
,
@Param
(
"time"
)
LocalTime
time
,
@Param
(
"date"
)
LocalDate
date
)
}
}
src/main/resources/mapper/LeisureDiscountConfigLimitMapper.xml
View file @
5c9384a3
...
@@ -16,4 +16,37 @@
...
@@ -16,4 +16,37 @@
where t1.date = #{date}
where t1.date = #{date}
and t1.leisure_discount_config_id = #{leisureDiscountConfigId}
and t1.leisure_discount_config_id = #{leisureDiscountConfigId}
</select>
</select>
<select
id=
"selectOneLeisureDiscountConfig"
resultType=
"com.gogirl.shared.product.LeisureScheduleServeResp"
>
SELECT t1.id as leisure_discount_config_id,
t1.discount_rate,
t1.department_id,
t5.time_node,
t7.week_date,
t6.id as serve_id,
t6.`name` as serve_name,
t8.`name` as department_name,
t8.latitude,
t8.longitude
from leisure_discount_config t1
LEFT JOIN leisure_discount_config_week t2 on t1.id = t2.leisure_discount_config_id
LEFT JOIN leisure_discount_config_service t3 on t1.id = t3.leisure_discount_config_id
LEFT JOIN time_node t5 on t1.start_time
<
= t5.time_node and t1.end_time
>
= t5.time_node
LEFT JOIN base_serve t6 on t3.service_id = t6.id
LEFT JOIN week_config t7 on t2.`week` = t7.`week`
LEFT JOIN store_manage t8 on t1.department_id = t8.id
LEFT JOIN leisure_discount_config_limit t9
on t1.id = t9.leisure_discount_config_id and t9.left_times > 0 and
t7.week_date = t9.date
where t1.is_enabled = 1
and t2.id is not null
and t3.id is not null
and t9.id is not null
and t1.id = #{leisureDiscountConfigId}
and t3.service_id = #{serveId}
and t5.time_node = #{time}
and t7.week_date = #{date}
limit 1
</select>
</mapper>
</mapper>
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