|
@@ -6,10 +6,7 @@ import com.alibaba.druid.util.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.imed.costaccount.common.exception.CostException;
|
|
|
-import com.imed.costaccount.common.util.BeanUtil;
|
|
|
-import com.imed.costaccount.common.util.DateUtils;
|
|
|
-import com.imed.costaccount.common.util.Result;
|
|
|
-import com.imed.costaccount.common.util.UserContext;
|
|
|
+import com.imed.costaccount.common.util.*;
|
|
|
import com.imed.costaccount.constants.NumberConstant;
|
|
|
import com.imed.costaccount.enums.DateStyleEnum;
|
|
|
import com.imed.costaccount.mapper.CostCostingGroupMapper;
|
|
@@ -18,6 +15,7 @@ import com.imed.costaccount.model.vo.IncomeErrorMessage;
|
|
|
import com.imed.costaccount.service.AccountingProductService;
|
|
|
import com.imed.costaccount.service.CostCostingGroupService;
|
|
|
import com.imed.costaccount.service.CostIncomeFileService;
|
|
|
+import com.imed.costaccount.service.ResponsibilityService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
@@ -39,10 +37,13 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
|
|
|
private final CostIncomeFileService costIncomeFileService;
|
|
|
|
|
|
- public CostCostingGroupServiceImpl(CostIncomeGroupServiceImpl costIncomeGroupService, AccountingProductService accountingProductService, CostIncomeFileService costIncomeFileService) {
|
|
|
+ private final ResponsibilityService responsibilityService;
|
|
|
+
|
|
|
+ public CostCostingGroupServiceImpl(CostIncomeGroupServiceImpl costIncomeGroupService, AccountingProductService accountingProductService, CostIncomeFileService costIncomeFileService, ResponsibilityService responsibilityService) {
|
|
|
this.costIncomeGroupService = costIncomeGroupService;
|
|
|
this.accountingProductService = accountingProductService;
|
|
|
this.costIncomeFileService = costIncomeFileService;
|
|
|
+ this.responsibilityService = responsibilityService;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -177,7 +178,8 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
}
|
|
|
}
|
|
|
if (CollectionUtils.isEmpty(incomeErrorMessageList)){
|
|
|
- Integer emptyStatus = 0;
|
|
|
+ incomeErrorMessageList=new ArrayList<>();
|
|
|
+ int emptyStatus = 0;
|
|
|
for (int j = 2; j < data.size()-1 ; j++) {
|
|
|
BigDecimal parseInt = new BigDecimal (data.get(j).toString());
|
|
|
if (!BigDecimal.ZERO.equals(parseInt)) {
|
|
@@ -190,16 +192,22 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
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());
|
|
|
} else {
|
|
|
IncomeErrorMessage incomeErrorMessage = new IncomeErrorMessage();
|
|
|
incomeErrorMessage.setTotal(1);
|
|
@@ -221,22 +229,35 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
// 0表示全为0 1表示不全为0
|
|
|
|
|
|
BigDecimal combined = new BigDecimal (data.get(data.size() - 1).toString());
|
|
|
- if (NumberConstant.ZERO.equals(emptyStatus) &&BigDecimal.ZERO.equals(combined)) {
|
|
|
- // 全为0
|
|
|
- } else if (!BigDecimal.ZERO.equals(combined) && NumberConstant.ZERO.equals(emptyStatus)) {
|
|
|
+ if (!BigDecimal.ZERO.equals(combined) && NumberConstant.ZERO.equals(emptyStatus)) {
|
|
|
// 这条数据是保存到其他责任中心的
|
|
|
CostCostingGroup costCostingGroup = costCostingGroupRequest;
|
|
|
+ AfterCostGroup afterCostGroup = BeanUtil.convertObj(afterCostGroupRequest,AfterCostGroup.class);
|
|
|
// TODO 设置其他责任中心
|
|
|
- costCostingGroup.setResponsibilityCode("其他责任中心的Code");
|
|
|
- costCostingGroup.setResponsibilityName("其他责任中心的Name");
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ 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();
|
|
@@ -253,7 +274,10 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
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);
|
|
@@ -277,6 +301,9 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
|
|
|
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);
|
|
|
+ costCostingGroup.setAfterCostGroup(s);
|
|
|
costCostingGroupArrayList.add(costCostingGroup);
|
|
|
}
|
|
|
}
|