调整+平潭协和对接

dev
wj 2 years ago
parent 648e9c8264
commit d7b1fd573c

@ -16,7 +16,7 @@ public interface BaseHttpClient {
/** /**
* *
* *
* @param testUnitRequest * @param udiwmsUnitRequest
* @return * @return
*/ */
BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest); BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest);
@ -32,7 +32,7 @@ public interface BaseHttpClient {
/** /**
* *
* *
* @param udiwmsOrderRequest * @param udiwmsBusTypeRequest
* @return * @return
*/ */
BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest); BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest);

@ -7,6 +7,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map;
/** /**
* controllerbase * controllerbase
*/ */

@ -0,0 +1,81 @@
package com.glxp.mipsdl.client;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
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.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
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.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.res.BaseResponse;
import com.glxp.mipsdl.res.udiwms.UdiwmsProductInfoResponse;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.file.UdiInfoUploadService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.util.*;
import com.glxp.mipsdl.vo.file.yxzyy.YxzyyProductEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
public abstract class CommonFileClient implements BaseFileClient {
@Autowired
private UdiInfoUploadService udiInfoUploadService;
@Autowired
private ExecutorUtil executorUtil;
@Override
public abstract BaseResponse uploadPi(List<MultipartFile> files, String thirdSys);
@Override
public BaseResponse uploadCorps(List<MultipartFile> files, String thirdSys) {
return ResultVOUtils.error(500, "暂不支持往来单位上传!");
}
@Override
public BaseResponse uploadInvPi(List<MultipartFile> files, String thirdSys) {
return ResultVOUtils.error(500, "暂不支持库存产品信息上传!");
}
@Override
public BaseResponse uploadOrders(List<MultipartFile> files, String thirdSys) {
return ResultVOUtils.error(500, "暂不支持业务单据上传!");
}
}

