|
@@ -17,19 +17,27 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.system.config.RedisUtil;
|
|
|
+import org.dromara.system.domain.SysDept;
|
|
|
+import org.dromara.system.domain.SysDiseaseLabel;
|
|
|
import org.dromara.system.domain.SysFoodCategory;
|
|
|
import org.dromara.system.domain.SysFoodIngredient;
|
|
|
import org.dromara.system.domain.vo.SysDeptVo;
|
|
|
import org.dromara.system.domain.vo.SysDiseaseLabelVo;
|
|
|
+import org.dromara.system.mapper.SysDeptMapper;
|
|
|
+import org.dromara.system.mapper.SysDiseaseLabelMapper;
|
|
|
import org.dromara.system.service.ISysDeptService;
|
|
|
import org.dromara.system.service.ISysDictDataService;
|
|
|
import org.dromara.system.service.ISysDiseaseLabelService;
|
|
|
+import org.dromara.web.domain.ProductManufacturer;
|
|
|
+import org.dromara.web.domain.ProductSupplier;
|
|
|
import org.dromara.web.domain.SuppliesCategory;
|
|
|
import org.dromara.web.domain.SuppliesManage;
|
|
|
import org.dromara.web.domain.bo.BatchSuppliesManageBo;
|
|
|
import org.dromara.web.domain.bo.SuppliesManageBo;
|
|
|
import org.dromara.web.domain.vo.SuppliesCategoryVo;
|
|
|
import org.dromara.web.domain.vo.SuppliesManageVo;
|
|
|
+import org.dromara.web.mapper.ProductManufacturerMapper;
|
|
|
+import org.dromara.web.mapper.ProductSupplierMapper;
|
|
|
import org.dromara.web.mapper.SuppliesCategoryMapper;
|
|
|
import org.dromara.web.mapper.SuppliesManageMapper;
|
|
|
import org.dromara.web.service.ISuppliesCategoryService;
|
|
@@ -56,16 +64,25 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
|
|
|
private final SuppliesManageMapper baseMapper;
|
|
|
|
|
|
+ private final SysDeptMapper deptMapper;
|
|
|
+
|
|
|
private final ISysDeptService deptService;
|
|
|
|
|
|
+ private final SysDiseaseLabelMapper labelMapper;
|
|
|
+
|
|
|
private final SuppliesCategoryMapper categoryMapper;
|
|
|
|
|
|
+ private final ProductSupplierMapper supplierMapper;
|
|
|
+
|
|
|
+ private final ProductManufacturerMapper manufacturerMapper;
|
|
|
+
|
|
|
private final ISysDictDataService dictDataService;
|
|
|
|
|
|
private final ISuppliesCategoryService categoryService;
|
|
|
|
|
|
private final ISysDiseaseLabelService diseaseLabelService;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 查询耗材管理
|
|
|
*
|
|
@@ -296,6 +313,19 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
|
|
|
List<SuppliesCategory> categoryList = categoryMapper.selectList(Wrappers.lambdaQuery(SuppliesCategory.class).select(SuppliesCategory::getCategoryId, SuppliesCategory::getCategoryName));
|
|
|
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(k1 -> k1.getCategoryName(), k2 -> String.valueOf(k2.getCategoryId()), (k1, k2) -> k1));
|
|
|
+
|
|
|
+ List<ProductSupplier> productSupplierList = supplierMapper.selectList(Wrappers.lambdaQuery(ProductSupplier.class).select(ProductSupplier::getId, ProductSupplier::getName));
|
|
|
+ Map<String, String> productSupplierMap = productSupplierList.stream().collect(Collectors.toMap(k1 -> k1.getName(), k2 -> String.valueOf(k2.getId()), (k1, k2) -> k1));
|
|
|
+
|
|
|
+ List<ProductManufacturer> productManufacturerList = manufacturerMapper.selectList(Wrappers.lambdaQuery(ProductManufacturer.class).select(ProductManufacturer::getId, ProductManufacturer::getName));
|
|
|
+ Map<String, String> productManufacturerMap = productManufacturerList.stream().collect(Collectors.toMap(k1 -> k1.getName(), k2 -> String.valueOf(k2.getId()), (k1, k2) -> k1));
|
|
|
+
|
|
|
+ List<SysDiseaseLabel> disLabelList = labelMapper.selectList(Wrappers.lambdaQuery(SysDiseaseLabel.class).select(SysDiseaseLabel::getLabelId, SysDiseaseLabel::getLabelName));
|
|
|
+ Map<String, String> labelMap = disLabelList.stream().collect(Collectors.toMap(k1 -> k1.getLabelName(), k2 -> String.valueOf(k2.getLabelId()), (k1, k2) -> k1));
|
|
|
+
|
|
|
+ List<SysDept> deptlList = deptMapper.selectList(Wrappers.lambdaQuery(SysDept.class).select(SysDept::getDeptId, SysDept::getDeptName));
|
|
|
+ Map<String, String> deptMap = deptlList.stream().collect(Collectors.toMap(k1 -> k1.getDeptName(), k2 -> String.valueOf(k2.getDeptId()), (k1, k2) -> k1));
|
|
|
+
|
|
|
List<SuppliesManage> suppliesManages = new ArrayList<>();
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
//根据excel中的值获取字典label
|
|
@@ -314,14 +344,6 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
productSpecUnitMap.put(y.getDictLabel(), k);
|
|
|
});
|
|
|
|
|
|
- Map<String, String> productSupplierMap = MapUtil.newHashMap(excelList.size());
|
|
|
- dictDataService.selectMapByType("product_supplier").getData().forEach((k, y) -> {
|
|
|
- productSupplierMap.put(y.getDictLabel(), k);
|
|
|
- });
|
|
|
- Map<String, String> productManufacturerMap = MapUtil.newHashMap(excelList.size());
|
|
|
- dictDataService.selectMapByType("product_manufacturer").getData().forEach((k, y) -> {
|
|
|
- productManufacturerMap.put(y.getDictLabel(), k);
|
|
|
- });
|
|
|
Map<String, String> putFlagMap = MapUtil.newHashMap(excelList.size());
|
|
|
dictDataService.selectMapByType("put_flag").getData().forEach((k, y) -> {
|
|
|
putFlagMap.put(y.getDictLabel(), k);
|
|
@@ -339,6 +361,8 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
suppliesManage.setShelfLife(v.get(3));
|
|
|
suppliesManage.setProductQualification(productQualificationMap.get(v.get(4)));
|
|
|
StringBuilder categoryIds = new StringBuilder();
|
|
|
+ StringBuilder labelIds = new StringBuilder();
|
|
|
+ StringBuilder deptIds = new StringBuilder();
|
|
|
|
|
|
List<String> suppliesNames = Arrays.stream(v.get(5).split("/")).map(String::trim).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
|
|
List<String> categories = new ArrayList<>();
|
|
@@ -361,15 +385,42 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
suppliesManage.setBrand(colVal);
|
|
|
|
|
|
}
|
|
|
+ colVal = v.get(13);
|
|
|
+ if (StrUtil.isNotBlank(colVal)) {
|
|
|
+ List<String> labelNames = Arrays.stream(colVal.split(",")).map(String::trim).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
|
|
+ List<String> dLabelNameList = new ArrayList<>();
|
|
|
+ for (String name : labelNames) {
|
|
|
+ dLabelNameList.add(labelMap.get(name));
|
|
|
+ }
|
|
|
+ String label = String.join(",", dLabelNameList); // 自动处理逗号
|
|
|
+ labelIds.append(label);
|
|
|
+ suppliesManage.setProductLabel(labelIds.toString());
|
|
|
+ }
|
|
|
+ colVal = v.get(14);
|
|
|
+ if (StrUtil.isNotBlank(colVal)) {
|
|
|
+ List<String> deptNames = Arrays.stream(colVal.split(",")).map(String::trim).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
|
|
+ List<String> deptNameList = new ArrayList<>();
|
|
|
+ for (String name : deptNames) {
|
|
|
+ SysDeptVo deptVo = deptMapper.selectVoById(deptMap.get(name));
|
|
|
+ if (null != deptVo) {
|
|
|
+ if (deptVo.getParentId() > 0) {
|
|
|
+ deptNameList.add(deptVo.getParentId() + "," + deptVo.getDeptId());
|
|
|
+ } else {
|
|
|
+ deptNameList.add(deptVo.getDeptId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String deptId = String.join(";", deptNameList); // 自动处理逗号
|
|
|
+ deptIds.append(deptId);
|
|
|
+ suppliesManage.setApplicableDepartment(deptIds.toString());
|
|
|
+ }
|
|
|
+
|
|
|
colVal = v.get(15);
|
|
|
if (StrUtil.isNotBlank(colVal)) {
|
|
|
suppliesManage.setSupplier(productSupplierMap.get(colVal));
|
|
|
}
|
|
|
+
|
|
|
colVal = v.get(16);
|
|
|
- if (StrUtil.isNotBlank(colVal)) {
|
|
|
- suppliesManage.setApprovalNumber(colVal);
|
|
|
- }
|
|
|
- colVal = v.get(17);
|
|
|
if (StrUtil.isNotBlank(colVal)) {
|
|
|
try {
|
|
|
suppliesManage.setProductLicenseExpiry(sdf.parse(colVal));
|
|
@@ -377,18 +428,21 @@ public class SuppliesManageServiceImpl implements ISuppliesManageService {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
- colVal = v.get(18);
|
|
|
+ colVal = v.get(17);
|
|
|
if (StrUtil.isNotBlank(colVal)) {
|
|
|
suppliesManage.setApprovalNumber(colVal);
|
|
|
}
|
|
|
-
|
|
|
+ colVal = v.get(18);
|
|
|
+ if (StrUtil.isNotBlank(colVal)) {
|
|
|
+ suppliesManage.setLicenseExpiryReminder(colVal);
|
|
|
+ }
|
|
|
colVal = v.get(19);
|
|
|
if (StrUtil.isNotBlank(colVal)) {
|
|
|
suppliesManage.setManufacturer(productManufacturerMap.get(colVal));
|
|
|
}
|
|
|
colVal = v.get(20);
|
|
|
if (StrUtil.isNotBlank(colVal)) {
|
|
|
- suppliesManage.setPutFlag(putFlagMap.get(colVal));
|
|
|
+ suppliesManage.setPutFlag(putFlagMap.get("已" + colVal));
|
|
|
}
|
|
|
|
|
|
suppliesManages.add(suppliesManage);
|