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

+ 13 - 0
src/main/java/com/imed/costaccount/model/vo/CostIncomeGroupBeforeVO.java

@@ -21,36 +21,49 @@ public class CostIncomeGroupBeforeVO {
     @ApiModelProperty(name = "openDepartmentCode",value = "开单科室的代码")
     private String openDepartmentCode;
 
+    @ApiModelProperty(name = "openDepartmentName",value = "开单科室的名称")
+    private String openDepartmentName;
+
     @ApiModelProperty(name = "openDepartmentCodeName",value = "开单科室的代码+名称")
     private String openDepartmentCodeName;
 
     @ApiModelProperty(name = "openResponsibilityCode",value = "开单责任中心的代码")
     private String openResponsibilityCode;
 
+    private String openResponsibilityName;
+
     @ApiModelProperty(name = "openResponsibilityCodeName",value = "开单责任中心的代码+名称")
     private String openResponsibilityCodeName;
 
     @ApiModelProperty(name = "startDepartmentCode",value = "执行科室的代码")
     private String startDepartmentCode;
 
+    private String startDepartmentName;
+
     @ApiModelProperty(name = "startDepartmentCodeName",value = "执行科室代码+名称")
     private String startDepartmentCodeName;
 
     @ApiModelProperty(name = "startResponsibilityCode",value = "执行责任中心代码")
     private String startResponsibilityCode;
 
+    private String startResponsibilityName;
+
     @ApiModelProperty(name = "startResponsibilityCodeName",value = "执行责任中心代码+名称")
     private String startResponsibilityCodeName;
 
     @ApiModelProperty(name = "productCode",value = "成本项目的代码")
     private String productCode;
 
+    private String productName;
+
     @ApiModelProperty(name = "productCodeName",value = "成本项目的代码+名称")
     private String productCodeName;
 
     @ApiModelProperty(name = "accountCode",value = "会计科目的代码")
     private String accountCode;
 
+    private String accountName;
+
     @ApiModelProperty(name = "accountCodeName",value = "会计科目的代码+名称")
     private String accountCodeName;
 

+ 34 - 28
src/main/java/com/imed/costaccount/service/impl/CostIncomeGroupServiceImpl.java

@@ -28,6 +28,7 @@ import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -99,10 +100,9 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         // 进行金额合并
         List<CostIncomeGroupAllAmountVO> costIncomeGroupAllAmountVoS = baseMapper.countMoney(costIncomeGroupBeforeVOList);
         //  对,的金额进行合并
-        BigDecimal totalAmount= null;
+        AtomicReference<BigDecimal> totalAmount= null;
         costIncomeGroupAllAmountVoS.forEach(i -> {
             String allMoney = i.getAllMoney();
-
             if (allMoney.contains(StrUtil.COMMA)) {
                 // 存在,在进行求和
                 long sum;
@@ -111,6 +111,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
                 i.setAmount(BigDecimal.valueOf(sum));
             }
             //TODO 统计总金额
+//            totalAmount.updateAndGet(v -> v + i.getAmount());
         });
         PageUtils pageUtils = new PageUtils(pages);
         pageUtils.setList(costIncomeGroupAllAmountVoS);
@@ -166,7 +167,8 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         // 记录文件上传记录
         CostIncomeFile costIncomeFile = new CostIncomeFile();
         costIncomeFile.setFileType(file.getContentType());
-        costIncomeFile.setFileName(file.getOriginalFilename());
+        String substring = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."))+System.currentTimeMillis()+".xsl";
+        costIncomeFile.setFileName(substring);
         costIncomeFile.setFileUrl(uploadFile);
         costIncomeFile.setTotalAmount(list.size());
         if (!CollectionUtils.isEmpty(incomeErrorMessageList)) {
@@ -185,6 +187,9 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
             // 设置文件Id
             i.setFileId(id);
         });
+        if (CollectionUtils.isEmpty(incomeErrorMessageList)){
+            this.saveBatch(costIncomeGroupArrayList);
+        }
         return Result.ok();
     }
 
@@ -217,10 +222,10 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
             String openDepartmentCode = data.get(3).toString();
             String startDepartmentName = data.get(4).toString();
             String startDepartmentCode = data.get(5).toString();