@ -0,0 +1,217 @@
package com.glxp.mipsdl.client;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
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.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
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.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.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.DictUtl;
import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
public abstract class CommonHttpClient implements BaseHttpClient {
@Autowired
private HttpClient httpClient;
@Autowired
private ThirdSysConfig thirdSysConfig;
@Autowired
private ThrSystemDetailService thrSystemDetailService;
@Autowired
private ThrBustypeOriginDao thrBustypeOriginDao;
@Autowired
private IoOrderDao orderDao;
@Autowired
private ThrSystemBusApiDao thrSystemBusApiDao;
@Autowired
private BasicBussinessTypeDao basicBussinessTypeDao;
@Autowired
private BasicCorpDao basicCorpDao;
@Autowired
private AuthWarehouseDao authWarehouseDao;
@Autowired
private ThrInvWarehouseDao thrInvWarehouseDao;
@Autowired
private AuthWarehouseService authWarehouseService;
@Autowired
private ThrCorpService thrCorpService;
@Autowired
private IoCodeDao codeDao;
@Autowired
private IoOrderDetailBizDao orderDetailBizDao;
@Autowired
private SubmitOrderUtil submitOrderUtil;
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_CORP_URL), udiwmsUnitRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_PI_QUERY_URL), udiwmsProductRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_BUS_TYPE_QUERY_URL), udiwmsBusTypeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
if (StrUtil.isBlank(udiwmsOrderQueryRequest.getBillType())) {
return ResultVOUtils.error(500, "单据类型不能为空");
}
//查询绑定的第三方单据类型
String thirdAction = thrBustypeOriginDao.findThirdActionByBillType(udiwmsOrderQueryRequest.getBillType(), DictUtl.CURRENT_HOSP_CODE);
udiwmsOrderQueryRequest.setBillType(thirdAction);
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_ORDER_QUERY_URL), udiwmsOrderQueryRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public abstract BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest);
/**
*
*
* @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) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), udiwmsInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_WAREHOUSE_QUERY_URL), udiwmsWarehouseRequest);
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) {
return null;
}
@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;
}
}

@ -3,6 +3,7 @@ package com.glxp.mipsdl.client.dsxyy;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.BaseHttpClient; import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
@ -139,11 +140,11 @@ public class DsxyyClient implements BaseHttpClient {
BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest); BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数 //查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo())); IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime())); dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型 //查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType())); ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) { if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!"); return ResultVOUtils.error(500, "接口未配置,无法提交!");
} }
@ -160,12 +161,12 @@ public class DsxyyClient implements BaseHttpClient {
dsOrderRequest.setCorpName(corpName); dsOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) { } else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室 //内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, udiwmsOrderRequest.getCorpId()));
try { try {
//根据第三方系统标识,获取对应字段的值 //根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); dsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
dsOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); dsOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
@ -184,11 +185,11 @@ public class DsxyyClient implements BaseHttpClient {
} }
//查询仓库信息 //查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try { try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode()); dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName()); dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
@ -203,7 +204,8 @@ public class DsxyyClient implements BaseHttpClient {
dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode()); dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode());
dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName()); dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>().eq("code", "29").eq("thirdSysFk", thirdSysConfig.getThirdId())); ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocStorageCode("29"); dsOrderRequest.setLocStorageCode("29");
dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName()); dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} }
@ -219,14 +221,14 @@ public class DsxyyClient implements BaseHttpClient {
dsOrderRequest.setRemark("udi管理系统提交单据"); dsOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据 //组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new QueryWrapper<IoCodeEntity>() List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq("orderId", orderEntity.getBillNo()) .eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne("action", "StockCheck") .ne(IoCodeEntity::getAction, "StockCheck")
); );
List<UdiwmsOrderDetailRequest> items = new ArrayList<>(); List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情 //查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo())); List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities); setOrderDetailList(ioCodeEntities, items, detailBizEntities);

@ -3,6 +3,7 @@ package com.glxp.mipsdl.client.phxyy;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.BaseHttpClient; import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
@ -139,11 +140,11 @@ public class PhxyyClient implements BaseHttpClient {
BeanUtil.copyProperties(udiwmsOrderRequest, phOrderRequest); BeanUtil.copyProperties(udiwmsOrderRequest, phOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数 //查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo())); IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
phOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime())); phOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型 //查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType())); ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) { if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!"); return ResultVOUtils.error(500, "接口未配置,无法提交!");
} }
@ -160,12 +161,12 @@ public class PhxyyClient implements BaseHttpClient {
phOrderRequest.setCorpName(corpName); phOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) { } else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室 //内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, udiwmsOrderRequest.getCorpId()));
try { try {
//根据第三方系统标识,获取对应字段的值 //根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
phOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); phOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
phOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); phOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
@ -184,11 +185,11 @@ public class PhxyyClient implements BaseHttpClient {
} }
//查询仓库信息 //查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try { try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
phOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode()); phOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
phOrderRequest.setLocInvName(thrInvWarehouseEntity.getName()); phOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
@ -203,7 +204,8 @@ public class PhxyyClient implements BaseHttpClient {
phOrderRequest.setCorpId(phOrderRequest.getLocStorageCode()); phOrderRequest.setCorpId(phOrderRequest.getLocStorageCode());
phOrderRequest.setCorpName(phOrderRequest.getLocStorageName()); phOrderRequest.setCorpName(phOrderRequest.getLocStorageName());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>().eq("code", "29").eq("thirdSysFk", thirdSysConfig.getThirdId())); ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
phOrderRequest.setLocStorageCode("29"); phOrderRequest.setLocStorageCode("29");
phOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName()); phOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} }
@ -219,14 +221,14 @@ public class PhxyyClient implements BaseHttpClient {
phOrderRequest.setRemark("udi管理系统提交单据"); phOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据 //组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new QueryWrapper<IoCodeEntity>() List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq("orderId", orderEntity.getBillNo()) .eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne("action", "StockCheck") .ne(IoCodeEntity::getAction, "StockCheck")
); );
List<UdiwmsOrderDetailRequest> items = new ArrayList<>(); List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情 //查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo())); List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities); setOrderDetailList(ioCodeEntities, items, detailBizEntities);

@ -1,20 +1,45 @@
package com.glxp.mipsdl.client.ptxhyy; package com.glxp.mipsdl.client.ptxhyy;
import com.alibaba.fastjson2.JSONObject; import cn.hutool.core.util.StrUtil;
import com.glxp.mipsdl.client.BaseHttpClient; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.mipsdl.client.CommonHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
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.thrsys.ThrBustypeOriginDao;
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
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.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.http.HttpClient;
import com.glxp.mipsdl.req.base.*; 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.res.BaseResponse; 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.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** /**
@ -22,93 +47,144 @@ import javax.annotation.Resource;
*/ */
@Slf4j @Slf4j
@Service(value = "100008HttpClient") @Service(value = "100008HttpClient")
public class PtxhyyClient implements BaseHttpClient { @RequiredArgsConstructor
public class PtxhyyClient extends CommonHttpClient {
@Resource
private HttpClient httpClient;
@Resource
private ThirdSysConfig thirdSysConfig;
@Override private final ThirdSysConfig thirdSysConfig;
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) { private final IoOrderDao orderDao;
return null; private final ThrSystemBusApiDao thrSystemBusApiDao;
} private final BasicBussinessTypeDao basicBussinessTypeDao;
private final BasicCorpDao basicCorpDao;
@Override private final AuthWarehouseDao authWarehouseDao;
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) { private final ThrInvWarehouseDao thrInvWarehouseDao;
return null; private final AuthWarehouseService authWarehouseService;
} private final ThrCorpService thrCorpService;
private final IoCodeDao codeDao;
@Override private final IoOrderDetailBizDao orderDetailBizDao;
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) { private final SubmitOrderUtil submitOrderUtil;
return null;
}
@Override
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
return null;
}
@Override @Override
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) { public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
return null; if (StrUtil.isBlank(udiwmsOrderRequest.getBillNo())) {
} return ResultVOUtils.error(500, "单据号不能为空");
}
@Override //查询单据和详情信息,组装第三方系统接口参数
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) { IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
return null; udiwmsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
} //查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
@Override if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) { return ResultVOUtils.error(500, "接口未配置,无法提交!");
return null; }
} udiwmsOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
//查询单据类型,设置往来单位信息
@Override BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(udiwmsOrderRequest.getBillType());
public BaseResponse testConnect() { if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_HOSPTIAL)) {
return ResultVOUtils.success(); //医院客户
} udiwmsOrderRequest.setCorpId(orderEntity.getFromCorp());
//查询客户名称
@Override String corpName = basicCorpDao.selectNameByErpId(orderEntity.getFromCorp());
public BaseResponse queryUdiInvProducts(UdiwmsQueryUdiInvProductsRequest queryUdiInvProductsRequest) { udiwmsOrderRequest.setCorpName(corpName);
return null; } else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
} //内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, udiwmsOrderRequest.getCorpId()));
@Override try {
public BaseResponse submitProducts(UdiwmsAddProductsRequest udiwmsAddProductsRequest) { //根据第三方系统标识,获取对应字段的值
return null; ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
} .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
@Override udiwmsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
public BaseResponse submitUnit(UdiwmsAddUnitRequest udiwmsAddUnitRequest) { udiwmsOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
return null; } catch (Exception e) {
} String msg = "查询单据对应往来单位的第三方仓库信息异常";
log.error(msg, e);
@Override return ResultVOUtils.error(500, msg);
public BaseResponse submitPreInOrders(UdiwmsPreInOrderRequest udiwmsPreInOrderRequest) { }
return null; } else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_SP)) {
} //供应商
ThrCorpEntity thrCorp = thrCorpService.getThrCorp(udiwmsOrderRequest.getCorpId());
@Override if (null != thrCorp) {
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) { udiwmsOrderRequest.setCorpId(thrCorp.getUnitId());
postThrProductsRequest.setUploadType("文件导入"); udiwmsOrderRequest.setCorpName(thrCorp.getName());
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostPiUrl(), postThrProductsRequest); } else {
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class); String msg = "查询单据对应的第三方往来单位信息异常";
return baseResponse; log.error(msg);
} return ResultVOUtils.error(500, msg);
}
@Override }
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
return null; //查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
udiwmsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
udiwmsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
// udiwmsOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
// udiwmsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
log.info("查询第三方系统仓库信息异常", e);
}
// if (StrUtil.nullToEmpty(thrSystemBusApiEntity.getUrl()).equals("useOut")) {
// udiwmsOrderRequest.setCorpId(udiwmsOrderRequest.getLocStorageCode());
// udiwmsOrderRequest.setCorpName(udiwmsOrderRequest.getLocStorageName());
//
// ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
// .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
// udiwmsOrderRequest.setLocStorageCode("29");
// udiwmsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
// }
udiwmsOrderRequest.setBillFlag("1");
//设置单据出入库类型
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
udiwmsOrderRequest.setInoutType(1); //入库
} else if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
udiwmsOrderRequest.setInoutType(2); //出库
}
udiwmsOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne(IoCodeEntity::getAction, "StockCheck")
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities);
Collections.reverse(items);
//云霄使用items字段其他医院使用item字段
udiwmsOrderRequest.setItem(items);
return submitOrderUtil.submitOrder(orderEntity, udiwmsOrderRequest);
}
/**
*
*
* @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 postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
return null;
} }
@Override
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
return null;
}
} }

@ -2,6 +2,7 @@ package com.glxp.mipsdl.client.ptxhyy;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import com.glxp.mipsdl.client.BaseFileClient; import com.glxp.mipsdl.client.BaseFileClient;
import com.glxp.mipsdl.client.CommonFileClient;
import com.glxp.mipsdl.req.post.PostThrProductsRequest; import com.glxp.mipsdl.req.post.PostThrProductsRequest;
import com.glxp.mipsdl.res.BaseResponse; import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.res.udiwms.UdiwmsProductInfoResponse; import com.glxp.mipsdl.res.udiwms.UdiwmsProductInfoResponse;
@ -24,7 +25,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service(value = "100008FileClient") @Service(value = "100008FileClient")
public class PtxhyyFileClient implements BaseFileClient { public class PtxhyyFileClient extends CommonFileClient {
@Resource @Resource
private UdiInfoUploadService udiInfoUploadService; private UdiInfoUploadService udiInfoUploadService;
@ -60,19 +61,4 @@ public class PtxhyyFileClient implements BaseFileClient {
} }
return ResultVOUtils.success("文件解析成功,正在上传,请稍后刷新查看"); return ResultVOUtils.success("文件解析成功,正在上传,请稍后刷新查看");
} }
@Override
public BaseResponse uploadCorps(List<MultipartFile> files, String thirdSys) {
return null;
}
@Override
public BaseResponse uploadInvPi(List<MultipartFile> files, String thirdSys) {
return null;
}
@Override
public BaseResponse uploadOrders(List<MultipartFile> files, String thirdSys) {
return null;
}
} }

@ -2,6 +2,7 @@ package com.glxp.mipsdl.client.ptxhyy;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.glxp.mipsdl.client.BaseHttpClient; import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.client.CommonHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.http.HttpClient; import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*; import com.glxp.mipsdl.req.base.*;
@ -22,93 +23,16 @@ import javax.annotation.Resource;
*/ */
@Slf4j @Slf4j
@Service(value = "100009HttpClient") @Service(value = "100009HttpClient")
public class PtxhyyHisClient implements BaseHttpClient { public class PtxhyyHisClient extends CommonHttpClient {
@Resource @Resource
private HttpClient httpClient; private HttpClient httpClient;
@Resource @Resource
private ThirdSysConfig thirdSysConfig; private ThirdSysConfig thirdSysConfig;
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
return null;
}
@Override
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
return null;
}
@Override
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
return null;
}
@Override
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
return null;
}
@Override @Override
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) { public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
return null; return null;
} }
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
return null;
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
return null;
}
@Override
public BaseResponse testConnect() {
return ResultVOUtils.success();
}
@Override
public BaseResponse queryUdiInvProducts(UdiwmsQueryUdiInvProductsRequest queryUdiInvProductsRequest) {
return null;
}
@Override
public BaseResponse submitProducts(UdiwmsAddProductsRequest udiwmsAddProductsRequest) {
return null;
}
@Override
public BaseResponse submitUnit(UdiwmsAddUnitRequest udiwmsAddUnitRequest) {
return null;
}
@Override
public BaseResponse submitPreInOrders(UdiwmsPreInOrderRequest udiwmsPreInOrderRequest) {
return null;
}
@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) {
return null;
}
@Override
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
return null;
}
@Override
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
return null;
}
} }

