新增service调用

Lhxyy
yewj 3 months ago
parent cd4618a9a5
commit f346a6cb5e

@ -110,7 +110,7 @@
<version>1.2.73</version>
</dependency>
<!--fastjson-->
<!-- <dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
<!-- <artifactId>fastjson2</artifactId>-->
<!-- <version>2.0.24</version>-->
@ -156,11 +156,11 @@
<artifactId>yb</artifactId>
<version>zephyr1.7.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.bouncycastle</groupId>-->
<!-- <artifactId>bcprov-jdk15to18</artifactId>-->
<!-- <version>1.69</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.bouncycastle</groupId>-->
<!-- <artifactId>bcprov-jdk15to18</artifactId>-->
<!-- <version>1.69</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.glxp</groupId>
@ -172,7 +172,16 @@
<artifactId>jna</artifactId>
<version>5.11.0</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
</dependency>
<!--okhttp-->
<!-- <dependency>-->
<!-- <groupId>com.squareup.okhttp3</groupId>-->

@ -78,10 +78,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -660,7 +663,6 @@ public class HlfyyyClient extends CommonHttpClient {
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType()));
zaxzyyOrderRequest.setThirdSys(getUserName(orderEntity));
zaxzyyOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
zaxzyyOrderRequest.setBillFlag("1");
@ -715,8 +717,6 @@ public class HlfyyyClient extends CommonHttpClient {
return ResultVOUtils.error(500, msg);
}
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
try {
@ -764,8 +764,6 @@ public class HlfyyyClient extends CommonHttpClient {
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
for (UdiwmsOrderDetailRequest i : items) {
String fphm = "";
String fprq = null;
@ -773,7 +771,7 @@ public class HlfyyyClient extends CommonHttpClient {
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
.eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
.eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
if (CollectionUtil.isNotEmpty(invoiceList)) {
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
if (invoiceList.get(0).getInvoiceDate() != null)
@ -783,68 +781,25 @@ public class HlfyyyClient extends CommonHttpClient {
i.setSecSalesInvNo(fphm);
i.setInvoiceDate(fprq);
}
//构造诏安接口参数
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
//提交到第三方系统
if (thrSystemBusApiEntity.getUrl().equals("saveMasterialInput")) {
// //采购入库单据
// if (vailHightMaterial(detailBizEntities.get(0))) {
// zaZyRequest.setMsgHeader(getMsgHeader("saveMaterialHight"));
// UdiwmsPreInOrderRequest udiwmsPreInOrderRequest = submitPreInOrderToThirdSys(zaxzyyOrderRequest, orderEntity);
// zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsPreInOrderRequest));
// } else {
// zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
// zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
// }
Boolean b = sysParamConfigService.selectByKey("ct_split_groupbuy");
if (b) {
Map<String, List<UdiwmsOrderDetailRequest>> splitMap = items.stream()
.collect(Collectors.groupingBy(UdiwmsOrderDetailRequest::getFirstSalesInvNo));
BaseResponse baseResponse = null;
int index = 1;
if (splitMap.size() > 1) {
for (List<UdiwmsOrderDetailRequest> splitItems : splitMap.values()) {
zaxzyyOrderRequest.setItem(splitItems);
zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
orderEntity.setBillNo(orderEntity.getBillNo() + "-" + index);
baseResponse = submitOrder(orderEntity, zaZyRequest);
}
return baseResponse;
} else {
zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
return submitOrder(orderEntity, zaZyRequest);
}
} else {
zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
return submitOrder(orderEntity, zaZyRequest);
}
} else if (thrSystemBusApiEntity.getUrl().equals("saveMaterialHight")) {
// // 1.先提交到物资
// zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
// zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
// submitOrder(orderEntity, zaZyRequest);
zaZyRequest.setMsgHeader(getMsgHeader("saveBuyApplyInfo"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
submitByWebService(zaZyRequest.getMsgHeader(), zaZyRequest.getMsgBody());
return submitOrder(orderEntity, zaZyRequest);
}
//2.提交到预备货
zaZyRequest.setMsgHeader(getMsgHeader("saveMaterialHight"));
UdiwmsPreInOrderRequest udiwmsPreInOrderRequest = submitPreInOrderToThirdSys(zaxzyyOrderRequest, orderEntity);
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsPreInOrderRequest));
return submitOrder(orderEntity, zaZyRequest);
public void submitByWebService(String msgHeader, String msgBody) {
try {
String response = callInterface(msgHeader, msgBody);
System.out.println("Service Response: " + response);
} catch (Exception e) {
e.printStackTrace();
}
return ResultVOUtils.error(500, "提交失败!");
}
/**
*
*
@ -866,33 +821,6 @@ public class HlfyyyClient extends CommonHttpClient {
public String getUserName(IoOrderEntity orderEntity) {
return "方奕生/1007";
// String userName = null;
// //创建人非供应商
// if (StrUtil.isNotEmpty(orderEntity.getCheckUser())) {
// AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getCheckUser());
// if (authUserEntity == null)
// userName = null;
// userName = authUserEntity.getUserName() + authUserEntity.getEmployeeName();
// } else if (StrUtil.isNotEmpty(orderEntity.getReviewUser())) {
// AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getReviewUser());
// userName = authUserEntity.getUserName() + authUserEntity.getEmployeeName();
// } else if (StrUtil.isNotEmpty(orderEntity.getCreateUser()) && orderEntity.getCreateUser().length() != 14) {
// AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getCreateUser());
// userName = authUserEntity.getUserName() + authUserEntity.getEmployeeName();
// } else if (StrUtil.isNotEmpty(orderEntity.getUpdateUser()) && orderEntity.getUpdateUser().length() != 14) {
// AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getUpdateUser());
// userName = authUserEntity.getUserName() + authUserEntity.getEmployeeName();
// }
// if (userName == null) {
// List<AuthWarehouseUser> authWarehouseUsers = authWarehouseUserMapper.selectList(new QueryWrapper<AuthWarehouseUser>().eq("code", orderEntity.getInvCode()));
// if (CollUtil.isNotEmpty(authWarehouseUsers)) {
// AuthWarehouseUser authWarehouseUser = authWarehouseUsers.get(0);
// AuthUserEntity authUserEntity = authUserDao.selectById(orderEntity.getCheckUser());
// userName = authUserEntity.getUserName() + authUserEntity.getEmployeeName();
// return userName;
// }
// }
// return userName;
}
@ -2475,4 +2403,49 @@ public class HlfyyyClient extends CommonHttpClient {
}
}
private static final String WSDL_URL = "http://192.168.158.208:8152/ZoesoftHipService.asmx?WSDL";
private static final String NAMESPACE = "http://192.168.158.208:8152/";
private static final String SERVICE_NAME = "saveBuyApplyInfo";
public String callInterface(String msgHeader, String msgBody) throws Exception {
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
try {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("tem", NAMESPACE);
SOAPBody soapBody = envelope.getBody();
SOAPElement operationElement = soapBody.addChildElement(SERVICE_NAME, "tem");
SOAPElement msgHeaderElement = operationElement.addChildElement("as_msgHeader");
msgHeaderElement.addTextNode(msgHeader);
SOAPElement msgBodyElement = operationElement.addChildElement("as_msgBody");
msgBodyElement.addTextNode(msgBody);
SOAPElement responseElement = operationElement.addChildElement("rs_response_xml");
log.error("request: {}", soapMessage.toString());
soapMessage.saveChanges();
SOAPMessage soapResponse = connection.call(soapMessage, WSDL_URL);
SOAPBody responseBody = soapResponse.getSOAPBody();
return responseBody.getTextContent();
} finally {
connection.close();
}
}
}

Loading…
Cancel
Save