Commit ef673e7d by huluobin

fix

parent a874921a
......@@ -46,4 +46,11 @@ public interface MarketService {
* @param orderId
*/
void calcOrderAmount(Integer orderId);
/**
* 自动选券
*
* @param couponCustomerRelevanceId
*/
void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId);
}
......@@ -33,6 +33,7 @@ import com.gogirl.shared.market.SetUpOuterCouponCommand;
import com.google.common.collect.Lists;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -603,6 +604,17 @@ public class MarketServiceImpl implements MarketService {
orderServeService.updateBatchById(orderServeList);
}
@Async
@Override
public void asyncAutoSetCoupon(Integer couponCustomerRelevanceId, Integer orderId) {
this.setUpInnerCoupon(SetUpInnerCouponCommand.builder()
.orderId(orderId)
.innerCouponCustomerRelevanceIds(Lists.newArrayList(couponCustomerRelevanceId))
.build());
//结算订单
this.calcOrderAmount(orderId);
}
@Data
static class CalcFreePay {
private Integer orderServeId;
......
......@@ -44,7 +44,6 @@ import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper;
import com.gogirl.infrastructure.service.push.PushMsgService;
import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.shared.market.SetUpInnerCouponCommand;
import com.gogirl.shared.member.CreateCommentCommand;
import com.gogirl.shared.member.OrderCommentCommand;
import com.gogirl.shared.order.ListOrderQuery;
......@@ -460,18 +459,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
.filter(couponCustomerRelevance -> couponCustomerRelevance.getDiscountAmount() != null)
.filter(couponCustomerRelevance -> couponCustomerRelevance.getDiscountAmount().compareTo(orderManage.getTotalPaymentAmount()) <= 0)
.findAny()
.ifPresent(couponCustomerRelevance -> {
try {
marketService.setUpInnerCoupon(SetUpInnerCouponCommand.builder()
.orderId(orderId)
.innerCouponCustomerRelevanceIds(Lists.newArrayList(couponCustomerRelevance.getId()))
.build());
//结算订单
marketService.calcOrderAmount(orderId);
} catch (Exception e) {
log.error(e.getMessage());
}
});
.ifPresent(couponCustomerRelevance -> marketService.asyncAutoSetCoupon(couponCustomerRelevance.getId(), orderId));
pushMsgService.sendOrderPayNotifyMsg(orderId,
customer.getOpenid1(),
......
......@@ -127,10 +127,10 @@
left join order_manage om on oc.order_id = om.id
left join customer cus on om.order_user = cus.id
where oc.technician_id = #{technicianId}
<if test="endTime != null">
<if test="endTime != null and endTime != '' ">
and oc.create_time &lt;= #{endTime}
</if>
<if test="startTime != null">
<if test="startTime != null and startTime != '' ">
and oc.create_time &gt;= #{startTime}
</if>
order by oc.create_time desc
......
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