Commit 24000eab by huluobin

闲时折扣

parent 68d6e41e
...@@ -261,6 +261,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -261,6 +261,15 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
OrderServe orderServe = orderServeMapper.selectById(orderServeParam.getId()); OrderServe orderServe = orderServeMapper.selectById(orderServeParam.getId());
//如果修改的订单服务 闲时折扣作废
if (!orderServe.getServeId().equals(orderServeParam.getServeId())) {
//设置折扣属性
orderServe.setLeisureDiscountConfigId(null);
orderServe.setDiscountRate(null);
orderServe.setLeisurePrice(null);
}
//服务改价 //服务改价
orderServe.setServeChangePrice(orderServeParam.getServeChangePrice()); orderServe.setServeChangePrice(orderServeParam.getServeChangePrice());
//服务id //服务id
...@@ -362,13 +371,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -362,13 +371,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
orderServe.setIsOwnProduce(1); orderServe.setIsOwnProduce(1);
orderServe.setOwnProduce(ownProduceMapper.selectById(orderServe.getOwnProduceId())); orderServe.setOwnProduce(ownProduceMapper.selectById(orderServe.getOwnProduceId()));
} }
//如果修改的订单服务 闲时折扣作废
if (!orderServe.getServeId().equals(orderServeParam.getServeId())) {
//设置折扣属性
orderServe.setLeisureDiscountConfigId(null);
orderServe.setDiscountRate(null);
orderServe.setLeisurePrice(null);
}
orderServe.calcPriceAndTimeLength(); orderServe.calcPriceAndTimeLength();
orderServeMapper.updateById(orderServe); orderServeMapper.updateById(orderServe);
......
...@@ -1175,12 +1175,16 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -1175,12 +1175,16 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
if (scheduleServe.getLeisureDiscountConfigId() != null) { if (scheduleServe.getLeisureDiscountConfigId() != null) {
LocalDateTime localDateTime = LocalDateTime.ofInstant(scheduleServe.getStartTime().toInstant(), ZoneId.systemDefault()); LocalDateTime localDateTime = LocalDateTime.ofInstant(scheduleServe.getStartTime().toInstant(), ZoneId.systemDefault());
LeisureScheduleServeResp leisureScheduleServeResp = leisureDiscountConfigLimitMapper.selectOneLeisureDiscountConfig(scheduleServe.getLeisureDiscountConfigId(), LeisureDiscountConfigLimit leisureDiscountConfigLimit = leisureDiscountConfigLimitMapper.selectOneLeisureDiscountConfig(scheduleServe.getLeisureDiscountConfigId(),
scheduleServe.getServeId(), scheduleServe.getServeId(),
localDateTime.toLocalTime(), localDateTime.toLocalTime(),
localDateTime.toLocalDate()); localDateTime.toLocalDate());
if (leisureScheduleServeResp != null) { if (leisureDiscountConfigLimit != null) {
scheduleServe.setDiscountRate(leisureScheduleServeResp.getDiscountRate()); LeisureDiscountConfig leisureDiscountConfig = leisureDiscountConfigMapper.selectById(leisureDiscountConfigLimit.getLeisureDiscountConfigId());
scheduleServe.setDiscountRate(leisureDiscountConfig.getDiscountRate());
leisureDiscountConfigLimit.setLeftTimes(leisureDiscountConfigLimit.getLeftTimes() - 1);
leisureDiscountConfigLimitMapper.updateById(leisureDiscountConfigLimit);
} else { } else {
scheduleServe.setLeisurePrice(null); scheduleServe.setLeisurePrice(null);
scheduleServe.setLeisureDiscountConfigId(null); scheduleServe.setLeisureDiscountConfigId(null);
......
...@@ -36,7 +36,6 @@ public class BaseServeServiceImpl extends ServiceImpl<BaseServeMapper, BaseServe ...@@ -36,7 +36,6 @@ public class BaseServeServiceImpl extends ServiceImpl<BaseServeMapper, BaseServe
public BaseServe getAggregate(Integer id, LocalDateTime date, Integer departmentId) { public BaseServe getAggregate(Integer id, LocalDateTime date, Integer departmentId) {
return baseServeMapper.selectById(id);
BaseServe baseServe = baseServeMapper.selectById(id); BaseServe baseServe = baseServeMapper.selectById(id);
if (SessionUtils.getSourceFrom().equals(SessionUtils.technician)) { if (SessionUtils.getSourceFrom().equals(SessionUtils.technician)) {
List<BaseProduce> baseProduceList = baseProduceMapper.selectList(new LambdaQueryWrapper<BaseProduce>().eq(BaseProduce::getServiceId, id)); List<BaseProduce> baseProduceList = baseProduceMapper.selectList(new LambdaQueryWrapper<BaseProduce>().eq(BaseProduce::getServiceId, id));
......
...@@ -82,6 +82,7 @@ public class ScheduleServe implements Serializable { ...@@ -82,6 +82,7 @@ public class ScheduleServe implements Serializable {
* 款式 * 款式
*/ */
@TableField(strategy = FieldStrategy.IGNORED)
private BigDecimal discountRate; private BigDecimal discountRate;
......
...@@ -2,7 +2,6 @@ package com.gogirl.infrastructure.mapper.market.discount; ...@@ -2,7 +2,6 @@ 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 org.apache.ibatis.annotations.Param;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -23,7 +22,7 @@ public interface LeisureDiscountConfigLimitMapper extends BaseMapper<LeisureDisc ...@@ -23,7 +22,7 @@ public interface LeisureDiscountConfigLimitMapper extends BaseMapper<LeisureDisc
LeisureDiscountConfigLimit selectConfigLimit(String date, Integer leisureDiscountConfigId); LeisureDiscountConfigLimit selectConfigLimit(String date, Integer leisureDiscountConfigId);
LeisureScheduleServeResp selectOneLeisureDiscountConfig(@Param("leisureDiscountConfigId") Integer leisureDiscountConfigId, LeisureDiscountConfigLimit selectOneLeisureDiscountConfig(@Param("leisureDiscountConfigId") Integer leisureDiscountConfigId,
@Param("serveId") Integer serveId, @Param("serveId") Integer serveId,
@Param("time") LocalTime time, @Param("time") LocalTime time,
@Param("date") LocalDate date); @Param("date") LocalDate date);
......
...@@ -17,16 +17,8 @@ ...@@ -17,16 +17,8 @@
and t1.leisure_discount_config_id = #{leisureDiscountConfigId} and t1.leisure_discount_config_id = #{leisureDiscountConfigId}
</select> </select>
<select id="selectOneLeisureDiscountConfig" <select id="selectOneLeisureDiscountConfig"
resultType="com.gogirl.shared.product.LeisureScheduleServeResp"> resultType="com.gogirl.domain.market.discount.LeisureDiscountConfigLimit">
SELECT t1.id as leisure_discount_config_id, SELECT t9.*
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 t8.longitude
from leisure_discount_config t1 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_week t2 on t1.id = t2.leisure_discount_config_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment