1.医疗器械信息导出关联导出第三方产品信息

master
MrZhai 3 years ago
parent d145d2c7e3
commit 971b8e2b51

@ -130,7 +130,7 @@ public class UdiInfoImportLogController {
String fileName = file.getOriginalFilename();
try {
String fileType = fileName.substring(fileName.lastIndexOf("."));
if (!".udi".equals(fileType.toLowerCase())) {
if (!".udi".equalsIgnoreCase(fileType)) {
return ResultVOUtils.error(500, "请上传udi文件");
}
//导入数据

@ -24,4 +24,11 @@ public interface ThrProductsDao {
boolean deleteById(@Param("id") String id);
boolean deleteAll();
/**
*
*
* @param thrProductsEntities
*/
void importThrProductss(@Param("thrProductsEntities") List<ThrProductsEntity> thrProductsEntities);
}

@ -2,6 +2,7 @@ package com.glxp.api.admin.res.basic;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import lombok.Data;
import java.util.ArrayList;
@ -17,8 +18,12 @@ public class UdiRelevanceExportJsonResponse {
List<UdiRelevanceEntity> udiRelevanceEntities;
//第三方产品信息
List<ThrProductsEntity> thrProductsEntities;
public UdiRelevanceExportJsonResponse() {
this.udiInfoEntities = new ArrayList<>();
this.udiRelevanceEntities = new ArrayList<>();
this.thrProductsEntities = new ArrayList<>();
}
}

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.UdiInfoDao;
import com.glxp.api.admin.dao.basic.UdiInfoImportDetailDao;
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
import com.glxp.api.admin.entity.basic.UdiInfoImportDetailEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
@ -25,6 +26,8 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic
UdiInfoDao udiInfoDao;
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
ThrProductsDao thrProductsDao;
@Override
public List<UdiInfoImportDetailEntity> filterUdiInfoImport(FilterUdiIpLogRequest filterInCodeLogRequest) {
@ -76,5 +79,9 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiRelevanceEntities())) {
udiRelevanceDao.importUdiRelevance(udiRelevanceExportJsonResponse.getUdiRelevanceEntities());
}
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getThrProductsEntities())) {
thrProductsDao.importThrProductss(udiRelevanceExportJsonResponse.getThrProductsEntities());
}
}
}

@ -3,15 +3,19 @@ package com.glxp.api.admin.thread;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.file.FileWriter;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.json.JSONUtil;
import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.dao.basic.UdiInfoDao;
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.admin.req.basic.CorpsExportRequest;
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
import com.glxp.api.admin.req.basic.UdiInfoExportRequest;
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
@ -25,6 +29,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
@ -44,6 +49,8 @@ public class BasicGenJsonService {
UdiRelevanceDao udiRelevanceDao;
@Resource
UdiInfoDao udiInfoDao;
@Resource
ThrProductsDao thrProductsDao;
public void exportCorp(String genKey, CorpsExportRequest corpsExportRequest) {
@ -135,6 +142,29 @@ public class BasicGenJsonService {
});
List<UdiInfoEntity> udiInfoEntities = udiInfoDao.batchSelectByUuid(uuids);
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceDao.batchSelectByUuid(uuids);
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
List<ThrProductsEntity> thrProductsEntities = new ArrayList<>(udiRelevanceEntities.size());
Field[] fields = ReflectUtil.getFields(UdiRelevanceEntity.class);
udiRelevanceEntities.forEach(udiRelevanceEntity -> {
for (Field field : fields) {
if (field.getName().contains("thirdId")) {
Object fieldValue = ReflectUtil.getFieldValue(udiRelevanceEntity, field);
if (null != fieldValue) {
FilterThrProductsRequest filter = new FilterThrProductsRequest();
filter.setCode(String.valueOf(fieldValue));
filter.setThirdSysFk("thirdId");
List<ThrProductsEntity> result = thrProductsDao.filterThrProductsRequest(filter);
if (CollUtil.isNotEmpty(result)) {
thrProductsEntities.addAll(result);
}
}
}
}
});
if (CollUtil.isNotEmpty(thrProductsEntities)) {
exportData.setThrProductsEntities(thrProductsEntities);
}
}
List<UdiInfoEntity> udiInfo = exportData.getUdiInfoEntities();
List<UdiRelevanceEntity> udiRelevance = exportData.getUdiRelevanceEntities();
udiInfo.addAll(udiInfoEntities);

@ -10,7 +10,6 @@ import com.glxp.api.admin.controller.inout.utils.InoutUtils;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.business.StockOrderEntity;
import com.glxp.api.admin.entity.info.CompanyEntity;
import com.glxp.api.admin.entity.inout.ErpOrderEntity;
import com.glxp.api.admin.entity.inout.FilterErpOrderRequest;
import com.glxp.api.admin.entity.inout.OrderEntity;
@ -160,7 +159,11 @@ public class IoTransInoutService {
orderSaveRequest.setErpFk(docidStr);
}
}
try {
orderService.insertOrder(orderSaveRequest);
} catch (Exception e) {
logger.error("插入订单数据异常", e);
}
for (int index = 0; index < warehouseEntityList.size(); index++) {
warehouseEntityList.get(index).setOrderId(orderId);
}

@ -143,4 +143,32 @@
DELETE
FROM thr_products
</delete>
<insert id="importThrProductss" parameterType="java.util.List">
replace into thr_products (id, code, name, measname, spec, registerNo, manufactory, thirdSysFk, cplb, flbm,
qxlb, ybbm, sptm, tyshxydm, zczbhhzbapzbh, ylqxzcrbarmc, ylqxzcrbarywmc, cpms,
updateTime, supName) VALUES
<foreach collection="thrProductsEntities" item="item" index="index" separator=",">
(#{item.id},
#{item.code},
#{item.name},
#{item.measname},
#{item.spec},
#{item.registerNo},
#{item.manufactory},
#{item.thirdSysFk},
#{item.cplb},
#{item.flbm},
#{item.qxlb},
#{item.ybbm},
#{item.sptm},
#{item.tyshxydm},
#{item.zczbhhzbapzbh},
#{item.ylqxzcrbarmc},
#{item.ylqxzcrbarywmc},
#{item.cpms},
#{item.updateTime},
#{item.supName})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save