-            BigDecimal beforeMoney = (BigDecimal) data.get(15);
-            boolean checkNull = Objects.isNull(beforeMoney);
-            boolean checkOne = NumberConstant.ZERO.equals(Integer.parseInt(beforeMoney.toString()));
-            if (!checkNull && !checkOne) {
+            BigDecimal beforeMoney = BigDecimal.valueOf(Double.parseDouble(data.get(15).toString()));
+            boolean checkNull = StrUtil.isBlank(data.get(15).toString());
+            boolean checkOne = NumberConstant.ZERO.equals(data.get(15).toString());
+            if (checkNull || checkOne) {
                 // 要求这一行的数据必须全部填写
                 for (int j = 0; j < NumberConstant.FIVE; j++) {
                     if (Objects.isNull(data.get(j))) {
@@ -236,7 +241,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
             Product product = productMap.get(productCode + productName);
             Department department = departmentMap.get(openDepartmentCode + openDepartmentName);
             Department department1 = departmentMap.get(startDepartmentCode + startDepartmentName);
-            if (checkNull || checkOne ){
+            if (!checkNull && !checkOne ){
                 if (StrUtil.isNotBlank(productCode) && StrUtil.isNotBlank(productName)){
                     if (Objects.isNull(product)) {
                         incomeErrorMessage.setTotal(i);
@@ -265,7 +270,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
                 }
             }
             // 检验开单科室
-            if (checkNull || checkOne ){
+            if (!checkNull && !checkOne ){
                 if (StrUtil.isNotBlank(openDepartmentCode) && StrUtil.isNotBlank(openDepartmentName)){
                     // 开单科室
                     if (Objects.isNull(department)) {
@@ -283,7 +288,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
                             costIncomeGroup.setOpenDepartmentCode(openDepartmentCode);
                             costIncomeGroup.setOpenDepartmentName(openDepartmentName);
                             costIncomeGroup.setOpenResponsibilityCode(responsibilityMap.get(responsibilityId).getResponsibilityCode());
-                            costIncomeGroup.setOpenResponsibilityCode(responsibilityMap.get(responsibilityId).getResponsibilityName());
+                            costIncomeGroup.setOpenResponsibilityName(responsibilityMap.get(responsibilityId).getResponsibilityName());
                         }
                     }
                 }else {
@@ -294,7 +299,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
                 }
             }
             // 检验执行科室
-            if (checkNull || checkOne ){
+            if ( !checkNull && !checkOne ){
                 if (StrUtil.isNotBlank(startDepartmentCode) && StrUtil.isNotBlank(startDepartmentName)){
                     //执行科室
                     if (Objects.isNull(department1)) {
@@ -310,9 +315,9 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
                             incomeErrorMessageList.add(incomeErrorMessage);
                         } else {
                             costIncomeGroup.setStartDepartmentCode(startDepartmentCode);
-                            costIncomeGroup.setOpenDepartmentName(startDepartmentName);
+                            costIncomeGroup.setStartDepartmentName(startDepartmentName);
                             costIncomeGroup.setStartResponsibilityCode(responsibilityMap.get(responsibilityId).getResponsibilityCode());
-                            costIncomeGroup.setStartResponsibilityCode(responsibilityMap.get(responsibilityId).getResponsibilityName());
+                            costIncomeGroup.setStartResponsibilityName(responsibilityMap.get(responsibilityId).getResponsibilityName());
                         }
                     }
                 }else {
@@ -333,6 +338,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
             costIncomeGroup.setDateYear(year);
             costIncomeGroup.setDateMonth(month);
             costIncomeGroup.setAmount(beforeMoney);
+            costIncomeGroupArrayList.add(costIncomeGroup);
         }
     }
 
@@ -343,23 +349,23 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
      * @param costIncomeGroupBeforeVOList
      */
     private void setCodeName(Long hospId, List<CostIncomeGroupBeforeVO> costIncomeGroupBeforeVOList) {
-        List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
-        Map<String, String> responsibilityMap = responsibilityList.stream().collect(Collectors.toMap(Responsibility::getResponsibilityCode, Responsibility::getResponsibilityName));
-        List<Department> departmentList = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId));
-        Map<String, String> departmentMap = departmentList.stream().collect(Collectors.toMap(Department::getDepartmentCode, Department::getDepartmentName));
-        List<Product> productList = productService.list(new QueryWrapper<Product>().lambda().eq(Product::getHospId, hospId));
-        Map<String, String> productMap = productList.stream().collect(Collectors.toMap(Product::getProductCode, Product::getProductName));
-        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
-        Map<String, String> accountMap = accountingList.stream().collect(Collectors.toMap(Accounting::getAccountingCode, Accounting::getAccountingName));
+//        List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
+//        Map<String, String> responsibilityMap = responsibilityList.stream().collect(Collectors.toMap(Responsibility::getResponsibilityCode, Responsibility::getResponsibilityName));
+//        List<Department> departmentList = departmentService.list(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId));
+//        Map<String, String> departmentMap = departmentList.stream().collect(Collectors.toMap(Department::getDepartmentCode, Department::getDepartmentName));
+//        List<Product> productList = productService.list(new QueryWrapper<Product>().lambda().eq(Product::getHospId, hospId));
+//        Map<String, String> productMap = productList.stream().collect(Collectors.toMap(Product::getProductCode, Product::getProductName));
+//        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
+//        Map<String, String> accountMap = accountingList.stream().collect(Collectors.toMap(Accounting::getAccountingCode, Accounting::getAccountingName));
         costIncomeGroupBeforeVOList.forEach(i -> {
             // 以为这里的数据导入的  在导入的时候进行数据校验
             // 设置开单科室名称 执行科室名称  开单责任中心名称  执行责任中心名称 成本项目的名称 会计科目名称
-            i.setOpenDepartmentCodeName("[" + i.getOpenDepartmentCode() + "]" + departmentMap.get(i.getOpenDepartmentCode()));
-            i.setOpenResponsibilityCodeName("[" + i.getOpenResponsibilityCode() + "]" + responsibilityMap.get(i.getOpenResponsibilityCode()));
-            i.setStartDepartmentCodeName("[" + i.getStartDepartmentCode() + "]" + departmentMap.get(i.getStartDepartmentCode()));
-            i.setStartResponsibilityCodeName("[" + i.getStartResponsibilityCode() + "]" + responsibilityMap.get(i.getStartResponsibilityCode()));
-            i.setProductCodeName("[" + i.getProductCode() + "]" + productMap.get(i.getProductCode()));
-            i.setAccountCodeName("[" + i.getAccountCode() + "]" + accountMap.get(i.getAccountCode()));
+            i.setOpenDepartmentCodeName("[" + i.getOpenDepartmentCode() + "]" + i.getOpenDepartmentName());
+            i.setOpenResponsibilityCodeName("[" + i.getOpenResponsibilityCode() + "]" + i.getOpenResponsibilityName());
+            i.setStartDepartmentCodeName("[" + i.getStartDepartmentCode() + "]" + i.getStartDepartmentName());
+            i.setStartResponsibilityCodeName("[" + i.getStartResponsibilityCode() + "]" + i.getStartResponsibilityCode());
+            i.setProductCodeName("[" + i.getProductCode() + "]" + i.getProductName());
+            i.setAccountCodeName("[" + i.getAccountCode() + "]" + i.getAccountName());
         });
     }
 
@@ -368,7 +374,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
      */
     public String uploadFile(MultipartFile file, User user) {
         Long hospId = user.getHospId();
-        String fileName = file.getOriginalFilename();
+        String fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."))+System.currentTimeMillis()+".xsl";
         String localFilePath = fileTempPath + StrUtil.SLASH + hospId + StrUtil.SLASH;
         File tempFile = new File(localFilePath);
         if (!tempFile.exists()) {

+ 1 - 1
src/main/java/com/imed/costaccount/service/impl/CostNumberBedSetServiceImpl.java

@@ -173,13 +173,13 @@ public class CostNumberBedSetServiceImpl extends ServiceImpl<CostNumberBedSetMap
         }
         String shareParamCodes = costNumberBedSetEditDto.getShareParamCode();
         Integer incomeFieldNums = costNumberBedSetEditDto.getIncomeFieldNum();
+        this.removeById(id);
         CostNumberBedSet costNumberBedSetResponse = this.getOne(new QueryWrapper<CostNumberBedSet>().lambda().eq(CostNumberBedSet::getHospId, hospId)
                 .eq(CostNumberBedSet::getShareParamCode, shareParamCodes)
                 .eq(CostNumberBedSet::getIncomeFieldNum, incomeFieldNums));
         if (Objects.nonNull(costNumberBedSetResponse)){
             throw new CostException(500,"数据已经存在");
         }
-        this.removeById(id);
         CostNumberBedSet costNumberBedSetRequest = BeanUtil.convertObj(costNumberBedSetEditDto, CostNumberBedSet.class);
         costNumberBedSetRequest.setHospId(hospId);
         costNumberBedSetRequest.setCreateTime(System.currentTimeMillis());