国家库同步下载,无法下载其他子级问题

zhairh
anthonywj 2 years ago
parent b2c98431c2
commit e941d115d1

@ -2,6 +2,7 @@ package com.glxp.udidl.admin.controller.device;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glxp.udidl.admin.constant.Constant;
import com.glxp.udidl.admin.dao.udi.ProductInfoMapper; import com.glxp.udidl.admin.dao.udi.ProductInfoMapper;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity; import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
import com.glxp.udidl.admin.entity.udi.UdiCompanyEntity; import com.glxp.udidl.admin.entity.udi.UdiCompanyEntity;
@ -11,13 +12,14 @@ import com.glxp.udidl.admin.req.ListPageRequest;
import com.glxp.udidl.admin.req.ProductInfoFilterRequest; import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
import com.glxp.udidl.admin.req.UdiCompanyRequest; import com.glxp.udidl.admin.req.UdiCompanyRequest;
import com.glxp.udidl.admin.res.BaseResponse; import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.service.dataSync.DeviceSyncService; import com.glxp.udidl.admin.res.udid.DataSetResult;
import com.glxp.udidl.admin.service.dataSync.UdplatDownloadService; import com.glxp.udidl.admin.res.udid.DataSetSingleResult;
import com.glxp.udidl.admin.service.dataSync.UdplatSyncService; import com.glxp.udidl.admin.service.dataSync.*;
import com.glxp.udidl.admin.service.inout.DeviceService; import com.glxp.udidl.admin.service.inout.DeviceService;
import com.glxp.udidl.admin.service.inout.ProductInfoService; import com.glxp.udidl.admin.service.inout.ProductInfoService;
import com.glxp.udidl.admin.service.udi.UdiCompanyService; import com.glxp.udidl.admin.service.udi.UdiCompanyService;
import com.glxp.udidl.admin.thread.UdiTransferUtils; import com.glxp.udidl.admin.thread.UdiTransferUtils;
import com.glxp.udidl.admin.util.RedisUtil;
import com.glxp.udidl.admin.util.ResultVOUtils; import com.glxp.udidl.admin.util.ResultVOUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -169,4 +172,40 @@ public class TestController {
return ResultVOUtils.error(500, "未查询到数据"); return ResultVOUtils.error(500, "未查询到数据");
} }
@Resource
private DeviceDownloadService deviceDownloadService;
@Resource
private DeviceSaveService deviceSaveService;
@Resource
RedisUtil redisUtil;
@GetMapping("udidl/device/updateDi")
public BaseResponse updateDi(ListPageRequest listPageRequest) {
List<String> keys = productInfoDao.findAllNameCodes(listPageRequest);
int index = listPageRequest.getPage();
for (String key : keys) {
index++;
if (key.length() != 14)
continue;
DataSetSingleResult res = null;
try {
Thread.sleep(5 * 1000);
res = deviceDownloadService.downloadByDi(key);
if (res.getReturnCode() != 1) {
return ResultVOUtils.error(-1, res.getReturnMsg());
}
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(res.getDataSet());
int insertCount = deviceSaveService.DeviceSave(dataSets, new Date(), Constant.DL_TYPE_UPDATE);
} catch (Exception e) {
e.printStackTrace();
redisUtil.set("updateDLLastCount", index + "");
return ResultVOUtils.error(500, res.getReturnMsg());
}
redisUtil.set("updateDLLastCount", index + "");
logger.info(listPageRequest.getPage() + "---" + listPageRequest.getLimit() + "----" + index);
}
return ResultVOUtils.success("总数=" + keys.size() + "\n");
}
} }

@ -37,6 +37,9 @@ public interface ProductInfoMapper extends BaseMapper<ProductInfoEntity> {
List<String> findAllUuids(ListPageRequest listPageRequest); List<String> findAllUuids(ListPageRequest listPageRequest);
List<String> findAllNameCodes(ListPageRequest listPageRequest);
List<ProductInfoEntity> selectByUuid(@Param("uuid") String uuid); List<ProductInfoEntity> selectByUuid(@Param("uuid") String uuid);
List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest); List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest);

