领用出库,udi国家库切换到本地查询

master
anthonyywj2 3 years ago
parent c1960486af
commit 49dc552120

@ -8,17 +8,21 @@ import com.glxp.sale.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.sale.admin.entity.basic.UdiCompanyEntity;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.sale.admin.entity.udid.UdiEntity;
import com.glxp.sale.admin.httpclient.ErpBasicClient;
import com.glxp.sale.admin.req.basic.FilterErpGoodsRequest;
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.req.thrsys.FilterThrProductsRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.basic.ErpProductsResponse;
import com.glxp.sale.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.sale.admin.service.basic.UdiInfoService;
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
import com.glxp.sale.admin.service.receipt.SyncUdiService;
import com.glxp.sale.admin.service.thrsys.ThrProductsService;
import com.glxp.sale.admin.util.FilterUdiUtils;
import com.glxp.sale.admin.util.HttpClient;
@ -35,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -51,55 +56,60 @@ public class UdiInfoController {
BasicThirdSysDetailService basicThirdSysDetailService;
@Resource
private ThrProductsService thrProductsService;
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
private ErpBasicClient erpBasicClient;
@Resource
HttpClient httpClient;
@Resource
SyncUdiService syncUdiService;
//获取同步库UDI信息
@AuthRuleAnnotation("")
@GetMapping("udiwms/udiinfo/filterUdi")
public BaseResponse filterUdi(FilterUdiInfoRequest productInfoFilterRequest) {
public BaseResponse filterUdi(FilterUdiInfoRequest filterUdiInfoRequest) {
Map<String, Object> paramMap = new HashMap<>(16);
String nameCode = null;
if (productInfoFilterRequest.getUdiCode() != null && !productInfoFilterRequest.getUdiCode().equals("")) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(productInfoFilterRequest.getUdiCode());
if (filterUdiInfoRequest.getUdiCode() != null && !filterUdiInfoRequest.getUdiCode().equals("")) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiInfoRequest.getUdiCode());
if (udiEntity != null) {
nameCode = udiEntity.getUdi();
} else {
return ResultVOUtils.error(500, "无效UDI码");
}
// paramMap.put("udiCode", productInfoFilterRequest.getUdiCode());
} else
nameCode = productInfoFilterRequest.getNameCode();
paramMap.put("page", productInfoFilterRequest.getPage());
paramMap.put("limit", productInfoFilterRequest.getLimit());
paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc());
paramMap.put("nameCode", nameCode);
paramMap.put("ggxh", productInfoFilterRequest.getGgxh());
paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh());
paramMap.put("uuid", productInfoFilterRequest.getUuid());
String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterUdi", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiInfoEntity>>>() {
});
nameCode = filterUdiInfoRequest.getNameCode();
// paramMap.put("page", productInfoFilterRequest.getPage());
// paramMap.put("limit", productInfoFilterRequest.getLimit());
// paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
// paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc());
// paramMap.put("nameCode", nameCode);
// paramMap.put("ggxh", productInfoFilterRequest.getGgxh());
// paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh());
// paramMap.put("uuid", productInfoFilterRequest.getUuid());
if (productInfoFilterRequest.getIsCheck() != null && productInfoFilterRequest.getIsCheck()) {
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData().getList();
if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
for (UdiInfoEntity udiInfoEntity : udiInfoEntities) {
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiInfoEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
BeanUtils.copyProperties(filterUdiInfoRequest, productInfoFilterRequest);
productInfoFilterRequest.setNameCode(nameCode);
// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterUdi", paramMap);
try {
// BaseResponse<PageSimpleResponse<UdiInfoEntity>> udiDlDeviceResponse =
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiInfoEntity>>>() {
// });
BaseResponse<PageSimpleResponse<ProductInfoEntity>> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest);
if (filterUdiInfoRequest.getIsCheck() != null && filterUdiInfoRequest.getIsCheck()) {
List<ProductInfoEntity> productInfoEntities = udiDlDeviceResponse.getData().getList();
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
if (productInfoEntities != null && productInfoEntities.size() > 0) {
for (ProductInfoEntity productInfoEntity : productInfoEntities) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(productInfoEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
BeanUtils.copyProperties(productInfoEntity, udiInfoEntity);
for (UdiRelevanceEntity udiRelevanceEntity : udiRelevanceEntities) {
if (udiRelevanceEntity.getThirdId() == null &&
udiRelevanceEntity.getThirdId2() == null && udiRelevanceEntity.getThirdId1() == null &&
@ -114,11 +124,10 @@ public class UdiInfoController {
} else {
udiInfoEntity.setCheck(false);
}
udiInfoEntities.add(udiInfoEntity);
}
}
}
return udiDlDeviceResponse;
} catch (Exception e) {
e.printStackTrace();
@ -130,16 +139,19 @@ public class UdiInfoController {
//获取同步库医疗器械注册人信息
@AuthRuleAnnotation("")
@GetMapping("udiwms/udiinfo/filterCompany")
public BaseResponse filterCompany(FilterUdiInfoRequest productInfoFilterRequest) {
public BaseResponse filterCompany(UdiCompanyRequest udiCompanyRequest) {
Map<String, Object> paramMap = new HashMap<>(16);
paramMap.put("page", productInfoFilterRequest.getPage());
paramMap.put("limit", productInfoFilterRequest.getLimit());
paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
// Map<String, Object> paramMap = new HashMap<>(16);
// paramMap.put("page", productInfoFilterRequest.getPage());
// paramMap.put("limit", productInfoFilterRequest.getLimit());
// paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc());
String response = httpClient.mipsGetHead(udiUrl + "/udi/company/filter", paramMap);
// String response = httpClient.mipsGetHead(udiUrl + "/udi/company/filter", paramMap);
try {
BaseResponse<PageSimpleResponse<UdiCompanyEntity>> udiDlDeviceResponse = (BaseResponse<PageSimpleResponse<UdiCompanyEntity>>) JSONObject.parseObject(response, BaseResponse.class);
BaseResponse<PageSimpleResponse<UdiCompanyEntity>> udiDlDeviceResponse = syncUdiService.filterCompany(udiCompanyRequest);
// BaseResponse<PageSimpleResponse<UdiCompanyEntity>> udiDlDeviceResponse = (BaseResponse<PageSimpleResponse<UdiCompanyEntity>>) JSONObject.parseObject(response, BaseResponse.class);
return udiDlDeviceResponse;
} catch (Exception e) {
e.printStackTrace();

@ -56,8 +56,6 @@ import java.util.stream.Collectors;
@RestController
public class UdiRelevanceController {
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
UdiDlHttpClient udiDlHttpClient;
@Resource

@ -577,6 +577,14 @@ public class StockOrderController {
return ResultVOUtils.success(billNo);
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/stock/order/generateBillNoInt")
public BaseResponse generateBillNoInt(@RequestParam("action") String action) {
String billNo = CustomUtil.getId();
return ResultVOUtils.success(billNo);
}
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();

@ -22,6 +22,7 @@ import com.glxp.sale.admin.service.inout.OrderDetailService;
import com.glxp.sale.admin.service.inout.OrderService;
import com.glxp.sale.admin.thread.InvProductsTrService;
import com.glxp.sale.admin.thread.IoTransInoutService;
import com.glxp.sale.admin.thread.UdiDlHttpClient;
import com.glxp.sale.admin.util.FilterUdiUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -47,6 +48,8 @@ public class ContrastErpUtil {
UdiRelevanceService udiRelevanceService;
@Resource
private OrderDetailService myErpOrderService;
@Resource
UdiDlHttpClient udiDlHttpClient;
public ContrastErpUtil() {
@ -125,7 +128,7 @@ public class ContrastErpUtil {
//
// }
UdiInfoEntity udiInfoEntity = null;
udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService,udiRelevanceService, warehouseEntity.getCode());
udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode(),udiDlHttpClient);
if (warehouseEntity.getCount() > 1) {
udiInfoEntity.setCount(warehouseEntity.getCount());
}
@ -176,7 +179,7 @@ public class ContrastErpUtil {
}
if (errorData.size() > 0) {
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, errorData);
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, errorData,udiDlHttpClient);
}
}

@ -1,14 +1,12 @@
package com.glxp.sale.admin.controller.inout.utils;
import com.glxp.sale.admin.constant.ConstantType;
import com.glxp.sale.admin.entity.basic.BasicInstrumentMaintainRelevanceEntity;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.entity.inout.ErpOrderEntity;
import com.glxp.sale.admin.entity.inout.WarehouseEntity;
import com.glxp.sale.admin.entity.udid.UdiEntity;
import com.glxp.sale.admin.httpclient.UdiDlHttpClient;
import com.glxp.sale.admin.req.param.SystemParamConfigRequest;
import com.glxp.sale.admin.res.basic.UdiRelevanceResponse;
import com.glxp.sale.admin.service.basic.UdiInfoService;
@ -16,6 +14,7 @@ import com.glxp.sale.admin.service.basic.UdiRelevanceService;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
import com.glxp.sale.admin.service.inout.CodesService;
import com.glxp.sale.admin.service.inout.OrderDetailService;
import com.glxp.sale.admin.thread.UdiDlHttpClient;
import com.glxp.sale.admin.util.DateUtil;
import com.glxp.sale.admin.util.FilterUdiUtils;
import org.springframework.beans.BeanUtils;
@ -168,12 +167,12 @@ public class InoutUtils {
}
public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code) {
public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code, UdiDlHttpClient udiDlHttpClient) {
String prefix;
prefix = FilterUdiUtils.getDiStr(code);
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(prefix);
if (udiInfoEntity == null) {
List<UdiInfoEntity> froms = new UdiDlHttpClient(udiUrl).getUdiByDi(prefix);
List<UdiInfoEntity> froms = udiDlHttpClient.getUdiByDi(prefix);
if (froms != null && !froms.isEmpty()) {
udiInfoService.insertUdiInfos(froms);
udiInfoEntity = udiInfoService.findByNameCode(prefix);
@ -196,7 +195,7 @@ public class InoutUtils {
}
public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code) {
public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code,UdiDlHttpClient udiDlHttpClient) {
String prefix;
prefix = FilterUdiUtils.getDiStr(code);
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
@ -208,7 +207,7 @@ public class InoutUtils {
udiRelevanceResponse = udiRelevanceResponses.get(0);
}
if (udiRelevanceResponse == null) {
udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, code);
udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, code,udiDlHttpClient);
} else {
BeanUtils.copyProperties(udiRelevanceResponse, udiInfoEntity);
udiInfoEntity.setRelId(udiRelevanceResponse.getId() + "");
@ -225,12 +224,12 @@ public class InoutUtils {
public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService,
OrderDetailService orderDetailService,
List<WarehouseEntity> warehouseEntityList) {
List<WarehouseEntity> warehouseEntityList,UdiDlHttpClient udiDlHttpClient) {
if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
for (WarehouseEntity warehouseEntity : warehouseEntityList) {
UdiInfoEntity udiInfoEntity = null;
udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode());
udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode(),udiDlHttpClient);
if (udiInfoEntity != null) {
udiInfoEntity.setCount(getActCount(warehouseEntity, udiRelevanceService) * warehouseEntity.getCount());
udiInfoEntity.setRelId(warehouseEntity.getRelId());

@ -53,13 +53,19 @@ public class ThrOrderReceiveController {
}
Integer userId = customerService.getUserId();
ThrOrderEntity stockOrderEntity = new ThrOrderEntity();
// Integer id = Integer.parseInt(CustomUtil.getId());
BeanUtils.copyProperties(stockOrderPostRequest, stockOrderEntity);
stockOrderEntity.setCreateUser(userId + "");
stockOrderEntity.setType(1);//领用单据
stockOrderEntity.setUpdateTime(new Date());
stockOrderEntity.setBilldate(DateUtil.formatDate(new Date()));
stockOrderEntity.setBillNo(CustomUtil.getId() + "");
// stockOrderEntity.setId(id);
ThrOrderEntity temp = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), stockOrderEntity.getThirdSysFk());
if (temp != null) {
stockOrderEntity.setId(temp.getId());
}
thrOrderService.insertThrOrder(stockOrderEntity);
stockOrderEntity = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), null);
stockOrderEntity = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), stockOrderEntity.getThirdSysFk());
if (stockOrderPostRequest.getSubErpOrders() != null) {
List<StockOrderDetailEntity> stockOrderDetailEntityList = stockOrderPostRequest.getSubErpOrders();

@ -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;
}
}
}

@ -17,6 +17,7 @@ public class ErpOrderResponse {
private String customerId;
private String originType;
private String locStorageCode;
private String thirdSysFk;
private List<SubErpOrder> subErpOrders;
//增加字段
@ -224,6 +225,14 @@ public class ErpOrderResponse {
this.locStorageCode = locStorageCode;
}
public String getThirdSysFk() {
return thirdSysFk;
}
public void setThirdSysFk(String thirdSysFk) {
this.thirdSysFk = thirdSysFk;
}
public static class SubErpOrder {
private String productId;
private String productName;

@ -4,21 +4,15 @@ import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.constant.ConstantStatus;
import com.glxp.sale.admin.dao.basic.UdiRelevanceDao;
import com.glxp.sale.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.sale.admin.httpclient.UdiDlHttpClient;
import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.sale.admin.res.basic.UdiRelevanceResponse;
import com.glxp.sale.admin.service.basic.BasicThirdSysService;
import com.glxp.sale.admin.service.basic.UdiInfoService;
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
import com.glxp.sale.admin.util.DateUtil;
import com.glxp.sale.admin.util.FilterUdiUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@ -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);
}
}

@ -1,8 +1,11 @@
package com.glxp.sale.admin.thread;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.sale.admin.entity.basic.UdiCompanyEntity;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.util.HttpClient;
import com.glxp.sale.common.res.BaseResponse;
@ -19,7 +22,13 @@ public class AsyncDiDlHelper {
paramMap.put("updateTime", updateTime);
String response = HttpClient.mipsGet(udiUrl + "/udidl/udiwms/syncUdi", paramMap);
try {
BaseResponse<List<ProductInfoEntity>> udiDlDeviceResponse = (BaseResponse<List<ProductInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
// BaseResponse<List<ProductInfoEntity>> udiDlDeviceResponse = (BaseResponse<List<ProductInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
BaseResponse<List<ProductInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<ProductInfoEntity>>>() {
});
List<ProductInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
return udiInfoEntities;
} catch (Exception e) {
@ -36,7 +45,14 @@ public class AsyncDiDlHelper {
paramMap.put("updateTime", updateTime);
String response = HttpClient.mipsGet(udiUrl + "/udidl/udiwms/syncCompany", paramMap);
try {
BaseResponse<List<UdiCompanyEntity>> baseResponse = (BaseResponse<List<UdiCompanyEntity>>) JSONObject.parseObject(response, BaseResponse.class);
// BaseResponse<List<UdiCompanyEntity>> baseResponse = (BaseResponse<List<UdiCompanyEntity>>) JSONObject.parseObject(response, BaseResponse.class);
BaseResponse<List<UdiCompanyEntity>> baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<UdiCompanyEntity>>>() {
});
List<UdiCompanyEntity> udiCompanyEntities = baseResponse.getData();
return udiCompanyEntities;
} catch (Exception e) {

@ -41,8 +41,6 @@ public class BasicUdiInfoImportService {
UdiRelevanceService udiRelevanceService;
@Resource
ThrDataService thrDataService;
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
SystemParamConfigService systemParamConfigService;
@Resource

@ -112,6 +112,8 @@ public class IoTransInoutService {
InvProductService invProductService;
@Resource
InvPreProductService invPreProductService;
@Resource
UdiDlHttpClient udiDlHttpClient;
//web端新增订单
@Async
@ -729,7 +731,7 @@ public class IoTransInoutService {
}
public void genOrderDetail(List<WarehouseEntity> warehouseEntityList) {
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, warehouseEntityList);
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, warehouseEntityList,udiDlHttpClient);
}

@ -3,7 +3,6 @@ package com.glxp.sale.admin.thread;
import com.glxp.sale.admin.dao.info.ScheduledDao;
import com.glxp.sale.admin.entity.info.ScheduledEntity;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.httpclient.UdiDlHttpClient;
import com.glxp.sale.admin.req.udid.ScheduledRequest;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
import org.slf4j.Logger;
@ -15,7 +14,6 @@ import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
@EnableScheduling

@ -3,68 +3,112 @@ package com.glxp.sale.admin.thread;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest;
import com.glxp.sale.admin.service.receipt.ProductInfoService;
import com.glxp.sale.admin.util.BeanUtils;
import com.glxp.sale.admin.util.HttpClient;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* UDI
*/
@Service
public class UdiDlHttpClient {
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Resource
HttpClient httpClient;
ProductInfoService productInfoService;
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.mipsGetHead(udiUrl + "/udidl/device/filterByUuid", paramMap);
try {
// BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse = (BaseResponse<List<UdiInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<UdiInfoEntity>>>() {
});
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setPage(1);
productInfoFilterRequest.setLimit(100);
productInfoFilterRequest.setUuid(uuid);
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
return udiInfoEntities;
} catch (Exception e) {
e.printStackTrace();
return null;
List<ProductInfoEntity> productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
for (ProductInfoEntity productInfoEntity : productInfoEntityList) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
BeanUtils.copyProperties(productInfoEntity, udiInfoEntity);
udiInfoEntities.add(udiInfoEntity);
}
return udiInfoEntities;
//
// Map<String, Object> paramMap = new HashMap<>(16);
// paramMap.put("page", 1);
// paramMap.put("limit", 100);
// paramMap.put("uuid", uuid);
// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByUuid", paramMap);
// try {
//// BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse = (BaseResponse<List<UdiInfoEntity>>) JSONObject.parseObject(response, BaseResponse.class);
//
// 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;
// }
}
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.mipsGetHead(udiUrl + "/udidl/device/filterByNameCode", paramMap);
try {
BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<UdiInfoEntity>>>() {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setPage(1);
productInfoFilterRequest.setLimit(100);
productInfoFilterRequest.setNameCode(key);
});
if (udiDlDeviceResponse != null && udiDlDeviceResponse.getCode() == 20000) {
List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
return udiInfoEntities;
List<ProductInfoEntity> productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
Map<String, List<ProductInfoEntity>> listMap = productInfoEntityList.stream().collect(Collectors.groupingBy(ProductInfoEntity::getUuid));
List<ProductInfoEntity> result = null;
for (List<ProductInfoEntity> value : listMap.values()) {
if (result == null || value.get(0).getVersionNumber() > result.get(0).getVersionNumber()) {
result = value;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
productInfoFilterRequest.setNameCode(null);
productInfoFilterRequest.setUuid(result.get(0).getUuid());
List<ProductInfoEntity> datas = productInfoService.findAll(productInfoFilterRequest);
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
for (ProductInfoEntity productInfoEntity : datas) {
UdiInfoEntity udiInfoEntity = new UdiInfoEntity();
BeanUtils.copyProperties(productInfoEntity, udiInfoEntity);
udiInfoEntities.add(udiInfoEntity);
}
return udiInfoEntities;
// Map<String, Object> paramMap = new HashMap<>(16);
// paramMap.put("page", 1);
// paramMap.put("limit", 100);
// paramMap.put("nameCode", key);
// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByNameCode", paramMap);
// try {
// BaseResponse<List<UdiInfoEntity>> udiDlDeviceResponse =
// JSONObject.parseObject(response, new TypeReference<BaseResponse<List<UdiInfoEntity>>>() {
//
// });
// if (udiDlDeviceResponse != null && udiDlDeviceResponse.getCode() == 20000) {
// List<UdiInfoEntity> udiInfoEntities = udiDlDeviceResponse.getData();
// return udiInfoEntities;
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// return null;
// }
// return null;
}
}

@ -41,6 +41,9 @@
<if test="editStatus != '' and editStatus != null">
AND editStatus = #{editStatus}
</if>
<!-- <if test="editStatus == '' or editStatus == null">-->
<!-- and `editStatus` <![CDATA[ <> ]]> 1-->
<!-- </if>-->
</where>
ORDER BY updateTime DESC
</select>
@ -49,10 +52,11 @@
<insert id="insertThrOrder" keyProperty="id" parameterType="com.glxp.sale.admin.entity.thrsys.ThrOrderEntity">
replace
INTO thr_order
(billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk,
(id,billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk,
startDate, endDate, createUser, reviewUser, address, linkMan, linkTel, remark, remark1, remark2,
remark3,locStorageCode,editStatus)
values (
#{id},
#{billNo},
#{billdate},
#{corpId},

Loading…
Cancel
Save