jiangping
2024-01-27 5b4b0b5b6462ca6da4dc8811663839b3045128f2
开发业务接口
已修改11个文件
160 ■■■■ 文件已修改
company/src/api/business/company.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/business/InsuranceDetails.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/business/insuranceApply.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/platform/src/main/java/com/doumee/api/business/CompanyController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/Constants.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/CompanyService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/company.js
@@ -27,6 +27,13 @@
    return request.post('/business/company/updateStatus', data)
}
export function exportComFiles (data) {
    return request.post('/business/company/exportFiles', data, {
        trim: true,
        download: true
    })
}
// 根据ID查询
export function getById (id) {
    return request.get(`/business/company/${id}`)
company/src/components/business/InsuranceDetails.vue
@@ -55,9 +55,9 @@
            </div>
        </div>
        <template v-slot:footer>
            <el-button type="primary">企业证件</el-button>
            <el-button type="primary"  :loading="isWorking.export" @click="exportComFiles">企业证件</el-button>
            <el-button type="primary"  :loading="isWorking.export" @click="exportDetail">导出详单</el-button>
            <el-button>取消</el-button>
            <el-button @click="visible=false">取消</el-button>
        </template>
    </GlobalWindow>
</template>
@@ -107,8 +107,7 @@
              })
            },
          exportDetail(){
            this.$dialog.exportConfirm('确认导出吗?')
            this.$dialog.exportConfirm('确认导出详单吗?')
                .then(() => {
                  this.isWorking = true
                  exportDetailExcel({ id: this.model.id })
@@ -127,6 +126,26 @@
                })
          },
          exportComFiles(){
            this.$dialog.exportConfirm('确认导出企业证件吗?')
                .then(() => {
                  this.isWorking = true
                  exportComFiles({ id: this.model.companyId })
                      .then(response => {
                        this.download(response)
                      })
                      .catch(e => {
                        console.log(e)
                        this.$message.error('数据下载失败!')
                      })
                      .finally(() => {
                        this.isWorking = false
                      })
                })
                .catch(() => {
                })
          },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
