|
|
|
@ -19,6 +19,8 @@ import com.glxp.api.req.collect.CollectOrderRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.FilterThrOrderRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -29,6 +31,7 @@ import java.util.List;
|
|
|
|
|
/**
|
|
|
|
|
* 下载工厂
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
public class DownloadFactory {
|
|
|
|
|
|
|
|
|
@ -49,25 +52,21 @@ public class DownloadFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (busType.startsWith("YPCF")) {
|
|
|
|
|
return this.downloadErpOrder(collectOrderRequest,"YPCF");
|
|
|
|
|
} else
|
|
|
|
|
if (busType.equals(BusTypeConstant.QXCF001.getBusType())) {
|
|
|
|
|
return this.downloadErpOrder(collectOrderRequest,BusTypeConstant.QXCF001.getBusType());
|
|
|
|
|
} else
|
|
|
|
|
if (busType.contains("SC")) {
|
|
|
|
|
return this.downloadErpOrder(collectOrderRequest, "YPCF");
|
|
|
|
|
} else if (busType.equals(BusTypeConstant.QXCF001.getBusType())) {
|
|
|
|
|
return this.downloadErpOrder(collectOrderRequest, BusTypeConstant.QXCF001.getBusType());
|
|
|
|
|
} else if (busType.contains("SC")) {
|
|
|
|
|
return ioCollectOrderService.importUdi(collectOrderRequest);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
return this.downloadErpThrOrder(collectOrderRequest);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ErpBasicClient erpBasicClient;
|
|
|
|
|
|
|
|
|
|
public BaseResponse downloadErpOrder(CollectOrderRequest collectOrderRequest,String busType) {
|
|
|
|
|
public BaseResponse downloadErpOrder(CollectOrderRequest collectOrderRequest, String busType) {
|
|
|
|
|
|
|
|
|
|
int page = 1;
|
|
|
|
|
int limit = 100;
|
|
|
|
@ -87,14 +86,11 @@ public class DownloadFactory {
|
|
|
|
|
getSickPrescribeRequest.setPage(page);
|
|
|
|
|
BaseResponse<PageSimpleResponse<IoCollectOrder>> baseResponse = new BaseResponse<>();
|
|
|
|
|
|
|
|
|
|
if (busType.equals(BusTypeConstant.QXCF001.getBusType())){
|
|
|
|
|
if (busType.equals(BusTypeConstant.QXCF001.getBusType())) {
|
|
|
|
|
baseResponse = erpBasicClient.getPrescribeQx(getSickPrescribeRequest);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
baseResponse = erpBasicClient.getPrescribeV2(getSickPrescribeRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: 2024/9/11 添加一张中间表(io_collect_order_origin)原始表做为转换
|
|
|
|
|
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
list = baseResponse.getData().getList();
|
|
|
|
|
if (list == null) {
|
|
|
|
@ -107,10 +103,10 @@ public class DownloadFactory {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "下载第三方系统产品信息异常");
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
log.error(ExceptionUtils.getStackTrace(e));
|
|
|
|
|
return ResultVOUtils.error(500, e.getMessage());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -121,8 +117,6 @@ public class DownloadFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse downloadErpThrOrder(CollectOrderRequest collectOrderRequest) {
|
|
|
|
|
int page = 1;
|
|
|
|
|
int limit = 100;
|
|
|
|
@ -143,7 +137,6 @@ public class DownloadFactory {
|
|
|
|
|
if (list == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "未查到此业务单据");
|
|
|
|
|
}
|
|
|
|
|
// TODO: 2024/9/11 2024/9/11 添加一张中间表(io_collect_order_origin)原始表做为转换
|
|
|
|
|
importThrOrder(list, collectOrderRequest);
|
|
|
|
|
if ((list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) || IntUtil.value(baseResponse.getData().getTotal()) == -555) {
|
|
|
|
|
page++;
|
|
|
|
@ -151,7 +144,7 @@ public class DownloadFactory {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "下载第三方系统产品信息异常");
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("下载成功");
|
|
|
|
@ -209,17 +202,12 @@ public class DownloadFactory {
|
|
|
|
|
if (exactMatches.isEmpty()) {
|
|
|
|
|
errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";");
|
|
|
|
|
}
|
|
|
|
|
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceDao.selectOne(new LambdaQueryWrapper<UdiRelevanceEntity>().eq(UdiRelevanceEntity::getUuid, exactMatches.get(0).getUuid()).last("limit 1"));
|
|
|
|
|
// if (udiRelevanceEntity != null) {
|
|
|
|
|
// collectOrderBiz.setRelId(udiRelevanceEntity.getId());
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(new LambdaQueryWrapper<BasicProductsEntity>().eq(BasicProductsEntity::getYbbm, entity.getYbbm()).last("limit 1"));
|
|
|
|
|
if (basicProductsEntity == null || StrUtil.isEmpty(basicProductsEntity.getNameCode())) {
|
|
|
|
|
errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
collectOrderBiz.setTagStatus(1);
|
|
|
|
|
collectOrderBiz.setUnTagCount(0);
|
|
|
|
|
bizList.add(collectOrderBiz);
|
|
|
|
@ -251,7 +239,7 @@ public class DownloadFactory {
|
|
|
|
|
ioCollectOrder.setBizList(bizList);
|
|
|
|
|
ioCollectOrderList.add(ioCollectOrder);
|
|
|
|
|
}
|
|
|
|
|
collectOrderService.importPrescribe(ioCollectOrderList, collectOrderRequest );
|
|
|
|
|
collectOrderService.importPrescribe(ioCollectOrderList, collectOrderRequest);
|
|
|
|
|
return ResultVOUtils.success("下载成功");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error("下载失败");
|
|
|
|
|