diff --git a/pom.xml b/pom.xml
index ec03a9c..edbd472 100644
--- a/pom.xml
+++ b/pom.xml
@@ -174,6 +174,11 @@
provided
+
+ redis.clients
+ jedis
+ 4.2.3
+
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 a6fe6fb..96e094e 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
@@ -2,6 +2,7 @@ package com.glxp.udidl.admin.controller.device;
import com.glxp.udidl.admin.annotation.AuthRuleAnnotation;
import com.glxp.udidl.admin.entity.udid.DeviceEntity;
+import com.glxp.udidl.admin.req.udid.DeviceRequest;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.res.udid.DataSetSingleHistoryResult;
import com.glxp.udidl.admin.service.dataSync.DeviceSyncService;
@@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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 java.util.Date;
@@ -87,4 +89,20 @@ public class UdidlDeviceController {
public BaseResponse downloadHistory(String key) {
return deviceSyncService.downloadHistory(key);
}
+
+ /**
+ * 下载医疗器械信息
+ *
+ * @return
+ */
+ @ApiOperation(value = "下载国家库产品数据", response = BaseResponse.class)
+ @AuthRuleAnnotation("udidl/device/downloadUdiData")
+ @PostMapping("udidl/device/downloadUdiData")
+ public BaseResponse downloadUdiData(@RequestBody DeviceRequest deviceRequest) {
+ if (null == deviceRequest) {
+ return ResultVOUtils.error(500, "下载参数不能为空");
+ }
+ deviceSyncService.downloadUdiData(deviceRequest);
+ return ResultVOUtils.success("后台已经开始下载");
+ }
}
diff --git a/src/main/java/com/glxp/udidl/admin/dao/udid/JobLogMapper.java b/src/main/java/com/glxp/udidl/admin/dao/udid/JobLogMapper.java
index 368d578..9cc235c 100644
--- a/src/main/java/com/glxp/udidl/admin/dao/udid/JobLogMapper.java
+++ b/src/main/java/com/glxp/udidl/admin/dao/udid/JobLogMapper.java
@@ -16,11 +16,4 @@ public interface JobLogMapper extends BaseMapper {
*/
List list(JobLogFilterRequest jobLogFilterRequest);
- /**
- * 日志记录
- *
- * @param jobLog
- * @return
- */
- int insert(JobLog jobLog);
}
diff --git a/src/main/java/com/glxp/udidl/admin/entity/udid/JobLog.java b/src/main/java/com/glxp/udidl/admin/entity/udid/JobLog.java
index 07c7279..bdf5fc3 100644
--- a/src/main/java/com/glxp/udidl/admin/entity/udid/JobLog.java
+++ b/src/main/java/com/glxp/udidl/admin/entity/udid/JobLog.java
@@ -1,5 +1,8 @@
package com.glxp.udidl.admin.entity.udid;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -11,11 +14,12 @@ import java.util.Date;
* 定时器数据同步日志
*/
@Data
-//@Table("job_log")
+@TableName("job_log")
@ApiModel("UDI日志信息实体")
public class JobLog {
@ApiModelProperty(value = "日志id")
+ @TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "类型: error; info; warning")
@@ -46,4 +50,11 @@ public class JobLog {
@ApiModelProperty(value = "创建时间", example = "2022-05-09 14:36:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;//创建时间
+
+ @ApiModelProperty(value = "修改时间", example = "2022-05-09 14:36:00")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date updateTime;//修改时间
+
+ @ApiModelProperty(value = "状态 0:处理中 1.已完成")
+ private Integer status;
}
diff --git a/src/main/java/com/glxp/udidl/admin/handler/GlobalExceptionHandler.java b/src/main/java/com/glxp/udidl/admin/handler/GlobalExceptionHandler.java
index a002ab3..76ba9ef 100644
--- a/src/main/java/com/glxp/udidl/admin/handler/GlobalExceptionHandler.java
+++ b/src/main/java/com/glxp/udidl/admin/handler/GlobalExceptionHandler.java
@@ -25,7 +25,7 @@ public class GlobalExceptionHandler {
// 拦截API异常
@ExceptionHandler(value = RuntimeException.class)
public BaseResponse handlerRuntimeException(RuntimeException e) {
- log.error(e.getMessage());
+ log.error(e.getMessage(), e);
// 返回对应的错误信息
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
diff --git a/src/main/java/com/glxp/udidl/admin/req/udid/DeviceRequest.java b/src/main/java/com/glxp/udidl/admin/req/udid/DeviceRequest.java
index 9227807..e625eaa 100644
--- a/src/main/java/com/glxp/udidl/admin/req/udid/DeviceRequest.java
+++ b/src/main/java/com/glxp/udidl/admin/req/udid/DeviceRequest.java
@@ -1,5 +1,7 @@
package com.glxp.udidl.admin.req.udid;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@@ -13,9 +15,39 @@ public class DeviceRequest {
* currentPageNumber : 请求分页数,初始请求时, 从 1 开始
*/
+ @ApiModelProperty(value = "接口调用凭据")
private String accessToken;
+
+ @ApiModelProperty(value = "数据类型", example = "1 新发布")
+ private String dataType;
+
+ @ApiModelProperty(value = "请求范围,1 按天请求,2 按月请求")
private String requestType;
+
+ @ApiModelProperty(value = "请求时间范围")
private String rangeValue;
+
+ @ApiModelProperty(value = "最小销售单元产品标识;精准查询")
+ @JsonProperty("ZXXSDYCPBS")
+ private String ZXXSDYCPBS;
+
+ @ApiModelProperty(value = "产品名称/通用名称;模糊查询")
+ @JsonProperty("CPMCTYMC")
+ private String CPMCTYMC;
+
+ @ApiModelProperty(value = "规格型号;模糊查询")
+ @JsonProperty("GGXH")
+ private String GGXH;
+
+ @ApiModelProperty(value = "注册/备案人名称;精准查询")
+ @JsonProperty("YLQXZCRBARMC")
+ private String YLQXZCRBARMC;
+
+ @ApiModelProperty(value = "注册/备案证号;精准查询")
+ @JsonProperty("ZCZBHHZBAPZBH")
+ private String ZCZBHHZBAPZBH;
+
+ @ApiModelProperty(value = "请求分页数,初始请求时,从 1 开始")
private String currentPageNumber;
}
diff --git a/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java b/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java
index 25d4369..ec99574 100644
--- a/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java
+++ b/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java
@@ -24,14 +24,16 @@ import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.JobLogService;
import com.glxp.udidl.admin.util.DateUtil;
import com.glxp.udidl.admin.util.HttpClient;
+import com.glxp.udidl.admin.util.RedisUtil;
import com.glxp.udidl.admin.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -43,28 +45,32 @@ public class DeviceDownloadService {
private String token = "";
- int reCount = 0;
+ private int reCount = 0;
- CompanyEntity companyEntity;
+ private CompanyEntity companyEntity;
- String url = "sharing/get";
+ private String url = "sharing/get";
- @Autowired
+ @Resource
private CompanyService companyService;
- @Autowired
- JobLogService jobLogService; //日志
- @Autowired
- DeviceSaveService deviceSaveService;
- @Autowired
+ @Resource
+ private JobLogService jobLogService; //日志
+ @Resource
+ private DeviceSaveService deviceSaveService;
+ @Resource
private DeviceService deviceService;
- @Autowired
+ @Resource
private ProductInfoService productInfoService;
+ @Resource
+ private RedisUtil redisUtil;
private void SetTokenEmpty() {
token = "";
}
+ private static List