新增单据类型接口,数据库切换到udiwms,文件上传问题

master
anthonyywj2 3 years ago
parent d167d2fa25
commit 16003b73d0

@ -4,10 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.glxp.mipsdl.admin.req.*;
import com.glxp.mipsdl.admin.res.system.UdiwmsInvProductResponse;
import com.glxp.mipsdl.admin.res.system.UdiwmsOrderResponse;
import com.glxp.mipsdl.admin.res.system.UdiwmsProductInfoResponse;
import com.glxp.mipsdl.admin.res.system.UdiwmsUnitResponse;
import com.glxp.mipsdl.admin.res.system.*;
import com.glxp.mipsdl.admin.util.CustomUtil;
import com.glxp.mipsdl.common.res.BaseResponse;
import com.glxp.mipsdl.common.util.ResultVOUtils;
@ -135,6 +132,30 @@ public class TestClient {
return ResultVOUtils.success(udiwmsOrderResponse);
}
public BaseResponse getBusType(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
if (null == udiwmsBusTypeRequest) {
return ResultVOUtils.error(500, "参数不能未空");
}
List<UdiwmsBusTypeResponse> udiwmsBusTypeResponses = new ArrayList<>();
UdiwmsBusTypeResponse udiwmsBusTypeResponse = new UdiwmsBusTypeResponse();
udiwmsBusTypeResponse.setId("1");
udiwmsBusTypeResponse.setCode("cgrk");
udiwmsBusTypeResponse.setName("采购入库单");
udiwmsBusTypeResponse.setRemark("测试");
udiwmsBusTypeResponses.add(udiwmsBusTypeResponse);
UdiwmsBusTypeResponse udiwmsBusTypeResponse2 = new UdiwmsBusTypeResponse();
udiwmsBusTypeResponse2.setId("2");
udiwmsBusTypeResponse2.setCode("syck");
udiwmsBusTypeResponse2.setName("使用出库单");
udiwmsBusTypeResponse2.setRemark("测试");
udiwmsBusTypeResponses.add(udiwmsBusTypeResponse2);
udiwmsBusTypeResponses.add(udiwmsBusTypeResponse);
udiwmsBusTypeResponses.add(udiwmsBusTypeResponse2);
return ResultVOUtils.success(udiwmsBusTypeResponses);
}
/**
*
*

@ -76,6 +76,18 @@ public class UdiWmsController {
}
//获取ERP单据类型接口
@AuthRuleAnnotation("")
@PostMapping("/udiwms/erp/getOrderType")
public BaseResponse getOrderTypes(@RequestBody UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
if (curFlag.equals("TEST")) {
return testClient.getBusType(udiwmsBusTypeRequest);
} else
return ResultVOUtils.error(500, "未设置系统版本!");
}
//新增单据
@AuthRuleAnnotation("")
@PostMapping("/udiwms/erp/addOrders")

@ -8,41 +8,59 @@ import com.glxp.mipsdl.admin.req.system.PostThrInvProductsRequest;
import com.glxp.mipsdl.admin.req.system.PostThrProductsRequest;
import com.glxp.mipsdl.admin.util.HttpClient;
import com.glxp.mipsdl.common.res.BaseResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
@Service
public class UdiwmsClient {
String udiWmsUrl;
@Value("${UDIWMS_IP}")
private String udiWmsUrl;
public UdiwmsClient(String udiWmsUrl) {
this.udiWmsUrl = udiWmsUrl;
@Value("${API_KEY}")
private String apiKey;
@Value("${API_SECRET}")
private String apiSecret;
public HttpHeaders getHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("api_key", apiKey);
headers.add("secret_key", apiSecret);
return headers;
}
public BaseResponse postProducts( PostThrProductsRequest postThrProductsRequest) {
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postThrProducts", postThrProductsRequest);
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postThrProducts", postThrProductsRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
return baseResponse;
}
public BaseResponse postCorps( PostThrCorpRequest postThrCorpRequest) {
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
postThrCorpRequest.setUploadType("文件导入");
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postCorps", postThrCorpRequest);
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postCorps", postThrCorpRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
return baseResponse;
}
public BaseResponse postOrderDetail( PostFileThrOrderRequest postFileThrOrderRequest) {
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postFileOrder", postFileThrOrderRequest);
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postFileOrder", postFileThrOrderRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
return baseResponse;
}
public BaseResponse postInvProducts( PostThrInvProductsRequest postThrInvProductsRequest) {
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postInvProducts", postThrInvProductsRequest);
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postInvProducts", postThrInvProductsRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});

@ -0,0 +1,14 @@
package com.glxp.mipsdl.admin.req;
import lombok.Data;
@Data
public class UdiwmsBusTypeRequest {
private String id;
private String code;
private String name;
private Integer limit;
private Integer page;
private String thirdSys;
}

@ -0,0 +1,12 @@
package com.glxp.mipsdl.admin.res.system;
import lombok.Data;
@Data
public class UdiwmsBusTypeResponse {
private String id;
private String code;
private String name;
private String remark;
}

@ -5,36 +5,37 @@ import com.glxp.mipsdl.admin.req.system.PostFileThrOrderRequest;
import com.glxp.mipsdl.admin.req.system.PostThrCorpRequest;
import com.glxp.mipsdl.admin.req.system.PostThrInvProductsRequest;
import com.glxp.mipsdl.admin.req.system.PostThrProductsRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class UdiInfoUploadService {
@Value("${UDIWMS_IP}")
private String udiwmsIp;
@Resource
UdiwmsClient udiwmsClient;
@Async
public void postProducts(PostThrProductsRequest postThrProductsRequest) {
new UdiwmsClient(udiwmsIp).postProducts(postThrProductsRequest);
udiwmsClient.postProducts(postThrProductsRequest);
}
@Async
public void postCorps(PostThrCorpRequest postThrCorpRequest) {
new UdiwmsClient(udiwmsIp).postCorps(postThrCorpRequest);
udiwmsClient.postCorps(postThrCorpRequest);
}
@Async
public void postInvPi(PostThrInvProductsRequest postThrInvProductsRequest) {
new UdiwmsClient(udiwmsIp).postInvProducts(postThrInvProductsRequest);
udiwmsClient.postInvProducts(postThrInvProductsRequest);
}
@Async
public void postOrders(PostFileThrOrderRequest postFileThrOrderRequest) {
new UdiwmsClient(udiwmsIp).postOrderDetail(postFileThrOrderRequest);
udiwmsClient.postOrderDetail(postFileThrOrderRequest);
}
}

@ -30,10 +30,9 @@ public class HttpClient {
public static String postJson(String url, Object object) {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(600000);
factory.setReadTimeout(20000);
factory.setReadTimeout(600000);
RestTemplate restTemplate = new RestTemplate(factory);
String json = JSONObject.toJSON(object).toString();
// logger.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
@ -42,4 +41,18 @@ public class HttpClient {
return response;
}
public static String postJson(String url, Object object, HttpHeaders headers) {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(600000);
factory.setReadTimeout(600000);
RestTemplate restTemplate = new RestTemplate(factory);
String json = JSONObject.toJSON(object).toString();
logger.info(url + "\n" + json);
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
String response = restTemplate.postForObject(url, httpEntity, String.class);
logger.info(response);
return response;
}
}

@ -1,10 +1,10 @@
# 本地环境
server.port=9997
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql://192.168.235.137:33306/udiwms_erp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
#spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udiwms_new?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
#spring.datasource.jdbc-url=jdbc:mysql://192.168.235.137:33306/udiwms_erp?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udiwms?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.password=123456
#spring.datasource.password=89083fb2fc145533
logging.level.com.glxp.mipsdl.admin.dao=debug
#logging.level.com.glxp.mipsdl.admin.barcode=debug
@ -24,6 +24,8 @@ server.connectionTimeout=180000
#udi管理系统IP地址上传文件解析后回传
UDIWMS_IP=http://192.168.0.109:9991
#UDIWMS_IP=http://139.159.187.130/UDI_WMS_MC
API_KEY=1102
API_SECRET=4dc07484afd34e8083ba96e8fe564224
#文件导入
#0.NULL(空未配置1.GLXP(自定义规范标准2.ZHIYE_V1(智业V1,诏安医院),3.YG_UDPLAT_V1(阳光采购平台)
FILE_VERSION_FLAG=ZHIYE_V1

@ -6,25 +6,24 @@
<insert id="insertScheduled" keyProperty="id"
parameterType="com.glxp.mipsdl.admin.entity.system.ScheduledEntity">
insert INTO scheduled
(cronName,cron,customerId)
values
(
#{cronName},
#{cron},
#{customerId}
)
insert INTO sys_scheduled
(cronName, cron, customerId)
values (#{cronName},
#{cron},
#{customerId})
</insert>
<delete id="deleteScheduled" parameterType="java.lang.String">
delete from scheduled where id = #{id}
delete
from sys_scheduled
where id = #{id}
</delete>
<select id="findScheduled" parameterType="com.glxp.mipsdl.admin.req.ScheduledRequest"
resultType="com.glxp.mipsdl.admin.entity.system.ScheduledEntity">
select * from scheduled
select * from sys_scheduled
<where>
<if test="cronName != null and cronName != ''">
and cronName = #{cronName}
@ -33,7 +32,7 @@
and customerId = #{customerId}
</if>
</where>
limit 1
</select>

Loading…
Cancel
Save