平潭接口修改,新增中医院智业接口修改

dev
anthonywj 2 years ago
parent df0f78747c
commit 7f627b00b7

@ -2,6 +2,7 @@ package com.glxp.mipsdl.client.ptxhyy;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -154,7 +155,7 @@ public class PtxhyyClient extends CommonHttpClient {
udiwmsOrderRequest.setLocInvName(thrInvWarehouseEntitys.get(0).getName());
}
} catch (Exception e) {
log.info("查询第三方系统仓库信息异常", e);
log.info("查询第三方系统仓库信息异常", ExceptionUtil.stacktraceToString(e));
return ResultVOUtils.error(500, "查询第三方系统仓库信息异常");
}
udiwmsOrderRequest.setBillFlag("1");
@ -184,11 +185,16 @@ public class PtxhyyClient extends CommonHttpClient {
if (CollectionUtil.isNotEmpty(ioOrderInvoiceEntities) && ioOrderInvoiceEntities.size() > 0) {
fbbz = 1;
}
String userName = getUserName(orderEntity);
String userName;
try {
userName = getUserName(orderEntity);
if (StrUtil.isEmpty(userName)) {
return ResultVOUtils.error(500, "该单据无创建人!");
}
} catch (Exception e) {
log.info("查询操作人异常", ExceptionUtil.stacktraceToString(e));
return ResultVOUtils.error(500, "查询操作人异常!");
}
PtxhyyOrderRequest ptxhyyOrderRequest = PtxhyyOrderRequest
.builder()
.kfxh(udiwmsOrderRequest.getLocInvCode())
@ -206,9 +212,7 @@ public class PtxhyyClient extends CommonHttpClient {
.build();
ptxhyyOrderRequest.setDetailList(new ArrayList<>());
setOrderDetailList(ioCodeEntities, items, detailBizEntities);
Collections.reverse(items);
for (UdiwmsOrderDetailRequest i : items) {
String udim = "";
if (CollectionUtil.isNotEmpty(i.getCodeList())) {

@ -0,0 +1,548 @@
package com.glxp.mipsdl.client.zzzyy;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthUserDao;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.inout.IoOrderUploadLogDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
import com.glxp.mipsdl.entity.auth.AuthUserEntity;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
import com.glxp.mipsdl.entity.inout.IoOrderUploadLogEntity;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
import com.glxp.mipsdl.req.post.PostFileThrOrderRequest;
import com.glxp.mipsdl.req.post.PostThrCorpRequest;
import com.glxp.mipsdl.req.post.PostThrInvProductsRequest;
import com.glxp.mipsdl.req.post.PostThrProductsRequest;
import com.glxp.mipsdl.req.zaxyy.ZaxzyyOrderRequest;
import com.glxp.mipsdl.req.zzzyy.ZzzyyRequest;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.util.DateUtil;
import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* --
*/
@Slf4j
@Service(value = "100010HttpClient")
public class ZzzyyClient implements BaseHttpClient {
@Resource
private ThrSystemDetailService thrSystemDetailService;
@Resource
private HttpClient httpClient;
@Resource
private IoOrderDao orderDao;
@Resource
private ThrSystemBusApiDao thrSystemBusApiDao;
@Resource
private AuthUserDao authUserDao;
@Resource
private BasicBussinessTypeDao basicBussinessTypeDao;
@Resource
private BasicCorpDao basicCorpDao;
@Resource
private IoCodeDao codeDao;
@Resource
private AuthWarehouseDao authWarehouseDao;
@Resource
private ThrInvWarehouseDao thrInvWarehouseDao;
@Resource
private AuthWarehouseService authWarehouseService;
@Resource
private ThirdSysConfig thirdSysConfig;
@Resource
private ThrCorpService thrCorpService;
@Resource
private IoOrderDetailBizDao orderDetailBizDao;
@Resource
private IoOrderUploadLogDao orderUploadLogDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
/**
* xml
*
* @param methodName
* @return
*/
public String getMsgHeader(String methodName) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<root>" +
"<serverName>" +
methodName +
"</serverName>" +
"</root>";
}
public String parserResult(String response) {
if (response.contains("<root")) {
try {
Document document = DocumentHelper.parseText(response);
String message = document.getRootElement().element("message").getText();
return message;
} catch (DocumentException e) {
log.info("解析漳州中医院智业接口返回结果异常, 返回结果:{}", response);
log.error("异常信息:", e);
}
}
return response;
}
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialUnit"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsUnitRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_CORP_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回往来单位字典数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialDict"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsProductRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_PI_QUERY_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回产品信息字典数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialType"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsBusTypeRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_BUS_TYPE_QUERY_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回单据类型数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialApply"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsOrderQueryRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_BUS_TYPE_QUERY_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回单据类型数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
if (StrUtil.isBlank(udiwmsOrderRequest.getBillNo())) {
return ResultVOUtils.error(500, "单据号不能为空");
}
ZaxzyyOrderRequest zaxzyyOrderRequest = new ZaxzyyOrderRequest();
BeanUtil.copyProperties(udiwmsOrderRequest, zaxzyyOrderRequest);
//查询单据和详情信息,组装第三方系统接口所需参数
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo()));
zaxzyyOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!");
}
Integer userId;
if (orderEntity.getReviewUser() != null) {
userId = Integer.valueOf(orderEntity.getReviewUser());
} else {
userId = Integer.valueOf(orderEntity.getCreateUser());
}
AuthUserEntity authUser = authUserDao.selectById(userId);
zaxzyyOrderRequest.setThirdSys(authUser.getEmployeeName());
zaxzyyOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
zaxzyyOrderRequest.setBillFlag("1");
//查询单据类型
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(udiwmsOrderRequest.getBillType());
if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_HOSPTIAL)) {
//医院客户
zaxzyyOrderRequest.setCorpId(orderEntity.getFromCorp());
//查询客户名称
String corpName = basicCorpDao.selectNameByErpId(orderEntity.getFromCorp());
zaxzyyOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId()));
try {
//根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
log.error("查询单据对应往来单位的第三方仓库信息异常", e);
}
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_SP)) {
//供应商
ThrCorpEntity thrCorp = thrCorpService.getThrCorp(udiwmsOrderRequest.getCorpId());
if (null != thrCorp) {
zaxzyyOrderRequest.setCorpId(thrCorp.getUnitId());
zaxzyyOrderRequest.setCorpName(thrCorp.getName());
} else {
log.error("查询单据对应的第三方往来单位信息异常");
}
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
zaxzyyOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
log.info("查询第三方系统仓库信息异常", e);
}
//设置单据出入库类型
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
zaxzyyOrderRequest.setInoutType(1); //入库
} else if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
zaxzyyOrderRequest.setInoutType(2); //出库
}
//设置备注信息
zaxzyyOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new QueryWrapper<IoCodeEntity>()
.eq("orderId", orderEntity.getBillNo())
.ne("action", "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities);
zaxzyyOrderRequest.setItem(items);
//构造诏安接口参数
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
//提交到第三方系统
if (thrSystemBusApiEntity.getUrl().equals("saveMasterialInput")) {
//采购入库单据
zaZyRequest.setMsgHeader(getMsgHeader("saveMasterialInput"));
String key = "orderSubmitUrl";
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(zaxzyyOrderRequest));
} else if (thrSystemBusApiEntity.getUrl().equals("saveMaterialHight")) {
zaxzyyOrderRequest.setLocStorageCode("1001304");
zaxzyyOrderRequest.setLocStorageName("骨科耗材及试剂仓库");
//临床出库
zaZyRequest.setMsgHeader(getMsgHeader("saveMaterialHight"));
String key = "preInOrderSubmit";
UdiwmsPreInOrderRequest udiwmsPreInOrderRequest = submitPreInOrderToThirdSys(zaxzyyOrderRequest, orderEntity);
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsPreInOrderRequest));
}
return submitOrder(orderEntity, zaZyRequest);
}
/**
*
*
* @param orderEntity
* @param zaZyRequest
* @return
*/
private BaseResponse submitOrder(IoOrderEntity orderEntity, ZzzyyRequest zaZyRequest) {
//记录日志
IoOrderUploadLogEntity uploadLog = new IoOrderUploadLogEntity();
uploadLog.setBillDate(orderEntity.getCreateTime());
uploadLog.setBillType(orderEntity.getAction());
uploadLog.setSubmitTime(new Date());
uploadLog.setBillNo(orderEntity.getBillNo());
uploadLog.setFromType(Constants.THIRD_ORDER_UPLOAD);
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_ORDER_SUBMIT_URL), zaZyRequest);
response = parserResult(response);
if (StrUtil.isNotBlank(response)) {
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000) {
String thirdBillNo = String.valueOf(baseResponse.getData());
orderEntity.setThirdBillNo(thirdBillNo);
orderEntity.setExportStatus(1); //提交成功
uploadLog.setStatus(2);
uploadLog.setThrBillNo(thirdBillNo);
uploadLog.setResult("提交成功");
orderDao.updateById(orderEntity);
orderUploadLogDao.insert(uploadLog);
return ResultVOUtils.success("提交成功");
}
uploadLog.setStatus(3);
uploadLog.setResult("提交失败,错误信息:" + baseResponse.getMessage());
orderEntity.setExportStatus(2); //上传失败
orderDao.updateById(orderEntity);
orderUploadLogDao.insert(uploadLog);
return baseResponse;
} catch (Exception e) {
log.error("解析提交到智业单据返回结果异常,结果信息:{}", response);
log.error("异常信息:{}", e);
uploadLog.setStatus(3);
uploadLog.setResult("提交失败,错误信息:" + response);
orderEntity.setExportStatus(2); //上传失败
orderDao.updateById(orderEntity);
orderUploadLogDao.insert(uploadLog);
return ResultVOUtils.error(500, "提交失败");
}
} else {
uploadLog.setStatus(3);
uploadLog.setResult("提交失败,调用接口返回为空");
orderEntity.setExportStatus(2); //上传失败
orderDao.updateById(orderEntity);
orderUploadLogDao.insert(uploadLog);
return ResultVOUtils.error(500, "提交失败");
}
}
/**
*
*
* @param ioCodeEntities
* @param orderDetailRequests
* @param detailBizEntities
*/
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
//封装条码信息
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
orderDetailRequests.add(item);
}
}
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialStorage"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsInvProductsRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回库存产品数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("getMaterialDept"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsWarehouseRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_WAREHOUSE_QUERY_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口返回仓库(科室)数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
@Override
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
postThrProductsRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostPiUrl(), postThrProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
postThrCorpRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostCorpUrl(), postThrCorpRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
postFileThrOrderRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostOrderUrl(), postFileThrOrderRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), postThrInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse testConnect() {
UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest();
udiwmsUnitRequest.setPage(1);
udiwmsUnitRequest.setLimit(1);
BaseResponse baseResponse = getUnit(udiwmsUnitRequest);
if (baseResponse.getCode() == 20000) {
return ResultVOUtils.success("连接成功!");
}
return ResultVOUtils.error(500, "连接失败!");
}
@Override
public BaseResponse queryUdiInvProducts(UdiwmsQueryUdiInvProductsRequest queryUdiInvProductsRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getQueryInvUrl(), queryUdiInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse submitProducts(UdiwmsAddProductsRequest udiwmsAddProductsRequest) {
return null;
}
@Override
public BaseResponse submitUnit(UdiwmsAddUnitRequest udiwmsAddUnitRequest) {
return null;
}
@Override
public BaseResponse submitPreInOrders(UdiwmsPreInOrderRequest udiwmsPreInOrderRequest) {
ZzzyyRequest zaZyRequest = new ZzzyyRequest();
zaZyRequest.setMsgHeader(getMsgHeader("saveMaterialHight"));
zaZyRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsPreInOrderRequest));
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_PRE_IN_ORDER_SUBMIT_URL), zaZyRequest);
response = parserResult(response);
try {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
} catch (Exception e) {
log.error("解析漳州中医院智业接口提交单据返回数据异常,返回结果:{}", response);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果(" + response + ")");
}
}
/**
*
*
* @param udiwmsOrderRequest
* @param orderEntity
* @return
*/
public UdiwmsPreInOrderRequest submitPreInOrderToThirdSys(ZaxzyyOrderRequest udiwmsOrderRequest, IoOrderEntity orderEntity) {
UdiwmsPreInOrderRequest udiwmsPreInOrderRequest = new UdiwmsPreInOrderRequest();
if (udiwmsOrderRequest != null) {
BeanUtils.copyProperties(udiwmsOrderRequest, udiwmsPreInOrderRequest);
udiwmsPreInOrderRequest.setLocInvCode(udiwmsOrderRequest.getLocStorageCode());
udiwmsPreInOrderRequest.setLocInvName(udiwmsOrderRequest.getLocStorageName());
if (orderEntity.getReviewUser() != null) {
AuthUserEntity authUser = authUserDao.selectById(orderEntity.getReviewUser());
udiwmsPreInOrderRequest.setActor(authUser.getEmployeeName());
} else if (orderEntity.getCreateUser() != null) {
AuthUserEntity authUser = authUserDao.selectById(orderEntity.getCreateUser());
udiwmsPreInOrderRequest.setActor(authUser.getEmployeeName());
}
List<UdiwmsPreInOrderRequest.ItemDTO> itemDTOS = new ArrayList<>();
if (CollUtil.isNotEmpty(udiwmsOrderRequest.getItem())) {
for (UdiwmsOrderDetailRequest udiwmsOrderDetail : udiwmsOrderRequest.getItem()) {
if (CollUtil.isNotEmpty(udiwmsOrderDetail.getCodeList())) {
for (UdiwmsOrderDetailRequest.CodeDetailEntity codeDetaiEntity : udiwmsOrderDetail.getCodeList()) {
UdiwmsPreInOrderRequest.ItemDTO itemDTO = new UdiwmsPreInOrderRequest.ItemDTO();
BeanUtils.copyProperties(udiwmsOrderDetail, itemDTO);
itemDTO.setCode(codeDetaiEntity.getCode());
itemDTO.setCount(codeDetaiEntity.getCount());
itemDTOS.add(itemDTO);
}
}
}
}
udiwmsPreInOrderRequest.setItems(itemDTOS);
}
return udiwmsPreInOrderRequest;
}
}

