1.全过程管理附件上送
This commit is contained in:
@@ -26,10 +26,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class GwSendUtil {
|
public class GwSendUtil {
|
||||||
|
|
||||||
private static final String GWURL = "dwzyywzt-pms3-proxy.com";
|
public static final String GWURL = "dwzyywzt-pms3-proxy.com";
|
||||||
private static final String CODE = "13B9B47F1E483324E05338297A0A0595";
|
public static final String CODE = "13B9B47F1E483324E05338297A0A0595";
|
||||||
|
|
||||||
|
//最新的上送接口路径
|
||||||
public static final String NEWGWURL = "http://pms.pms30.com.cn/pms-tech-seval";
|
public static final String NEWGWURL = "http://pms.pms30.com.cn/pms-tech-seval";
|
||||||
|
public static final String secretKey = "xQcEF+9hnekk2ZAD1+K1y3PS1d7e3wf0dmPXeeMKf/19qRhyP+4c0FTr70bGINpR";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
Map<String, DictData> mapSupvUserClass = supvUserClassList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
Map<String, DictData> mapSupvUserClass = supvUserClassList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DictData> supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
List<DictData> supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||||
Map<String, DictData> mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
Map<String, DictData> mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
|
||||||
@@ -712,29 +711,15 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public String LoginToken() {
|
|
||||||
String token = null;
|
|
||||||
String clientId = "e512d3940a7d11eeae0cd6fb272b183c";
|
|
||||||
String clientSecret = "k8cF9CgXsj/lnuP2C4Vhx8tuNsPwieBIU8n14vHL1EoWSadcX0we2wffjyTUYGsK";
|
|
||||||
|
|
||||||
String userUrl = "http://" + gwUrl + "/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}";
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
map.put("grant_type", "credentials");
|
|
||||||
map.put("client_id", clientId);
|
|
||||||
map.put("client_secret", clientSecret);
|
|
||||||
ResponseEntity<Map> userEntity = RestTemplateUtil.get(userUrl, Map.class, map);
|
|
||||||
|
|
||||||
if (userEntity.getStatusCodeValue() == 200) {
|
|
||||||
log.info(Thread.currentThread().getName() + "数据:" + userEntity.getBody() + "结束----!");
|
|
||||||
//获取返回体
|
|
||||||
Map body = userEntity.getBody();
|
|
||||||
token = body.get("access_token").toString();
|
|
||||||
} else {
|
|
||||||
throw new BusinessException("获取数据token出现未知异常!请检查ip端口是否正确!");
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件推送
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param supvFile
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
public Map<String, String> sendFile(String url, SupvFile supvFile) throws IOException {
|
public Map<String, String> sendFile(String url, SupvFile supvFile) throws IOException {
|
||||||
//获取文件服务器地址
|
//获取文件服务器地址
|
||||||
Map<String, String> maps = new HashMap<>();
|
Map<String, String> maps = new HashMap<>();
|
||||||
@@ -750,9 +735,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> otherParams = new HashMap<>();
|
Map<String, String> otherParams = new HashMap<>();
|
||||||
otherParams.put("provinceId", code);
|
otherParams.put("provinceId", code);
|
||||||
|
otherParams.put("secretKey", GwSendUtil.secretKey);
|
||||||
otherParams.put("uuid", supvFile.getUuid());
|
otherParams.put("uuid", supvFile.getUuid());
|
||||||
otherParams.put("attachmentName", supvFile.getAttachmentName());
|
otherParams.put("attachmentName", supvFile.getAttachmentName());
|
||||||
otherParams.put("attachmentType", supvFile.getAttachmentType());
|
otherParams.put("attachmentType", supvFile.getAttachmentType());
|
||||||
@@ -762,18 +747,21 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
otherParams.put("uploadTime", uploadTime);
|
otherParams.put("uploadTime", uploadTime);
|
||||||
otherParams.put("uploaderId", supvFile.getUploaderId());
|
otherParams.put("uploaderId", supvFile.getUploaderId());
|
||||||
|
|
||||||
log.info("文件上报接口发送:{}",JSONObject.toJSONString(otherParams));
|
|
||||||
byte[] bytes = IOUtils.toByteArray(in);
|
byte[] bytes = IOUtils.toByteArray(in);
|
||||||
String s = Base64.encodeStr(bytes, false, false);
|
String s = Base64.encodeStr(bytes, false, false);
|
||||||
|
|
||||||
int m = 1;
|
int m = 1;
|
||||||
String str = "";
|
String str = "";
|
||||||
|
log.info("文件上报接口发送:{}", JSONObject.toJSONString(otherParams));
|
||||||
for (int i = 0; i < s.length(); i += 1365000) {
|
for (int i = 0; i < s.length(); i += 1365000) {
|
||||||
otherParams.put("fileByte", s.substring(i, Math.min(i + 1365000, s.length())));
|
|
||||||
otherParams.put("fileCount", (int) Math.ceil(s.length() / (1365000 * 1.0)) + "");
|
otherParams.put("fileCount", (int) Math.ceil(s.length() / (1365000 * 1.0)) + "");
|
||||||
otherParams.put("fileCurrentNum", m + "");
|
otherParams.put("fileCurrentNum", m + "");
|
||||||
str = requestCommon("pqFileFromHyCreate", url, otherParams);
|
str = requestCommon("pqFileFromHyCreate", url, otherParams);
|
||||||
|
otherParams.put("fileByte", s.substring(i, Math.min(i + 1365000, s.length())));
|
||||||
m++;
|
m++;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(str)) {
|
if (StrUtil.isNotBlank(str)) {
|
||||||
String[] split = str.split("_");
|
String[] split = str.split("_");
|
||||||
@@ -792,6 +780,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传请求
|
* 文件上传请求
|
||||||
|
*
|
||||||
* @param serviceName
|
* @param serviceName
|
||||||
* @param url
|
* @param url
|
||||||
* @param param
|
* @param param
|
||||||
@@ -812,6 +801,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
|||||||
.contentType("application/x-www-form-urlencoded;charset=utf-8") //设置请求content-type
|
.contentType("application/x-www-form-urlencoded;charset=utf-8") //设置请求content-type
|
||||||
.putHeaderParamsMap("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
|
.putHeaderParamsMap("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
|
||||||
.putHeaderParamsMap("serviceName", serviceName)
|
.putHeaderParamsMap("serviceName", serviceName)
|
||||||
|
.putHeaderParamsMap("secretKey", "lW2xr6zKjbaqVDOSgQpcGrM6Rg0=")
|
||||||
.putParamsMapAll(param);
|
.putParamsMapAll(param);
|
||||||
try {
|
try {
|
||||||
HttpReturn ret = HttpCaller.invokeReturn(builder.build());
|
HttpReturn ret = HttpCaller.invokeReturn(builder.build());
|
||||||
|
|||||||
Reference in New Issue
Block a user