浏览代码

Merge branch 'master' of huangrui/CostAccount into dev

lijiaxi 4 年之前
父节点
当前提交
57cb980c16

+ 1 - 1
src/main/java/com/imed/costaccount/mapper/RoleMenuMapper.java

@@ -18,7 +18,7 @@ import java.util.List;
 public interface RoleMenuMapper extends BaseMapper<RoleMenu> {
 
     /**
-     * 通过roleid和hospId 获取role关联的menu信息
+     * 通过roleId和hospId 获取role关联的menu信息
      * @param roleId 角色id
      * @param hospId 医院id
      * @return id name

+ 11 - 0
src/main/java/com/imed/costaccount/service/CostIncomeGroupService.java

@@ -2,8 +2,11 @@ package com.imed.costaccount.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.imed.costaccount.common.util.PageUtils;
+import com.imed.costaccount.common.util.Result;
 import com.imed.costaccount.model.CostIncomeGroup;
 
+import java.util.List;
+
 /**
  * 收入归集
  *
@@ -23,5 +26,13 @@ public interface CostIncomeGroupService extends IService<CostIncomeGroup> {
      * @return
      */
     PageUtils queryList(Integer current, Integer pageSize, String dateTime, String responsibilityCode, String accountCode, Long hospId);
+
+    /**
+     * 批量导入收入数据
+     * @param read
+     * @param hospId
+     * @return
+     */
+    Result importIncomeGroup(List<List<Object>> read, Long hospId);
 }
 

+ 49 - 17
src/main/java/com/imed/costaccount/service/impl/CostIncomeGroupServiceImpl.java

@@ -7,21 +7,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.imed.costaccount.common.util.BeanUtil;
 import com.imed.costaccount.common.util.DateUtils;
 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.CostIncomeGroupMapper;
 import com.imed.costaccount.model.*;
 import com.imed.costaccount.model.vo.CostIncomeGroupAllAmountVO;
 import com.imed.costaccount.model.vo.CostIncomeGroupBeforeVO;
 import com.imed.costaccount.service.*;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
-
+@Slf4j
 @Service("costIncomeGroupService")
 public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMapper, CostIncomeGroup> implements CostIncomeGroupService {
 
@@ -54,18 +54,20 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
      */
     @Override
     public PageUtils queryList(Integer current, Integer pageSize, String dateTime, String responsibilityCode, String accountCode, Long hospId) {
-        int year = DateUtils.getYear(dateTime);
-        int month=DateUtils.getMonth(dateTime);
+        int year = 0;
+        int month=0;
+        if (StrUtil.isNotBlank(dateTime)){
+            year = DateUtils.getYear(dateTime);
+            month=DateUtils.getMonth(dateTime);
+        }
         Page<CostIncomeGroup> costIncomeGroupPage = new Page<>(current, pageSize);
-        QueryWrapper<CostIncomeGroup> wrapper = new QueryWrapper<>();
-        wrapper.eq("hosp_id",hospId);
-        wrapper.eq("date_year",year);
-        wrapper.eq("date_month",month);
-        wrapper.like(!StringUtils.isEmpty(responsibilityCode),"open_responsibility_code",responsibilityCode)
-                .or()
-                .like(!StringUtils.isEmpty(responsibilityCode),"start_responsibility_code",responsibilityCode);
-        wrapper.eq(!StringUtils.isEmpty(accountCode),"account_code",accountCode);
-        Page<CostIncomeGroup> pages = this.page(costIncomeGroupPage, wrapper);
+        Page<CostIncomeGroup> pages= this.page(costIncomeGroupPage,new QueryWrapper<CostIncomeGroup>().lambda()
+                .eq(Objects.nonNull(hospId),CostIncomeGroup::getHospId,hospId)
+                .eq(!NumberConstant.ZERO.equals(year),CostIncomeGroup::getDateYear,year)
+                .eq(!NumberConstant.ONE.equals(month),CostIncomeGroup::getDateMonth,month)
+                .and(StrUtil.isNotBlank(responsibilityCode),i->i.like(CostIncomeGroup::getOpenResponsibilityCode,responsibilityCode)
+                .or().like(CostIncomeGroup::getStartResponsibilityCode, responsibilityCode))
+                .like(StrUtil.isNotBlank(accountCode),CostIncomeGroup::getAccountCode,accountCode));
         List<CostIncomeGroup> records = pages.getRecords();
         List<CostIncomeGroupBeforeVO> costIncomeGroupBeforeVOList = BeanUtil.convertList(records, CostIncomeGroupBeforeVO.class);
         // 查询所有的责任中心 科室 会计科目  成本项目的数据  处理名字
@@ -88,6 +90,36 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         return pageUtils;
     }
 
+    /**
+     * 批量导入收入数据
+     *
+     * @param list 输入的文件
+     * @param hospId 医院Id
+     * @return
+     */
+    @Override
+    public Result importIncomeGroup(List<List<Object>> list, Long hospId) {
+        // 移除前几行的抬头内容
+        for (int i = list.size() - 1; i >= 0; i--) {
+            if (i == NumberConstant.ZERO || i == NumberConstant.ONE || i == NumberConstant.TWO || i == NumberConstant.THREE) {
+                list.remove(list.get(i));
+            }
+        }
+        log.info("读取的数据为:{}", list);
+        List<CostIncomeGroup> costIncomeGroupList = new ArrayList<>();
+        List<String> errRowNums = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            List<Object> data = list.get(i);
+            log.info("用户输入的数据是{}",data);
+            CostIncomeGroup costIncomeGroup = new CostIncomeGroup();
+            costIncomeGroup.setCreateTime(System.currentTimeMillis());
+            costIncomeGroup.setHospId(hospId);
+
+
+        }
+        return Result.ok();
+    }
+
     /**
      * 设置相关名称
      * @param hospId
@@ -114,7 +146,7 @@ public class CostIncomeGroupServiceImpl extends ServiceImpl<CostIncomeGroupMappe
         });
     }
     /**
-     * 收入归集数据的计算规则
+     * 收入数据导入
      */
 
 }

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