@ -2,6 +2,7 @@ package com.glxp.mipsdl.client.ptxhyy;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import com.glxp.mipsdl.client.BaseFileClient; import com.glxp.mipsdl.client.BaseFileClient;
import com.glxp.mipsdl.client.CommonFileClient;
import com.glxp.mipsdl.req.post.PostThrProductsRequest; import com.glxp.mipsdl.req.post.PostThrProductsRequest;
import com.glxp.mipsdl.res.BaseResponse; import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.res.udiwms.UdiwmsProductInfoResponse; import com.glxp.mipsdl.res.udiwms.UdiwmsProductInfoResponse;
@ -24,7 +25,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Service(value = "100009FileClient") @Service(value = "100009FileClient")
public class PtxhyyHisFileClient implements BaseFileClient { public class PtxhyyHisFileClient extends CommonFileClient {
@Resource @Resource
private UdiInfoUploadService udiInfoUploadService; private UdiInfoUploadService udiInfoUploadService;
@ -60,19 +61,4 @@ public class PtxhyyHisFileClient implements BaseFileClient {
} }
return ResultVOUtils.success("文件解析成功,正在上传,请稍后刷新查看"); return ResultVOUtils.success("文件解析成功,正在上传,请稍后刷新查看");
} }
@Override
public BaseResponse uploadCorps(List<MultipartFile> files, String thirdSys) {
return null;
}
@Override
public BaseResponse uploadInvPi(List<MultipartFile> files, String thirdSys) {
return null;
}
@Override
public BaseResponse uploadOrders(List<MultipartFile> files, String thirdSys) {
return null;
}
} }

