فهرست منبع

文件处理查询

ljx 4 سال پیش
والد
کامیت
3797c1c555

+ 13 - 1
src/main/java/com/imed/costaccount/model/vo/CostIncomeFileVO.java

@@ -22,13 +22,25 @@ public class CostIncomeFileVO {
     private String fileType;
     @ApiModelProperty(name = "fileName",value = "文件名称")
     private String fileName;
-
+    /**
+     * 文件上传路径
+     */
+    @ApiModelProperty(name = "fileUrl",value = "文件地址")
+    private String fileUrl;
     @ApiModelProperty(name = "successAmount",value = "导入成功记录数")
     private Integer successAmount;
     @ApiModelProperty(name = "totalAmount",value = "总记录数")
     private Integer totalAmount;
     @ApiModelProperty(name = "userName",value = "导入人员")
     private String userName;
+    /**
+     * 创建时间
+     */
+    private Long createTime;
+    /**
+     * 导入时间
+     */
+    private String dateTime;
     /**
      * 错误详情
      */

+ 2 - 0
src/main/java/com/imed/costaccount/service/impl/CostIncomeFileServiceImpl.java

@@ -1,5 +1,6 @@
 package com.imed.costaccount.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -77,6 +78,7 @@ public class CostIncomeFileServiceImpl extends ServiceImpl<CostIncomeFileMapper,
             if (StrUtil.isNotBlank(errorList)){
                 i.setErrStatus(NumberConstant.ONE);
             }
+            i.setDateTime(DateUtil.format(DateUtil.date(i.getCreateTime()),"yyyy-MM-dd"));
         });
         PageUtils pageUtils = new PageUtils(page);
         pageUtils.setList(costIncomeFileVOList);

+ 54 - 8
src/main/java/com/imed/costaccount/service/impl/CostIncomeGroupServiceImpl.java

@@ -16,6 +16,7 @@ import com.imed.costaccount.model.vo.CostIncomeGroupBeforeVO;
 import com.imed.costaccount.model.vo.IncomeErrorMessage;
 import com.imed.costaccount.service.*;
 import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -145,12 +146,12 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         log.info("读取的数据为:{}", list);
         List<IncomeErrorMessage> incomeErrorMessageList = new ArrayList<>();
         //获取所有的科室 成本项目 责任中心 会计科目
-        Map<String, Department> departmentMap = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId)).stream().collect(Collectors.toMap(k -> k.getDepartmentCode() + k.getDepartmentName(), synOe -> synOe));
-        Map<String, Product> productMap = productService.list(new QueryWrapper<Product>().lambda().eq(Product::getHospId, hospId)).stream().collect(Collectors.toMap(k -> k.getProductCode() + k.getProductName(), synOe -> synOe));
-        Map<Long, Responsibility> responsibilityMap = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOe -> synOe));
-        Map<Long, Accounting> accountingMap = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId)).stream().collect(Collectors.toMap(Accounting::getId, synOe -> synOe));
-        List<ResponsibilityDepartment> responsibilityDepartmentList = responsibilityDepartmentService.list(new QueryWrapper<ResponsibilityDepartment>().lambda()
-                .eq(ResponsibilityDepartment::getHospId, hospId));
+        //
+        Map<String, Department> departmentMap = getDepartmentByCodeNameMap(hospId);
+        Map<String, Product> productMap = getProductByCodeNameMap(hospId);
+        Map<Long, Responsibility> responsibilityMap = getLongResponsibilityMap(hospId);
+        Map<Long, Accounting> accountingMap = getLongAccountingMap(hospId);
+        List<ResponsibilityDepartment> responsibilityDepartmentList = getResponsibilityDepartments(hospId);
         if (CollectionUtils.isEmpty(responsibilityDepartmentList)) {
             throw new CostException(500, "没有科室责任中心对照数据");
         }
@@ -158,8 +159,8 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         if (CollectionUtils.isEmpty(accountingProductList)) {
             throw new CostException(500, "没有成本会计对照数据");
         }
-        Map<Long, Long> responsibilityDepMap = responsibilityDepartmentList.stream().collect(Collectors.toMap(ResponsibilityDepartment::getDepartmentId, ResponsibilityDepartment::getResponsibilityId));
-        Map<Long, Long> accountProMap = accountingProductList.stream().collect(Collectors.toMap(AccountingProduct::getProductId, AccountingProduct::getAccountingId));
+        Map<Long, Long> responsibilityDepMap = getDepartmentIdResponsibilityIdMap(responsibilityDepartmentList);
+        Map<Long, Long> accountProMap = getProductIdAccountIdMap(accountingProductList);
         List<CostIncomeGroup> costIncomeGroupArrayList = new ArrayList<>();
         // 检验数据
         checkImportData(list, incomeErrorMessageList, costIncomeGroupArrayList, departmentMap, productMap, responsibilityMap, accountingMap, responsibilityDepMap, accountProMap,hospId,year,month);
@@ -183,6 +184,51 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         return Result.ok();
     }
 
+    /**
+     * 返回成本会计对照数据  Key 成本项目Id   Value 会计科目Id
+     * @param accountingProductList
+     * @return
+     */
+    @NotNull
+    private Map<Long, Long> getProductIdAccountIdMap(List<AccountingProduct> accountingProductList) {
+        return accountingProductList.stream().collect(Collectors.toMap(AccountingProduct::getProductId, AccountingProduct::getAccountingId));
+    }
+
+    /**
+     *
+     * @param responsibilityDepartmentList
+     * @return
+     */
+    @NotNull
+    private Map<Long, Long> getDepartmentIdResponsibilityIdMap(List<ResponsibilityDepartment> responsibilityDepartmentList) {
+        return responsibilityDepartmentList.stream().collect(Collectors.toMap(ResponsibilityDepartment::getDepartmentId, ResponsibilityDepartment::getResponsibilityId));
+    }
+
+    private List<ResponsibilityDepartment> getResponsibilityDepartments(Long hospId) {
+        return responsibilityDepartmentService.list(new QueryWrapper<ResponsibilityDepartment>().lambda()
+                    .eq(ResponsibilityDepartment::getHospId, hospId));
+    }
+
+    @NotNull
+    private Map<Long, Accounting> getLongAccountingMap(Long hospId) {
+        return accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId)).stream().collect(Collectors.toMap(Accounting::getId, synOe -> synOe));
+    }
+
+    @NotNull
+    private Map<Long, Responsibility> getLongResponsibilityMap(Long hospId) {
+        return responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOe -> synOe));
+    }
+
+    @NotNull
+    private Map<String, Product> getProductByCodeNameMap(Long hospId) {
+        return productService.list(new QueryWrapper<Product>().lambda().eq(Product::getHospId, hospId)).stream().collect(Collectors.toMap(k -> k.getProductCode() + k.getProductName(), synOe -> synOe));
+    }
+
+    @NotNull
+    private Map<String, Department> getDepartmentByCodeNameMap(Long hospId) {
+        return departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId)).stream().collect(Collectors.toMap(k -> k.getDepartmentCode() + k.getDepartmentName(), synOe -> synOe));
+    }
+
     /**
      * 导入收入数据
      *