@@ -26,6 +26,7 @@ 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.bind.annotation.RequestParam;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -138,12 +139,14 @@ public class CostIncomeGroupSetServiceImpl extends ServiceImpl<CostIncomeGroupSe
     private void checkIncomeGroupSet(CostIncomeGroupSetSaveDto costIncomeGroupSetSaveDto, Long hospId) {
         Integer sum = costIncomeGroupSetSaveDto.getOpenDepartmentProportion() + costIncomeGroupSetSaveDto.getStartDepartmentProportion();
         if (!NumberConstant.ONE_HUNDRED.equals(sum)) {
-            throw new CostException(500, "输入的比例和不是100");
+            if ((NumberConstant.ONE.equals(costIncomeGroupSetSaveDto.getOpenDepartmentStatus()) || NumberConstant.ONE.equals(costIncomeGroupSetSaveDto.getStartDepartmentStatus()))){
+                throw new CostException(500, "输入的比例和不是100");
+            }
         }
         if (NumberConstant.TWO.equals(costIncomeGroupSetSaveDto.getOpenDepartmentStatus())
                 && NumberConstant.TWO.equals(costIncomeGroupSetSaveDto.getStartDepartmentStatus())) {
             if (StringUtils.isEmpty(costIncomeGroupSetSaveDto.getResponsibilityCodes())){
-                throw new CostException(500, "两个成本中心需要输入对应的责任中心");
+                throw new CostException(500, "请选择要归属到的责任中心");
             }else {
                 costIncomeGroupSetSaveDto.setOpenDepartmentProportion(NumberConstant.ZERO);
                 costIncomeGroupSetSaveDto.setStartDepartmentProportion(NumberConstant.ZERO);
@@ -256,7 +259,7 @@ public class CostIncomeGroupSetServiceImpl extends ServiceImpl<CostIncomeGroupSe
      * @return
      */
     @Override
-    public List<AccountIncomeSetVO> getIncomeAccountStatus(Long id, Long hospId) {
+    public List<AccountIncomeSetVO> getIncomeAccountStatus(@RequestParam(value = "id")Long id, Long hospId) {
 
         CostIncomeGroupSet incomeGroupSet = this.getById(id);
         if (Objects.isNull(incomeGroupSet)){

+ 40 - 40
src/main/java/com/imed/costaccount/service/impl/ReportRelationServiceImpl.java

@@ -77,48 +77,48 @@ public class ReportRelationServiceImpl extends ServiceImpl<ReportRelationMapper,
     public List<RelationVO> getRelationList(Long reportId, Integer relation, Long hospId) {
         List<RelationVO> list = new ArrayList<>();
         if (relation == 1) {
-            List<RelationVO> accountRelation = this.getAccountRelation(reportId, hospId);
-            List<Accounting> accounts = accountingService.list(new LambdaQueryWrapper<Accounting>().select(Accounting::getAccountingCode, Accounting::getAccountingName).eq(Accounting::getHospId, hospId));
-            if (accounts.isEmpty()) {
-                return list;
-            }
-            list = accounts.stream().map(i -> {
-                RelationVO relationVO = new RelationVO();
-                relationVO.setIsSelect(false);
-                relationVO.setRelation(1);
-                relationVO.setCode(i.getAccountingCode());
-                relationVO.setName(i.getAccountingName());
-                return relationVO;
-            }).collect(Collectors.toList());
-            for (RelationVO relationVO : accountRelation) {
-                for (RelationVO vo : list) {
-                    if (vo.getCode().equals(relationVO.getCode())) {
-                        vo.setIsSelect(true);
-                    }
-                }
-            }
+            list = this.getAccountRelation(reportId, hospId);
+//            List<Accounting> accounts = accountingService.list(new LambdaQueryWrapper<Accounting>().select(Accounting::getAccountingCode, Accounting::getAccountingName).eq(Accounting::getHospId, hospId));
+//            if (accounts.isEmpty()) {
+//                return list;
+//            }
+//            list = accounts.stream().map(i -> {
+//                RelationVO relationVO = new RelationVO();
+//                relationVO.setIsSelect(false);
+//                relationVO.setRelation(1);
+//                relationVO.setCode(i.getAccountingCode());
+//                relationVO.setName(i.getAccountingName());
+//                return relationVO;
+//            }).collect(Collectors.toList());
+//            for (RelationVO relationVO : accountRelation) {
+//                for (RelationVO vo : list) {
+//                    if (vo.getCode().equals(relationVO.getCode())) {
+//                        vo.setIsSelect(true);
+//                    }
+//                }
+//            }
 
         } else if (relation == 2) {
-            List<RelationVO> accountRelation = this.getShareParam(reportId, hospId);
-            List<CostShareParam> accounts = shareParamService.list(new LambdaQueryWrapper<CostShareParam>().select(CostShareParam::getShareParamCode, CostShareParam::getShareParamName).eq(CostShareParam::getHospId, hospId));
-            if (accounts.isEmpty()) {
-                return list;
-            }
-            list = accounts.stream().map(i -> {
-                RelationVO relationVO = new RelationVO();
-                relationVO.setIsSelect(false);
-                relationVO.setRelation(1);
-                relationVO.setCode(i.getShareParamCode());
-                relationVO.setName(i.getShareParamName());
-                return relationVO;
-            }).collect(Collectors.toList());
-            for (RelationVO relationVO : accountRelation) {
-                for (RelationVO vo : list) {
-                    if (vo.getCode().equals(relationVO.getCode())) {
-                        vo.setIsSelect(true);
-                    }
-                }
-            }
+            list = this.getShareParam(reportId, hospId);
+//            List<CostShareParam> accounts = shareParamService.list(new LambdaQueryWrapper<CostShareParam>().select(CostShareParam::getShareParamCode, CostShareParam::getShareParamName).eq(CostShareParam::getHospId, hospId));
+//            if (accounts.isEmpty()) {
+//                return list;
+//            }
+//            list = accounts.stream().map(i -> {
+//                RelationVO relationVO = new RelationVO();
+//                relationVO.setIsSelect(false);
+//                relationVO.setRelation(1);
+//                relationVO.setCode(i.getShareParamCode());
+//                relationVO.setName(i.getShareParamName());
+//                return relationVO;
+//            }).collect(Collectors.toList());
+//            for (RelationVO relationVO : accountRelation) {
+//                for (RelationVO vo : list) {
+//                    if (vo.getCode().equals(relationVO.getCode())) {
+//                        vo.setIsSelect(true);
+//                    }
+//                }
+//            }
         }
         return list;
     }

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

@@ -3,21 +3,16 @@ package com.imed.costaccount.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.mapper.UserRoleMapper;
 import com.imed.costaccount.model.UserRole;
 import com.imed.costaccount.model.dto.RoleUserDTO;
-import com.imed.costaccount.model.vo.CommonSelectVO;
 import com.imed.costaccount.model.vo.CommonVO;
-import com.imed.costaccount.model.vo.UserVO;
 import com.imed.costaccount.service.UserRoleService;
 import com.imed.costaccount.service.UserService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -69,8 +64,7 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
 //        this.removeById(roleId);
         List<Long> userIds = roleUserDTO.getUserIds();
         this.remove(
-                new LambdaQueryWrapper<UserRole>().in(UserRole::getUserId, userIds).eq(UserRole::getRoleId, roleId)
-        );
+                new LambdaQueryWrapper<UserRole>().eq(UserRole::getRoleId, roleId));
         if (CollUtil.isNotEmpty(userIds)) {
             List<UserRole> userRoles = userIds.stream().map(i -> {
                 UserRole userRole = new UserRole();

+ 11 - 7
src/main/java/com/imed/costaccount/web/ExcelController.java

@@ -56,7 +56,10 @@ public class ExcelController {
 
     private final CostShareParamService costShareParamService;
 
-    public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService, AccountingService accountingService, AccountingProductService accountingProductService, ResponsibilityDepartmentService responsibilityDepartmentService, CostShareParamService costShareParamService) {
+    private final CostIncomeGroupService costIncomeGroupService;
+
+
+    public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService, AccountingService accountingService, AccountingProductService accountingProductService, ResponsibilityDepartmentService responsibilityDepartmentService, CostShareParamService costShareParamService, CostIncomeGroupService costIncomeGroupService) {
         this.userService = userService;
         this.departmentService = departmentService;
         this.productService = productService;
@@ -64,6 +67,7 @@ public class ExcelController {
         this.accountingProductService = accountingProductService;
         this.responsibilityDepartmentService = responsibilityDepartmentService;
         this.costShareParamService = costShareParamService;
+        this.costIncomeGroupService = costIncomeGroupService;
     }
 
     @ApiOperation("用户导出模板设置")
@@ -252,8 +256,8 @@ public class ExcelController {
         int accountType=NumberConstant.ONE;
         int column=NumberConstant.FOUR;
         getProductByAccountType(hospId, writer,accountType,column);
-        writer.setColumnWidth(0,10);
-        writer.setColumnWidth(1,10);
+        writer.setColumnWidth(0,20);
+        writer.setColumnWidth(1,20);
         writer.setColumnWidth(2,20);
         writer.setColumnWidth(3,20);
         writer.setColumnWidth(4,20);
@@ -416,11 +420,11 @@ public class ExcelController {
      * @param file 导入的文件
      * @param fileType 文件类型 1 成本分摊数据  2 收入数据 3 成本数据
      */
-    @PostMapping("/importProductAccount")
-    @ApiOperation("批量导入数据信息")
+    @PostMapping("/importDataByFileType")
+    @ApiOperation("批量导入指定类型数据信息")
     public Result importProductAccount(@RequestParam("file") MultipartFile file,Integer fileType){
         InputStream in;
-        // 导入的是成本分摊参数的数据
+        // 导入的是收入数据
         try {
             in = file.getInputStream();
             ExcelReader reader = ExcelUtil.getReader(in);
@@ -428,7 +432,7 @@ public class ExcelController {
             log.info("最开始:read={}",read);
             log.info("-------------------------------------------------------------------");
             Long hospId = UserContext.getHospId();
-            return productService.importProduct(read, hospId);
+            return costIncomeGroupService.importIncomeGroup(read, hospId);
         }catch (IOException e){
             e.printStackTrace();;
             throw new CostException(500, "导入失败");

+ 8 - 0
src/main/java/com/imed/costaccount/web/ReportFormController.java

@@ -107,6 +107,14 @@ public class ReportFormController extends AbstractController {
         return Result.ok(list);
     }
 
+
+    /**
+     *
+     * @since 2021-8-6 10:50:59
+     * @param reportId
+     * @param relation
+     * @return 只返回已经选择过的数据列表
+     */
     @ApiOperation("根据关系类型,获取可绑定的关系数据(包含回显)")
     @GetMapping("/getRelationList")
     @ApiImplicitParams({