领用出库,udi国家库切换到本地查询
parent
c1960486af
commit
49dc552120
@ -1,57 +0,0 @@
|
||||
package com.glxp.sale.admin.httpclient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
||||
import com.glxp.sale.admin.util.HttpClient;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取国家UDI同步库信息
|
||||
*/
|
||||
public class UdiDlHttpClient {
|
||||
String udiUrl;
|
||||
|
||||
public UdiDlHttpClient(String udiUrl) {
|
||||
this.udiUrl = udiUrl;
|
||||
}
|
||||
|
||||
public List<UdiInfoEntity> getUdiByUuid(String uuid) {
|
||||
Map<String, Object> paramMap = new HashMap<>(16);
|
||||
paramMap.put("page", 1);
|
||||
paramMap.put("limit", 100);
|
||||
paramMap.put("uuid", uuid);
|
||||
String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterByUuid", paramMap);
|
||||
try {
|
||||
BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse = (BaseResponse<List<UdiInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
|
||||
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
|
||||
return udiInfoEntities;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<UdiInfoEntity> getUdiByDi(String key) {
|
||||
Map<String, Object> paramMap = new HashMap<>(16);
|
||||
paramMap.put("page", 1);
|
||||
paramMap.put("limit", 100);
|
||||
paramMap.put("nameCode", key);
|
||||
String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterByNameCode", paramMap);
|
||||
try {
|
||||
BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse =
|
||||
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<UdiInfoEntity>>>() {
|
||||
|
||||
});
|
||||
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
|
||||
return udiInfoEntities;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.glxp.sale.admin.service.receipt;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.sale.admin.entity.basic.UdiCompanyEntity;
|
||||
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
|
||||
import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest;
|
||||
import com.glxp.sale.admin.req.basic.UdiCompanyRequest;
|
||||
import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest;
|
||||
import com.glxp.sale.admin.res.PageSimpleResponse;
|
||||
import com.glxp.sale.admin.service.basic.UdiCompanyService;
|
||||
import com.glxp.sale.common.enums.ResultEnum;
|
||||
import com.glxp.sale.common.res.BaseResponse;
|
||||
import com.glxp.sale.common.util.ResultVOUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SyncUdiService {
|
||||
|
||||
|
||||
@Resource
|
||||
ProductInfoService productInfoService;
|
||||
@Resource
|
||||
UdiCompanyService udiCompanyService;
|
||||
|
||||
public BaseResponse filterUdi(ProductInfoFilterRequest productInfoFilterRequest) {
|
||||
|
||||
//过滤--1.参数不能全未空
|
||||
if ((productInfoFilterRequest.getYlqxzcrbarmc() == null || productInfoFilterRequest.getYlqxzcrbarmc().equals("")) &&
|
||||
(productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals("")) &&
|
||||
(productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals("")) &&
|
||||
(productInfoFilterRequest.getGgxh() == null || productInfoFilterRequest.getGgxh().equals("")) &&
|
||||
(productInfoFilterRequest.getUuid() == null || productInfoFilterRequest.getUuid().equals("")) &&
|
||||
(productInfoFilterRequest.getZczbhhzbapzbh() == null || productInfoFilterRequest.getZczbhhzbapzbh().equals("")) &&
|
||||
(productInfoFilterRequest.getDeviceRecordKey() == null || productInfoFilterRequest.getDeviceRecordKey().equals(""))
|
||||
) {
|
||||
return ResultVOUtils.error(500, "参数不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(productInfoFilterRequest.getYlqxzcrbarmc()) &&
|
||||
StrUtil.isEmpty(productInfoFilterRequest.getCpmctymc())
|
||||
&& StrUtil.isEmpty(productInfoFilterRequest.getNameCode())
|
||||
&& StrUtil.isEmpty(productInfoFilterRequest.getGgxh())
|
||||
&& StrUtil.isEmpty(productInfoFilterRequest.getUuid())
|
||||
&& StrUtil.isEmpty(productInfoFilterRequest.getZczbhhzbapzbh()))
|
||||
|
||||
|
||||
if (productInfoFilterRequest.getNameCode() != null && !productInfoFilterRequest.getNameCode().equals("") && productInfoFilterRequest.getNameCode().length() < 10) {
|
||||
return ResultVOUtils.error(500, "请输入完整的最小销售单元标识!");
|
||||
}
|
||||
|
||||
if (productInfoFilterRequest.getYlqxzcrbarmc() != null && !productInfoFilterRequest.getYlqxzcrbarmc().equals("") && productInfoFilterRequest.getYlqxzcrbarmc().length() < 4) {
|
||||
return ResultVOUtils.error(500, "请输入完整的医疗器械注册备案人名称!");
|
||||
}
|
||||
|
||||
|
||||
if ((productInfoFilterRequest.getYlqxzcrbarmc() == null || productInfoFilterRequest.getYlqxzcrbarmc().equals(""))
|
||||
&& (productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals(""))
|
||||
&& (productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals(""))
|
||||
|
||||
) {
|
||||
if (productInfoFilterRequest.getGgxh() != null && !productInfoFilterRequest.getGgxh().equals("")) {
|
||||
return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称");
|
||||
}
|
||||
if (productInfoFilterRequest.getZczbhhzbapzbh() != null && !productInfoFilterRequest.getZczbhhzbapzbh().equals("")) {
|
||||
return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称");
|
||||
}
|
||||
}
|
||||
|
||||
// if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("")) {
|
||||
// return ResultVOUtils.error(500, "请输入完整的产品通用名称!");
|
||||
// }
|
||||
productInfoFilterRequest.setIsNewest(1);
|
||||
productInfoFilterRequest.setDiType("1");
|
||||
List<ProductInfoEntity> productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest);
|
||||
PageInfo<ProductInfoEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(productInfoEntityList);
|
||||
PageSimpleResponse<ProductInfoEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(productInfoEntityList);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public BaseResponse filterCompany(@Valid UdiCompanyRequest udiCompanyRequest) {
|
||||
|
||||
List<UdiCompanyEntity> udiCompanyEntities = udiCompanyService.filterUdiCompany(udiCompanyRequest);
|
||||
return ResultVOUtils.success(udiCompanyEntities);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue