提交 38c47dff authored 作者: 吴德鹏's avatar 吴德鹏

update activity

上级 e9ae1796
......@@ -15,10 +15,11 @@ import org.springframework.web.bind.annotation.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* @Auther: wudepeng
......@@ -52,7 +53,7 @@ public class ActivityController {
//查询商品活动
@GetMapping("item/{itemId}")
public Result getItemActivity(@PathVariable("itemId") String itemId) throws ParseException {
public Result getItemActivity(@PathVariable("itemId") String itemId) throws ParseException, ExecutionException, InterruptedException {
Result result = new Result();
Activity activity = null;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -74,14 +75,27 @@ public class ActivityController {
String category3 = item.getItemDescritionId();
String con2 = category1 + "," + category2;
String con3 = category1 + "," + category2 + "," + category3;
List<Activity> activityList = activityRepository.findAllByUseType(2);
List<Activity> actList = new ArrayList<>();
for (Activity act2 : activityList) {
boolean condition = category1.equals(act2.getCategoryId()) || con2.equals(act2.getCategoryId()) || con3.equals(act2.getCategoryId());
if (condition)
activity = act2;
break;
if (category1.equals(act2.getCategoryId())) {
act2.setOrder(3);
actList.add(act2);
}
if (con2.equals(act2.getCategoryId())) {
act2.setOrder(2);
actList.add(act2);
}
if (con3.equals(act2.getCategoryId())) {
act2.setOrder(1);
actList.add(act2);
}
}
Collections.sort(actList, Comparator.comparing(Activity::getOrder));
if (actList.size() > 0 && actList != null)
activity = actList.get(0);
}
}
......@@ -122,4 +136,6 @@ public class ActivityController {
}
return t;
}
}
......@@ -89,4 +89,7 @@ public class Activity implements Serializable {
*/
@Transient
private String deadline;
@Transient
private Integer order;
}
......@@ -57,9 +57,9 @@ dpo:
#服务类型
service_type: 35711
#回调地址
notify_url: https://app.afrieshop.com/afrishop/dpo/notify
notify_url: https://app.afrieshop.com/zion/dpo/notify
#取消地址
back_url: https://app.afrieshop.com/afrishop/dpo/cancel
back_url: https://app.afrieshop.com/zion/dpo/cancel
#支付成功页面
success_url: https://www.afrieshop.com/payment_successful
#支付失败页面
......
server.servlet.context-path=/zion
spring.jpa.hibernate.ddl-auto=update
server.port=8083
spring.profiles.active=prod
spring.profiles.active=dev
#spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/afrishop_test?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=Diaoyunnuli.8
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论