| | |
| | | // 省进入 查询 省和地市 ;地市进入 查询自己地市 |
| | | // TODO Long.valueOf(getSysInfo().getTenantId()) |
| | | FinSysTenant finSysTenant = |
| | | this.finSysTenantService.get(new FinSysTenant(Long.valueOf(getSysInfo().getTenantId()))); |
| | | this.finSysTenantService.get(new FinSysTenant(Long.valueOf(getSysInfo().getTenantId()))); |
| | | if (finSysTenant.getLv() == 3) { |
| | | return ResponseValue.error("县区级别无法查看"); |
| | | } |
| | | List<FinSysTenant> finSysTenantList = |
| | | this.finSysTenantService.queryTreeById(finSysTenant.getId(), finSysTenant.getLv()); |
| | | this.finSysTenantService.queryTreeById(finSysTenant.getId(), finSysTenant.getLv()); |
| | | List<TreeNode> treeNodeList = new ArrayList<>(); |
| | | // 省查本身及以下 市查本级 县无权查看 |
| | | if (finSysTenant.getLv() == 1) { |
| | |
| | | } |
| | | } else { |
| | | TreeNode treeNode = new TreeNode(finSysTenantList.get(0).getId(), finSysTenantList.get(0).getName(), |
| | | new ArrayList<>(), finSysTenantList.get(0).getParentId(), finSysTenantList.get(0).getCode()); |
| | | new ArrayList<>(), finSysTenantList.get(0).getParentId(), finSysTenantList.get(0).getCode()); |
| | | treeNodeList.add(treeNode); |
| | | } |
| | | return ResponseValue.success(treeNodeList); |
| | |
| | | // 省进入 查询 省和地市 ;地市进入 查询自己地市 |
| | | // TODO Long.valueOf(getSysInfo().getTenantId()) |
| | | FinSysTenant finSysTenant = |
| | | this.finSysTenantService.get(new FinSysTenant(Long.valueOf(getSysInfo().getTenantId()))); |
| | | this.finSysTenantService.get(new FinSysTenant(Long.valueOf(getSysInfo().getTenantId()))); |
| | | if (finSysTenant.getLv() == 3) { |
| | | return ResponseValue.error("县区级别无法查看"); |
| | | } |
| | | Map<Long, List<FinSysTenant>> finSysTenantList = |
| | | this.finSysTenantService.queryCountyByCityCode(finSysTenant.getId(), finSysTenant.getLv()); |
| | | this.finSysTenantService.queryCountyByCityCode(finSysTenant.getId(), finSysTenant.getLv()); |
| | | return ResponseValue.success(finSysTenantList); |
| | | } |
| | | |
| | |
| | | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | Iterator var2 = this.rootMap.values().iterator(); |
| | | |
| | | while (var2.hasNext()) { |
| | | TreeNode node = (TreeNode)var2.next(); |
| | | TreeNode node = (TreeNode) var2.next(); |
| | | list.add(node); |
| | | } |
| | | return list; |
| | |
| | | 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"); |
| | | "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(")"); |
| | |
| | | fileName = "物品信息.xls"; |
| | | } else if ("procure".equals(type)) { |
| | | fileName = "采购导入.xls"; |
| | | } else if ("distribute".equals(type)) { |
| | | fileName = "分发导入.xls"; |
| | | } else if ("classification".equals(type)) { |
| | | fileName = "物品分类.xls"; |
| | | } |
| | | Resource resource = new ClassPathResource("import/" + fileName); |
| | | // 获取文件输入流 |
| | |
| | | } |
| | | |
| | | EasyExcelFactory |
| | | .read(file.getInputStream(), ImportTenantTemplate.class, new AnalysisEventListener<ImportTenantTemplate>() { |
| | | LinkedList<FinSysTenantParam> finSysTenantParams = new LinkedList<>(); |
| | | .read(file.getInputStream(), ImportTenantTemplate.class, new AnalysisEventListener<ImportTenantTemplate>() { |
| | | LinkedList<FinSysTenantParam> finSysTenantParams = new LinkedList<>(); |
| | | |
| | | @Override |
| | | public void invoke(ImportTenantTemplate finSysTenantParam, AnalysisContext analysisContext) { |
| | | String code = finSysTenantParam.getCode(); |
| | | String tenantName = finSysTenantParam.getTenantName(); |
| | | ReadSheetHolder readSheetHolder = analysisContext.readSheetHolder(); |
| | | Integer rowIndex = readSheetHolder.getRowIndex() + 1; |
| | | if (StringUtils.isEmpty(code) || code.length() > 20) { |
| | | IllegalStateException exception = |
| | | new IllegalStateException("第" + rowIndex + "行,机构编号不能为空或长度大于20"); |
| | | throw exception; |
| | | } |
| | | if (null != finSysTenantService.queryOneByCode(code)) { |
| | | throw new IllegalStateException("第" + rowIndex + "行,机构编号已存在"); |
| | | } |
| | | if (StringUtils.isEmpty(tenantName) || tenantName.length() > 100) { |
| | | IllegalStateException exception = |
| | | new IllegalStateException("第" + rowIndex + "行,机构名称不能为空或长度大于100"); |
| | | throw exception; |
| | | } |
| | | FinSysTenantParam tenantParam = new FinSysTenantParam(); |
| | | tenantParam.setParentId(pid); |
| | | tenantParam.setStatus(1); |
| | | tenantParam.setSummary("系统导入"); |
| | | tenantParam.setCode(code); |
| | | tenantParam.setName(tenantName); |
| | | finSysTenantParams.add(tenantParam); |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | finSysTenantService.insertFinSysTenantBatch(finSysTenantParams, sysInfo, lv); |
| | | } |
| | | |
| | | @Override |
| | | public void onException(Exception exception, AnalysisContext context) { |
| | | // 如果是某一个单元格的转换异常 能获取到具体行号 |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException)exception; |
| | | Integer rowIndex = excelDataConvertException.getRowIndex() + 1; |
| | | Integer columnIndex = excelDataConvertException.getColumnIndex(); |
| | | String stringValue = excelDataConvertException.getCellData().getStringValue(); |
| | | logger.error("第{}行,第{}列解析异常,数据为:{}", rowIndex, columnIndex, stringValue); |
| | | throw new IllegalStateException( |
| | | "第" + rowIndex + "行,第" + columnIndex + "列解析异常,异常数据为:[ " + stringValue + " ]"); |
| | | } |
| | | if (exception instanceof IllegalStateException) { |
| | | throw (IllegalStateException)exception; |
| | | @Override |
| | | public void invoke(ImportTenantTemplate finSysTenantParam, AnalysisContext analysisContext) { |
| | | String code = finSysTenantParam.getCode(); |
| | | String tenantName = finSysTenantParam.getTenantName(); |
| | | ReadSheetHolder readSheetHolder = analysisContext.readSheetHolder(); |
| | | Integer rowIndex = readSheetHolder.getRowIndex() + 1; |
| | | if (StringUtils.isEmpty(code) || code.length() > 20) { |
| | | IllegalStateException exception = |
| | | new IllegalStateException("第" + rowIndex + "行,机构编号不能为空或长度大于20"); |
| | | throw exception; |
| | | } |
| | | if (null != finSysTenantService.queryOneByCode(code)) { |
| | | throw new IllegalStateException("第" + rowIndex + "行,机构编号已存在"); |
| | | } |
| | | if (StringUtils.isEmpty(tenantName) || tenantName.length() > 100) { |
| | | IllegalStateException exception = |
| | | new IllegalStateException("第" + rowIndex + "行,机构名称不能为空或长度大于100"); |
| | | throw exception; |
| | | } |
| | | FinSysTenantParam tenantParam = new FinSysTenantParam(); |
| | | tenantParam.setParentId(pid); |
| | | tenantParam.setStatus(1); |
| | | tenantParam.setSummary("系统导入"); |
| | | tenantParam.setCode(code); |
| | | tenantParam.setName(tenantName); |
| | | finSysTenantParams.add(tenantParam); |
| | | } |
| | | |
| | | } |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | finSysTenantService.insertFinSysTenantBatch(finSysTenantParams, sysInfo, lv); |
| | | } |
| | | |
| | | }).doReadAll(); |
| | | @Override |
| | | public void onException(Exception exception, AnalysisContext context) { |
| | | // 如果是某一个单元格的转换异常 能获取到具体行号 |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; |
| | | Integer rowIndex = excelDataConvertException.getRowIndex() + 1; |
| | | Integer columnIndex = excelDataConvertException.getColumnIndex(); |
| | | String stringValue = excelDataConvertException.getCellData().getStringValue(); |
| | | logger.error("第{}行,第{}列解析异常,数据为:{}", rowIndex, columnIndex, stringValue); |
| | | throw new IllegalStateException( |
| | | "第" + rowIndex + "行,第" + columnIndex + "列解析异常,异常数据为:[ " + stringValue + " ]"); |
| | | } |
| | | if (exception instanceof IllegalStateException) { |
| | | throw (IllegalStateException) exception; |
| | | } |
| | | |
| | | } |
| | | |
| | | }).doReadAll(); |
| | | |
| | | return ResponseValue.success("导入成功!", 1); |
| | | } |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | |
| | | |
| | | int num = this.finSysTenantService.updateFinSysTenant(param, this.getSysInfo()); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("编辑失败!"); |
| | | } |
| | |
| | | // 省 |
| | | FinSysTenant finSysTenant1 = this.finSysTenantService.get(new FinSysTenant(finSysTenant.getParentId())); |
| | | List<FinSysTenantUser> finSysTenantUserList = |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant1.getId()); |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant1.getId()); |
| | | if (!StringUtils.isEmptyList(finSysTenantUserList)) { |
| | | FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult(); |
| | | finSysTenantUserResult.setOrgId(finSysTenant1.getId()); |
| | |
| | | // 市 |
| | | FinSysTenant finSysTenant2 = this.finSysTenantService.get(new FinSysTenant(finSysTenant.getParentId())); |
| | | List<FinSysTenantUser> finSysTenantUserList2 = |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant2.getId()); |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant2.getId()); |
| | | if (!StringUtils.isEmptyList(finSysTenantUserList2)) { |
| | | FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult(); |
| | | finSysTenantUserResult.setOrgId(finSysTenant2.getId()); |
| | |
| | | // 省 |
| | | FinSysTenant finSysTenant1 = this.finSysTenantService.get(new FinSysTenant(finSysTenant2.getParentId())); |
| | | List<FinSysTenantUser> finSysTenantUserList = |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant1.getId()); |
| | | this.finSysTenantUserService.getByOrgId(finSysTenant1.getId()); |
| | | if (!StringUtils.isEmptyList(finSysTenantUserList)) { |
| | | FinSysTenantUserResult finSysTenantUserResult = new FinSysTenantUserResult(); |
| | | finSysTenantUserResult.setOrgId(finSysTenant1.getId()); |
| | |
| | | |
| | | @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(); |