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

[系统][修复]:添加couponchannel自动过期,修复一些代码错误问题

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
2dcd9e0713
6 измененных файлов: 74 добавлений и 9 удалений
  1. +55
    -0
      mallinkAdmin/src/main/java/com/simple/schedule/CouponExpiringSchedule.java
  2. +2
    -1
      mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java
  3. +3
    -3
      mallinkService/src/main/java/com/simple/mapper/WxCouponChannelMapper.java
  4. +1
    -1
      mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java
  5. +9
    -0
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  6. +4
    -4
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 55
- 0
mallinkAdmin/src/main/java/com/simple/schedule/CouponExpiringSchedule.java Просмотреть файл

@@ -0,0 +1,55 @@
package com.simple.schedule;

import com.simple.common.IdWorker;
import com.simple.domain.po.WxCouponOrder;
import com.simple.domain.po.WxDateAmountRecord;
import com.simple.domain.po.WxMall;
import com.simple.domain.po.WxMerchant;
import com.simple.enums.EnumDateAmtType;
import com.simple.mapper.*;
import com.simple.service.WxDateAmountRecordService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Component
public class CouponExpiringSchedule {

private final Logger logger = Logger.getLogger(CouponExpiringSchedule.class);


@Autowired
private WxMallMapper wxMallMapper;

@Autowired
private WxCouponChannelMapper wxCouponChannelMapper;

@Autowired
private WxCouponMapper wxCouponMapper;



@Scheduled(cron = "0 30 0 * * ?") // 每天凌晨
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void couponExpiringSchedule() {



}

@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void couponChannelExpiringSchedule() {

wxCouponChannelMapper.offExpiriedCouponChannelByEndTime();
wxCouponChannelMapper.offExpiriedCouponChannelByValidDate();
}
}

+ 2
- 1
mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java Просмотреть файл

@@ -7,6 +7,7 @@ import com.simple.common.ResultData;
import com.simple.domain.po.WxCUser;
import com.simple.domain.po.WxCouponOrder;
import com.simple.domain.vo.WxCouponOrderCVo;
import com.simple.enums.EnumCouponOrderStatus;
import com.simple.exception.MallinkException;
import com.simple.service.WxCouponOrderService;
import io.swagger.annotations.Api;
@@ -72,7 +73,7 @@ public class WxCouponOrderController extends BaseController {
wxCouponOrder.setCUserId(getUser().getId());
if (wxCouponOrder.getCouponOrderStatus() == null)
wxCouponOrder.setSortColumns(WxCouponOrder.Field.CreateDate_DESC);
else if (wxCouponOrder.getCouponOrderStatus() == 0)
else if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())
wxCouponOrder.setSortColumns(WxCouponOrder.Field.CreateDate_DESC);
else
wxCouponOrder.setSortColumns(WxCouponOrder.Field.UpdateDate_DESC);


+ 3
- 3
mallinkService/src/main/java/com/simple/mapper/WxCouponChannelMapper.java Просмотреть файл

@@ -13,10 +13,10 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str
List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel);

void updateStatusByCouponId(WxCouponChannel wxCouponChannel);

void offExpiriedCouponChannelByEndTime();

void offExpiriedCouponChannelByValidDate();
}

+ 1
- 1
mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java Просмотреть файл

@@ -20,7 +20,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {
WxCouponOrderCVo selectDetailOfUser(Map paramMap);

List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder);
List<WxCouponOrderCVo> findListOfAdmin(WxCouponOrder wxCouponOrder);
List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrder wxCouponOrder);

//营销报表 券数据图表
List<MarkingCouponDataReportVo> couponDataMap(HashMap<String,Object> params);


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

@@ -147,7 +147,16 @@



<update id="offExpiriedCouponChannelByEndTime">
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and end_time &lt; now()

</update>

<update id="offExpiriedCouponChannelByValidDate">
update wx_coupon_channel, wx_coupon c SET cc.status = 1, cc.update_date = now()
where cc.status = 0 and cc.coupon_id = c.id and c.valid_type = 1 and valid_end_date &lt; now();
</update>


</mapper>

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

@@ -148,7 +148,7 @@
<if test="startDate != null">
AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
<if test="startDate != null">
<if test="endDate != null">
AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
AND (co.coupon_order_status = '0' or co.coupon_order_status = '1')
@@ -167,7 +167,7 @@
<if test="startDate != null">
AND co.update_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
<if test="startDate != null">
<if test="endDate != null">
AND co.update_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
AND co.coupon_order_status = '1'
@@ -250,7 +250,7 @@
<if test="startDate != null">
AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
<if test="startDate != null">
<if test="endDate != null">
AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
AND (co.coupon_order_status = '0' or co.coupon_order_status = '1')
@@ -265,7 +265,7 @@
<if test="startDate != null">
AND co.update_date &gt; #{startDate,jdbcType=TIMESTAMP}
</if>
<if test="startDate != null">
<if test="endDate != null">
AND co.update_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
AND co.coupon_order_status = '1'


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