|
@@ -14,10 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/user")
|
|
@@ -56,7 +53,7 @@ public class UserController {
|
|
|
products = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
- log.error("Valid-Product-Get-From-Service, product={}, len={}", products, products.size());
|
|
|
+ log.error("Valid Product Get From Service, product={}, len={}", products, products.size());
|
|
|
|
|
|
List<Map<String, Object> > recs = new ArrayList<>();
|
|
|
|
|
@@ -77,4 +74,48 @@ public class UserController {
|
|
|
return APIResult.ok(data);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value="/messages/productExpiredAlert", method = RequestMethod.GET)
|
|
|
+ public APIResult getMessagesProductExpired(@NeedUser DeviceUserVo user){
|
|
|
+
|
|
|
+ String uid = user.getUid();
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String, Object>> validItems = userService.getProductValid(uid);
|
|
|
+
|
|
|
+ List<Map<String, Object> > recs = new ArrayList<>();
|
|
|
+
|
|
|
+ Long now = new Date().getTime();
|
|
|
+
|
|
|
+
|
|
|
+ Long remindTime = 5*24*3600*1000L;
|
|
|
+
|
|
|
+ for(Map<String, Object> item : validItems){
|
|
|
+
|
|
|
+ Long endTime = (Long) item.get("endTime");
|
|
|
+
|
|
|
+ if (null == endTime){
|
|
|
+ log.error("Illegal Product endTime, endTime=null");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (endTime > now + remindTime){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> rec = new HashMap<>();
|
|
|
+ rec.put("id", item.get("pid"));
|
|
|
+ rec.put("title", item.get("name"));
|
|
|
+ rec.put("beginTime", item.get("beginTime"));
|
|
|
+ rec.put("endTime", item.get("endTime"));
|
|
|
+ rec.put("type", item.get("type"));
|
|
|
+ recs.add(rec);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("totalNum", recs.size());
|
|
|
+ data.put("recs", recs);
|
|
|
+
|
|
|
+ return APIResult.ok(data);
|
|
|
+ }
|
|
|
+
|
|
|
}
|