@ -3,6 +3,7 @@ package com.glxp.mipsdl.client.yxzyy;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.BaseHttpClient; import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
@ -139,11 +140,11 @@ public class YxzyyClient implements BaseHttpClient {
BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest); BeanUtil.copyProperties(udiwmsOrderRequest, dsOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数 //查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new QueryWrapper<IoOrderEntity>().eq("billNo", udiwmsOrderRequest.getBillNo())); IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()));
dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime())); dsOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
//查询对应的第三方单据类型 //查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new QueryWrapper<ThrSystemBusApiEntity>().eq("code", udiwmsOrderRequest.getBillType())); ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) { if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!"); return ResultVOUtils.error(500, "接口未配置,无法提交!");
} }
@ -160,12 +161,12 @@ public class YxzyyClient implements BaseHttpClient {
dsOrderRequest.setCorpName(corpName); dsOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) { } else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室 //内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, udiwmsOrderRequest.getCorpId()));
try { try {
//根据第三方系统标识,获取对应字段的值 //根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); dsOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
dsOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); dsOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
@ -184,11 +185,11 @@ public class YxzyyClient implements BaseHttpClient {
} }
//查询仓库信息 //查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try { try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode()); dsOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName()); dsOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
@ -203,7 +204,8 @@ public class YxzyyClient implements BaseHttpClient {
dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode()); dsOrderRequest.setCorpId(dsOrderRequest.getLocStorageCode());
dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName()); dsOrderRequest.setCorpName(dsOrderRequest.getLocStorageName());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>().eq("code", "29").eq("thirdSysFk", thirdSysConfig.getThirdId())); ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
dsOrderRequest.setLocStorageCode("29"); dsOrderRequest.setLocStorageCode("29");
dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName()); dsOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} }
@ -219,14 +221,14 @@ public class YxzyyClient implements BaseHttpClient {
dsOrderRequest.setRemark("udi管理系统提交单据"); dsOrderRequest.setRemark("udi管理系统提交单据");
//组装单据明细数据 //组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new QueryWrapper<IoCodeEntity>() List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq("orderId", orderEntity.getBillNo()) .eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
.ne("action", "StockCheck") .ne(IoCodeEntity::getAction, "StockCheck")
); );
List<UdiwmsOrderDetailRequest> items = new ArrayList<>(); List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情 //查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderEntity.getBillNo())); List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
setOrderDetailList(ioCodeEntities, items, detailBizEntities); setOrderDetailList(ioCodeEntities, items, detailBizEntities);

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.BaseHttpClient; import com.glxp.mipsdl.client.BaseHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
@ -237,9 +238,9 @@ public class ZaxyyClient implements BaseHttpClient {
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId()));
try { try {
//根据第三方系统标识,获取对应字段的值 //根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setCorpId(thrInvWarehouseEntity.getCode()); zaxzyyOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setCorpName(thrInvWarehouseEntity.getName()); zaxzyyOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
@ -260,9 +261,9 @@ public class ZaxyyClient implements BaseHttpClient {
//查询仓库信息 //查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode())); AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", orderEntity.getInvCode()));
try { try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper<ThrInvWarehouseEntity>() ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq("code", authWarehouseService.getThirdInvCode(warehouseEntity)) .eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq("thirdSys", thirdSysConfig.getThirdId())); .eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
zaxzyyOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode()); zaxzyyOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
zaxzyyOrderRequest.setLocInvName(thrInvWarehouseEntity.getName()); zaxzyyOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());

@ -42,7 +42,7 @@ public class HospConfig {
public SysHospConfigEntity getHospConfig() { public SysHospConfigEntity getHospConfig() {
if (null == hospConfig) { if (null == hospConfig) {
log.info("系统启动中,获取医院编码"); log.info("系统启动中,获取医院编码");
SysHospConfigEntity sysHospConfig = hospConfigDao.selectOne(new QueryWrapper<SysHospConfigEntity>().eq("thirdSys", thirdSys)); SysHospConfigEntity sysHospConfig = hospConfigDao.selectOne(new LambdaQueryWrapper<SysHospConfigEntity>().eq(SysHospConfigEntity::getThirdSys, thirdSys));
if (null != sysHospConfig) { if (null != sysHospConfig) {
hospConfig = sysHospConfig; hospConfig = sysHospConfig;
DictUtl.CURRENT_HOSP_CODE = hospConfig.getCode(); DictUtl.CURRENT_HOSP_CODE = hospConfig.getCode();

@ -169,7 +169,7 @@ public class BasicBussinessTypeEntity {
* *
*/ */
@TableField(value = "corpType") @TableField(value = "corpType")
private Boolean corpType; private Integer corpType;
/** /**
* *

@ -1,11 +1,11 @@
package com.glxp.mipsdl.entity.thrsys; package com.glxp.mipsdl.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
@TableName(value = "thr_inv_warehouse") @TableName(value = "thr_inv_warehouse")
public class ThrInvWarehouseEntity { public class ThrInvWarehouseEntity {
@ -27,4 +27,7 @@ public class ThrInvWarehouseEntity {
@TableField(value = "thirdSysFk") @TableField(value = "thirdSysFk")
private String thirdSysFk; private String thirdSysFk;
@TableField(value = "updateTime")
private Date updateTime;
} }

@ -2,6 +2,7 @@ package com.glxp.mipsdl.service.thrsys;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.config.ThirdSysConfig; import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao; import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
@ -35,14 +36,14 @@ public class ThrProductService {
*/ */
private ThrProductsEntity getThrProduct(String relId) { private ThrProductsEntity getThrProduct(String relId) {
if (StrUtil.isNotBlank(relId)) { if (StrUtil.isNotBlank(relId)) {
BasicUdirelEntity basicUdirelEntity = basicUdirelDao.selectOne(new QueryWrapper<BasicUdirelEntity>().eq("id", relId)); BasicUdirelEntity basicUdirelEntity = basicUdirelDao.selectOne(new LambdaQueryWrapper<BasicUdirelEntity>().eq(BasicUdirelEntity::getId, relId));
if (null != basicUdirelEntity) { if (null != basicUdirelEntity) {
try { try {
String code = (String) ReflectUtil.getFieldValue(basicUdirelEntity, basicUdirelEntity.getClass().getField(thirdSysConfig.getThirdId())); String code = (String) ReflectUtil.getFieldValue(basicUdirelEntity, basicUdirelEntity.getClass().getField(thirdSysConfig.getThirdId()));
if (StrUtil.isBlank(code)) { if (StrUtil.isBlank(code)) {
log.error("第三方产品信息未关联,查询失败,产品编码:{}", relId); log.error("第三方产品信息未关联,查询失败,产品编码:{}", relId);
} else { } else {
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new QueryWrapper<ThrProductsEntity>().eq("code", code)); ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper<ThrProductsEntity>().eq(ThrProductsEntity::getCode, code));
log.info("查询第三方系统产品信息成功,产品编码:{},产品名称:{}UDI管理系统产品编码{}", thrProductsEntity.getCode(), thrProductsEntity.getName(), relId); log.info("查询第三方系统产品信息成功,产品编码:{},产品名称:{}UDI管理系统产品编码{}", thrProductsEntity.getCode(), thrProductsEntity.getName(), relId);
return thrProductsEntity; return thrProductsEntity;
} }

@ -57,7 +57,7 @@ public class DateUtil {
* yyyy-MM-dd HH:mm:ss * yyyy-MM-dd HH:mm:ss
*/ */
public static String formatDateTime(Date date) { public static String formatDateTime(Date date) {
Date currentTime = new Date(); Date currentTime = date;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime); String dateString = formatter.format(currentTime);
return dateString; return dateString;

Loading…
Cancel
Save