Commit 24000eab by huluobin

闲时折扣

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