Commit d60b7b86 by huluobin

OrderServe 新增mainOrderServeId 字段

parent dd4191bf
...@@ -53,4 +53,11 @@ public interface MarketService { ...@@ -53,4 +53,11 @@ public interface MarketService {
* @param couponCustomerRelevanceId * @param couponCustomerRelevanceId
*/ */
void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId); void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId);
/**
*
* @param orderId
*/
void achievementReCalc(Integer orderId);
} }
...@@ -802,8 +802,9 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -802,8 +802,9 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//如果时间节点不可用返回false //如果时间节点不可用返回false
IdleTimeDTO idleTimeDTO = idleTimeDTOList.stream().findAny().orElseThrow(NullPointerException::new); IdleTimeDTO idleTimeDTO = idleTimeDTOList.stream().findAny().orElseThrow(NullPointerException::new);
if (!idleTimeDTO.isStatus()) { if (!idleTimeDTO.isStatus()) {
throw new RRException("预约时间不可用"); throw new RRException("预约时间已过期");
} }
} catch (RRException e) { } catch (RRException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
...@@ -1529,8 +1530,19 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper, ...@@ -1529,8 +1530,19 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
//插入订单 //插入订单
orderManageMapper.insert(orderManage); orderManageMapper.insert(orderManage);
orderServeList.forEach(orderServe -> orderServe.setOrderId(orderManage.getId())); orderServeList.forEach(orderServe -> orderServe.setOrderId(orderManage.getId()));
//插入订单相亲 //插入订单详情
orderServeService.saveBatch(orderServeList); orderServeService.saveBatch(orderServeList);
//写入订单详情的mainOrderServeId;
orderServeList.stream().filter(orderServe -> orderServe.getMainServeId() != null)
.forEach(orderServe -> {
Integer mainOrderServeId = orderServeList.stream().filter(val -> val.getServeId().equals(orderServe.getServeId()))
.findAny()
.map(OrderServe::getId)
.orElse(null);
orderServe.setMainOrderServeId(mainOrderServeId);
orderServeService.updateById(orderServe);
});
//更新预约 //更新预约
scheduleManage.setOrderId(orderManage.getId()); scheduleManage.setOrderId(orderManage.getId());
......
...@@ -79,6 +79,9 @@ public class OrderServe implements Serializable { ...@@ -79,6 +79,9 @@ public class OrderServe implements Serializable {
private Integer serveTypeId; private Integer serveTypeId;
private Integer mainServeId; private Integer mainServeId;
private Integer mainOrderServeId;
/** /**
* 预约款式vo * 预约款式vo
*/ */
......
...@@ -3,10 +3,13 @@ package com.gogirl.infrastructure.mapper.order.serve; ...@@ -3,10 +3,13 @@ package com.gogirl.infrastructure.mapper.order.serve;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gogirl.domain.market.coupon.CouponCustomerRelevance;
import com.gogirl.domain.order.serve.OrderServe; import com.gogirl.domain.order.serve.OrderServe;
import com.gogirl.domain.store.store.TechnicianAchieve; import com.gogirl.domain.store.store.TechnicianAchieve;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface OrderServeMapper extends BaseMapper<OrderServe> { public interface OrderServeMapper extends BaseMapper<OrderServe> {
...@@ -50,4 +53,6 @@ public interface OrderServeMapper extends BaseMapper<OrderServe> { ...@@ -50,4 +53,6 @@ public interface OrderServeMapper extends BaseMapper<OrderServe> {
@Param("departmentId") Integer departmentId); @Param("departmentId") Integer departmentId);
void syncOrderServeTimes(); void syncOrderServeTimes();
List<CouponCustomerRelevance> selectReCalc();
} }
...@@ -14,6 +14,8 @@ spring: ...@@ -14,6 +14,8 @@ spring:
mybatis-plus: mybatis-plus:
mapper-locations: mapper-locations:
- classpath:mapper/**/*.xml - classpath:mapper/**/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
server: server:
undertow: undertow:
......
...@@ -236,4 +236,13 @@ ...@@ -236,4 +236,13 @@
</if> </if>
order by a.start_time desc order by a.start_time desc
</select> </select>
<select id="selectReCalc" resultType="com.gogirl.domain.market.coupon.CouponCustomerRelevance">
SELECT t1.* from coupon_customer_relevance t1
LEFT JOIN order_manage t2 on t1.order_id =t2.id
where t1.state =2
and t2.create_time like '2020-04%'
and t1.coupon_name like '%免单券%'
GROUP BY t1.order_id
</select>
</mapper> </mapper>
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.gogirl.application.market.coupon.CouponCustomerRelevanceService; import com.gogirl.application.market.coupon.CouponCustomerRelevanceService;
import com.gogirl.application.market.coupon.CouponService; import com.gogirl.application.market.coupon.CouponService;
import com.gogirl.application.market.coupon.MarketService;
import com.gogirl.application.market.timescard.TimesCardCustomerRelevanceService; import com.gogirl.application.market.timescard.TimesCardCustomerRelevanceService;
import com.gogirl.application.market.timescard.TimesCardUsedRecordService; import com.gogirl.application.market.timescard.TimesCardUsedRecordService;
import com.gogirl.application.store.store.StoreTechnicianService; import com.gogirl.application.store.store.StoreTechnicianService;
...@@ -551,4 +552,18 @@ public class Test { ...@@ -551,4 +552,18 @@ public class Test {
System.out.println(customerBalanceRecord.getRefereeId()); System.out.println(customerBalanceRecord.getRefereeId());
} }
@Resource
MarketService marketService;
@org.junit.Test
public void achievementReCalc() {
List<CouponCustomerRelevance> couponCustomerRelevanceList = orderServeMapper.selectReCalc();
couponCustomerRelevanceList.forEach(couponCustomerRelevance -> {
marketService.achievementReCalc(couponCustomerRelevance.getOrderId());
});
}
} }
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