Compare commits

..

No commits in common. 'test' and 'master' have entirely different histories.
test ... master

@ -47,17 +47,6 @@ public enum BasicExportTypeEnum {
*/
ORDER_INVOICE("io_order_invoice", "扫码单据发票信息"),
/**
*
*/
// IO_ORDER("io_order", "单据信息"),
/**
*
*/
// ORDER_INVOICE("io_order_invoice", "扫码单据发票信息"),
/**
*
*/

@ -1,14 +1,15 @@
package com.glxp.sale.admin.controller.sync;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.glxp.sale.admin.constant.*;
import com.glxp.sale.admin.dto.RelaySyncDto;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.entity.sync.BasicExportStatusEntity;
import com.glxp.sale.admin.entity.sync.BasicUploadStatusEntity;
import com.glxp.sale.admin.entity.sync.*;
import com.glxp.sale.admin.http.SpGetHttp;
import com.glxp.sale.admin.http.SpPostHttp;
import com.glxp.sale.admin.idc.utils.UriUtils;
@ -256,7 +257,7 @@ public class SpsSyncDataController {
throw new RuntimeException("系统异常,文件名为空");
}
relaySyncResponse = RelaySyncResponse.builder()
.taskId(one.getTaskId())
.taskId(one.getId())
.fileContent(this.readDataFile(one.getCacheFilePath()))
.build();
}

@ -16,6 +16,10 @@ import com.glxp.sale.admin.idc.service.FileService;
import com.glxp.sale.common.res.BaseResponse;
/**
*
*/
@ -52,4 +56,6 @@ public class FileController {
}
}

