Skip to content

Commit

Permalink
hotfix remove http-request & support Pair itself
Browse files Browse the repository at this point in the history
  • Loading branch information
zjn committed Mar 3, 2022
1 parent 35621d5 commit 67b0aed
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.ice.core.relation.*;
import com.ice.core.utils.IceLinkedList;
import com.ice.rmi.common.client.IceRmiClientService;
import javafx.util.Pair;
import com.ice.common.model.Pair;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
Expand Down
30 changes: 30 additions & 0 deletions ice-common/src/main/java/com/ice/common/model/Pair.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.ice.common.model;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Pair<K,V> implements Serializable{
private K key;

public K getKey() { return key; }

private V value;

@Override
public String toString() {
return key + "=" + value;
}

@Override
public int hashCode() {
return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.ice.core.context.IceContext;
import com.ice.core.utils.IceExecutor;
import com.ice.core.utils.IceLinkedList;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.ice.core.context.IceContext;
import com.ice.core.utils.IceExecutor;
import com.ice.core.utils.IceLinkedList;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.util.ArrayList;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.ice.core.context.IceContext;
import com.ice.core.utils.IceExecutor;
import com.ice.core.utils.IceLinkedList;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.util.ArrayList;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.ice.core.context.IceContext;
import com.ice.core.utils.IceExecutor;
import com.ice.core.utils.IceLinkedList;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.ice.core.context.IceContext;
import com.ice.core.utils.IceExecutor;
import com.ice.core.utils.IceLinkedList;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.ice.common.model.IceShowConf;
import com.ice.core.context.IceContext;
import com.ice.core.context.IcePack;
import javafx.util.Pair;
import com.ice.common.model.Pair;

import java.rmi.Remote;
import java.rmi.RemoteException;
Expand Down
5 changes: 0 additions & 5 deletions ice-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
</properties>

<dependencies>
<dependency>
<groupId>com.github.kevinsawicki</groupId>
<artifactId>http-request</artifactId>
<version>${kevinsawicki.http.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.ice.server.controller;

import com.github.kevinsawicki.http.HttpRequest;
import com.ice.server.dao.model.IceBase;
import com.ice.server.dao.model.IcePushHistory;
import com.ice.server.exception.ErrorCode;
Expand Down Expand Up @@ -56,18 +55,18 @@ public Long basePush(@RequestParam Integer app, @RequestParam Long iceId, @Reque
return iceBaseService.push(app, iceId, reason);
}

@RequestMapping(value = "/ice-server/base/pro", method = RequestMethod.POST)
public int pro(@RequestBody String json) {
if (!"product".equals(environment)) {
return HttpRequest.post(productImportUrl)
.connectTimeout(5000)
.readTimeout(5000)
.header("Content-Type", "application/json; charset=utf-8")
.send(json)
.code();
}
return 0;
}
// @RequestMapping(value = "/ice-server/base/pro", method = RequestMethod.POST)
// public int pro(@RequestBody String json) {
// if (!"product".equals(environment)) {
// return HttpRequest.post(productImportUrl)
// .connectTimeout(5000)
// .readTimeout(5000)
// .header("Content-Type", "application/json; charset=utf-8")
// .send(json)
// .code();
// }
// return 0;
// }

@RequestMapping(value = "/ice-server/base/push/history", method = RequestMethod.GET)
public PageResult<IcePushHistory> history(@RequestParam Integer app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.kevinsawicki.http.HttpRequest;
import com.ice.server.model.*;
import com.ice.server.service.IceBaseService;
import com.ice.server.service.IceEditService;
Expand Down Expand Up @@ -90,24 +89,24 @@ public WebResult push(@RequestBody Map map) {
return WebResult.success(iceBaseService.push((Integer) map.get("app"), Long.parseLong(map.get("iceId").toString()), (String) map.get("reason")));
}

/*
* 发布到线上
*/
@Deprecated
@RequestMapping(value = "/ice/topro", method = RequestMethod.POST)
public WebResult toPro(@RequestBody Map map) {
WebResult result = new WebResult();
if (!"product".equals(environment)) {
int code = HttpRequest.post(productImportUrl)
.connectTimeout(5000)
.readTimeout(5000)
.header("Content-Type", "application/json; charset=utf-8")
.send(JSON.toJSONString(map))
.code();
result.setMsg(String.valueOf(code));
}
return result;
}
// /*
// * 发布到线上
// */
// @Deprecated
// @RequestMapping(value = "/ice/topro", method = RequestMethod.POST)
// public WebResult toPro(@RequestBody Map map) {
// WebResult result = new WebResult();
// if (!"product".equals(environment)) {
// int code = HttpRequest.post(productImportUrl)
// .connectTimeout(5000)
// .readTimeout(5000)
// .header("Content-Type", "application/json; charset=utf-8")
// .send(JSON.toJSONString(map))
// .code();
// result.setMsg(String.valueOf(code));
// }
// return result;
// }

/*
* 发布历史
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.ice.server.dao.model.IceRmiExample;
import com.ice.server.exception.ErrorCode;
import com.ice.server.exception.ErrorCodeException;
import javafx.util.Pair;
import com.ice.common.model.Pair;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.ice.server.rmi.IceRmiClientManager;
import com.ice.server.service.IceConfService;
import com.ice.server.service.IceServerService;
import javafx.util.Pair;
import com.ice.common.model.Pair;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down

0 comments on commit 67b0aed

Please sign in to comment.