@ -2,6 +2,8 @@ package com.glxp.mipsdl.dao.auth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.mipsdl.entity.auth.AuthUserEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AuthUserDao extends BaseMapper<AuthUserEntity> {
}

@ -94,7 +94,7 @@ public class IoCodeEntity {
* ID
*/
@TableField(value = "relId")
private Integer relId;
private Long relId;
/**
*

@ -0,0 +1,18 @@
package com.glxp.mipsdl.req.zzzyy;
import lombok.Data;
@Data
public class ZzzyyRequest {
/**
*
*/
private String msgHeader;
/**
*
*/
private String msgBody;
}

@ -1,12 +1,46 @@
[
{"code": "100000", "name": "自定义规范标准"},
{"code": "100001", "name": "测试接口"},
{"code": "100002", "name": "用友3.1版本,片仔癀诊断"},
{"code": "100003", "name": "智业V1,诏安医院"},
{"code": "100004", "name": "阳光采购平台"},
{"code": "100005", "name": "平和县医院"},
{"code": "100006", "name": "东山县医院"},
{"code": "100007", "name": "云霄中医院"},
{"code": "100008", "name": "平潭协和医院物资系统"},
{"code": "100009", "name": "平潭协和医院HIS系统"}
{
"code": "100000",
"name": "自定义规范标准"
},
{
"code": "100001",
"name": "测试接口"
},
{
"code": "100002",
"name": "用友3.1版本,片仔癀诊断"
},
{
"code": "100003",
"name": "智业V1,诏安医院"
},
{
"code": "100004",
"name": "阳光采购平台"
},
{
"code": "100005",
"name": "平和县医院"
},
{
"code": "100006",
"name": "东山县医院"
},
{
"code": "100007",
"name": "云霄中医院"
},
{
"code": "100008",
"name": "平潭协和医院物资系统"
},
{
"code": "100009",
"name": "平潭协和医院HIS系统"
},
{
"code": "100010",
"name": "漳州中医院"
}
]
Loading…
Cancel
Save