@ -47,7 +47,7 @@ public class DeviceSaveService {
List<DataSetResult.ClinicalInfo> ClinicalInfoAll = ds.getClinicalInfo(); List<DataSetResult.ClinicalInfo> ClinicalInfoAll = ds.getClinicalInfo();
List<DataSetResult.StorageInfo> storageInfoAll = ds.getStorageInfo(); List<DataSetResult.StorageInfo> storageInfoAll = ds.getStorageInfo();
List<DataSetResult.PackingInfo> packingInfoAll = ds.getPackingInfo(); List<DataSetResult.PackingInfo> packingInfoAll = ds.getPackingInfo();
if (ds.getDeviceInfo() != null)
for (DataSetResult.DeviceInfo item : ds.getDeviceInfo()) { for (DataSetResult.DeviceInfo item : ds.getDeviceInfo()) {
//1:判断数据是否存在 //1:判断数据是否存在

@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.PushBuilder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -159,9 +160,7 @@ public class DeviceSyncService {
} }
public BaseResponse searchDlByDi(String deviceId) { public BaseResponse searchDlByDi(String deviceId) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); List<ProductInfoEntity> productInfoEntityList = searchByDI(deviceId);
productInfoFilterRequest.setNameCode(deviceId);
List<ProductInfoEntity> productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
if (CollUtil.isEmpty(productInfoEntityList)) { if (CollUtil.isEmpty(productInfoEntityList)) {
DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId); DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId);
if (result1.getReturnCode() != 1) if (result1.getReturnCode() != 1)
@ -171,7 +170,7 @@ public class DeviceSyncService {
List<DataSetResult.DataSet> dataSets = new ArrayList<>(); List<DataSetResult.DataSet> dataSets = new ArrayList<>();
dataSets.add(result1.getDataSet()); dataSets.add(result1.getDataSet());
deviceSaveService.DeviceSave(dataSets, new Date(), Constant.DL_TYPE_UPDATE); deviceSaveService.DeviceSave(dataSets, new Date(), Constant.DL_TYPE_UPDATE);
productInfoEntityList = productInfoService.findAll(productInfoFilterRequest); productInfoEntityList = searchByDI(deviceId);
} else { } else {
return ResultVOUtils.error(501, "医疗器械唯一标识数据库未找到此产品DI,请检查是否输入正确或联系厂家是否已上传"); return ResultVOUtils.error(501, "医疗器械唯一标识数据库未找到此产品DI,请检查是否输入正确或联系厂家是否已上传");
} }
@ -180,6 +179,20 @@ public class DeviceSyncService {
return ResultVOUtils.success(productInfoEntityList); return ResultVOUtils.success(productInfoEntityList);
} }
public List<ProductInfoEntity> searchByDI(String deviceId) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setNameCode(deviceId);
productInfoFilterRequest.setIsNewest(1);
List<ProductInfoEntity> productInfoEntityList = productInfoService.findAll(productInfoFilterRequest);
if (CollUtil.isNotEmpty(productInfoEntityList)) {
ProductInfoFilterRequest request = new ProductInfoFilterRequest();
request.setUuid(productInfoEntityList.get(0).getUuid());
productInfoEntityList = productInfoService.findAll(request);
}
return productInfoEntityList;
}
public BaseResponse searchDlByUuid(String uuid) { public BaseResponse searchDlByUuid(String uuid) {
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setUuid(uuid); productInfoFilterRequest.setUuid(uuid);

@ -116,7 +116,8 @@
<!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14--> <!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14-->
<select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest" <select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity"> resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo select *
from productinfo
<where> <where>
<if test="tyshxydm != '' and tyshxydm != null"> <if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm} AND tyshxydm = #{tyshxydm}
@ -384,10 +385,10 @@
cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm,
versionNumber versionNumber
, diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, , diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq,
ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx,sfwblztlcp,cgzmraqxgxx,sfbjwycxsy,zdcfsycs, ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx, sfwblztlcp, cgzmraqxgxx,
sfwwjbz,syqsfxyjxmj,mjfs,qtxxdwzlj,categoryName) sfbjwycxsy, zdcfsycs,
values ( sfwwjbz, syqsfxyjxmj, mjfs, qtxxdwzlj, categoryName)
#{nameCode}, values (#{nameCode},
#{packRatio}, #{packRatio},
#{packLevel}, #{packLevel},
#{bhxjsl}, #{bhxjsl},
@ -434,8 +435,7 @@
#{syqsfxyjxmj}, #{syqsfxyjxmj},
#{mjfs}, #{mjfs},
#{qtxxdwzlj}, #{qtxxdwzlj},
#{categoryName} #{categoryName})
)
</insert> </insert>
<delete id="deleteById" parameterType="Map"> <delete id="deleteById" parameterType="Map">
@ -569,7 +569,6 @@
<if test="categoryName != null"> <if test="categoryName != null">
categoryName=#{categoryName}, categoryName=#{categoryName},
</if> </if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@ -643,8 +642,6 @@
<if test="categoryName != null"> <if test="categoryName != null">
categoryName=#{categoryName}, categoryName=#{categoryName},
</if> </if>
</set> </set>
WHERE uuid = #{uuid} WHERE uuid = #{uuid}
</update> </update>
@ -657,6 +654,15 @@
group by uuid group by uuid
limit #{page}, #{limit} limit #{page}, #{limit}
</select> </select>
<select id="findAllNameCodes" parameterType="com.glxp.udidl.admin.req.ListPageRequest"
resultType="java.lang.String">
SELECT nameCode
from productinfo
group by nameCode
limit #{page}, #{limit}
</select>
<select id="findAllTyshxyh" resultType="java.lang.String"> <select id="findAllTyshxyh" resultType="java.lang.String">
SELECT tyshxydm SELECT tyshxydm
from productinfo from productinfo
@ -693,7 +699,8 @@
cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm,
versionNumber versionNumber
, diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, , diType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq,
ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx, sfwblztlcp, cgzmraqxgxx, sfbjwycxsy, ybbm, spmc, cphhhbh, cpms, cpbsbmtxmc, isNewest, updateTime, hchzsb, cplx, sfwblztlcp, cgzmraqxgxx,
sfbjwycxsy,
zdcfsycs, zdcfsycs,
sfwwjbz, syqsfxyjxmj, mjfs, qtxxdwzlj, categoryName) sfwwjbz, syqsfxyjxmj, mjfs, qtxxdwzlj, categoryName)
values (#{id}, values (#{id},

Loading…
Cancel
Save