|
@@ -217,7 +217,7 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
throw new CostException(500, "文件上传异常");
|
|
|
}
|
|
|
// 记录文件上传记录
|
|
|
- CostIncomeFile costIncomeFile = costIncomeFileService.saveCostIncomeFile(list, user, file, hospId, incomeErrorMessageList, uploadFile, fileType,year,month);
|
|
|
+ CostIncomeFile costIncomeFile = costIncomeFileService.saveCostIncomeFile(list, user, file, hospId, incomeErrorMessageList, uploadFile, fileType, year, month);
|
|
|
return Result.build(500, "数据未成功导入", null);
|
|
|
}
|
|
|
// 检验数据的合理性
|
|
@@ -230,7 +230,7 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
throw new CostException(500, "文件上传异常");
|
|
|
}
|
|
|
// 记录文件上传记录
|
|
|
- CostIncomeFile costIncomeFile = costIncomeFileService.saveCostIncomeFile(list, user, file, hospId, incomeErrorMessageList, uploadFile, fileType,year,month);
|
|
|
+ CostIncomeFile costIncomeFile = costIncomeFileService.saveCostIncomeFile(list, user, file, hospId, incomeErrorMessageList, uploadFile, fileType, year, month);
|
|
|
Long id = costIncomeFile.getId();
|
|
|
costCostingGroupArrayList.forEach(i -> {
|
|
|
// 设置文件Id
|
|
@@ -246,7 +246,6 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 检验成本数据
|
|
|
*
|
|
@@ -284,11 +283,11 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
data.add(NumberConstant.ZERO);
|
|
|
}
|
|
|
}
|
|
|
- if (CollectionUtils.isEmpty(incomeErrorMessageList)){
|
|
|
- incomeErrorMessageList=new ArrayList<>();
|
|
|
+ if (CollectionUtils.isEmpty(incomeErrorMessageList)) {
|
|
|
+ incomeErrorMessageList = new ArrayList<>();
|
|
|
int emptyStatus = 0;
|
|
|
- for (int j = 2; j < data.size()-1 ; j++) {
|
|
|
- BigDecimal parseInt = new BigDecimal (data.get(j).toString());
|
|
|
+ for (int j = 2; j < data.size() - 1; j++) {
|
|
|
+ BigDecimal parseInt = new BigDecimal(data.get(j).toString());
|
|
|
if (!BigDecimal.ZERO.equals(parseInt)) {
|
|
|
emptyStatus = 1;
|
|
|
break;
|
|
@@ -296,25 +295,32 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
}
|
|
|
// 检验成本项目是否正确
|
|
|
CostCostingGroup costCostingGroupRequest = new CostCostingGroup();
|
|
|
- String productCode = data.get(0).toString();
|
|
|
- String productName = data.get(1).toString();
|
|
|
- Product product = productMap.get(productCode + productName);
|
|
|
- AfterCostGroup afterCostGroupRequest = new AfterCostGroup();
|
|
|
- if (Objects.nonNull(product)) {
|
|
|
- Long id = product.getId();
|
|
|
- Long accountTingId = accountProMap.get(id);
|
|
|
- if (Objects.nonNull(accountTingId)) {
|
|
|
- Accounting accounting = accountingMap.get(accountTingId);
|
|
|
- if (Objects.nonNull(accounting)) {
|
|
|
+ if (Objects.nonNull(data.get(0)) && Objects.nonNull(data.get(1))) {
|
|
|
+ String productCode = data.get(0).toString();
|
|
|
+ String productName = data.get(1).toString();
|
|
|
+ Product product = productMap.get(productCode + productName);
|
|
|
+ AfterCostGroup afterCostGroupRequest = new AfterCostGroup();
|
|
|
+ if (Objects.nonNull(product)) {
|
|
|
+ Long id = product.getId();
|
|
|
+ Long accountTingId = accountProMap.get(id);
|
|
|
+ if (Objects.nonNull(accountTingId)) {
|
|
|
+ Accounting accounting = accountingMap.get(accountTingId);
|
|
|
+ if (Objects.nonNull(accounting)) {
|
|
|
|
|
|
- costCostingGroupRequest.setProductCode(productCode);
|
|
|
- costCostingGroupRequest.setProductName(productName);
|
|
|
- costCostingGroupRequest.setAccountCode(accounting.getAccountingCode());
|
|
|
- costCostingGroupRequest.setAccountName(accounting.getAccountingName());
|
|
|
- afterCostGroupRequest.setProductCode(productCode);
|
|
|
- afterCostGroupRequest.setProductName(productName);
|
|
|
- afterCostGroupRequest.setAccountCode(accounting.getAccountingCode());
|
|
|
- afterCostGroupRequest.setAccountName(accounting.getAccountingName());
|
|
|
+ costCostingGroupRequest.setProductCode(productCode);
|
|
|
+ costCostingGroupRequest.setProductName(productName);
|
|
|
+ costCostingGroupRequest.setAccountCode(accounting.getAccountingCode());
|
|
|
+ costCostingGroupRequest.setAccountName(accounting.getAccountingName());
|
|
|
+ afterCostGroupRequest.setProductCode(productCode);
|
|
|
+ afterCostGroupRequest.setProductName(productName);
|
|
|
+ afterCostGroupRequest.setAccountCode(accounting.getAccountingCode());
|
|
|
+ afterCostGroupRequest.setAccountName(accounting.getAccountingName());
|
|
|
+ } else {
|
|
|
+ IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
+ incomeErrorMessage.setTotal(1);
|
|
|
+ incomeErrorMessage.setErrMessage("成本代码" + productCode + " 成本名称" + productName + " 不存在对应的会计科目不存在");
|
|
|
+ incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
+ }
|
|
|
} else {
|
|
|
IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
incomeErrorMessage.setTotal(1);
|
|
@@ -324,103 +330,99 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
} else {
|
|
|
IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
incomeErrorMessage.setTotal(1);
|
|
|
- incomeErrorMessage.setErrMessage("成本代码" + productCode + " 成本名称" + productName + " 不存在对应的会计科目不存在");
|
|
|
+ incomeErrorMessage.setErrMessage("成本代码" + productCode + " 成本名称" + productName + "不存在");
|
|
|
incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
}
|
|
|
- } else {
|
|
|
- IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
- incomeErrorMessage.setTotal(1);
|
|
|
- incomeErrorMessage.setErrMessage("成本代码" + productCode + " 成本名称" + productName + "不存在");
|
|
|
- incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
- }
|
|
|
- // 0表示全为0 1表示不全为0
|
|
|
+ // 0表示全为0 1表示不全为0
|
|
|
|
|
|
- BigDecimal combined = new BigDecimal (data.get(data.size() - 1).toString());
|
|
|
- if (!BigDecimal.ZERO.equals(combined) && NumberConstant.ZERO.equals(emptyStatus)) {
|
|
|
- // 这条数据是保存到其他责任中心的
|
|
|
- CostCostingGroup costCostingGroup = costCostingGroupRequest;
|
|
|
- AfterCostGroup afterCostGroup = BeanUtil.convertObj(afterCostGroupRequest,AfterCostGroup.class);
|
|
|
- // TODO 设置其他责任中心
|
|
|
- Responsibility responsibilityServiceOne = responsibilityService.getOne(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, UserContext.getHospId()).eq(Responsibility::getIsDefault, NumberConstant.ONE));
|
|
|
- if (Objects.nonNull(responsibilityServiceOne)){
|
|
|
- costCostingGroup.setResponsibilityCode(responsibilityServiceOne.getResponsibilityCode());
|
|
|
- costCostingGroup.setResponsibilityName(responsibilityServiceOne.getResponsibilityName());
|
|
|
- // 设置统计数据
|
|
|
- afterCostGroup.setOtherResponsibilityCode(responsibilityServiceOne.getResponsibilityCode());
|
|
|
- afterCostGroup.setOtherResponsibilityName(responsibilityServiceOne.getResponsibilityName());
|
|
|
- }else {
|
|
|
- IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
- incomeErrorMessage.setTotal(row);
|
|
|
- incomeErrorMessage.setErrMessage("不存在默认责任中心");
|
|
|
- incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
- }
|
|
|
- costCostingGroup.setProductCode(costCostingGroupRequest.getProductCode());
|
|
|
- costCostingGroup.setProductName(costCostingGroupRequest.getProductName());
|
|
|
- costCostingGroup.setAccountCode(costCostingGroupRequest.getAccountCode());
|
|
|
- costCostingGroup.setAccountName(costCostingGroupRequest.getAccountName());
|
|
|
- costCostingGroup.setAmount(combined);
|
|
|
- costCostingGroup.setHospId(UserContext.getHospId());
|
|
|
- costCostingGroup.setCreateTime(System.currentTimeMillis());
|
|
|
- costCostingGroup.setDateYear(year);
|
|
|
- costCostingGroup.setDateMonth(month);
|
|
|
- afterCostGroup.setAmount(combined);
|
|
|
+ BigDecimal combined = new BigDecimal(data.get(data.size() - 1).toString());
|
|
|
+ if (!BigDecimal.ZERO.equals(combined) && NumberConstant.ZERO.equals(emptyStatus)) {
|
|
|
+ // 这条数据是保存到其他责任中心的
|
|
|
+ CostCostingGroup costCostingGroup = costCostingGroupRequest;
|
|
|
+ AfterCostGroup afterCostGroup = BeanUtil.convertObj(afterCostGroupRequest, AfterCostGroup.class);
|
|
|
+ // TODO 设置其他责任中心
|
|
|
+ Responsibility responsibilityServiceOne = responsibilityService.getOne(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, UserContext.getHospId()).eq(Responsibility::getIsDefault, NumberConstant.ONE));
|
|
|
+ if (Objects.nonNull(responsibilityServiceOne)) {
|
|
|
+ costCostingGroup.setResponsibilityCode(responsibilityServiceOne.getResponsibilityCode());
|
|
|
+ costCostingGroup.setResponsibilityName(responsibilityServiceOne.getResponsibilityName());
|
|
|
+ // 设置统计数据
|
|
|
+ afterCostGroup.setOtherResponsibilityCode(responsibilityServiceOne.getResponsibilityCode());
|
|
|
+ afterCostGroup.setOtherResponsibilityName(responsibilityServiceOne.getResponsibilityName());
|
|
|
+ } else {
|
|
|
+ IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
+ incomeErrorMessage.setTotal(row);
|
|
|
+ incomeErrorMessage.setErrMessage("不存在默认责任中心");
|
|
|
+ incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
+ }
|
|
|
+ costCostingGroup.setProductCode(costCostingGroupRequest.getProductCode());
|
|
|
+ costCostingGroup.setProductName(costCostingGroupRequest.getProductName());
|
|
|
+ costCostingGroup.setAccountCode(costCostingGroupRequest.getAccountCode());
|
|
|
+ costCostingGroup.setAccountName(costCostingGroupRequest.getAccountName());
|
|
|
+ costCostingGroup.setAmount(combined);
|
|
|
+ costCostingGroup.setHospId(UserContext.getHospId());
|
|
|
+ costCostingGroup.setCreateTime(System.currentTimeMillis());
|
|
|
+ costCostingGroup.setDateYear(year);
|
|
|
+ costCostingGroup.setDateMonth(month);
|
|
|
+ afterCostGroup.setAmount(combined);
|
|
|
// String s = -JsonUtil.toJSONString(afterCostGroup);
|
|
|
- String s = JacksonUtil.obj2Str(combined);
|
|
|
- costCostingGroup.setAfterCostGroup(s);
|
|
|
- costCostingGroupArrayList.add(costCostingGroup);
|
|
|
- } else {
|
|
|
- for (int j = 2; j < data.size() - 1; j++) {
|
|
|
- AfterCostGroup afterCostGroup = BeanUtil.convertObj(afterCostGroupRequest,AfterCostGroup.class);
|
|
|
- CostCostingGroup costCostingGroup = BeanUtil.convertObj(costCostingGroupRequest,CostCostingGroup.class);
|
|
|
- // 检验科室信息是否准确
|
|
|
- String departmentCode = departmentCodes.get(j).toString();
|
|
|
- String departmentName = departmentNames.get(j).toString();
|
|
|
- Department department = departmentMap.get(departmentCode + departmentName);
|
|
|
- if (Objects.nonNull(department)) {
|
|
|
- // 检测责任中心是否存在
|
|
|
- Long id = department.getId();
|
|
|
- Long responsibilityId = responsibilityDepMap.get(id);
|
|
|
- if (Objects.nonNull(responsibilityId)) {
|
|
|
- Responsibility responsibility = responsibilityMap.get(responsibilityId);
|
|
|
- if (Objects.nonNull(responsibility)) {
|
|
|
- costCostingGroup.setDepartmentCode(departmentCode);
|
|
|
- costCostingGroup.setDepartmentName(departmentName);
|
|
|
- costCostingGroup.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
|
- costCostingGroup.setResponsibilityName(responsibility.getResponsibilityName());
|
|
|
- afterCostGroup.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
|
- afterCostGroup.setResponsibilityName(responsibility.getResponsibilityName());
|
|
|
- afterCostGroup.setDepartmentCode(departmentCode);
|
|
|
- afterCostGroup.setDepartmentName(departmentName);
|
|
|
+ String s = JacksonUtil.obj2Str(combined);
|
|
|
+ costCostingGroup.setAfterCostGroup(s);
|
|
|
+ costCostingGroupArrayList.add(costCostingGroup);
|
|
|
+ } else {
|
|
|
+ for (int j = 2; j < data.size() - 1; j++) {
|
|
|
+ AfterCostGroup afterCostGroup = BeanUtil.convertObj(afterCostGroupRequest, AfterCostGroup.class);
|
|
|
+ CostCostingGroup costCostingGroup = BeanUtil.convertObj(costCostingGroupRequest, CostCostingGroup.class);
|
|
|
+ // 检验科室信息是否准确
|
|
|
+ String departmentCode = departmentCodes.get(j).toString();
|
|
|
+ String departmentName = departmentNames.get(j).toString();
|
|
|
+ Department department = departmentMap.get(departmentCode + departmentName);
|
|
|
+ if (Objects.nonNull(department)) {
|
|
|
+ // 检测责任中心是否存在
|
|
|
+ Long id = department.getId();
|
|
|
+ Long responsibilityId = responsibilityDepMap.get(id);
|
|
|
+ if (Objects.nonNull(responsibilityId)) {
|
|
|
+ Responsibility responsibility = responsibilityMap.get(responsibilityId);
|
|
|
+ if (Objects.nonNull(responsibility)) {
|
|
|
+ costCostingGroup.setDepartmentCode(departmentCode);
|
|
|
+ costCostingGroup.setDepartmentName(departmentName);
|
|
|
+ costCostingGroup.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
|
+ costCostingGroup.setResponsibilityName(responsibility.getResponsibilityName());
|
|
|
+ afterCostGroup.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
|
+ afterCostGroup.setResponsibilityName(responsibility.getResponsibilityName());
|
|
|
+ afterCostGroup.setDepartmentCode(departmentCode);
|
|
|
+ afterCostGroup.setDepartmentName(departmentName);
|
|
|
+ } else {
|
|
|
+ IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
+ incomeErrorMessage.setTotal(j);
|
|
|
+ incomeErrorMessage.setErrMessage("第" + j + "列科室信息对应的责任中心不存在");
|
|
|
+ incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
+ }
|
|
|
} else {
|
|
|
IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
incomeErrorMessage.setTotal(j);
|
|
|
- incomeErrorMessage.setErrMessage("第" + j + "列科室信息对应的责任中心不存在");
|
|
|
+ incomeErrorMessage.setErrMessage("第" + j + "列科室信息不存在对应的责任中心");
|
|
|
incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
}
|
|
|
} else {
|
|
|
IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
incomeErrorMessage.setTotal(j);
|
|
|
- incomeErrorMessage.setErrMessage("第" + j + "列科室信息不存在对应的责任中心");
|
|
|
+ incomeErrorMessage.setErrMessage("第" + j + "列科室信息不存在");
|
|
|
incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
}
|
|
|
- } else {
|
|
|
- IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
- incomeErrorMessage.setTotal(j);
|
|
|
- incomeErrorMessage.setErrMessage("第" + j + "列科室信息不存在");
|
|
|
- incomeErrorMessageList.add(incomeErrorMessage);
|
|
|
- }
|
|
|
- costCostingGroup.setAmount(new BigDecimal((Objects.isNull(data.get(j)) || "0".equals(data.get(j).toString())) ? "0.00" : data.get(j).toString()));
|
|
|
- costCostingGroup.setHospId(UserContext.getHospId());
|
|
|
- costCostingGroup.setCreateTime(System.currentTimeMillis());
|
|
|
- costCostingGroup.setDateYear(year);
|
|
|
- costCostingGroup.setDateMonth(month);
|
|
|
- afterCostGroup.setAmount(new BigDecimal((Objects.isNull(data.get(j)) || "0".equals(data.get(j).toString())) ? "0.00" : data.get(j).toString()));
|
|
|
+ costCostingGroup.setAmount(new BigDecimal((Objects.isNull(data.get(j)) || "0".equals(data.get(j).toString())) ? "0.00" : data.get(j).toString()));
|
|
|
+ costCostingGroup.setHospId(UserContext.getHospId());
|
|
|
+ costCostingGroup.setCreateTime(System.currentTimeMillis());
|
|
|
+ costCostingGroup.setDateYear(year);
|
|
|
+ costCostingGroup.setDateMonth(month);
|
|
|
+ afterCostGroup.setAmount(new BigDecimal((Objects.isNull(data.get(j)) || "0".equals(data.get(j).toString())) ? "0.00" : data.get(j).toString()));
|
|
|
// String s = JsonUtil.toJSONString(afterCostGroup);
|
|
|
- String s = JacksonUtil.obj2Str(afterCostGroup);
|
|
|
- costCostingGroup.setAfterCostGroup(s);
|
|
|
- costCostingGroupArrayList.add(costCostingGroup);
|
|
|
+ String s = JacksonUtil.obj2Str(afterCostGroup);
|
|
|
+ costCostingGroup.setAfterCostGroup(s);
|
|
|
+ costCostingGroupArrayList.add(costCostingGroup);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|