|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.parser.Feature;
|
|
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
|
import com.miekir.shibei.bean.*;
|
|
import com.miekir.shibei.bean.*;
|
|
|
import com.miekir.shibei.repository.JsonRepository;
|
|
import com.miekir.shibei.repository.JsonRepository;
|
|
|
|
|
+import com.miekir.shibei.repository.SystemRepository;
|
|
|
import com.miekir.shibei.repository.UserRepository;
|
|
import com.miekir.shibei.repository.UserRepository;
|
|
|
import com.miekir.shibei.tool.*;
|
|
import com.miekir.shibei.tool.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -26,6 +27,9 @@ public class JsonController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private UserRepository userRepository;
|
|
private UserRepository userRepository;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SystemRepository systemRepository;
|
|
|
|
|
+
|
|
|
//private String mLastWeatherDate = "";
|
|
//private String mLastWeatherDate = "";
|
|
|
//private WeatherBean mWeatherBean;
|
|
//private WeatherBean mWeatherBean;
|
|
|
private String mLastYijiDate = "";
|
|
private String mLastYijiDate = "";
|
|
@@ -42,7 +46,7 @@ public class JsonController {
|
|
|
String cityUtf8 = StringTool.getUtf8String(city);
|
|
String cityUtf8 = StringTool.getUtf8String(city);
|
|
|
|
|
|
|
|
// 根据token查找用户
|
|
// 根据token查找用户
|
|
|
- /*User dbUserBean;
|
|
|
|
|
|
|
+ User dbUserBean;
|
|
|
try {
|
|
try {
|
|
|
List<User> dbUserList = userRepository.findUserByToken(token);
|
|
List<User> dbUserList = userRepository.findUserByToken(token);
|
|
|
if (dbUserList != null && dbUserList.size() == 1) {
|
|
if (dbUserList != null && dbUserList.size() == 1) {
|
|
@@ -57,15 +61,11 @@ public class JsonController {
|
|
|
return JSON.toJSONString(weatherBean);
|
|
return JSON.toJSONString(weatherBean);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // todo 以后收费
|
|
|
|
|
- if (!dbUserBean.isVip()) {
|
|
|
|
|
|
|
+ SystemBean systemBean = systemRepository.findSystemBean();
|
|
|
|
|
+ // 以后收费
|
|
|
|
|
+ if (systemBean != null && systemBean.isVipLimit && !dbUserBean.isVip()) {
|
|
|
return "请更新客户端并开通服务后重试";
|
|
return "请更新客户端并开通服务后重试";
|
|
|
- }*/
|
|
|
|
|
-// String currentDate = DateTool.getCurrentDate();
|
|
|
|
|
-// if (!TextUtils.equals(mLastWeatherDate, currentDate) || TextUtils.isEmpty(mWeatherBean.temperatureRange)) {
|
|
|
|
|
-// mWeatherBean = WebTool.getWeatherInfo(weatherBean, city);
|
|
|
|
|
-// mLastWeatherDate = currentDate;
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ }
|
|
|
WebTool.getWeatherInfo(weatherBean, cityUtf8);
|
|
WebTool.getWeatherInfo(weatherBean, cityUtf8);
|
|
|
|
|
|
|
|
return JSON.toJSONString(weatherBean);
|
|
return JSON.toJSONString(weatherBean);
|
|
@@ -80,7 +80,7 @@ public class JsonController {
|
|
|
YijiBean yijiBean = new YijiBean();
|
|
YijiBean yijiBean = new YijiBean();
|
|
|
|
|
|
|
|
// 根据token查找用户
|
|
// 根据token查找用户
|
|
|
- /*User dbUserBean;
|
|
|
|
|
|
|
+ User dbUserBean;
|
|
|
try {
|
|
try {
|
|
|
List<User> dbUserList = userRepository.findUserByToken(token);
|
|
List<User> dbUserList = userRepository.findUserByToken(token);
|
|
|
if (dbUserList != null && dbUserList.size() == 1) {
|
|
if (dbUserList != null && dbUserList.size() == 1) {
|
|
@@ -94,10 +94,12 @@ public class JsonController {
|
|
|
return JSON.toJSONString(yijiBean);
|
|
return JSON.toJSONString(yijiBean);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // todo 以后收费
|
|
|
|
|
- if (!dbUserBean.isVip()) {
|
|
|
|
|
|
|
+ SystemBean systemBean = systemRepository.findSystemBean();
|
|
|
|
|
+ // 以后收费
|
|
|
|
|
+ if (systemBean != null && systemBean.isVipLimit && !dbUserBean.isVip()) {
|
|
|
return "请更新客户端并开通服务后重试";
|
|
return "请更新客户端并开通服务后重试";
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String currentDate = DateTool.getCurrentDate();
|
|
String currentDate = DateTool.getCurrentDate();
|
|
|
if (!TextUtils.equals(mLastYijiDate, currentDate) || TextUtils.isEmpty(mYijiBean.newDate)) {
|
|
if (!TextUtils.equals(mLastYijiDate, currentDate) || TextUtils.isEmpty(mYijiBean.newDate)) {
|
|
|
mYijiBean = WebTool.getYijiInfo(yijiBean);
|
|
mYijiBean = WebTool.getYijiInfo(yijiBean);
|