company/src/views/business/insuranceApply.vue
@@ -95,6 +95,7 @@
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import { all as solutionAll} from '@/api/business/solutions'
import {exportComFiles as exportComFiles} from '@/api/business/company'
import { pageAll as companyAll} from '@/api/business/company'
import OperaInsuranceApplyWindow from '@/components/business/OperaInsuranceApplyWindow'
export default {
server/platform/src/main/java/com/doumee/api/business/CompanyController.java
@@ -3,6 +3,8 @@
import com.doumee.api.BaseController;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageWrap;
import com.doumee.core.model.PageData;
@@ -129,4 +131,14 @@
        return ApiResponse.success(companyService.findById(id));
    }
    @ApiOperation("企业证件下载")
    @PostMapping("/exportFiles")
    @RequiresPermissions("business:locks:exportExcel")
    public void exportFiles(@RequestBody Company company,HttpServletResponse response) {
        if(company.getId() == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        companyService.exportFiles(company.getId(),response);
    }
}
server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java
@@ -78,7 +78,7 @@
    @ApiOperation("资料下载")
    @PostMapping("/exportFiles")
    @RequiresPermissions("business:locks:exportExcel")
    public void exportExcel(@RequestParam Integer id,HttpServletResponse response) {
    public void exportFiles(@RequestParam Integer id,HttpServletResponse response) {
        if(id == null){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -350,6 +350,7 @@
        style.setFont(font);
        // 设置边框
        configCellBorder(style);
//        configCellBorder(style);
        cell.setCellStyle(style);
    }
    /**
@@ -478,17 +479,18 @@
            sxssfWorkbook = new SXSSFWorkbook();
            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
            for (int i = 0; i < 6; i++) {
                sheet.setColumnWidth(i, 20 * 2 * 256);
                sheet.setColumnWidth(i, (i==5?20:15) * 2 * 256);
            }
            sheet.createFreezePane(0, 1);
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,5));
            Row title = sheet.createRow(0);
            title.setHeight((short) 800);
            Cell c = title.createCell(0);
            c.setCellValue(sheetName);
            configTitleCell(sxssfWorkbook,c);
            for (int i = 0; i < 6; i++) {
                title.createCell(i).setCellValue(i==0?sheetName:"");
                configTitleCell(sxssfWorkbook,title.getCell(i));
            }
            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,5));
            Row header1 = sheet.createRow(1);
            header1.setHeight((short) 400);
            header1.setHeight((short) 500);
            header1.createCell(0).setCellValue("投保企业");
            header1.createCell(1).setCellValue("保险方案");
            header1.createCell(2).setCellValue("保险生效起期");
@@ -515,7 +517,7 @@
            header4.createCell(3).setCellValue("身份证号");
            header4.createCell(4).setCellValue("派遣单位");
            header4.createCell(5).setCellValue("所属工种");
            header4.setHeight((short) 400);
            header4.setHeight((short) 500);
            for (int i = 0; i < 6; i++) {
                configFirstCell(sxssfWorkbook,header4.getCell(i));
            }
@@ -524,7 +526,7 @@
                for (int rowIndex = 0; rowIndex < data.getApplyDetailList().size(); rowIndex++) {
                    ApplyDetail d = data.getApplyDetailList().get(rowIndex);
                    Row header5 = sheet.createRow(rowIndex + 4);
                    header5.setHeight((short) 300);
//                    header5.setHeight((short) 300);
                    header5.createCell(0).setCellValue(rowIndex+1);
                    header5.createCell(1).setCellValue(StringUtils.defaultString(d.getMemberName(),""));
                    header5.createCell(2).setCellValue(Constants.equalsInteger(d.getSex(),0)?"男":(Constants.equalsInteger(d.getSex(),1)?"女":"-"));
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -5,12 +5,12 @@
import com.doumee.dao.business.model.Solutions;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;
@@ -811,6 +811,7 @@
        private int key;
        private int collectStatus;
        // 构造方法
        InsuranceApplyStatus(int key, String name,String info,int collectStatus) {
            this.name = name;
@@ -1367,4 +1368,20 @@
        return file;
    }
    public static void packFilesToZip(List<File> files,    ServletOutputStream os) throws IOException {
        try (ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(os)) {
            for (File file : files) {
                ZipArchiveEntry entry = new ZipArchiveEntry(file.getName());
                zipOutputStream.putArchiveEntry(entry);
                try (FileInputStream fileInputStream = new FileInputStream(file)) {
                    byte[] buffer = new byte[1024];
                    int length;
                    while ((length = fileInputStream.read(buffer)) > 0) {
                        zipOutputStream.write(buffer, 0, length);
                    }
                }
                zipOutputStream.closeArchiveEntry();
            }
        }
    }
}
server/service/src/main/java/com/doumee/service/business/CompanyService.java
@@ -3,6 +3,8 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Company;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -103,4 +105,6 @@
    void   dealSignIdStatus();
    void updateSolutions(Company company);
    void exportFiles(Integer id, HttpServletResponse response);
}
server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
@@ -31,9 +32,12 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.net.URI;
import java.net.URLEncoder;
import java.util.*;
/**
@@ -112,6 +116,46 @@
        //处理关联方案
        dealSolutionsData(company);
    }
    @Transactional
    public void exportFiles(Integer id, HttpServletResponse response){
        try {
            Company model = companyMapper.selectById(id);
            if(model == null){
                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
            }
            List<File> fileList = new ArrayList<>();
            List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
                    .eq(Multifile::getObjId,id)
                    .isNotNull(Multifile::getFileurl)
                    .in(Multifile::getObjType, Arrays.asList(new Integer[]{
                            Constants.MultiFile.COM_BUSINESS_LICENSE.getKey(),
                            Constants.MultiFile.COM_IDCARD_IMG.getKey(),
                    }))
            );
            if(multifileList== null || multifileList.size() == 0){
                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
            }
            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.COMPANY_FILE).getCode();
            for(Multifile l : multifileList){
                File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(l.getName(),"未命名"));
                if(f !=null && f.isFile()){
                    fileList.add(f);
                }
            }
            if(fileList == null || fileList.size() == 0){
                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
            }
            String fileName =  model.getName() +"理赔资料下_"+System.currentTimeMillis()+".zip" ;
            String encodeFileName = URLEncoder.encode(fileName);
            response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
            response.setContentType("application/octet-stream");
            response.setHeader("eva-opera-type", "download");
            response.setHeader("eva-download-filename", encodeFileName);
            Constants. packFilesToZip(fileList,response.getOutputStream());
        } catch (IOException e) {
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
    }
    private void dealSystemUserData(Company company) {
        if(systemUserMapper.selectCount(new QueryWrapper<SystemUser>().lambda()
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -1014,7 +1014,7 @@
                .selectAs(DispatchUnit::getName,ApplyDetail::getDuName)
                .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId)
                .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId)
                .eq(InsuranceApply::getId,model.getId());
                .eq(ApplyDetail::getApplyId,model.getId());
        //查询明细
        List<ApplyDetail> detailList =applyDetailJoinMapper.selectJoinList(ApplyDetail.class,wrapper1);
        if(detailList!=null){
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -413,29 +413,13 @@
            response.setContentType("application/octet-stream");
            response.setHeader("eva-opera-type", "download");
            response.setHeader("eva-download-filename", encodeFileName);
            packFilesToZip(fileList,response.getOutputStream());
            Constants.packFilesToZip(fileList,response.getOutputStream());
        } catch (IOException e) {
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
    }
    public static void packFilesToZip(List<File> files,    ServletOutputStream os) throws IOException {
        try (ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(os)) {
            for (File file : files) {
                ZipArchiveEntry entry = new ZipArchiveEntry(file.getName());
                zipOutputStream.putArchiveEntry(entry);
                try (FileInputStream fileInputStream = new FileInputStream(file)) {
                    byte[] buffer = new byte[1024];
                    int length;
                    while ((length = fileInputStream.read(buffer)) > 0) {
                        zipOutputStream.write(buffer, 0, length);
                    }
                }
                zipOutputStream.closeArchiveEntry();
            }
        }
    }
    @Override
    public SettleClaims getSettleClaimsDetail(Integer id){