Просмотр исходного кода

TJD车牌

release_toaliyun_real
Stormeye.Wu 7 лет назад
Родитель
Сommit
4824047313
4 измененных файлов: 17 добавлений и 70 удалений
  1. +1
    -1
      mallinkCApi/pom.xml
  2. +0
    -65
      mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java
  3. +13
    -1
      mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml
  4. +3
    -3
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml

+ 1
- 1
mallinkCApi/pom.xml Просмотреть файл

@@ -9,7 +9,7 @@
<version>1.0</version>
</parent>

<artifactId>mallinkCclientApi</artifactId>
<artifactId>mallinkCApi</artifactId>

<dependencies>
<dependency>


+ 0
- 65
mallinkService/src/main/java/com/simple/service/impl/WxUserCouponServiceImpl.java Просмотреть файл

@@ -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<WxUserCouponDto> findList(Long userId, int status) {
//TODO 待测试优化
List<WxUserCouponDto> wxUserCoupons = new ArrayList<>();
//查询订单表
WxOrder wxOrder = new WxOrder();
wxOrder.setCUserId(userId);
wxOrder.setCouponStatus(status);
List<WxOrder> orders = wxOrderService.findList(wxOrder);
List<String> ids = orders.stream().map(p->p.getCouponId()+"").distinct().collect(Collectors.toList());
if(ids.size()>0){
//查询WxCoupon
WxCoupon wxCoupon = new WxCoupon();
wxCoupon.setIds(ids);
List<WxCoupon> wxCoupons = wxCouponMapper.findList(wxCoupon);
Map<Long,String> 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;
}
}

+ 13
- 1
mallinkService/src/main/resources/mapper/WxCUserCarsMapper.xml Просмотреть файл

@@ -8,10 +8,12 @@
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="vendor_type" jdbcType="INTEGER" property="vendorType" />
<result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" />
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -45,6 +47,16 @@
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != vendorType ">
and `vendor_type` = #{vendorType}
</if>
<if test=" null != vendorParams ">
and `vendor_params` like concat('%', #{vendorParams},'%')
</if>
<if test=" null != ids ">
and id in


+ 3
- 3
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Просмотреть файл

@@ -10,7 +10,7 @@
<result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="coupon_status" jdbcType="INTEGER" property="couponStatus" />
<result column="validDate" jdbcType="TIMESTAMP" property="validDate" />
<result column="valid_date" jdbcType="TIMESTAMP" property="validDate" />
<result column="refund" jdbcType="INTEGER" property="refund" />
<result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
@@ -18,7 +18,7 @@
</resultMap>
<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
@@ -65,7 +65,7 @@
</if>
<if test=" null != validDate ">
and `validDate` = #{validDate}
and `valid_date` = #{validDate}
</if>


Загрузка…
Отмена
Сохранить