|
@@ -9,6 +9,7 @@ import com.happy.Model.*;
|
|
|
import com.happy.Model.weixin.Users;
|
|
import com.happy.Model.weixin.Users;
|
|
|
import com.happy.Until.*;
|
|
import com.happy.Until.*;
|
|
|
import com.happy.common.controller.BaseController;
|
|
import com.happy.common.controller.BaseController;
|
|
|
|
|
+import com.happy.common.http.HttpsClient;
|
|
|
import com.happy.constant.ConstDefault;
|
|
import com.happy.constant.ConstDefault;
|
|
|
import com.happy.constant.ResultStatusCode;
|
|
import com.happy.constant.ResultStatusCode;
|
|
|
import com.happy.dto.ArticleCommentDto;
|
|
import com.happy.dto.ArticleCommentDto;
|
|
@@ -19,7 +20,15 @@ import com.happy.vo.*;
|
|
|
import com.opensymphony.xwork2.ModelDriven;
|
|
import com.opensymphony.xwork2.ModelDriven;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
|
|
+import org.apache.http.client.HttpClient;
|
|
|
|
|
+import org.apache.http.client.methods.HttpGet;
|
|
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
|
|
+import org.apache.http.entity.StringEntity;
|
|
|
|
|
+import org.apache.http.impl.client.HttpClientBuilder;
|
|
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
import org.apache.struts2.ServletActionContext;
|
|
import org.apache.struts2.ServletActionContext;
|
|
|
|
|
+import org.aspectj.weaver.ast.Var;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -28,6 +37,8 @@ import java.text.ParseException;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import static com.happy.common.http.HttpsClient.httpsRequestReturnString;
|
|
|
|
|
+
|
|
|
public class articleTweetAction extends BaseController implements ModelDriven<ArticleTweetDto> {
|
|
public class articleTweetAction extends BaseController implements ModelDriven<ArticleTweetDto> {
|
|
|
|
|
|
|
|
private final ArticleTweetDto articleTweetDto = new ArticleTweetDto();
|
|
private final ArticleTweetDto articleTweetDto = new ArticleTweetDto();
|
|
@@ -61,12 +72,12 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
|
|
public String endTime;
|
|
public String endTime;
|
|
|
|
|
|
|
|
- public String getKey(){
|
|
|
|
|
|
|
+ public String getKey() {
|
|
|
return key;
|
|
return key;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void setKey(String key){
|
|
|
|
|
- this.key=key;
|
|
|
|
|
|
|
+ public void setKey(String key) {
|
|
|
|
|
+ this.key = key;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public String getStartTime() {
|
|
public String getStartTime() {
|
|
@@ -366,9 +377,9 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
|
Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
|
if (one != null && one.isPresent() && min != null && min.isPresent()) {
|
|
if (one != null && one.isPresent() && min != null && min.isPresent()) {
|
|
|
- if(one.get().getPrice() > min.get().getPrice()){
|
|
|
|
|
|
|
+ if (one.get().getPrice() > min.get().getPrice()) {
|
|
|
hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
|
|
hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
|
|
hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -539,9 +550,9 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
|
Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
|
|
|
if (one != null && one.isPresent() && min != null && min.isPresent()) {
|
|
if (one != null && one.isPresent() && min != null && min.isPresent()) {
|
|
|
- if(one.get().getPrice() > min.get().getPrice()){
|
|
|
|
|
|
|
+ if (one.get().getPrice() > min.get().getPrice()) {
|
|
|
hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
|
|
hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
|
|
hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -757,7 +768,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
|
|
List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
|
|
|
|
|
|
|
|
for (ArticleListVo data : result.getPageList()) {
|
|
for (ArticleListVo data : result.getPageList()) {
|
|
|
- if(fileInfos != null){
|
|
|
|
|
|
|
+ if (fileInfos != null) {
|
|
|
List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
|
|
List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
|
|
|
if (fileInfoList != null) {
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
if (fileInfoList.size() > 1) {
|
|
@@ -1176,21 +1187,22 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 攻略分页
|
|
* 攻略分页
|
|
|
|
|
+ *
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public String walkthroughPage(){
|
|
|
|
|
|
|
+ public String walkthroughPage() {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder(" and at.status=1 "); // 推文没删除才显示
|
|
StringBuilder strSql = new StringBuilder(" and at.status=1 "); // 推文没删除才显示
|
|
|
- if (!Func.checkNull(key)){
|
|
|
|
|
|
|
+ if (!Func.checkNull(key)) {
|
|
|
strSql.append(" and (at.user_name like '%").append(key).append("%' or at.title like '%").append(key).append("%') ");
|
|
strSql.append(" and (at.user_name like '%").append(key).append("%' or at.title like '%").append(key).append("%') ");
|
|
|
}
|
|
}
|
|
|
- if (!Func.checkNull(startTime) && !Func.checkNull(endTime)){
|
|
|
|
|
|
|
+ if (!Func.checkNull(startTime) && !Func.checkNull(endTime)) {
|
|
|
strSql.append(" and at.create_date >= '").append(startTime).append("' ");
|
|
strSql.append(" and at.create_date >= '").append(startTime).append("' ");
|
|
|
strSql.append(" and at.create_date <= '").append(endTime).append("' ");
|
|
strSql.append(" and at.create_date <= '").append(endTime).append("' ");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IPage<WalkthroughVo> walkthroughPage=articleTweetService.walkthroughPage(strSql.toString(),page, rows);
|
|
|
|
|
|
|
+ IPage<WalkthroughVo> walkthroughPage = articleTweetService.walkthroughPage(strSql.toString(), page, rows);
|
|
|
|
|
|
|
|
jsonObject.put("message", "查询分页成功");
|
|
jsonObject.put("message", "查询分页成功");
|
|
|
jsonObject.put("code", 200);
|
|
jsonObject.put("code", 200);
|
|
@@ -1199,4 +1211,66 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 商品页面
|
|
|
|
|
+ */
|
|
|
|
|
+ public String productPage() throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+// JSONObject jsonBody = new JSONObject();
|
|
|
|
|
+// jsonBody.put("username", "admin");
|
|
|
|
|
+// jsonBody.put("password", "123456");
|
|
|
|
|
+//
|
|
|
|
|
+// String url = "https://www.jinganrenjiams.com/cloud-mall/admin/open/login";
|
|
|
|
|
+//
|
|
|
|
|
+ // 构建http请求客户端
|
|
|
|
|
+// HttpClient httpclient = HttpClientBuilder.create().useSystemProperties().build();
|
|
|
|
|
+// // 构建post请求
|
|
|
|
|
+// HttpPost postMethod = new HttpPost(url);
|
|
|
|
|
+// // 设置请求头
|
|
|
|
|
+// postMethod.addHeader("Content-Type", "application/json");
|
|
|
|
|
+// // 设置请求体
|
|
|
|
|
+// postMethod.setEntity(new StringEntity(jsonBody.toString()));
|
|
|
|
|
+//
|
|
|
|
|
+// // 发送请求
|
|
|
|
|
+// HttpResponse response = httpclient.execute(postMethod);
|
|
|
|
|
+//
|
|
|
|
|
+// String s = EntityUtils.toString(response.getEntity());
|
|
|
|
|
+//
|
|
|
|
|
+// JSONObject postJson = JSONObject.parseObject(s);
|
|
|
|
|
+//
|
|
|
|
|
+// JSONObject data = postJson.getJSONObject("data");
|
|
|
|
|
+//
|
|
|
|
|
+// String token = data.getString("token");
|
|
|
|
|
+
|
|
|
|
|
+ // 构建http请求客户端
|
|
|
|
|
+ HttpClient httpclient = HttpClientBuilder.create().useSystemProperties().build();
|
|
|
|
|
+ String getUrl = "";
|
|
|
|
|
+
|
|
|
|
|
+ if (!Func.checkNull(key)) {
|
|
|
|
|
+ getUrl = "https://www.jinganrenjiams.com/cloud-mall/goods/open/page?state=1&curPage="+page+"&pageSize="+rows+"&goodsName=" + key;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ getUrl = "https://www.jinganrenjiams.com/cloud-mall/goods/open/page?state=1&curPage="+page+"&pageSize="+rows;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ HttpGet httpGet = new HttpGet(getUrl);
|
|
|
|
|
+ // 设置请求头
|
|
|
|
|
+ httpGet.addHeader("Content-Type", "application/json");
|
|
|
|
|
+// httpGet.addHeader("Mall-Token", token);
|
|
|
|
|
+ // 发送请求
|
|
|
|
|
+ HttpResponse execute = httpclient.execute(httpGet);
|
|
|
|
|
+ String s1 = EntityUtils.toString(execute.getEntity());
|
|
|
|
|
+ JSONObject getJson = JSONObject.parseObject(s1);
|
|
|
|
|
+ JSONObject data1 = getJson.getJSONObject("data");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ jsonObject.put("message", "查询分页成功");
|
|
|
|
|
+ jsonObject.put("code", 200);
|
|
|
|
|
+ jsonObject.put("data", data1);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|