|
@@ -2,6 +2,7 @@ package com.ydtech.modules.report.service.impl;
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.ydtech.aop.exception.DescribeException;
|
|
import com.ydtech.aop.exception.DescribeException;
|
|
@@ -12,6 +13,7 @@ import com.ydtech.modules.admin.model.SysDept;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
|
|
|
+import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
import com.ydtech.modules.ins.utils.ExcelStyleLeftUtil;
|
|
import com.ydtech.modules.ins.utils.ExcelStyleLeftUtil;
|
|
|
import com.ydtech.modules.ins.utils.ExcelStyleUtil;
|
|
import com.ydtech.modules.ins.utils.ExcelStyleUtil;
|
|
|
import com.ydtech.modules.ins.utils.ExcelUtils2;
|
|
import com.ydtech.modules.ins.utils.ExcelUtils2;
|
|
@@ -1193,8 +1195,55 @@ public class ReportServiceImpl implements ReportService {
|
|
|
public BasePageResult<PayApplyDeptReportResVo> getPayApplyDeptReportData(PayApplyDeptReportReqVo reqDto) {
|
|
public BasePageResult<PayApplyDeptReportResVo> getPayApplyDeptReportData(PayApplyDeptReportReqVo reqDto) {
|
|
|
Page<InsOrders> page = new Page<>(reqDto.getPageNum(), reqDto.getPageSize());
|
|
Page<InsOrders> page = new Page<>(reqDto.getPageNum(), reqDto.getPageSize());
|
|
|
page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
|
|
page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
|
|
|
|
|
+ List<String> comStr=new ArrayList<>();
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"1".equals(reqDto.getIsDrilling())){//下钻时查询下级所有机构
|
|
|
|
|
+ LambdaQueryWrapper<SysDept> lqw1 = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lqw1.eq(SysDept::getParentId, reqDto.getDeptId());
|
|
|
|
|
+ List<SysDept> sysDeptList=sysDeptService.list(lqw1);
|
|
|
|
|
+ if(sysDeptList!=null&&sysDeptList.size()>0){
|
|
|
|
|
+ sysDeptList.stream().forEach(item->{
|
|
|
|
|
+ comStr.add(item.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw new SystemException("已经到最底层,不能继续下钻!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"2".equals(reqDto.getIsDrilling())){//返回时 查询上级的上级的所有下级
|
|
|
|
|
+ SysDept sysDept1=sysDeptService.getById(reqDto.getDeptId());
|
|
|
|
|
+ if("1".equals(sysDept1.getComlevel())||"0".equals(sysDept1.getComlevel())){
|
|
|
|
|
+ throw new SystemException("已经到最顶层,不能继续返回!");
|
|
|
|
|
+ }else if("2".equals(sysDept1.getComlevel())){//如果是二级 往上找一级
|
|
|
|
|
+ SysDept sysDept2=sysDeptService.getById(sysDept1.getParentId());
|
|
|
|
|
+ comStr.add(sysDept2.getId());
|
|
|
|
|
+ }else{//找上级的上级的所有下级
|
|
|
|
|
+ SysDept sysDept2=sysDeptService.getById(sysDept1.getParentId());
|
|
|
|
|
+ SysDept sysDept3=sysDeptService.getById(sysDept2.getParentId());
|
|
|
|
|
+ LambdaQueryWrapper<SysDept> lqw1 = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lqw1.eq(SysDept::getParentId, sysDept3.getId());
|
|
|
|
|
+ List<SysDept> sysDeptList=sysDeptService.list(lqw1);
|
|
|
|
|
+ if(sysDeptList!=null&&sysDeptList.size()>0){
|
|
|
|
|
+ sysDeptList.stream().forEach(item->{
|
|
|
|
|
+ comStr.add(item.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw new SystemException("机构数据有误,请联系管理员!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{//正常查询时
|
|
|
|
|
+ comStr.add(reqDto.getDeptId());
|
|
|
|
|
+ }
|
|
|
|
|
+ reqDto.setGroupInsCompanyArr(comStr);
|
|
|
Page<PayApplyDeptReportResVo> payApplyDeptReportResVoPage = reportInsurancePolicyMapper.queryPayApplyDeptReportData(page,
|
|
Page<PayApplyDeptReportResVo> payApplyDeptReportResVoPage = reportInsurancePolicyMapper.queryPayApplyDeptReportData(page,
|
|
|
reqDto);
|
|
reqDto);
|
|
|
|
|
+
|
|
|
|
|
+ if(payApplyDeptReportResVoPage.getRecords().size()==0){
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"1".equals(reqDto.getIsDrilling())){
|
|
|
|
|
+ throw new SystemException("已经是最底层机构,无法继续下钻!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ payApplyDeptReportResVoPage.getRecords().stream().forEach(item->{
|
|
|
|
|
+ SysDept sysDept1=sysDeptService.getById(item.getInstitutionId());
|
|
|
|
|
+ item.setInstitution(sysDept1.getName());
|
|
|
|
|
+ });
|
|
|
Long total = reportInsurancePolicyMapper.queryPayApplyDeptReportDataCount(reqDto);
|
|
Long total = reportInsurancePolicyMapper.queryPayApplyDeptReportDataCount(reqDto);
|
|
|
payApplyDeptReportResVoPage.setTotal(total);
|
|
payApplyDeptReportResVoPage.setTotal(total);
|
|
|
return new BasePageResult<>(reqDto.getPageNum(), reqDto.getPageSize(),
|
|
return new BasePageResult<>(reqDto.getPageNum(), reqDto.getPageSize(),
|
|
@@ -1204,8 +1253,74 @@ public class ReportServiceImpl implements ReportService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public HttpResult<String> exportPayApplyDeptReportData(PayApplyDeptReportReqVo reqDto) {
|
|
public HttpResult<String> exportPayApplyDeptReportData(PayApplyDeptReportReqVo reqDto) {
|
|
|
|
|
+ List<String> comStr=new ArrayList<>();
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"1".equals(reqDto.getIsDrilling())){//下钻时查询下级所有机构
|
|
|
|
|
+ LambdaQueryWrapper<SysDept> lqw1 = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lqw1.eq(SysDept::getParentId, reqDto.getDeptId());
|
|
|
|
|
+ List<SysDept> sysDeptList=sysDeptService.list(lqw1);
|
|
|
|
|
+ if(sysDeptList!=null&&sysDeptList.size()>0){
|
|
|
|
|
+ sysDeptList.stream().forEach(item->{
|
|
|
|
|
+ comStr.add(item.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw new SystemException("已经到最底层,不能继续下钻!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"2".equals(reqDto.getIsDrilling())){//返回时 查询上级的上级的所有下级
|
|
|
|
|
+ SysDept sysDept1=sysDeptService.getById(reqDto.getDeptId());
|
|
|
|
|
+ if("1".equals(sysDept1.getComlevel())||"0".equals(sysDept1.getComlevel())){
|
|
|
|
|
+ throw new SystemException("已经到最顶层,不能继续返回!");
|
|
|
|
|
+ }else if("2".equals(sysDept1.getComlevel())){//如果是二级 往上找一级
|
|
|
|
|
+ SysDept sysDept2=sysDeptService.getById(sysDept1.getParentId());
|
|
|
|
|
+ comStr.add(sysDept2.getId());
|
|
|
|
|
+ }else{//找上级的上级的所有下级
|
|
|
|
|
+ SysDept sysDept2=sysDeptService.getById(sysDept1.getParentId());
|
|
|
|
|
+ SysDept sysDept3=sysDeptService.getById(sysDept2.getParentId());
|
|
|
|
|
+ LambdaQueryWrapper<SysDept> lqw1 = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lqw1.eq(SysDept::getParentId, sysDept3.getId());
|
|
|
|
|
+ List<SysDept> sysDeptList=sysDeptService.list(lqw1);
|
|
|
|
|
+ if(sysDeptList!=null&&sysDeptList.size()>0){
|
|
|
|
|
+ sysDeptList.stream().forEach(item->{
|
|
|
|
|
+ comStr.add(item.getId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw new SystemException("机构数据有误,请联系管理员!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{//正常查询时
|
|
|
|
|
+ comStr.add(reqDto.getDeptId());
|
|
|
|
|
+ }
|
|
|
|
|
+ reqDto.setGroupInsCompanyArr(comStr);
|
|
|
List<PayApplyDeptReportResVo> payApplyUserReportResVoList = reportInsurancePolicyMapper.queryPayApplyDeptReportData(reqDto);
|
|
List<PayApplyDeptReportResVo> payApplyUserReportResVoList = reportInsurancePolicyMapper.queryPayApplyDeptReportData(reqDto);
|
|
|
- String s = EasyExcelUtils.downExcel(uploadFilePath, PayApplyUserReportResVo.class, payApplyUserReportResVoList);
|
|
|
|
|
|
|
+ if(payApplyUserReportResVoList.size()==0){
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reqDto.getIsDrilling())&&"1".equals(reqDto.getIsDrilling())){
|
|
|
|
|
+ throw new SystemException("已经是最底层机构,无法继续下钻!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ payApplyUserReportResVoList.stream().forEach(item->{
|
|
|
|
|
+ SysDept sysDept1=sysDeptService.getById(item.getInstitutionId());
|
|
|
|
|
+ item.setInstitution(sysDept1.getName());
|
|
|
|
|
+ });
|
|
|
|
|
+ String s = EasyExcelUtils.downExcel(uploadFilePath, PayApplyDeptReportResVo.class, payApplyUserReportResVoList);
|
|
|
|
|
+ return HttpResult.ok("", s);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<String> exportPayApplyDeptReportListData(PayApplyDeptReportReqVo payApplyDeptReportReqVo) {
|
|
|
|
|
+ List<PayApplyDeptReportListResVo> payApplyDeptReportListData = reportInsurancePolicyMapper.exportPayApplyDeptReportListData(payApplyDeptReportReqVo);
|
|
|
|
|
+ payApplyDeptReportListData.stream().forEach(item->{
|
|
|
|
|
+ if("0".equals(item.getAuditstatus())){
|
|
|
|
|
+ item.setAuditstatus("未审核");
|
|
|
|
|
+ }else if("1".equals(item.getAuditstatus())){
|
|
|
|
|
+ item.setAuditstatus("已审核");
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("0".equals(item.getSettlestatus())){
|
|
|
|
|
+ item.setSettlestatus("未结算");
|
|
|
|
|
+ }else if("1".equals(item.getSettlestatus())){
|
|
|
|
|
+ item.setSettlestatus("已结算");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ String s = EasyExcelUtils.downExcel(uploadFilePath, PayApplyDeptReportListResVo.class, payApplyDeptReportListData);
|
|
|
return HttpResult.ok("", s);
|
|
return HttpResult.ok("", s);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|