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

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 com.alibaba.fastjson.JSONObject;
import com.glxp.udidl.admin.constant.Constant;
import com.glxp.udidl.admin.dao.udi.ProductInfoMapper;
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
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.UdiCompanyRequest;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.service.dataSync.DeviceSyncService;
import com.glxp.udidl.admin.service.dataSync.UdplatDownloadService;
import com.glxp.udidl.admin.service.dataSync.UdplatSyncService;
import com.glxp.udidl.admin.res.udid.DataSetResult;
import com.glxp.udidl.admin.res.udid.DataSetSingleResult;
import com.glxp.udidl.admin.service.dataSync.*;
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.thread.UdiTransferUtils;
import com.glxp.udidl.admin.util.RedisUtil;
import com.glxp.udidl.admin.util.ResultVOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -169,4 +172,40 @@ public class TestController {
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> findAllNameCodes(ListPageRequest listPageRequest);
List<ProductInfoEntity> selectByUuid(@Param("uuid") String uuid);
List<ProductInfoEntity> filterUdi(ProductInfoFilterRequest productInfoFilterRequest);

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

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

@ -116,7 +116,8 @@
<!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14-->
<select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo
select *
from productinfo
<where>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
@ -384,10 +385,10 @@
cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm,
versionNumber
, 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,
sfbjwycxsy, zdcfsycs,
sfwwjbz, syqsfxyjxmj, mjfs, qtxxdwzlj, categoryName)
values (
#{nameCode},
values (#{nameCode},
#{packRatio},
#{packLevel},
#{bhxjsl},
@ -434,8 +435,7 @@
#{syqsfxyjxmj},
#{mjfs},
#{qtxxdwzlj},
#{categoryName}
)
#{categoryName})
</insert>
<delete id="deleteById" parameterType="Map">
@ -569,7 +569,6 @@
<if test="categoryName != null">
categoryName=#{categoryName},
</if>
</set>
WHERE id = #{id}
</update>
@ -643,8 +642,6 @@
<if test="categoryName != null">
categoryName=#{categoryName},
</if>
</set>
WHERE uuid = #{uuid}
</update>
@ -657,6 +654,15 @@
group by uuid
limit #{page}, #{limit}
</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 tyshxydm
from productinfo
@ -693,7 +699,8 @@
cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, uuid, sjcpbm,
versionNumber
, 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,
sfwwjbz, syqsfxyjxmj, mjfs, qtxxdwzlj, categoryName)
values (#{id},

Loading…
Cancel
Save