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

master
MrZhai 3 years ago
parent c731f23e97
commit a58340e2e0

@ -1,7 +1,6 @@
package com.glxp.sale.admin.controller.basic;
import cn.hutool.core.io.IoUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo;
@ -136,7 +135,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文件");
}
//导入数据

@ -31,4 +31,11 @@ public interface ThrProductsDao {
* @param thrProductsEntities
*/
void importThrProducts(@Param("thrProductsEntities") List<ThrProductsEntity> thrProductsEntities);
/**
*
*
* @param thrProductsEntities
*/
void importThrProductss(@Param("thrProductsEntities") List<ThrProductsEntity> thrProductsEntities);
}

@ -3,6 +3,7 @@ package com.glxp.sale.admin.res.basic;
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
import lombok.Data;
import java.util.ArrayList;
@ -18,10 +19,14 @@ public class UdiRelevanceExportJsonResponse {
List<UdiRelevanceEntity> udiRelevanceEntities;
//第三方产品信息
List<ThrProductsEntity> thrProductsEntities;
public UdiRelevanceExportJsonResponse() {
this.udiInfoEntities = new ArrayList<>();
this.udiRelevanceEntities = new ArrayList<>();
this.companyProductRelevanceEntities = new ArrayList<>();
this.thrProductsEntities = new ArrayList<>();
}
private List<CompanyProductRelevanceEntity> companyProductRelevanceEntities;

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
import com.glxp.sale.admin.dao.basic.UdiInfoImportDetailDao;
import com.glxp.sale.admin.dao.basic.UdiRelevanceDao;
import com.glxp.sale.admin.dao.thrsys.ThrProductsDao;
import com.glxp.sale.admin.entity.basic.UdiInfoImportDetailEntity;
import com.glxp.sale.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.sale.admin.res.basic.UdiRelevanceExportJsonResponse;
@ -24,6 +25,8 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic
UdiInfoDao udiInfoDao;
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
ThrProductsDao thrProductsDao;
@Override
public List<UdiInfoImportDetailEntity> filterUdiInfoImport(FilterUdiIpLogRequest filterInCodeLogRequest) {
@ -74,5 +77,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,16 +3,19 @@ package com.glxp.sale.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.sale.admin.constant.BasicProcessStatus;
import com.glxp.sale.admin.constant.ConstantStatus;
import com.glxp.sale.admin.constant.UdiInfoImportStatus;
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
import com.glxp.sale.admin.dao.basic.UdiRelevanceDao;
import com.glxp.sale.admin.dao.thrsys.ThrProductsDao;
import com.glxp.sale.admin.entity.basic.*;
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.sale.admin.req.basic.*;
import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest;
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
import com.glxp.sale.admin.res.basic.UdiExportJsonResponse;
import com.glxp.sale.admin.res.basic.UdiRelevanceExportJsonResponse;
import com.glxp.sale.admin.res.basic.UdiRelevanceResponse;
@ -21,13 +24,13 @@ import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
import com.glxp.sale.admin.util.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,6 +55,8 @@ public class BasicGenExcelService {
UdiInfoDao udiInfoDao;
@Resource
private CompanyProductRelevanceService companyProductRelevanceService;
@Resource
ThrProductsDao thrProductsDao;
//往来单位
@Async
@ -364,6 +369,29 @@ public class BasicGenExcelService {
});
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);

@ -138,4 +138,32 @@
#{item.thirdSysFk}, #{item.updateTime}, #{item.supName})
</foreach>
</insert>
<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