diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/UdiInfoController.java b/src/main/java/com/glxp/udidl/admin/controller/device/UdiInfoController.java new file mode 100644 index 0000000..5864df7 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/controller/device/UdiInfoController.java @@ -0,0 +1,165 @@ +package com.glxp.udidl.admin.controller.device; + +import cn.hutool.core.collection.CollUtil; +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; +import com.glxp.udidl.admin.entity.udid.UdiEntity; +import com.glxp.udidl.admin.req.FilterUdiInfoRequest; +import com.glxp.udidl.admin.req.ProductInfoFilterRequest; +import com.glxp.udidl.admin.res.BaseResponse; +import com.glxp.udidl.admin.res.PageSimpleResponse; +import com.glxp.udidl.admin.service.dataSync.DeviceSyncService; +import com.glxp.udidl.admin.service.inout.ProductInfoService; +import com.glxp.udidl.admin.util.FilterUdiUtils; +import com.glxp.udidl.admin.util.ResultVOUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@RestController +public class UdiInfoController { + + @Resource + ProductInfoService productInfoService; + @Autowired + DeviceSyncService deviceSyncService; + + //获取同步库UDI信息 + @AuthRuleAnnotation("") + @GetMapping("udiwms/udiinfo/filterUdi") + public BaseResponse filterUdi(FilterUdiInfoRequest filterUdiInfoRequest) { + String nameCode = null; + if (StrUtil.isNotEmpty(filterUdiInfoRequest.getCode())) { + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiInfoRequest.getCode()); + if (udiEntity != null) { + nameCode = udiEntity.getUdi(); + } else { + return ResultVOUtils.error(500, "无效UDI码!"); + } + } else + nameCode = filterUdiInfoRequest.getNameCode(); + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + BeanUtils.copyProperties(filterUdiInfoRequest, productInfoFilterRequest); + if (StrUtil.isNotEmpty(nameCode)) { + productInfoFilterRequest.setNameCode(nameCode); + } else { + productInfoFilterRequest.setDiType("1"); + } + try { + List productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(productInfoEntityList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(productInfoEntityList); + return ResultVOUtils.success(pageSimpleResponse); + + } catch (Exception e) { + e.printStackTrace(); + return ResultVOUtils.error(500, "连接UDI数据下载服务出错!"); + } + } + + +// //校验UDI完整性 +// @AuthRuleAnnotation("") +// @GetMapping("udidl/device/vailUdiCode") +// public BaseResponse vailUdiCode(String udiCode) { +// +// if (StrUtil.isEmpty(udiCode)) { +// return ResultVOUtils.error(500, "查询条件不能为空!"); +// } +// UdiEntity udiEntity = FilterUdiUtils.getUdi(udiCode); +// if (udiEntity == null) { +// return ResultVOUtils.error(500, "UDI码格式错误!"); +// } else { +// if (StrUtil.isNotEmpty(udiEntity.getUdi())) { +// ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); +// productInfoFilterRequest.setNameCode(udiEntity.getUdi()); +// List productInfoEntityList = productInfoService.filterProductInfo(productInfoFilterRequest); +// if (CollUtil.isEmpty(productInfoEntityList)) { +// return ResultVOUtils.error(500, "未查询到该UDI码国家库产品信息!"); +// } else { +// ProductInfoEntity productInfoEntity = productInfoEntityList.get(0); +// String lostMsg = ""; +// boolean checkSuccess = true; +// if ("是".equals(productInfoEntity.getScbssfbhph()) && StrUtil.isEmpty(udiEntity.getBatchNo())) { +// checkSuccess = false; +// lostMsg = lostMsg + ",批次号"; +// } +// if ("是".equals(productInfoEntity.getScbssfbhscrq()) && StrUtil.isEmpty(udiEntity.getProduceDate())) { +// checkSuccess = false; +// lostMsg = lostMsg + ",生产日期"; +// } +// +// if ("是".equals(productInfoEntity.getScbssfbhsxrq()) && StrUtil.isEmpty(udiEntity.getExpireDate())) { +// checkSuccess = false; +// lostMsg = lostMsg + ",失效日期"; +// } +// if (("是".equals(productInfoEntity.getScbssfbhxlh()) && StrUtil.isEmpty(udiEntity.getSerialNo())) +// ) { +// checkSuccess = false; +// lostMsg = lostMsg + ",序列号"; +// } +// if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) { +// return ResultVOUtils.error(504, "序列号超出20位!"); +// } +// if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) { +// return ResultVOUtils.error(504, "批次号超出20位!"); +// } +// if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) { +// checkSuccess = false; +// } +// if (checkSuccess) { +// return ResultVOUtils.success(productInfoEntity); +// } else { +// return ResultVOUtils.error(500, "UDI码格式错误,缺少" + lostMsg.substring(1)); +// } +// } +// } else { +// return ResultVOUtils.error(500, "UDI码格式错误!"); +// } +// } +// +// } + + + @AuthRuleAnnotation("") + @GetMapping("udiwms/udiinfo/superSearch") + public BaseResponse superSearch(FilterUdiInfoRequest filterUdiInfoRequest) { + + if (StrUtil.isEmpty(filterUdiInfoRequest.getNameCode()) && StrUtil.isEmpty(filterUdiInfoRequest.getCode())) { + return ResultVOUtils.error(500, "DI不能为空!"); + } + + if (StrUtil.isNotEmpty(filterUdiInfoRequest.getCode())) { + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiInfoRequest.getCode()); + if (udiEntity == null) + return ResultVOUtils.error(500, "UDI码格式错误!"); + filterUdiInfoRequest.setNameCode(udiEntity.getUdi()); + } + + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + productInfoFilterRequest.setNameCode(filterUdiInfoRequest.getNameCode()); + productInfoFilterRequest.setPage(filterUdiInfoRequest.getPage()); + productInfoFilterRequest.setLimit(filterUdiInfoRequest.getLimit()); + try { + + return deviceSyncService.searchDlByDi(filterUdiInfoRequest.getNameCode()); + + + } catch (Exception e) { + e.printStackTrace(); + return ResultVOUtils.error(500, "连接UDI数据下载服务出错!"); + } + } + + +} diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java b/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java index 87a5c4a..ac7ebc6 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java @@ -177,7 +177,6 @@ public class UdidlDeviceController { ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); productInfoFilterRequest.setNameCode(deviceId); return ResultVOUtils.success(productInfoService.findLastVersion(productInfoFilterRequest)); - } diff --git a/src/main/java/com/glxp/udidl/admin/req/FilterUdiInfoRequest.java b/src/main/java/com/glxp/udidl/admin/req/FilterUdiInfoRequest.java new file mode 100644 index 0000000..758e64f --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/req/FilterUdiInfoRequest.java @@ -0,0 +1,66 @@ +package com.glxp.udidl.admin.req; + +import lombok.Data; + +import java.util.List; + +@Data +public class FilterUdiInfoRequest extends ListPageRequest { + + private String ylqxzcrbarmc; + private String cpmctymc; + private String nameCode; + private String uuid; + private String ggxh; + private String thirdId; + private String id; + + private String thirdId1; + private String thirdId2; + private String thirdId3; + private String thirdId4; + + + private String thirdCode; + private String thirdSys; + + private String lastUpdateTime; + private String zczbhhzbapzbh; + private Integer diType; + + + private String unionCode; + private String code; + private String thrPiId; + + + private Boolean isCheck; + + private Integer filterType; //0:全部,1.对照完成,2.未对照DI,3.未对照产品编码,4.未对照其他产品编码 + + private Integer lockStatus; + private String customerId; + private String udplatCode; + private String mainId; + private Boolean isAdavence; + private String corpId; + private String billType; + + private String ybbm; + private String sptm; + private String unionFilterStr;//产品名称,规格,批文,生产厂家联合查询 + + private Boolean isDisable; + List relIds; + private String uniqueNameCode; + private String supName; + private String unitFk; + private String originUuid; + private String relId; + private String companyName; + + private String supId; + private Boolean groupBuy; + private Boolean dispatch; + +} diff --git a/src/main/resources/mybatis/mapper/udid/JobLogMapper.xml b/src/main/resources/mybatis/mapper/udid/JobLogMapper.xml index ae53762..077faba 100644 --- a/src/main/resources/mybatis/mapper/udid/JobLogMapper.xml +++ b/src/main/resources/mybatis/mapper/udid/JobLogMapper.xml @@ -19,7 +19,7 @@ and createTime <= #{endDate} - order by createTime desc + order by createTime, downloadDate desc \ No newline at end of file