From 4824047313742f011c3a2942d05977124afb3887 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sat, 11 Aug 2018 08:37:54 +0800 Subject: [PATCH] =?UTF-8?q?TJD=E8=BD=A6=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkCApi/pom.xml | 2 +- .../service/impl/WxUserCouponServiceImpl.java | 65 ------------------- .../resources/mapper/WxCUserCarsMapper.xml | 14 +++- .../main/resources/mapper/WxOrderMapper.xml | 6 +- 4 files changed, 17 insertions(+), 70 deletions(-) delete mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java diff --git a/mallinkCApi/pom.xml b/mallinkCApi/pom.xml index 0e7f141ff..c52e4ab9e 100644 --- a/mallinkCApi/pom.xml +++ b/mallinkCApi/pom.xml @@ -9,7 +9,7 @@ 1.0 - mallinkCclientApi + mallinkCApi diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java deleted file mode 100644 index ff8c1172e..000000000 --- a/mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.simple.service.impl; -import com.simple.domain.dto.WxUserCouponDto; -import com.simple.domain.po.WxCoupon; -import com.simple.domain.po.WxOrder; -import com.simple.mapper.WxCouponMapper; -import com.simple.service.WxOrderService; -import com.simple.service.WxUserCouponService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Created by syf on 2018/8/10. - */ -@Service -public class WxUserCouponServiceImpl implements WxUserCouponService { - - @Autowired - private WxOrderService wxOrderService; - @Autowired - private WxCouponMapper wxCouponMapper; - - /** - * - * @param userId 用户id - * @param status 用户卡券状态 - * @return - */ - @Override - public List findList(Long userId, int status) { - //TODO 待测试优化 - List wxUserCoupons = new ArrayList<>(); - //查询订单表 - WxOrder wxOrder = new WxOrder(); - wxOrder.setCUserId(userId); - wxOrder.setCouponStatus(status); - List orders = wxOrderService.findList(wxOrder); - List ids = orders.stream().map(p->p.getCouponId()+"").distinct().collect(Collectors.toList()); - if(ids.size()>0){ - //查询WxCoupon - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setIds(ids); - List wxCoupons = wxCouponMapper.findList(wxCoupon); - Map couponNamesMap = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId,p->p.getTitle())); - for (WxOrder temp:orders) { - wxUserCoupons.add(getWxUserCoupon(temp,couponNamesMap.get(temp.getCouponId()))); - } - } - return wxUserCoupons; - } - public WxUserCouponDto getWxUserCoupon(WxOrder wxOrder, String title){ - WxUserCouponDto wxUserCoupon = new WxUserCouponDto(); - wxUserCoupon.setOrderId(wxOrder.getId()); - wxUserCoupon.setcUserId(wxOrder.getCUserId()); - wxUserCoupon.setCouponId(wxOrder.getCouponId()); - wxUserCoupon.setCouponStatus(wxOrder.getCouponStatus()); - wxUserCoupon.setValidDate(wxOrder.getValidDate()); - wxUserCoupon.setCouponTitle(title); - return wxUserCoupon; - } -} diff --git a/mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml index 04040d13c..31f261e49 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml @@ -8,10 +8,12 @@ + + - `id`,`tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date` + `id`,`tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params` @@ -45,6 +47,16 @@ and `update_date` = #{updateDate} + + + + and `vendor_type` = #{vendorType} + + + + + and `vendor_params` like concat('%', #{vendorParams},'%') + and id in diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index baaf5b3a0..08dc8cd4f 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ - `id`,`tenant_id`,`coupon_id`,`c_user_id`,`payment`,`payment_time`,`status`,`coupon_status`,`validDate`,`refund`,`refund_time`,`create_date`,`update_date` + `id`,`tenant_id`,`coupon_id`,`c_user_id`,`payment`,`payment_time`,`status`,`coupon_status`,`valid_date`,`refund`,`refund_time`,`create_date`,`update_date` @@ -65,7 +65,7 @@ - and `validDate` = #{validDate} + and `valid_date` = #{validDate}