Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 11 months ago
parent 8b8d3c74b3
commit 140169409d
  1. 33
      hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java
  2. 5
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageAgentServiceImpl.java
  3. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java

@ -1,9 +1,9 @@
package com.hai.schedule;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighDiscountUserRel;
import com.hai.entity.HighOrder;
import com.hai.entity.*;
import com.hai.service.BsTemporaryServices;
import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountPackageAgentService;
import com.hai.service.HighDiscountUserRelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -11,6 +11,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
@ -29,6 +31,12 @@ public class HighDiscountSchedule {
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private BsTemporaryServices bsTemporaryServices;
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
/**
* @Author 胡锐
* @Description 处理过期的优惠券
@ -55,4 +63,23 @@ public class HighDiscountSchedule {
}
}
@Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:5执行一次
public void deleteOilNo() {
List<BsTemporary> list = bsTemporaryServices.getList(new HashMap<>());
for (BsTemporary bsTemporary : list) {
HighDiscountPackageAgentCode discountPackageAgentCode = discountPackageAgentService.findDiscountPackageAgentCode(bsTemporary.getCode());
discountPackageAgentCode.setStatus(1);
discountPackageAgentCode.setUpdateTime(new Date());
discountPackageAgentService.updateDiscountPackageAgentCode(discountPackageAgentCode);
bsTemporary.setStatus(0);
bsTemporary.setUpdateTime(new Date());
bsTemporaryServices.update(bsTemporary);
}
}
}

@ -154,11 +154,12 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
HighDiscountPackageAgentCode discountPackageAgentCode ;
mapCode.put("type" , "DISCOUNT_PACKAGE");
int percent;
int num = object.getInteger("num");
for (int i = 0; i <= object.getInteger("num"); i++) {
for (int i = 0; i < object.getInteger("num"); i++) {
// 生成百分比
percent = i*100/object.getInteger("num");
percent = i*100/(num -1);
redisUtil.set(object.getString("serialNumber") , percent , 3600);
HighDiscountPackageActual discountPackageActual = discountPackageActualList.get(i);

@ -279,8 +279,8 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if (MapUtils.getLong(map, "agentId") != null) {
criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId"));
}
if (MapUtils.getLong(map, "discountName") != null) {
criteria.andDiscountNameLike(MapUtils.getString(map, "discountName"));
if (MapUtils.getString(map, "discountName") != null) {
criteria.andDiscountNameLike("%" + MapUtils.getString(map, "discountName") + "%");
}
if (MapUtils.getInteger(map, "discountPlatform") != null) {

Loading…
Cancel
Save