@ -1,37 +1,37 @@
package com.glxp.sale.admin.idc.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.glxp.sale.admin.idc.dao.DbDao;
import com.glxp.sale.admin.idc.service.IdcService;
import com.glxp.sale.admin.idc.utils.UriUtils;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
import com.glxp.sale.admin.util.MyStrUtil;
import com.glxp.sale.common.res.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
/**
@ -149,7 +149,6 @@ public class IdcController {
if (StrUtil.isNotEmpty(upperServerHost)) {
uri = upperServerHost + "/" + uri;
}
uri = changeUri(uri);
log.info(uri);
if (uri.contains("getImage")) {
return redirectIamge(request, httpServletResponse, uri);
@ -158,67 +157,6 @@ public class IdcController {
}
}
// @RequestMapping("/dirImages/**")
// public void images(HttpServletRequest request, HttpServletResponse httpServletResponse) {
// String uri = uriUtils.parseUri(request.getRequestURL().toString());
//
// log.info(uri);
// String imageHost = "http://192.168.0.66:9000";
// String url = "";
//// systemParamConfigService.selectValueByParamKey("is_top_service");
// if (StrUtil.isNotEmpty(imageHost)) {
// String prefix = "dirImages/";
// url = (imageHost.substring(imageHost.length() - 1) == "/" ? imageHost : imageHost + "/")
// + uri.substring(uri.indexOf(prefix) + prefix.length());
//
// }
// log.info(url);
// redirectIamge2(request, httpServletResponse, url);
// }
public String changeUri(String uri) {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
} else {
uri = MyStrUtil.deDup(uri);
}
log.error("changeUri = " + uri);
return uri;
}
private void redirectIamge2(HttpServletRequest request, HttpServletResponse httpServletResponse, String uri) {
HttpRequest result = HttpUtil.createGet(uri);
HttpResponse execute = result.execute();
execute.headers().forEach((k, v) -> {
httpServletResponse.setHeader(k, v.get(0));
});
ServletOutputStream outputStream = null;
InputStream inputStream = null;
try {
outputStream = httpServletResponse.getOutputStream();
inputStream = execute.bodyStream();
outputStream.write(inputStream.readAllBytes());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
if (outputStream != null)
outputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
if (inputStream != null)
inputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private byte[] redirectIamge(HttpServletRequest request, HttpServletResponse httpServletResponse, String uri) {
RestTemplate restTemplate = new RestTemplate();

@ -221,7 +221,7 @@ public class FileServiceImpl implements FileService {
if(config!=null&&config.get("paramValue")!=null)
host = config.get("paramValue").toString();
} catch (Exception ex) {
ex.printStackTrace();
}
if(!StringUtils.isEmpty(host)) {
String result = IDCUtils.post(host+"/spssync/file/downloadFile", params);

@ -245,7 +245,8 @@ public class IdcServiceImpl implements IdcService {
/*上传失败重新上传*/
private void asyncFailTask(String host) {
try {
try
{
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
String sql = "select * from basic_export_status where status='1' and receiveStatus='0' where updateTime<date_sub(now(),interval 6 minute) order by updateTime";
Map<String,Object> map = new HashMap<String,Object>();
@ -630,7 +631,6 @@ public class IdcServiceImpl implements IdcService {
OutputStream os;
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : fileName.substring(0, 1).equals("/") ? "" : "/";
String sourceFileName = filePath + filePathSlash + imagePath + fileName;
// String sourceFileName = fileName;
try {
if (FileUtils.isFileExist(sourceFileName)) {
byte[] bytes = FileUtils.readFileByBytes(sourceFileName);
@ -1188,6 +1188,7 @@ public class IdcServiceImpl implements IdcService {
if (result != null && result.isSuccessful() && MediaType.parse("application/force-download").equals(result.body().contentType())) {
try (InputStream inputStream = result.body().byteStream()) {
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath + fileName);
byte b[] = new byte[1024];
@ -1207,8 +1208,8 @@ public class IdcServiceImpl implements IdcService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
}
}
if (!(total > 0)) {
@ -1224,68 +1225,6 @@ public class IdcServiceImpl implements IdcService {
return (total>0);
}
// @Override
// public boolean signleDownloadFile(String syncIp, String fileFullName) {
// OkHttpClient client = new OkHttpClient().newBuilder()
// .build();
// ;
// MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
//
// RequestBody body = RequestBody.create(mediaType, "fileName=" + fileFullName);
//
// Request request = new Request.Builder()
// .url(syncIp + "/spssync/common/downloadFile")
// .post(body)
// .addHeader("Content-Type", "application/x-www-form-urlencoded")
// .build();
// int total = 0;
// try {
// Response result = client.newCall(request).execute();
// String msg = result!=null ? result.message().length()>200 ? result.message().substring(0,200) : result.message() : "";
//
// if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) {
// try (InputStream inputStream = result.body().byteStream()) {
//
// String path = fileFullName.substring(0,fileFullName.lastIndexOf("/"));
// if(!FileUtils.makeDirectory(path))
// IDCUtils.createDirectory(path);
//
//
// FileOutputStream outputStream = new FileOutputStream(fileFullName);
//
// byte b[] = new byte[1024];
//
// int len = 0;
// while ((len = inputStream.read(b)) != -1) {
// total += len;
// outputStream.write(b, 0, len);
//
// }
//
// outputStream.flush();
// outputStream.close();
// if(!(total>0)) {
// new File(fileFullName).delete();
// executeSql("delete from idc_file where filePath='"+fileFullName+"'");
// }
//
// } catch (Exception e) {
//
//
// }
// }
// if(!(total>0)) {
// String sql = "replace idc_file (filePath,createTime,msg) values ('"+fileFullName+"',now(),'"+msg+"')";
// executeSql(sql);
// }
//
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// return (total>0);
// }
/*获取转发服务地址当前值允许单向只使用参数upper_server_ip*/
private String getNextHost() {
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("upper_server_ip");

@ -194,7 +194,7 @@ public class DlAllDataService {
String taskId = syncOrderResponse.getString("taskId");
myEntity.setId(taskId);
JSONArray fileJson = syncOrderResponse.getJSONArray("syncFiles");
JSONArray fileJson = syncOrderResponse.getJSONArray("files");
if (fileJson != null) {
List<String> syncFiles = fileJson.toJavaList(String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
@ -263,10 +263,6 @@ public class DlAllDataService {
switch (exportType){
case IO_ORDER:
case COUNTRY_DI_DATA:
case SYS_SET_DATA:
case DOCUMENT_TYPE_DATA:
case USER_DATA:
case THIRD_DATA:
return;
}

@ -16,8 +16,8 @@ cors.allowed-Credentials=true
server.tomcat.max-http-form-post-size=100MB
server.max-http-header-size=100MB
#\u6700\u5927\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F(10MB)
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
spring.servlet.multipart.max-file-size=104857600
spring.servlet.multipart.max-request-size=104857600
server.connectionTimeout=180000
#logging.level.com.glxp.sale.admin.dao=debug
# \u8F93\u51FA\u65E5\u5FD7\u5230\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u7684springboot.log\u6587\u4EF6\u4E2D // \u914D\u7F6E logback-spring.xml\u65F6 \u6B64\u65E5\u5FD7\u8F93\u51FA\u65B9\u5F0F\u4F1A\u88AB\u8986\u76D6\u3002

@ -1,4 +1,4 @@
spring.profiles.active=test
spring.profiles.active=dev
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.config-location=classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations=classpath:mybatis/mapper/*/*.xml

@ -8,7 +8,7 @@ import lombok.Getter;
@Getter
public enum ResultEnum {
SUCCESS(20000, "success"),
SUCCESS(0, "success"),
NOT_NETWORK(1, "系统繁忙,请稍后再试。"),
LOGIN_VERIFY_FALL(2, "登录失效"),
PARAM_VERIFY_FALL(3, "参数验证错误"),

@ -18,7 +18,7 @@ public class ResultVOUtils {
*/
public static BaseResponse success(Object data) {
BaseResponse<Object> baseResponse = new BaseResponse<>();
baseResponse.setCode(ResultEnum.SUCCESS.getCode());
baseResponse.setCode(20000);
baseResponse.setMessage("success");
baseResponse.setData(data);
return baseResponse;

Loading…
Cancel
Save