ljx 4 vuotta sitten
vanhempi
commit
30f065a2f4

+ 6 - 6
src/main/java/com/imed/costaccount/model/CostAccountShare.java

@@ -49,18 +49,18 @@ public class CostAccountShare implements Serializable {
 	 */
 	private Long hospId;
 	/**
-	 * 成本项目Id
+	 * 会计科目Id
 	 *
 	 */
-	private Long accountingId;
+	private String accountingIds;
 	/**
-	 * 成本项目名称
+	 * 会计科目名称
 	 */
-	private String accountingName;
+	private String accountingNames;
 	/**
-	 * 成本项目代码
+	 * 会计科目代码
 	 */
-	private String accountingCode;
+	private String accountingCodes;
 	/**
 	 * 分摊参数集合
 	 */

+ 25 - 0
src/main/java/com/imed/costaccount/model/dto/AccountShareCopyDto.java

@@ -0,0 +1,25 @@
+package com.imed.costaccount.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @author 李加喜
+ * @Package com.imed.costaccount.model.dto
+ * @date 2021-08-16 9:58
+ */
+@Data
+@ApiModel("成本分摊参数对应设置功能")
+public class AccountShareCopyDto {
+    @ApiModelProperty(name="id",value = "成本分摊参数设置对应Id不能为空")
+    @NotNull(message = "成本分摊参数设置对应Id不能为空")
+    private Long id;
+
+    @ApiModelProperty(name="responsibilityId",value = "成本分摊参数设置对应Id不能为空")
+   @NotNull(message = "成本分摊参数设置对应Id不能为空")
+    private List<Long> responsibilityIds;
+}

+ 3 - 3
src/main/java/com/imed/costaccount/model/dto/CostAccountShareEditDto.java

@@ -32,13 +32,13 @@ public class CostAccountShareEditDto {
     private String responsibilityName;
 
     @ApiModelProperty(name = "accountingId",value = "成本项目的Id")
-    private Long accountingId;
+    private String accountingIds;
 
     @ApiModelProperty(name = "accountingName",value = "成本项目名称")
-    private String accountingName;
+    private String accountingNames;
 
     @ApiModelProperty(name = "accountingCode",value = "成本项目代码")
-    private String accountingCode;
+    private String accountingCodes;
 
     @ApiModelProperty(name = "costNode",value = "备注")
     private String costNode;

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

@@ -28,14 +28,14 @@ public class CostAccountShareSaveDto {
     @ApiModelProperty(name = "responsibilityCode",value = "责任中心名称")
     private String responsibilityName;
 
-    @ApiModelProperty(name = "accountingId",value = "成本项目的Id")
-    private Long accountingId=0L;
+    @ApiModelProperty(name = "accountingId",value = "会计科目的Id")
+    private String accountingIds;
 
-    @ApiModelProperty(name = "accountingName",value = "成本项目名称")
-    private String accountingName;
+    @ApiModelProperty(name = "accountingName",value = "会计科目名称")
+    private String accountingNames;
 
-    @ApiModelProperty(name = "accountingCode",value = "成本项目代码")
-    private String accountingCode;
+    @ApiModelProperty(name = "accountingCode",value = "会计科目的代码")
+    private String accountingCodes;
 
     @ApiModelProperty(name = "costNode",value = "备注")
     private String costNode;

+ 6 - 6
src/main/java/com/imed/costaccount/model/vo/CostAccountShareVO.java

@@ -28,14 +28,14 @@ public class CostAccountShareVO {
     @ApiModelProperty(name = "responsibilityCode",value = "责任中心名称")
     private String responsibilityName;
 
-    @ApiModelProperty(name = "accountingId",value = "成本项目的Id")
-    private Long accountingId;
+    @ApiModelProperty(name = "accountingId",value = "会计科目的Id")
+    private String accountingIds;
 
-    @ApiModelProperty(name = "accountingName",value = "成本项目名称")
-    private String accountingName;
+    @ApiModelProperty(name = "accountingName",value = "会计科目名称")
+    private String accountingNames;
 
-    @ApiModelProperty(name = "accountingCode",value = "成本项目代码")
-    private String accountingCode;
+    @ApiModelProperty(name = "accountingCode",value = "会计科目代码")
+    private String accountingCodes;
 
     @ApiModelProperty(name = "shareparamId",value = "关联的分摊参数的Id集合")
     private String shareparamId;

+ 2 - 0
src/main/java/com/imed/costaccount/model/vo/CostIncomeGroupAllAmountBO.java

@@ -1,9 +1,11 @@
 package com.imed.costaccount.model.vo;
 
 import com.imed.costaccount.model.CostIncomeGroup;
+import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 @Data
+@ApiModel("收入数据归集前的查询")
 public class CostIncomeGroupAllAmountBO extends CostIncomeGroup {
     private String allMoney;
 }

+ 18 - 0
src/main/java/com/imed/costaccount/service/CostAccountShareService.java

@@ -3,6 +3,8 @@ package com.imed.costaccount.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.model.CostAccountShare;
+import com.imed.costaccount.model.Responsibility;
+import com.imed.costaccount.model.dto.AccountShareCopyDto;
 import com.imed.costaccount.model.dto.CostAccountShareEditDto;
 import com.imed.costaccount.model.dto.CostAccountShareSaveDto;
 import com.imed.costaccount.model.dto.ShareParamEditDto;
@@ -61,5 +63,21 @@ public interface CostAccountShareService extends IService<CostAccountShare> {
      * @return
      */
     List<CostShareParamStatusVO> getAllShareParamStatusById(Integer id, Long hospId);
+
+    /**
+     * 拷贝
+     * @param accountShareCopyDto
+     * @param hospId
+     */
+    void copyAccountShareData(AccountShareCopyDto accountShareCopyDto, Long hospId);
+
+    /**
+     * 获取指定类型的责任中心集合 分开计算还是合并计算
+     *
+     * @param accountShareId 分摊参数设置对应的Id
+     * @param hospId 医院的Id
+     * @return
+     */
+    List<Responsibility> getResponsibilityCalType(Long accountShareId, Long hospId);
 }
 

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

@@ -61,6 +61,6 @@ public interface CostShareParamService extends IService<CostShareParam> {
      */
     CostShareParamVO getByHospIdAndAPramId(Integer id, Long hospId);
 
-    List<Integer> selectIsSelect(Integer shareParamId);
+    List<Long> selectIsSelect(Integer shareParamId);
 }
 

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

@@ -59,7 +59,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
         List<AccountVO> all = BeanUtil.convertList(list, AccountVO.class);
         // 查询所有的已绑定的分摊参数
         if (Objects.nonNull(shareParamId)) {
-            List<Integer> ids = shareParamService.selectIsSelect(shareParamId);
+            List<Long> ids = shareParamService.selectIsSelect(shareParamId);
             if (CollUtil.isNotEmpty(ids)) {
                 all.forEach(i -> {
                     if (ids.contains(i.getId())) {

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

@@ -1,14 +1,17 @@
 package com.imed.costaccount.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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.JsonUtil;
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.constants.NumberConstant;
 import com.imed.costaccount.mapper.CostAccountShareMapper;
 import com.imed.costaccount.model.*;
+import com.imed.costaccount.model.dto.AccountShareCopyDto;
 import com.imed.costaccount.model.dto.CostAccountShareEditDto;
 import com.imed.costaccount.model.dto.CostAccountShareSaveDto;
 import com.imed.costaccount.model.dto.ShareParamEditDto;
@@ -17,7 +20,6 @@ import com.imed.costaccount.model.vo.CostShareParamStatusVO;
 import com.imed.costaccount.model.vo.CostShareParamVO;
 import com.imed.costaccount.model.vo.ShareParamProportionVO;
 import com.imed.costaccount.service.*;
-import com.imed.costaccount.common.util.BeanUtil;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -25,10 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
@@ -69,40 +68,39 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         List<CostAccountShare> costAccountShareList = pages.getRecords();
 
         List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
-        getMessage(hospId, costAccountShareVOList);
-        //
+//        getMessage(hospId, costAccountShareVOList);
         PageUtils pageUtils = new PageUtils(pages);
         pageUtils.setList(costAccountShareVOList);
         return pageUtils;
     }
 
-    private void getMessage(Long hospId, List<CostAccountShareVO> costAccountShareList) {
-        // 设置责任中心的数据 与 会计科目的数据从对应的id里面获取
-        List<Responsibility> list = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
-        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
-        Map<Long, List<Responsibility>> resMap = list.stream().collect(Collectors.groupingBy(Responsibility::getId));
-        Map<Long, List<Accounting>> accountMap = accountingList.stream().collect(Collectors.groupingBy(Accounting::getId));
-        costAccountShareList.forEach(i->{
-            Long id = i.getResponsibilityId();
-            List<Responsibility> responsibilities = resMap.get(id);
-            if (!CollectionUtils.isEmpty(responsibilities)){
-                i.setResponsibilityId(id);
-                i.setResponsibilityName(responsibilities.get(0).getResponsibilityName());
-                i.setResponsibilityCode(responsibilities.get(0).getResponsibilityCode());
-
-            }
-            Long accountingId = i.getAccountingId();
-            if (accountingId>0){
-                List<Accounting> accountingList1 = accountMap.get(accountingId);
-                if (!CollectionUtils.isEmpty(accountingList1)){
-                    i.setAccountingId(accountingId);
-                    i.setAccountingName(accountingList1.get(0).getAccountingName());
-                    i.setAccountingCode(accountingList1.get(0).getAccountingCode());
-                    i.setAllParentIds(accountingList1.get(0).getAllParentIds());
-                }
-            }
-        });
-    }
+//    private void getMessage(Long hospId, List<CostAccountShareVO> costAccountShareList) {
+//        // 设置责任中心的数据 与 会计科目的数据从对应的id里面获取
+//        List<Responsibility> list = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
+//        List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
+//        Map<Long, List<Responsibility>> resMap = list.stream().collect(Collectors.groupingBy(Responsibility::getId));
+//        Map<Long, List<Accounting>> accountMap = accountingList.stream().collect(Collectors.groupingBy(Accounting::getId));
+//        costAccountShareList.forEach(i->{
+//            Long id = i.getResponsibilityId();
+//            List<Responsibility> responsibilities = resMap.get(id);
+//            if (!CollectionUtils.isEmpty(responsibilities)){
+//                i.setResponsibilityId(id);
+//                i.setResponsibilityName(responsibilities.get(0).getResponsibilityName());
+//                i.setResponsibilityCode(responsibilities.get(0).getResponsibilityCode());
+//
+//            }
+//            Long accountingId = i.getAccountingId();
+//            if (accountingId>0){
+//                List<Accounting> accountingList1 = accountMap.get(accountingId);
+//                if (!CollectionUtils.isEmpty(accountingList1)){
+//                    i.setAccountingId(accountingId);
+//                    i.setAccountingName(accountingList1.get(0).getAccountingName());
+//                    i.setAccountingCode(accountingList1.get(0).getAccountingCode());
+//                    i.setAllParentIds(accountingList1.get(0).getAllParentIds());
+//                }
+//            }
+//        });
+//    }
 
     /**
      * 保存成本参数对应成本对照表
@@ -144,37 +142,43 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         costAccountShareSaveDto.setResponsibilityCode(responsibility.getResponsibilityCode());
         costAccountShareSaveDto.setResponsibilityName(responsibility.getResponsibilityName());
         costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
-        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)){
-                throw new CostException(500,"输入的成本科目不存在");
+        if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())){
+            // 这个责任中心允许输入会计科目
+            List<String> accountIdList = Arrays.asList(costAccountShareSaveDto.getAccountingIds().split(StrUtil.COMMA));
+            List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId).in(Accounting::getId, accountIdList).orderByDesc(Accounting::getCreateTime));
+            if (CollectionUtils.isEmpty(accountingList)){
+                throw new CostException(500,"输入的会计科目不存在");
             }else {
-                costAccountShareSaveDto.setAccountingId(accounting.getId());
-                costAccountShareSaveDto.setAccountingName(accounting.getAccountingName());
-                costAccountShareSaveDto.setAccountingCode(accounting.getAccountingCode());
+                String accountIds = accountingList.stream().map(Accounting::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
+                costAccountShareSaveDto.setAccountingIds(accountIds);
+                String accountNames = accountingList.stream().map(Accounting::getAccountingName).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
+                costAccountShareSaveDto.setAccountingNames(accountNames);
+                String accountCodes = accountingList.stream().map(Accounting::getAccountingCode).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
+                costAccountShareSaveDto.setAccountingCodes(accountCodes);
             }
             // 检验输入的责任中心与匹配的成本科目是否存在
             List<CostAccountShare> costAccountShareList = baseMapper.selectList(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId,hospId));
             Map<String, List<CostAccountShare>> costAccountMap = costAccountShareList.stream().collect(Collectors.groupingBy(CostAccountShare::getResponsibilityCode));
             List<CostAccountShare> list = costAccountMap.get(costAccountShareSaveDto.getResponsibilityCode());
             if (!CollectionUtils.isEmpty(list)){
-                String accountingCode = list.get(0).getAccountingCode();
-                if (accountingCode.equals(costAccountShareSaveDto.getAccountingCode())){
-                    throw new CostException(500,"输入的责任中心对应的成本科目已存在");
+                String accountingIds = list.get(0).getAccountingIds();
+                List<String> accountIdListRequest = Arrays.asList(accountingIds.split(StrUtil.COMMA));
+                if (!Collections.disjoint(accountIdListRequest,accountIdList)){
+                    throw new CostException(500,"存在重复的数据");
                 }
+
             }
         }
-        // 检验输入的这个责任中心是否允许输入成本科目
+        // 检验输入的这个责任中心是否允许输入会计科目
         Long shareId = responsibility.getShareId();
         CostShareLevel costShareLevel = costShareLevelService.getOne(new QueryWrapper<CostShareLevel>().lambda()
                 .eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getId, shareId));
         if (Objects.nonNull(costShareLevel)){
-            if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingId()) && costAccountShareSaveDto.getAccountingId() > 0) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
-                throw new CostException(500,"合并计算不允许选择成本科目");
+            if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
+                throw new CostException(500,"合并计算不允许选择会计科目");
             }
-            if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingId()) && costAccountShareSaveDto.getAccountingId() <= 0) && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
-                throw new CostException(500,"分开计算的责任中心需要选择成本科目");
+            if ((StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
+                throw new CostException(500,"分开计算的责任中心需要选择会计科目");
             }
         }else {
             throw new CostException(500,"对不起该责任中心没有对应分摊层级");
@@ -315,4 +319,70 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         return costShareParamStatusVOList;
     }
 
+    /**
+     * 拷贝
+     *
+     * @param accountShareCopyDto 赋值数据
+     * @param hospId 医院Id
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    public void copyAccountShareData(AccountShareCopyDto accountShareCopyDto, Long hospId) {
+        Long id = accountShareCopyDto.getId();
+        CostAccountShare costAccountShare = this.getById(id);
+        if (Objects.isNull(costAccountShare)){
+            throw new CostException(500,"成本分摊参数设置对应数据不存在");
+        }
+        List<CostAccountShare> accountShareList = new ArrayList<>();
+        List<Long> responsibilityIds = accountShareCopyDto.getResponsibilityIds();
+        Map<Long, Responsibility> responsibilityMap = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
+                .eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOne->synOne));
+        long millis = System.currentTimeMillis();
+        responsibilityIds.forEach(i->{
+            CostAccountShare accountShareRequest = BeanUtil.convertObj(costAccountShare, CostAccountShare.class);
+            accountShareRequest.setId(null);
+            accountShareRequest.setCreateTime(millis);
+            Responsibility responsibility = responsibilityMap.get(i);
+            accountShareRequest.setResponsibilityId(i);
+            accountShareRequest.setResponsibilityCode(responsibility.getResponsibilityCode());
+            accountShareRequest.setResponsibilityName(responsibility.getResponsibilityName());
+            accountShareRequest.setShareLevel(responsibility.getShareLevel());
+            accountShareList.add(accountShareRequest);
+        });
+        this.saveBatch(accountShareList);
+
+    }
+
+    /**
+     * 获取指定类型的责任中心集合 分开计算还是合并计算
+     *
+     *
+     * @param accountShareId
+     * @param hospId
+     * @return
+     */
+    @Override
+    public List<Responsibility> getResponsibilityCalType(Long accountShareId, Long hospId) {
+        CostAccountShare costAccountShare = this.getById(accountShareId);
+        if (Objects.isNull(costAccountShare)){
+            throw new CostException(500,"成本分摊参数设置对应数据不存在");
+        }
+        Long responsibilityId = costAccountShare.getResponsibilityId();
+        Responsibility responsibility = responsibilityService.getById(responsibilityId);
+        Long shareId = responsibility.getShareId();
+        CostShareLevel costShareLevel = costShareLevelService.getById(shareId);
+        Integer calcType = costShareLevel.getCalcType();
+        List<Long> responsibilityIds = this.list(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId)).stream().map(CostAccountShare::getResponsibilityId).collect(Collectors.toList());
+        // 执行类型的分摊级别的Id的集合
+        List<Long> costShareIds = costShareLevelService.list(new QueryWrapper<CostShareLevel>().lambda()
+                .eq(CostShareLevel::getCalcType, calcType))
+                .stream().map(CostShareLevel::getId).collect(Collectors.toList());
+        // 筛选责任中心里面符合指定类型的责任中心
+        // 筛选指定类型的责任中心 并且当前没有设置的责任中心
+        List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
+                .eq(Responsibility::getHospId, hospId)).stream()
+                .filter(i -> costShareIds.contains(i.getShareId()) && !responsibilityIds.contains(i.getId())).collect(Collectors.toList());
+        return responsibilityList;
+    }
+
 }

+ 36 - 14
src/main/java/com/imed/costaccount/service/impl/CostIncomeFileServiceImpl.java

@@ -15,9 +15,7 @@ import com.imed.costaccount.mapper.CostCostingGroupMapper;
 import com.imed.costaccount.mapper.CostIncomeFileMapper;
 import com.imed.costaccount.mapper.CostIncomeGroupMapper;
 import com.imed.costaccount.mapper.CostShareParamGroupMapper;
-import com.imed.costaccount.model.CostIncomeFile;
-import com.imed.costaccount.model.CostIncomeGroup;
-import com.imed.costaccount.model.User;
+import com.imed.costaccount.model.*;
 import com.imed.costaccount.model.vo.CostIncomeFileVO;
 import com.imed.costaccount.model.vo.IncomeErrorMessage;
 import com.imed.costaccount.service.CostIncomeFileService;
@@ -36,6 +34,9 @@ import java.util.stream.Collectors;
 @Service("costIncomeFileService")
 public class CostIncomeFileServiceImpl extends ServiceImpl<CostIncomeFileMapper, CostIncomeFile> implements CostIncomeFileService {
 
+    private static final String INCOME_FILETYPE="收入数据";
+    private static final String COST_FILETYPE="成本数据";
+    private static final String SHAREPARAM_FILETYPE="成本分摊参数数据";
     @Autowired
     private CostIncomeGroupMapper costIncomeGroupMapper;
     @Autowired
@@ -68,11 +69,11 @@ public class CostIncomeFileServiceImpl extends ServiceImpl<CostIncomeFileMapper,
             costIncomeFile.setSuccessAmount(list.size());
         }
         if (NumberConstant.ONE.equals(fileType)){
-            costIncomeFile.setFileType("成本分摊参数值");
+            costIncomeFile.setFileType(INCOME_FILETYPE);
         }else if (NumberConstant.TWO.equals(fileType)){
-            costIncomeFile.setFileType("收入数据");
+            costIncomeFile.setFileType(COST_FILETYPE);
         }else if (NumberConstant.THREE.equals(fileType)){
-            costIncomeFile.setFileType("成本数据");
+            costIncomeFile.setFileType(SHAREPARAM_FILETYPE);
         }else {
             costIncomeFile.setFileType(file.getContentType());
         }
@@ -127,14 +128,35 @@ public class CostIncomeFileServiceImpl extends ServiceImpl<CostIncomeFileMapper,
         if (Objects.isNull(costIncomeFile)){
             throw new CostException(500,"文件记录不存在");
         }
-//        // 根据文件的Id 和 医院Id获取数据
-        List<CostIncomeGroup> costIncomeGroupList = costIncomeGroupMapper.selectList(new QueryWrapper<CostIncomeGroup>().lambda()
-                .eq(CostIncomeGroup::getHospId, hospId).eq(CostIncomeGroup::getFileId, id));
-//        if (CollectionUtils.isEmpty(costIncomeGroupList)){
-//            throw new CostException(410,"数据已撤销");
-//        }
-        List<Long> list = costIncomeGroupList.stream().map(CostIncomeGroup::getId).collect(Collectors.toList());
-        costIncomeGroupMapper.deleteBatchIds(list);
+        String fileType = costIncomeFile.getFileType();
+        if (INCOME_FILETYPE.equals(fileType)){
+            // 根据文件的Id 和 医院Id获取数据
+            List<CostIncomeGroup> costIncomeGroupList = costIncomeGroupMapper.selectList(new QueryWrapper<CostIncomeGroup>().lambda()
+                    .eq(CostIncomeGroup::getHospId, hospId).eq(CostIncomeGroup::getFileId, id));
+            if (CollectionUtils.isEmpty(costIncomeGroupList)){
+                throw new CostException(410,"数据已撤销");
+            }
+            List<Long> list = costIncomeGroupList.stream().map(CostIncomeGroup::getId).collect(Collectors.toList());
+            costIncomeGroupMapper.deleteBatchIds(list);
+        }else if (COST_FILETYPE.equals(fileType)){
+            // 根据文件的Id 和 医院Id获取数据
+            List<CostCostingGroup> costIncomeGroupList = costCostingGroupMapper.selectList(new QueryWrapper<CostCostingGroup>().lambda()
+                    .eq(CostCostingGroup::getHospId, hospId).eq(CostCostingGroup::getFileId, id));
+            if (CollectionUtils.isEmpty(costIncomeGroupList)){
+                throw new CostException(410,"数据已撤销");
+            }
+            List<Long> list = costIncomeGroupList.stream().map(CostCostingGroup::getId).collect(Collectors.toList());
+            costCostingGroupMapper.deleteBatchIds(list);
+        }if (SHAREPARAM_FILETYPE.equals(fileType)){
+            // 根据文件的Id 和 医院Id获取数据
+            List<CostShareParamGroup> costIncomeGroupList = costShareParamGroupMapper.selectList(new QueryWrapper<CostShareParamGroup>().lambda()
+                    .eq(CostShareParamGroup::getHospId, hospId).eq(CostShareParamGroup::getFileId, id));
+            if (CollectionUtils.isEmpty(costIncomeGroupList)){
+                throw new CostException(410,"数据已撤销");
+            }
+            List<Long> list = costIncomeGroupList.stream().map(CostShareParamGroup::getId).collect(Collectors.toList());
+            costShareParamGroupMapper.deleteBatchIds(list);
+        }
         costIncomeFile.setRollbackStatus(NumberConstant.ONE);
         this.updateById(costIncomeFile);
     }

+ 3 - 6
src/main/java/com/imed/costaccount/service/impl/CostShareParamServiceImpl.java

@@ -8,11 +8,9 @@ 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.PageUtils;
-import com.imed.costaccount.common.util.Result;
 import com.imed.costaccount.constants.NumberConstant;
 import com.imed.costaccount.mapper.CostShareParamMapper;
 import com.imed.costaccount.model.CostShareParam;
-import com.imed.costaccount.model.User;
 import com.imed.costaccount.model.dto.CostShareParamAccountDto;
 import com.imed.costaccount.model.dto.CostShareParamEditDto;
 import com.imed.costaccount.model.dto.CostShareParamSaveDto;
@@ -24,7 +22,6 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -129,7 +126,7 @@ public class CostShareParamServiceImpl extends ServiceImpl<CostShareParamMapper,
             String[] accountIds = costShareParamAccountDto.getAccountIds();
             List<String> accountList = Arrays.asList(accountIds);
             if (!CollectionUtil.isEmpty(accountList)){
-                String accounds = accountList.stream().map(String::valueOf).collect(Collectors.joining(","));
+                String accounds = accountList.stream().map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
                 costShareParam.setAccountingId(accounds);
             }else {
                 costShareParam.setAccountingId(null);
@@ -173,7 +170,7 @@ public class CostShareParamServiceImpl extends ServiceImpl<CostShareParamMapper,
     }
 
     @Override
-    public List<Integer> selectIsSelect(Integer shareParamId) {
+    public List<Long> selectIsSelect(Integer shareParamId) {
         CostShareParam byId = this.getById(shareParamId);
         if (Objects.isNull(byId)) {
             return Collections.emptyList();
@@ -181,7 +178,7 @@ public class CostShareParamServiceImpl extends ServiceImpl<CostShareParamMapper,
         String accountingId = byId.getAccountingId();
         if (!StringUtils.isEmpty(accountingId)){
             String[] split = accountingId.split(StrUtil.COMMA);
-            List<Integer> collect = Arrays.stream(split).map(Integer::valueOf).collect(Collectors.toList());
+            List<Long> collect = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
             return collect;
         }else {
             return Collections.emptyList();

+ 31 - 4
src/main/java/com/imed/costaccount/web/CostAccountShareController.java

@@ -3,8 +3,11 @@ package com.imed.costaccount.web;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.common.util.Result;
+import com.imed.costaccount.common.util.UserContext;
 import com.imed.costaccount.model.CostAccountShare;
+import com.imed.costaccount.model.Responsibility;
 import com.imed.costaccount.model.User;
+import com.imed.costaccount.model.dto.AccountShareCopyDto;
 import com.imed.costaccount.model.dto.CostAccountShareEditDto;
 import com.imed.costaccount.model.dto.CostAccountShareSaveDto;
 import com.imed.costaccount.model.dto.ShareParamEditDto;
@@ -54,7 +57,7 @@ public class CostAccountShareController {
      * 获取相关的责任中心成本对照表数据
      */
     @GetMapping("/getCostAccountShare")
-    @ApiOperation("根据责任中心成本对照表的Id获取")
+    @ApiOperation("根据成本分摊参数对应表的Id获取")
     public Result getCostAccountShare(Integer id){
 		CostAccountShare costAccountShare = costAccountShareService.getById(id);
         return Result.ok(costAccountShare);
@@ -64,7 +67,7 @@ public class CostAccountShareController {
      * 保存
      */
     @PostMapping("/save")
-    @ApiOperation("保存责任中心成本对照数据")
+    @ApiOperation("保存成本分摊参数对应数据")
     public Result save(@RequestBody @Valid CostAccountShareSaveDto costAccountShareSaveDto){
 		costAccountShareService.addCostAccountShare(costAccountShareSaveDto);
         return Result.ok();
@@ -74,11 +77,14 @@ public class CostAccountShareController {
      * 修改
      */
     @PostMapping("/update")
-    @ApiOperation("修改责任中心成本数据")
+    @ApiOperation("修改成本分摊参数对应数据")
     public Result update(@RequestBody @Valid CostAccountShareEditDto costAccountShareEditDto){
 		costAccountShareService.updateByCostAccountShare(costAccountShareEditDto);
         return Result.ok();
     }
+    /**
+     * 显示会计科目里面
+     */
     /**
      * 在全部分摊参数里面显示当前责任中心已经存在的分摊参数
      */
@@ -125,9 +131,30 @@ public class CostAccountShareController {
      */
     @PostMapping("/delete")
     @ApiOperation("删除责任中心成本数据")
-    public Result delete(@RequestBody Integer[] ids){
+    public Result delete(@RequestBody Long[] ids){
 		costAccountShareService.removeByIds(Arrays.asList(ids));
         return Result.ok();
     }
 
+    /**
+     * 成本分摊参数设置对应复制
+     */
+    @PostMapping("/copyAccountShareData")
+    @ApiOperation("复制成本分摊参数设置功能")
+    public Result copyAccountShareData(@RequestBody @Valid AccountShareCopyDto accountShareCopyDto){
+        Long hospId = UserContext.getHospId();
+        costAccountShareService.copyAccountShareData(accountShareCopyDto,hospId);
+        return Result.ok();
+    }
+    /**
+     * 获取指定类型的责任中心集合 分开计算还是合并计算
+     * @param accountShareId 分摊参数设置的Id
+     */
+    @GetMapping("/getResponsibilityCalType")
+    @ApiOperation("获取指定类型的责任中心集合")
+    public Result getResponsibilityCalType(Long accountShareId){
+        Long hospId = UserContext.getHospId();
+        List<Responsibility> responsibilityList= costAccountShareService.getResponsibilityCalType(accountShareId,hospId);
+        return Result.ok(responsibilityList);
+    }
 }

+ 1 - 1
src/main/java/com/imed/costaccount/web/CostShareParamController.java

@@ -72,7 +72,7 @@ public class CostShareParamController {
      * 接受传递过来的数组集合
      */
     @PostMapping("/updateCostShareParamByAccountId")
-    @ApiOperation("为成本参数添加对应科目信息")
+    @ApiOperation("为成本参数添加对应会计科目信息")
     public Result updateCostShareParamByAccountId(@RequestBody CostShareParamAccountDto costShareParamAccountDto){
         User user = (User) SecurityUtils.getSubject().getPrincipal();
         Long hospId = user.getHospId();

+ 3 - 3
src/main/resources/mapper/CostAccountShareMapper.xml

@@ -11,9 +11,9 @@
         <result property="responsibilityCode" column="responsibility_code"/>
         <result property="responsibilityName" column="responsibility_name"/>
         <result property="hospId" column="hosp_id"/>
-        <result property="accountingId" column="accounting_id"/>
-        <result property="accountingName" column="accounting_name"/>
-        <result property="accountingCode" column="accounting_code"/>
+        <result property="accountingIds" column="accounting_ids"/>
+        <result property="accountingNames" column="accounting_names"/>
+        <result property="accountingCodes" column="accounting_codes"/>
         <result property="paramList" column="param_list"/>
         <result property="costNode" column="cost_node"/>
         <result property="createTime" column="create_time"/>