소스 검색

修改责任中西与层级的对照关系

ljx 4 년 전
부모
커밋
4109251de6

+ 1 - 1
src/main/java/com/imed/costaccount/model/dto/CostAccountShareSaveDto.java

@@ -29,7 +29,7 @@ public class CostAccountShareSaveDto {
     private String responsibilityName;
 
     @ApiModelProperty(name = "accountingId",value = "成本项目的Id")
-    private Integer accountingId;
+    private Integer accountingId=0;
 
     @ApiModelProperty(name = "accountingName",value = "成本项目名称")
     private String accountingName;

+ 3 - 0
src/main/java/com/imed/costaccount/model/vo/CostResponsibilityLevelVO.java

@@ -23,6 +23,9 @@ public class CostResponsibilityLevelVO {
     @ApiModelProperty(name = "responsibilityCode",value = "责任中心代码")
     private String responsibilityCode;
 
+    @ApiModelProperty(name = "shareId",value = "分摊级别的Id")
+    private Integer shareId;
+
     @ApiModelProperty(name = "shareLevel",value = "分摊级别 如果是顶层默认为0")
     private Integer shareLevel;
 

+ 5 - 5
src/main/java/com/imed/costaccount/service/impl/CostAccountShareServiceImpl.java

@@ -136,7 +136,7 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         costAccountShareSaveDto.setResponsibilityCode(responsibility.getResponsibilityCode());
         costAccountShareSaveDto.setResponsibilityName(responsibility.getResponsibilityName());
         costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
-        if (costAccountShareSaveDto.getAccountingId() > 0){
+        if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingId()) && costAccountShareSaveDto.getAccountingId() > 0){
             // 如果输入成本科目的情况下
             Accounting accounting = accountingService.getOne(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId).eq(Accounting::getId, costAccountShareSaveDto.getAccountingId()));
             if (Objects.isNull(accounting)){
@@ -162,10 +162,10 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         CostShareLevel costShareLevel = costShareLevelService.getOne(new QueryWrapper<CostShareLevel>().lambda()
                 .eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getId, shareLevel));
         if (Objects.nonNull(costShareLevel)){
-            if (costAccountShareSaveDto.getAccountingId()>0 && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
+            if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingId()) && costAccountShareSaveDto.getAccountingId() > 0) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
                 throw new CostException(500,"合并计算不允许选择成本科目");
             }
-            if (costAccountShareSaveDto.getAccountingId()<= 0 && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
+            if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingId()) && costAccountShareSaveDto.getAccountingId() <= 0) && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
                 throw new CostException(500,"分开计算的责任中心需要选择成本科目");
             }
         }else {
@@ -193,8 +193,8 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         CostAccountShareSaveDto costAccountShareSaveDto = BeanUtil.convertObj(costAccountShareEditDto, CostAccountShareSaveDto.class);
         // 检验输入的数据是否符合规则
         checkAccountShare(costAccountShareSaveDto,hospId);
-
-        CostAccountShare costAccountShareRequest = BeanUtil.convertObj(costAccountShareEditDto, CostAccountShare.class);
+        CostAccountShareEditDto accountShareEditDto = BeanUtil.convertObj(costAccountShareSaveDto, CostAccountShareEditDto.class);
+        CostAccountShare costAccountShareRequest = BeanUtil.convertObj(accountShareEditDto, CostAccountShare.class);
         costAccountShareRequest.setId(null);
         costAccountShareRequest.setHospId(hospId);
         costAccountShareRequest.setParamList(costAccountShare.getParamList());

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

@@ -323,8 +323,8 @@ public class ResponsibilityServiceImpl extends ServiceImpl<ResponsibilityMapper,
         // 设置责任中心的计算方式
         costResponsibilityLevelVOS.forEach(i -> {
             i.setResponsibilityId(i.getId());
-            Integer shareLevel = i.getShareLevel();
-            List<CostShareLevelVO> costShareLevelVOList = listMap.get(shareLevel);
+            Integer shareId = i.getShareId();
+            List<CostShareLevelVO> costShareLevelVOList = listMap.get(shareId);
             if (!CollectionUtils.isEmpty(costShareLevelVOList)) {
                 i.setCalcType(costShareLevelVOList.get(0).getCalcType());
             }