futian.liu
2023-12-11 18877546c8e7fa36c537fe7f9cfc07e7ac6e7654
修改模板下载
1个文件已添加
3个文件已修改
156 ■■■■■ 已修改文件
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 152 ●●●●● 补丁 | 查看 | 原始文档 | 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 åŒºåˆ’
@@ -231,7 +234,7 @@
            while (var3.hasNext()) {
                Object obj = var3.next();
                node = this.toTreeNode((FinSysTenant) obj);
                node = this.toTreeNode((FinSysTenant)obj);
                if (node.getId() == this.defaultParentId) {
                    this.rootMap.put(node.getId(), node);
@@ -251,7 +254,7 @@
                    var3 = this.rootMap.values().iterator();
                    while (var3.hasNext()) {
                        TreeNode n = (TreeNode) var3.next();
                        TreeNode n = (TreeNode)var3.next();
                        n.setParentId(this.defaultParentId);
                        this.dummyRoot.addChild(n);
                    }
@@ -266,16 +269,16 @@
        Iterator i = childMap.values().iterator();
        while (i.hasNext()) {
            _node = (TreeNode) i.next();
            _node = (TreeNode)i.next();
            this.mountMiddleNode(_node, childMap);
        }
    }
    private void mountMiddleNode(TreeNode currentNode, Map<Long, TreeNode> childMap) {
        TreeNode _parentNode = (TreeNode) this.rootMap.get(currentNode.getParentId());
        TreeNode _parentNode = (TreeNode)this.rootMap.get(currentNode.getParentId());
        if (_parentNode == null) {
            _parentNode = (TreeNode) childMap.get(currentNode.getId());
            _parentNode = (TreeNode)childMap.get(currentNode.getId());
            if (_parentNode == null) {
                throw new NullPointerException("parent node not found, current: " + currentNode);
            }
@@ -290,7 +293,7 @@
    protected TreeNode toTreeNode(FinSysTenant entity) {
        TreeNode treeNode =
            new TreeNode(entity.getId(), entity.getName(), (List) null, entity.getParentId(), entity.getCode());
            new TreeNode(entity.getId(), entity.getName(), (List)null, entity.getParentId(), entity.getCode());
        return treeNode;
    }
@@ -302,7 +305,7 @@
            Iterator var2 = this.rootMap.values().iterator();
            while (var2.hasNext()) {
                TreeNode node = (TreeNode) var2.next();
                TreeNode node = (TreeNode)var2.next();
                list.add(node);
            }
            return list;
@@ -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(
@@ -488,15 +469,16 @@
            public void onException(Exception exception, AnalysisContext context) {
                // å¦‚果是某一个单元格的转换异常 èƒ½èŽ·å–åˆ°å…·ä½“è¡Œå·
                if (exception instanceof ExcelDataConvertException) {
                    ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
                    ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException)exception;
                    logger.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(),
                        excelDataConvertException.getColumnIndex() + 1, excelDataConvertException.getCellData().getStringValue());
                    throw new IllegalStateException(
                        "第" + (excelDataConvertException.getRowIndex() + 1) + "行,第" + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ "
                            + excelDataConvertException.getCellData().getStringValue() + " ]");
                        excelDataConvertException.getColumnIndex() + 1,
                        excelDataConvertException.getCellData().getStringValue());
                    throw new IllegalStateException("第" + (excelDataConvertException.getRowIndex() + 1) + "行,第"
                        + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ "
                        + excelDataConvertException.getCellData().getStringValue() + " ]");
                }
                if (exception instanceof IllegalStateException) {
                    throw (IllegalStateException) exception;
                    throw (IllegalStateException)exception;
                }
            }
@@ -527,10 +509,10 @@
        if (sysInfo == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        //        FinSysTenant finSysTenant1 = this.finSysTenantService.selectByTenantId(sysInfo.getTenantCode());
//        if (finSysTenant1.getLv() != 1) {
//            return ResponseValue.error("暂无修改权限");
//        }
        // FinSysTenant finSysTenant1 = this.finSysTenantService.selectByTenantId(sysInfo.getTenantCode());
        // if (finSysTenant1.getLv() != 1) {
        // return ResponseValue.error("暂无修改权限");
        // }
        int num = this.finSysTenantService.updateFinSysTenant(param, this.getSysInfo());
        return num > 0 ? ResponseValue.success(1) : ResponseValue.error("编辑失败!");
    }
@@ -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();
@@ -629,7 +613,7 @@
        finSysTenant.setTempId(Long.valueOf(tenantId));
        FinSysTenant userTenant = this.finSysTenantService.get(finSysTenant);
        Long parentId = userTenant.getParentId();
        //第一级
        // ç¬¬ä¸€çº§
        if (parentId == 0) {
            return ResponseValue.success(userTenant);
        } else {
deploy-jar-single/src/main/resources/import/ÎïÆ·ÐÅÏ¢.xls
Binary files differ