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

update activity

上级 e9ae1796
...@@ -15,10 +15,11 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,10 +15,11 @@ import org.springframework.web.bind.annotation.*;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.Date; import java.util.concurrent.ExecutionException;
import java.util.List; import java.util.concurrent.ExecutorService;
import java.util.Optional; import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/** /**
* @Auther: wudepeng * @Auther: wudepeng
...@@ -52,7 +53,7 @@ public class ActivityController { ...@@ -52,7 +53,7 @@ public class ActivityController {
//查询商品活动 //查询商品活动
@GetMapping("item/{itemId}") @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(); Result result = new Result();
Activity activity = null; Activity activity = null;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -74,14 +75,27 @@ public class ActivityController { ...@@ -74,14 +75,27 @@ public class ActivityController {
String category3 = item.getItemDescritionId(); String category3 = item.getItemDescritionId();
String con2 = category1 + "," + category2; String con2 = category1 + "," + category2;
String con3 = category1 + "," + category2 + "," + category3; String con3 = category1 + "," + category2 + "," + category3;
List<Activity> activityList = activityRepository.findAllByUseType(2); List<Activity> activityList = activityRepository.findAllByUseType(2);
List<Activity> actList = new ArrayList<>();
for (Activity act2 : activityList) { for (Activity act2 : activityList) {
boolean condition = category1.equals(act2.getCategoryId()) || con2.equals(act2.getCategoryId()) || con3.equals(act2.getCategoryId()); if (category1.equals(act2.getCategoryId())) {
if (condition) act2.setOrder(3);
activity = act2; actList.add(act2);
break; }
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 { ...@@ -122,4 +136,6 @@ public class ActivityController {
} }
return t; return t;
} }
} }
...@@ -89,4 +89,7 @@ public class Activity implements Serializable { ...@@ -89,4 +89,7 @@ public class Activity implements Serializable {
*/ */
@Transient @Transient
private String deadline; private String deadline;
@Transient
private Integer order;
} }
...@@ -57,9 +57,9 @@ dpo: ...@@ -57,9 +57,9 @@ dpo:
#服务类型 #服务类型
service_type: 35711 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 success_url: https://www.afrieshop.com/payment_successful
#支付失败页面 #支付失败页面
......
server.servlet.context-path=/zion server.servlet.context-path=/zion
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
server.port=8083 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.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.username=root
#spring.datasource.password=Diaoyunnuli.8 #spring.datasource.password=Diaoyunnuli.8
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论