From 94759bc1448e84871953bb61214421c11e6acef9 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Fri, 12 Aug 2022 15:59:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96=E9=87=8D?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/device/DeviceController.java | 62 +--- .../device/DownloadDeviceHelper.java | 322 ------------------ .../device/PosTaggerController.java | 4 +- .../device/ProductInfoController.java | 78 +++-- .../device/UdiCompanyController.java | 5 +- .../inout/impl/ProductInfoServiceImpl.java | 1 - .../glxp/udidl/admin/util/FilterUdiUtils.java | 22 ++ 7 files changed, 86 insertions(+), 408 deletions(-) delete mode 100644 src/main/java/com/glxp/udidl/admin/controller/device/DownloadDeviceHelper.java diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/DeviceController.java b/src/main/java/com/glxp/udidl/admin/controller/device/DeviceController.java index 9ba2060..43d5599 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/DeviceController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/DeviceController.java @@ -1,18 +1,15 @@ package com.glxp.udidl.admin.controller.device; -import com.github.pagehelper.PageInfo; +import cn.hutool.core.util.StrUtil; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; -import com.glxp.udidl.admin.dao.udid.DevicedownloadMapper; -import com.glxp.udidl.admin.entity.udid.*; +import com.glxp.udidl.admin.entity.udid.Device; +import com.glxp.udidl.admin.entity.udid.DeviceEntity; import com.glxp.udidl.admin.enums.ResultEnum; -import com.glxp.udidl.admin.req.udid.*; +import com.glxp.udidl.admin.req.udid.DeviceListRequest; +import com.glxp.udidl.admin.req.udid.DeviceSearchRequest; import com.glxp.udidl.admin.res.BaseResponse; import com.glxp.udidl.admin.res.PageSimpleResponse; -import com.glxp.udidl.admin.res.udid.ProgressResponse; -import com.glxp.udidl.admin.service.info.CompanyService; import com.glxp.udidl.admin.service.inout.DeviceService; -import com.glxp.udidl.admin.service.inout.ProductInfoService; -import com.glxp.udidl.admin.service.udi.UdiCompanyService; import com.glxp.udidl.admin.util.FilterUdiUtils; import com.glxp.udidl.admin.util.ResultVOUtils; import io.swagger.annotations.Api; @@ -20,8 +17,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -38,42 +33,7 @@ public class DeviceController { @Resource private DeviceService deviceService; - @Resource - private DevicedownloadMapper devicedownloadMapper; - @ApiOperation(value = "查询医疗器械信息", response = DeviceEntity.class) - @AuthRuleAnnotation("warehouse/device/list") - @GetMapping("warehouse/device/list") - public BaseResponse listDevices(@Valid DeviceListRequest deviceListRequest, BindingResult bindingResult) { - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); - } - - String key = deviceListRequest.getKey(); - boolean isScan = false; - if (key != null) { - key = FilterUdiUtils.getDiStr(key); - deviceListRequest.setKey(key); - isScan = true; - } - List medicalResonseList = deviceService.listDevices(deviceListRequest); - long total = 0; - PageInfo pageInfo = new PageInfo<>(medicalResonseList); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - List devicedownloads = devicedownloadMapper.selectByExample(new DevicedownloadExample()); - Devicedownload devicedownload; - if (devicedownloads != null && devicedownloads.size() > 0) { - devicedownload = devicedownloads.get(0); - total = devicedownload.getAlltotal() - devicedownload.getAllindex(); - } - if (isScan) { - total = 20; - pageSimpleResponse.setTotal(total); - } else - pageSimpleResponse.setTotal(total * 10); - pageSimpleResponse.setList(medicalResonseList); - return ResultVOUtils.success(pageSimpleResponse); - } @ApiOperation(value = "根据关键字查询医疗器械信息", response = DeviceEntity.class) @AuthRuleAnnotation("warehouse/device/search") @@ -85,10 +45,12 @@ public class DeviceController { } String key = deviceListRequest.getKey(); - if (key != null) { - key = FilterUdiUtils.getDiStr(key); - deviceListRequest.setKey(key); + + if (FilterUdiUtils.vailDiEmpty(key) != null) { + return FilterUdiUtils.vailDiEmpty(key); } + key = FilterUdiUtils.filterToDi(key); + deviceListRequest.setKey(key); DeviceSearchRequest deviceSearchRequest = new DeviceSearchRequest(); deviceSearchRequest.setZxxsdycpbs(key); deviceSearchRequest.setPage(1); @@ -117,6 +79,10 @@ public class DeviceController { } String key = deviceListRequest.getKey(); + + if (FilterUdiUtils.vailDiEmpty(key) != null) { + return FilterUdiUtils.vailDiEmpty(key); + } Device device = deviceService.searchByZxxscpbs(key); long total = 1; DeviceEntity deviceEntity = new DeviceEntity(); diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/DownloadDeviceHelper.java b/src/main/java/com/glxp/udidl/admin/controller/device/DownloadDeviceHelper.java deleted file mode 100644 index 980e420..0000000 --- a/src/main/java/com/glxp/udidl/admin/controller/device/DownloadDeviceHelper.java +++ /dev/null @@ -1,322 +0,0 @@ -package com.glxp.udidl.admin.controller.device; - -import com.alibaba.fastjson.JSONObject; -import com.glxp.udidl.admin.entity.info.CompanyEntity; -import com.glxp.udidl.admin.entity.udid.*; -import com.glxp.udidl.admin.req.udid.DeviceRequest; -import com.glxp.udidl.admin.req.udid.DownloadDiRequest; -import com.glxp.udidl.admin.req.udid.DownloadHistoryRequest; -import com.glxp.udidl.admin.req.udid.TokenRequest; -import com.glxp.udidl.admin.res.udid.DataSetBean; -import com.glxp.udidl.admin.res.udid.MedicalHistoryResonse; -import com.glxp.udidl.admin.res.udid.MedicalResonse; -import com.glxp.udidl.admin.res.udid.MedicalSingleResponse; -import com.glxp.udidl.admin.service.info.CompanyService; -import com.glxp.udidl.admin.service.inout.DeviceService; -import com.glxp.udidl.admin.service.inout.ProductInfoService; -import com.glxp.udidl.admin.thread.UdiTransferUtils; -import com.glxp.udidl.admin.util.DateUtil; -import com.glxp.udidl.admin.util.HttpClient; -import com.glxp.udidl.admin.util.WarehousBeanUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -@Service -public class DownloadDeviceHelper { - - - CompanyEntity companyEntity; - String url = ""; - String appId; - String appSecret; - @Resource - CompanyService companyService; - @Resource - UdiTransferUtils udiTransferUtils; - @Resource - DeviceService deviceService; - - public void DownloadDeviceHelper() { - companyEntity = companyService.findCompany(); - if (companyEntity != null && companyEntity.getClasses() != null) { - if (companyEntity.getClasses().equals("1")) { - url = "company/identifier/get"; - } else { - url = "sharing/get"; - } - appId = companyEntity.getAppId(); - appSecret = companyEntity.getAppSecret(); - } - } - - public TokenEntity getToken() { - TokenRequest tokenRequest = new TokenRequest(); - tokenRequest.setAppId(appId); - tokenRequest.setAppSecret(appSecret); - tokenRequest.setTyshxydm(companyEntity.getTyshxydm()); - String response = HttpClient.post("token/get", tokenRequest); - TokenEntity tokenEntity = (TokenEntity) JSONObject.parseObject(response, TokenEntity.class); - return tokenEntity; - } - - public int getTotal(String token) { - DeviceRequest deviceRequest = new DeviceRequest(); - deviceRequest.setCurrentPageNumber("1"); - deviceRequest.setRequestType("3"); - deviceRequest.setAccessToken(token); - String response = HttpClient.post(url, deviceRequest); - MedicalResonse medicalResonse = (MedicalResonse) JSONObject.parseObject(response, MedicalResonse.class); - return medicalResonse.getTotalPageCount(); - } - - //下载流通企业 - public int downloadDevices(ProductInfoService productInfoService, DeviceService deviceService, DeviceRequest deviceRequest) { - String response = HttpClient.post(url, deviceRequest); - int result = -1; - List dataSetBeanList; - MedicalResonse medicalResonse = null; - if (url.equals("sharing/get")) { - medicalResonse = (MedicalResonse) JSONObject.parseObject(response, MedicalResonse.class); - result = medicalResonse.getReturnCode(); - dataSetBeanList = medicalResonse.getDataSet(); - } else { - MedicalHistoryResonse medicalResonse2 = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class); - result = medicalResonse2.getReturnCode(); - dataSetBeanList = medicalResonse2.getDataList(); - } - - - if (dataSetBeanList != null && dataSetBeanList.size() > 0) { - for (int i = 0; i < dataSetBeanList.size(); i++) { - DataSetBean dataSetBean = dataSetBeanList.get(i); - Device device = WarehousBeanUtils.responseToDevice(dataSetBean); - if (deviceService.selectisSame(device.getDevicerecordkey(), device.getVersionnumber()) == null) { - if (device.getBssjzt() != null && device.getBssjzt().equals("草稿")) { - //草稿数据忽略 - } else { - String uuid = getUUId(); - device.setUuid(uuid); - - String versionNum = device.getVersionnumber(); - //如果版本号大于1,说明是新增,则更新历史记录 - if (versionNum != null && Integer.parseInt(versionNum) > 1) { - deviceService.deleteHistory(device.getDevicerecordkey()); - device.setLastModifyTime(DateUtil.formatDateTime(new Date())); - deviceService.insertDevice(device); - DownloadHistoryRequest deviceHistoryRequest = new DownloadHistoryRequest(); - deviceHistoryRequest.setAccessToken(deviceRequest.getAccessToken()); - deviceHistoryRequest.setCurrentPageNumber("1"); - List dataSetBeans = new ArrayList<>(); - DownloadHistoryRequest.DataSetBean keys = new DownloadHistoryRequest.DataSetBean(); - keys.setDeviceRecordKey(device.getDevicerecordkey()); - dataSetBeans.add(keys); - deviceHistoryRequest.setDataSet(dataSetBeans); - downloadHistory(deviceHistoryRequest); - } else { - device.setLastModifyTime(DateUtil.formatDateTime(new Date())); - deviceService.insertDevice(device); - } - - udiTransferUtils.transUdi(uuid); - List deviceclinicals = dataSetBean.getDeviceClinical(); - List deviceclinicalList = new ArrayList<>(); - if (deviceclinicalList != null && deviceclinicalList.size() > 0) { - for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) { - if (deviceClinicalBean != null) { - Deviceclinical deviceclinical = WarehousBeanUtils.responseToDeviceclinical(deviceClinicalBean); - deviceclinical.setDevicerecordkey(device.getDevicerecordkey()); - deviceclinical.setUuid(uuid); - deviceclinicalList.add(deviceclinical); - } - } - deviceService.insertDeviceClinical(deviceclinicalList); - } - List devicePackageBeans = dataSetBean.getDevicePackage(); - if (devicePackageBeans != null && devicePackageBeans.size() > 0) { - List devicepackageList = new ArrayList<>(); - for (DataSetBean.DevicePackageBean devicePackageBean : devicePackageBeans) { - Devicepackage devicepackage = WarehousBeanUtils.responseToDevicepackage(devicePackageBean); - devicepackage.setDevicerecordkey(device.getDevicerecordkey()); - devicepackage.setUuid(uuid); - devicepackageList.add(devicepackage); - } - deviceService.insertDevicepackage(devicepackageList); - } - - List deviceStorageBeans = dataSetBean.getDeviceStorage(); - if (deviceStorageBeans != null && deviceStorageBeans.size() > 0) { - List devicestorageList = new ArrayList<>(); - for (DataSetBean.DeviceStorageBean deviceStorageBean : deviceStorageBeans) { - Devicestorage devicestorage = WarehousBeanUtils.responseToDevicestorage(deviceStorageBean); - devicestorage.setDevicerecordkey(device.getDevicerecordkey()); - devicestorage.setUuid(uuid); - devicestorageList.add(devicestorage); - } - deviceService.insertDevicestorage(devicestorageList); - } - List contactListBeans = dataSetBean.getContactList(); - if (contactListBeans != null && contactListBeans.size() > 0) { - List contactlistList = new ArrayList<>(); - for (DataSetBean.ContactListBean contactListBean : contactListBeans) { - Contactlist contactlist = WarehousBeanUtils.responseToContactlist(contactListBean); - contactlist.setDevicerecordkey(device.getDevicerecordkey()); - contactlist.setUuid(uuid); - contactlistList.add(contactlist); - } - deviceService.insertContactlist(contactlistList); - } - } - } - } - } - if (Integer.parseInt(deviceRequest.getCurrentPageNumber()) >= medicalResonse.getTotalPageCount()) { - return -1; - } - return result; - } - - - public int downloadHistory(DownloadHistoryRequest deviceHistoryRequest) { - String response = HttpClient.post("sharing/history/get", deviceHistoryRequest); - MedicalHistoryResonse medicalResonse = (MedicalHistoryResonse) JSONObject.parseObject(response, MedicalHistoryResonse.class); - if (medicalResonse.getReturnCode() == 1) { - List dataSetBeanList = medicalResonse.getDataList(); - if (dataSetBeanList != null && dataSetBeanList.size() > 0) { - for (int i = 0; i < dataSetBeanList.size(); i++) { - DataSetBean dataSetBean = dataSetBeanList.get(i); - Device device = WarehousBeanUtils.responseToDevice(dataSetBean); - if (deviceService.selectisSame(device.getDevicerecordkey(), device.getVersionnumber()) == null) { - String uuid = getUUId(); - device.setUuid(uuid); - device.setLastModifyTime(DateUtil.formatDateTime(new Date())); - deviceService.insertDevice(device); - udiTransferUtils.transUdi(uuid); - List deviceclinicals = dataSetBean.getDeviceClinical(); - List deviceclinicalList = new ArrayList<>(); - for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) { - if (deviceClinicalBean != null) { - Deviceclinical deviceclinical = WarehousBeanUtils.responseToDeviceclinical(deviceClinicalBean); - deviceclinical.setDevicerecordkey(device.getDevicerecordkey()); - deviceclinical.setUuid(uuid); - deviceclinicalList.add(deviceclinical); - } - - } - deviceService.insertDeviceClinical(deviceclinicalList); - - List devicePackageBeans = dataSetBean.getDevicePackage(); - List devicepackageList = new ArrayList<>(); - for (DataSetBean.DevicePackageBean devicePackageBean : devicePackageBeans) { - Devicepackage devicepackage = WarehousBeanUtils.responseToDevicepackage(devicePackageBean); - devicepackage.setDevicerecordkey(device.getDevicerecordkey()); - devicepackage.setUuid(uuid); - devicepackageList.add(devicepackage); - } - deviceService.insertDevicepackage(devicepackageList); - - List deviceStorageBeans = dataSetBean.getDeviceStorage(); - List devicestorageList = new ArrayList<>(); - for (DataSetBean.DeviceStorageBean deviceStorageBean : deviceStorageBeans) { - Devicestorage devicestorage = WarehousBeanUtils.responseToDevicestorage(deviceStorageBean); - devicestorage.setDevicerecordkey(device.getDevicerecordkey()); - devicestorage.setUuid(uuid); - devicestorageList.add(devicestorage); - } - deviceService.insertDevicestorage(devicestorageList); - - List contactListBeans = dataSetBean.getContactList(); - List contactlistList = new ArrayList<>(); - for (DataSetBean.ContactListBean contactListBean : contactListBeans) { - Contactlist contactlist = WarehousBeanUtils.responseToContactlist(contactListBean); - contactlist.setDevicerecordkey(device.getDevicerecordkey()); - contactlist.setUuid(uuid); - contactlistList.add(contactlist); - } - deviceService.insertContactlist(contactlistList); - } - } - } - } else { - return -1; - } - return 1; - } - - public int downloadBydi(DownloadDiRequest downloadDiRequest, DeviceService deviceService, ProductInfoService productInfoService) { - String response = HttpClient.post("sharing/single", downloadDiRequest); - MedicalSingleResponse medicalResonse = (MedicalSingleResponse) JSONObject.parseObject(response, MedicalSingleResponse.class); - if (medicalResonse.getReturnCode() == 1) { - List dataSetBeanList = medicalResonse.getDataSet(); - if (dataSetBeanList != null && dataSetBeanList.size() > 0) { - for (int i = 0; i < dataSetBeanList.size(); i++) { - DataSetBean dataSetBean = dataSetBeanList.get(i); - Device device = WarehousBeanUtils.responseToDevice(dataSetBean); - String uuid = getUUId(); - device.setUuid(uuid); - if (deviceService.selectisSame(device.getDevicerecordkey(), device.getVersionnumber()) != null) { - return -1; - } - device.setLastModifyTime(DateUtil.formatDateTime(new Date())); - deviceService.insertDevice(device); - List deviceclinicals = dataSetBean.getDeviceClinical(); - List deviceclinicalList = new ArrayList<>(); - for (DataSetBean.DeviceClinicalBean deviceClinicalBean : deviceclinicals) { - if (deviceClinicalBean != null) { - Deviceclinical deviceclinical = WarehousBeanUtils.responseToDeviceclinical(deviceClinicalBean); - deviceclinical.setDevicerecordkey(device.getDevicerecordkey()); - deviceclinical.setUuid(uuid); - deviceclinicalList.add(deviceclinical); - } - } - deviceService.insertDeviceClinical(deviceclinicalList); - - List devicePackageBeans = dataSetBean.getDevicePackage(); - List devicepackageList = new ArrayList<>(); - for (DataSetBean.DevicePackageBean devicePackageBean : devicePackageBeans) { - Devicepackage devicepackage = WarehousBeanUtils.responseToDevicepackage(devicePackageBean); - devicepackage.setDevicerecordkey(device.getDevicerecordkey()); - devicepackage.setUuid(uuid); - devicepackageList.add(devicepackage); - } - deviceService.insertDevicepackage(devicepackageList); - - List deviceStorageBeans = dataSetBean.getDeviceStorage(); - List devicestorageList = new ArrayList<>(); - for (DataSetBean.DeviceStorageBean deviceStorageBean : deviceStorageBeans) { - Devicestorage devicestorage = WarehousBeanUtils.responseToDevicestorage(deviceStorageBean); - devicestorage.setDevicerecordkey(device.getDevicerecordkey()); - devicestorage.setUuid(uuid); - devicestorageList.add(devicestorage); - } - deviceService.insertDevicestorage(devicestorageList); - - List contactListBeans = dataSetBean.getContactList(); - List contactlistList = new ArrayList<>(); - for (DataSetBean.ContactListBean contactListBean : contactListBeans) { - Contactlist contactlist = WarehousBeanUtils.responseToContactlist(contactListBean); - contactlist.setDevicerecordkey(device.getDevicerecordkey()); - contactlist.setUuid(uuid); - contactlistList.add(contactlist); - } - deviceService.insertContactlist(contactlistList); - - udiTransferUtils.transUdi(uuid); - } - } - } else { - return -1; - } - return 1; - } - - private String getUUId() { - UUID uuid = UUID.randomUUID(); - return uuid.toString().replace("-", ""); - } - -} diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/PosTaggerController.java b/src/main/java/com/glxp/udidl/admin/controller/device/PosTaggerController.java index f596f27..9c20274 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/PosTaggerController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/PosTaggerController.java @@ -1,5 +1,6 @@ package com.glxp.udidl.admin.controller.device; +import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; @@ -38,11 +39,10 @@ public class PosTaggerController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - if (productInfoFilterRequest.getTyshxydm() == null) { + if (StrUtil.isNotEmpty(productInfoFilterRequest.getTyshxydm())) { return ResultVOUtils.error(510, "通用社会信用代码不能为空"); } List productInfoEntities = productInfoService.filterUdiByCreditNo(productInfoFilterRequest); - PageInfo pageInfo; pageInfo = new PageInfo<>(productInfoEntities); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/ProductInfoController.java b/src/main/java/com/glxp/udidl/admin/controller/device/ProductInfoController.java index a2beed2..f26a80a 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/ProductInfoController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/ProductInfoController.java @@ -76,11 +76,12 @@ public class ProductInfoController { @GetMapping("udidl/wms/findBydi") public BaseResponse findBydiWms(ProductInfoFilterRequest productInfoFilterRequest) { String key = productInfoFilterRequest.getNameCode(); - UdiEntity udiEntity = null; - if (key != null) { - udiEntity = FilterUdiUtils.getUdi(key); - key = udiEntity.getUdi();// FilterUdiUtils.getDiStr(key); - productInfoFilterRequest.setNameCode(key); + if (FilterUdiUtils.vailDiEmpty(key) != null) { + return FilterUdiUtils.vailDiEmpty(key); + } + UdiEntity udiEntity = FilterUdiUtils.getUdi(key); + if (udiEntity == null) { + return ResultVOUtils.error(500, "UDI码格式错误!"); } List productInfoEntityList = productInfoService.findAll(productInfoFilterRequest); ProductInfoResponse productInfoResponse = new ProductInfoResponse(); @@ -113,19 +114,29 @@ public class ProductInfoController { } } - //出入库同步下载 + //UDI自助平台/UDI管理系统/DI同步下载 @ApiOperation(value = "出入库同步下载", response = ProductInfoEntity.class) @AuthRuleAnnotation("udidl/udiwms/syncUdi") @GetMapping("udidl/udiwms/syncUdi") public BaseResponse syncUdi(ProductInfoFilterRequest productInfoFilterRequest) { + + if (productInfoFilterRequest.getPage() == null || productInfoFilterRequest.getLimit() == null) + return ResultVOUtils.error(500, "分页参数不能为空"); +// +// if (StrUtil.isEmpty(productInfoFilterRequest.getUpdateTime())) { +// return ResultVOUtils.error(500, "最后更新时间不能为空!"); +// } + List productInfoEntityList = productInfoService.syncDlUdi(productInfoFilterRequest); return ResultVOUtils.success(productInfoEntityList); } - //出入库同步下载 + //UDI自助平台/UDI管理系统/企业信息同步下载 @AuthRuleAnnotation("udidl_company_all") @GetMapping("udidl/udiwms/syncCompany") public BaseResponse syncCompany(UdiCompanyRequest udiCompanyRequest) { + if (udiCompanyRequest.getPage() == null || udiCompanyRequest.getLimit() == null) + return ResultVOUtils.error(500, "分页参数不能为空"); List udiCompanyEntities = udiCompanyService.syncDlCompany(udiCompanyRequest); return ResultVOUtils.success(udiCompanyEntities); } @@ -135,44 +146,34 @@ public class ProductInfoController { @GetMapping("udidl/device/filterUdi") 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 (productInfoFilterRequest.getNameCode() != null && !productInfoFilterRequest.getNameCode().equals("") && productInfoFilterRequest.getNameCode().length() < 10) { - 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()) && + StrUtil.isEmpty(productInfoFilterRequest.getDeviceRecordKey())) { + return ResultVOUtils.error(500, "查询条件不足!"); + } + if (StrUtil.isNotEmpty(productInfoFilterRequest.getNameCode()) && productInfoFilterRequest.getNameCode().length() <= 10) { + return ResultVOUtils.error(500, "最小销售单元标识格式错误!"); } - if (productInfoFilterRequest.getYlqxzcrbarmc() != null && !productInfoFilterRequest.getYlqxzcrbarmc().equals("") && productInfoFilterRequest.getYlqxzcrbarmc().length() < 4) { + if (StrUtil.isNotEmpty(productInfoFilterRequest.getYlqxzcrbarmc()) && productInfoFilterRequest.getYlqxzcrbarmc().length() <= 6) { 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("")) { + if (StrUtil.isEmpty(productInfoFilterRequest.getYlqxzcrbarmc()) && + StrUtil.isEmpty(productInfoFilterRequest.getCpmctymc()) && + StrUtil.isEmpty(productInfoFilterRequest.getNameCode())) { + if (StrUtil.isNotEmpty(productInfoFilterRequest.getGgxh())) { return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称"); } - if (productInfoFilterRequest.getZczbhhzbapzbh() != null && !productInfoFilterRequest.getZczbhhzbapzbh().equals("")) { + if (StrUtil.isNotEmpty(productInfoFilterRequest.getZczbhhzbapzbh())) { return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称"); } } - - /* if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("") && productInfoFilterRequest.getCpmctymc().length() < 4) { - return ResultVOUtils.error(500, "请输入完整的产品通用名称!"); - }*/ productInfoFilterRequest.setIsNewest(1); - productInfoFilterRequest.setDiType("1"); List productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(productInfoEntityList); @@ -287,6 +288,10 @@ public class ProductInfoController { @AuthRuleAnnotation("udidl/device/filterByUuid") @GetMapping("udidl/device/filterByUuid") public BaseResponse filterByUuid(ProductInfoFilterRequest productInfoFilterRequest) { + + if (StrUtil.isEmpty(productInfoFilterRequest.getUuid())) { + return ResultVOUtils.error(500, "查询条件不能为空!"); + } List productInfoEntityList = productInfoService.findAll(productInfoFilterRequest); return ResultVOUtils.success(productInfoEntityList); } @@ -295,6 +300,11 @@ public class ProductInfoController { @AuthRuleAnnotation("udidl/device/filterByNameCode") @GetMapping("udidl/device/filterByNameCode") public BaseResponse filterByNameCode(ProductInfoFilterRequest productInfoFilterRequest) { + + if (StrUtil.isEmpty(productInfoFilterRequest.getNameCode())) { + return ResultVOUtils.error(500, "查询条件不能为空!"); + } + return ResultVOUtils.success(productInfoService.findLastVersion(productInfoFilterRequest)); } diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/UdiCompanyController.java b/src/main/java/com/glxp/udidl/admin/controller/device/UdiCompanyController.java index a31a6fa..32935c0 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/UdiCompanyController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/UdiCompanyController.java @@ -1,5 +1,6 @@ package com.glxp.udidl.admin.controller.device; +import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; @@ -63,7 +64,9 @@ public class UdiCompanyController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - + if (StrUtil.isNotEmpty(productInfoFilterRequest.getTyshxydm())) { + return ResultVOUtils.error(500, "统一社会信用代码不能为空!"); + } List productInfoEntities; productInfoFilterRequest.setDiType("1"); if (productInfoFilterRequest.isShowHis()) { diff --git a/src/main/java/com/glxp/udidl/admin/service/inout/impl/ProductInfoServiceImpl.java b/src/main/java/com/glxp/udidl/admin/service/inout/impl/ProductInfoServiceImpl.java index 4ca93c9..83224f3 100644 --- a/src/main/java/com/glxp/udidl/admin/service/inout/impl/ProductInfoServiceImpl.java +++ b/src/main/java/com/glxp/udidl/admin/service/inout/impl/ProductInfoServiceImpl.java @@ -121,7 +121,6 @@ public class ProductInfoServiceImpl implements ProductInfoService { && StrUtil.isEmpty(productInfoFilterRequest.getUuid())) { return Collections.emptyList(); } - List data = productInfoDao.filterProductInfo(productInfoFilterRequest); return data; } diff --git a/src/main/java/com/glxp/udidl/admin/util/FilterUdiUtils.java b/src/main/java/com/glxp/udidl/admin/util/FilterUdiUtils.java index 4a6cf21..e813035 100644 --- a/src/main/java/com/glxp/udidl/admin/util/FilterUdiUtils.java +++ b/src/main/java/com/glxp/udidl/admin/util/FilterUdiUtils.java @@ -3,6 +3,7 @@ package com.glxp.udidl.admin.util; import cn.hutool.core.util.StrUtil; import com.glxp.udidl.admin.entity.udid.UdiEntity; +import com.glxp.udidl.admin.res.BaseResponse; import com.glxp.udidl.admin.util.gs1.AI; import com.glxp.udidl.admin.util.gs1.AIs; import com.glxp.udidl.admin.util.gs1.Gs1128Decoder; @@ -146,4 +147,25 @@ public class FilterUdiUtils { } + public static String filterToDi(String code) { + UdiEntity udiEntity = getUdi(code); + if (udiEntity != null) + return udiEntity.getUdi(); + else + return code; + } + + public static BaseResponse vailDiEmpty(String code) { + if (StrUtil.isEmpty(code)) { + return ResultVOUtils.error(500, "请输入查询条件"); + } + + if (code.length() < 14) { + return ResultVOUtils.error(500, "DI码格式错误!"); + } + + return null; + + } + }