futian.liu
2023-12-11 18877546c8e7fa36c537fe7f9cfc07e7ac6e7654
修改模板下载
1个文件已添加
3个文件已修改
126 ■■■■■ 已修改文件
admin-web/src/views/foundation/material/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/org/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
deploy-jar-single/src/main/resources/import/物品信息.xls 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/foundation/material/index.vue
@@ -118,7 +118,7 @@
          /* æ¨¡æ¿ä¸‹è½½ */
          templateSettings: {
              templateName: '导入模板.xls', // åç§°
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate' // ä¸‹è½½åœ°å€
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate?type=goods' // ä¸‹è½½åœ°å€
          },
          onSuccess: null
      },
admin-web/src/views/systemManger/org/index.vue
@@ -70,7 +70,7 @@
          /* æ¨¡æ¿ä¸‹è½½ */
          templateSettings: {
              templateName: '导入模板.xls', // åç§°
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate' // ä¸‹è½½åœ°å€
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate?type=tenant' // ä¸‹è½½åœ°å€
          },
          onSuccess: null
      },
consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java
@@ -1,5 +1,32 @@
package com.consum.base.controller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
@@ -18,34 +45,10 @@
import com.walker.infrastructure.tree.TreeNode;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
 * @Description åŒºåˆ’
