main
王家东 1 year ago
parent b0a71386cf
commit 93d8526049
  1. 35
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  2. 10
      jeecgboot-vue3-master/src/views/system/user/index.vue
  3. 3
      jeecgboot-vue3-master/src/views/system/user/user.api.js
  4. 3
      jeecgboot-vue3-master/src/views/system/user/user.api.ts

@ -20,6 +20,7 @@ import org.jeecg.common.aspect.annotation.PermissionData;
import org.jeecg.common.config.TenantContext; import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig; import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
@ -46,6 +47,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@ -100,6 +102,8 @@ public class SysUserController {
@Autowired @Autowired
private ISysUserTenantService userTenantService; private ISysUserTenantService userTenantService;
@Resource
private JeecgBaseConfig jeecgBaseConfig;
/** /**
* 获取租户下用户数据支持租户隔离 * 获取租户下用户数据支持租户隔离
@ -514,7 +518,15 @@ public class SysUserController {
String passwordEncode = PasswordUtil.encrypt(sysUserExcel.getUsername(), sysUserExcel.getPassword(), salt); String passwordEncode = PasswordUtil.encrypt(sysUserExcel.getUsername(), sysUserExcel.getPassword(), salt);
sysUserExcel.setPassword(passwordEncode); sysUserExcel.setPassword(passwordEncode);
try { try {
sysUserService.save(sysUserExcel); if (sysUserExcel.getUsername()=="" || sysUserExcel.getUsername().isEmpty() || sysUserExcel.getUsername()==null) {
}else {
if (sysUserExcel.getJuese().equals("学生")) {
sysUserExcel.setDelFlag(0);
sysUserService.save(sysUserExcel);
} else {
errorMessage.add("第 " + i + 1 + " 行:目前仅允许导入学生身份的用户,其他身份请手动导入");
}
}
successLines++; successLines++;
} catch (Exception e) { } catch (Exception e) {
errorLines++; errorLines++;
@ -1742,4 +1754,25 @@ public class SysUserController {
sysUserService.editTenantUser(sysUser,tenantId,departs,roles); sysUserService.editTenantUser(sysUser,tenantId,departs,roles);
return Result.ok("修改成功"); return Result.ok("修改成功");
} }
@RequestMapping(value = "/exportXlsMb")
public ModelAndView exportXlsMb(HttpServletRequest request, SysUser awardPersion) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// Step.2 获取导出数据
List<SysUser> exportList = new ArrayList<>();
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, "学生导入模板");
mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams("学生导入模板", "用户名和学号均为学号" , "学生导入模板");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
} }

@ -8,6 +8,7 @@
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreateZJ"> 新增专家</a-button> <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreateZJ"> 新增专家</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls" >导入</j-upload-button> <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls" >导入</j-upload-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsMb"> 导出模板</a-button>
<a-button type="primary" @click="handleSyncUser" preIcon="ant-design:sync-outlined"> 同步流程</a-button> <a-button type="primary" @click="handleSyncUser" preIcon="ant-design:sync-outlined"> 同步流程</a-button>
<a-button type="primary" @click="openModal(true, {})" preIcon="ant-design:hdd-outlined"> 回收站</a-button> <a-button type="primary" @click="openModal(true, {})" preIcon="ant-design:hdd-outlined"> 回收站</a-button>
<JThirdAppButton biz-type="user" :selected-row-keys="selectedRowKeys" syncToApp syncToLocal @sync-finally="onSyncFinally" /> <JThirdAppButton biz-type="user" :selected-row-keys="selectedRowKeys" syncToApp syncToLocal @sync-finally="onSyncFinally" />
@ -73,7 +74,7 @@
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { columns, searchFormSchema } from './user.data'; import { columns, searchFormSchema } from './user.data';
import { listNoCareTenant, deleteUser, batchDeleteUser, getImportUrl, getExportUrl, frozenBatch, syncUser,queryByUserId } from './user.api'; import { listNoCareTenant, deleteUser, batchDeleteUser, getImportUrl, getExportUrl, frozenBatch, syncUser,queryByUserId,getExportUrlMb } from './user.api';
import {usePermission} from "/@/hooks/web/usePermission"; import {usePermission} from "/@/hooks/web/usePermission";
import {defHttp} from "../../../utils/http/axios"; import {defHttp} from "../../../utils/http/axios";
@ -94,7 +95,7 @@
const [registerQuitModal, { openModal: openQuitModal }] = useModal(); const [registerQuitModal, { openModal: openQuitModal }] = useModal();
// //
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls,onExportXlsMb } = useListPage({
designScope: 'user-list', designScope: 'user-list',
tableProps: { tableProps: {
title: '用户列表', title: '用户列表',
@ -116,6 +117,11 @@
name: '用户列表', name: '用户列表',
url: getExportUrl, url: getExportUrl,
}, },
exportConfigMb: {
name: "导出模板",
url: getExportUrlMb,
params: null,
},
importConfig: { importConfig: {
url: getImportUrl, url: getImportUrl,
}, },

@ -17,6 +17,7 @@ var Api;
Api["deleteBatch"] = "/sys/user/deleteBatch"; Api["deleteBatch"] = "/sys/user/deleteBatch";
Api["importExcel"] = "/sys/user/importExcel"; Api["importExcel"] = "/sys/user/importExcel";
Api["exportXls"] = "/sys/user/exportXls"; Api["exportXls"] = "/sys/user/exportXls";
Api["exportXlsMb"] = "/sys/user/exportXlsMb";
Api["recycleBinList"] = "/sys/user/recycleBin"; Api["recycleBinList"] = "/sys/user/recycleBin";
Api["putRecycleBin"] = "/sys/user/putRecycleBin"; Api["putRecycleBin"] = "/sys/user/putRecycleBin";
Api["deleteRecycleBin"] = "/sys/user/deleteRecycleBin"; Api["deleteRecycleBin"] = "/sys/user/deleteRecycleBin";
@ -45,6 +46,8 @@ export const getExportUrl = Api.exportXls;
* 导入api * 导入api
*/ */
export const getImportUrl = Api.importExcel; export const getImportUrl = Api.importExcel;
export const getExportUrlMb = Api.exportXlsMb;
/** /**
* 根据userid判断是否为专家 * 根据userid判断是否为专家
* @param params * @param params

@ -34,6 +34,7 @@ enum Api {
putCancelQuit = '/sys/user/putCancelQuit', putCancelQuit = '/sys/user/putCancelQuit',
updateUserTenantStatus='/sys/tenant/updateUserTenantStatus', updateUserTenantStatus='/sys/tenant/updateUserTenantStatus',
getUserTenantPageList='/sys/tenant/getUserTenantPageList', getUserTenantPageList='/sys/tenant/getUserTenantPageList',
exportXlsMb = '/sys/user/exportXlsMb',
queryByUserId = '/expert/expert/queryByUserId', queryByUserId = '/expert/expert/queryByUserId',
} }
/** /**
@ -48,6 +49,8 @@ export const queryByUserId = (params) => {
* @param params * @param params
*/ */
export const getExportUrl = Api.exportXls; export const getExportUrl = Api.exportXls;
export const getExportUrlMb = Api.exportXlsMb;
/** /**
* api * api
*/ */

Loading…
Cancel
Save