@@ -324,7 +327,8 @@
        if (param.getFirstZmS() != null && !param.getFirstZmS().equals("")) {
            whStr.append(" and name is not null and(");
            String upperCase = param.getFirstZmS().toUpperCase();
            whStr.append("instr(:upperFirstZmS,F_PINYIN( SUBSTR(name, 1, 1)))>0 or instr(:upperFirstZmS2,SUBSTR(name, 1, 1))>0");
            whStr.append(
                "instr(:upperFirstZmS,F_PINYIN( SUBSTR(name, 1, 1)))>0 or instr(:upperFirstZmS2,SUBSTR(name, 1, 1))>0");
            parameter.put("upperFirstZmS", upperCase);
            parameter.put("upperFirstZmS2", upperCase);
            whStr.append(")");
@@ -333,7 +337,6 @@
        List<FinSysTenant> select = this.finSysTenantService.select(new FinSysTenant(), whStr.toString(), parameter);
        return ResponseValue.success(select);
    }
    /**
     * åˆ é™¤
@@ -394,50 +397,27 @@
    }
    @GetMapping("getImportTemplate")
    public ResponseEntity<InputStreamResource> getImportTemplate() throws IOException {
    public ResponseEntity<InputStreamResource> getImportTemplate(String type) throws IOException {
        // ä»Žå½“前项目资源目录获取文件
        Resource resource = new ClassPathResource("import/机构导入模板.xls");
        String fileName = null;
        if ("tenant".equals(type)) {
            fileName = "机构导入模板.xls";
        } else if ("goods".equals(type)) {
            fileName = "物品信息.xls";
        }
        Resource resource = new ClassPathResource("import/" + fileName);
        // èŽ·å–æ–‡ä»¶è¾“å…¥æµ
        InputStream inputStream = resource.getInputStream();
        // è®¾ç½®HTTP响应头
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
        String encodedFilename = URLEncoder.encode("机构导入模板.xls", "UTF-8");
        String encodedFilename = URLEncoder.encode(fileName, "UTF-8");
        headers.setContentDispositionFormData("attachment", encodedFilename);
        // åˆ›å»ºInputStreamResource对象,将文件输入流包装起来
        InputStreamResource resourceToDownload = new InputStreamResource(inputStream);
        // è¿”回带有文件输入流的ResponseEntity对象
        return ResponseEntity
            .status(HttpStatus.OK)
            .headers(headers)
            .body(resourceToDownload);
        return ResponseEntity.status(HttpStatus.OK).headers(headers).body(resourceToDownload);
    }
    /**
     * @return èŽ·å–é¡¹ç›®å¯¼å…¥çš„æ¨¡æ¿
     * @throws IOException
     */
    @GetMapping("getProjectImportTemplate")
    public ResponseEntity<InputStreamResource> getProjectImportTemplate() throws IOException {
        // ä»Žå½“前项目资源目录获取文件
        Resource resource = new ClassPathResource("import/项目导入模板.xls");
        // èŽ·å–æ–‡ä»¶è¾“å…¥æµ
        InputStream inputStream = resource.getInputStream();
        // è®¾ç½®HTTP响应头
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
        String encodedFilename = URLEncoder.encode("项目导入模板.xls", "UTF-8");
        headers.setContentDispositionFormData("attachment", encodedFilename);
        // åˆ›å»ºInputStreamResource对象,将文件输入流包装起来
        InputStreamResource resourceToDownload = new InputStreamResource(inputStream);
        // è¿”回带有文件输入流的ResponseEntity对象
        return ResponseEntity
            .status(HttpStatus.OK)
            .headers(headers)
            .body(resourceToDownload);
    }
    @PostMapping("import")
    public ResponseValue upload(@RequestParam Long pid, MultipartFile file) throws IOException {
@@ -466,7 +446,8 @@
                    throw exception;
                }
                if (null != finSysTenantService.queryOneByCode(finSysTenantParam.getCode())) {
                    throw new IllegalStateException("第" + analysisContext.readSheetHolder().getRowIndex() + "行,机构编号已存在");
                    throw new IllegalStateException(
                        "第" + analysisContext.readSheetHolder().getRowIndex() + "行,机构编号已存在");
                }
                if (StringUtils.isEmpty(finSysTenantParam.getName()) || finSysTenantParam.getName().length() > 100) {
                    IllegalStateException exception = new IllegalStateException(
@@ -490,9 +471,10 @@
                if (exception instanceof ExcelDataConvertException) {
                    ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
                    logger.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(),
                        excelDataConvertException.getColumnIndex() + 1, excelDataConvertException.getCellData().getStringValue());
                    throw new IllegalStateException(
                        "第" + (excelDataConvertException.getRowIndex() + 1) + "行,第" + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ "
                        excelDataConvertException.getColumnIndex() + 1,
                        excelDataConvertException.getCellData().getStringValue());
                    throw new IllegalStateException("第" + (excelDataConvertException.getRowIndex() + 1) + "行,第"
                        + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ "
                            + excelDataConvertException.getCellData().getStringValue() + " ]");
                }
                if (exception instanceof IllegalStateException) {
@@ -571,7 +553,8 @@
            }
            // çœ
            FinSysTenant finSysTenant1 = this.finSysTenantService.get(new FinSysTenant(finSysTenant.getParentId()));
            List<FinSysTenantUser> finSysTenantUserList = this.finSysTenantUserService.getByOrgId(finSysTenant1.getId());
            List<FinSysTenantUser> finSysTenantUserList =
                this.finSysTenantUserService.getByOrgId(finSysTenant1.getId());
            if (!StringUtils.isEmptyList(finSysTenantUserList)) {
                FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult();
                finSysTenantUserResult.setOrgId(finSysTenant1.getId());
@@ -592,7 +575,8 @@
            }
            // å¸‚
            FinSysTenant finSysTenant2 = this.finSysTenantService.get(new FinSysTenant(finSysTenant.getParentId()));
            List<FinSysTenantUser> finSysTenantUserList2 = this.finSysTenantUserService.getByOrgId(finSysTenant2.getId());
            List<FinSysTenantUser> finSysTenantUserList2 =
                this.finSysTenantUserService.getByOrgId(finSysTenant2.getId());
            if (!StringUtils.isEmptyList(finSysTenantUserList2)) {
                FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult();
                finSysTenantUserResult.setOrgId(finSysTenant2.getId());
@@ -602,7 +586,8 @@
            }
            // çœ
            FinSysTenant finSysTenant1 = this.finSysTenantService.get(new FinSysTenant(finSysTenant2.getParentId()));
            List<FinSysTenantUser> finSysTenantUserList = this.finSysTenantUserService.getByOrgId(finSysTenant1.getId());
            List<FinSysTenantUser> finSysTenantUserList =
                this.finSysTenantUserService.getByOrgId(finSysTenant1.getId());
            if (!StringUtils.isEmptyList(finSysTenantUserList)) {
                FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult();
                finSysTenantUserResult.setOrgId(finSysTenant1.getId());
@@ -616,8 +601,7 @@
    @ApiOperation(value = "获取父级机构", notes = "获取父级机构")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "token", dataType = "String", paramType = "header"),
    })
        @ApiImplicitParam(name = "Authorization", value = "token", dataType = "String", paramType = "header"),})
    @GetMapping("/get/parent/tenant")
    public ResponseValue getParentTenant() {
        FinSysTenantUser sysInfo = getSysInfo();
deploy-jar-single/src/main/resources/import/ÎïÆ·ÐÅÏ¢.xls
Binary files differ