|
|
|
@ -20,6 +20,7 @@ import org.jeecg.common.aspect.annotation.PermissionData; |
|
|
|
|
import org.jeecg.common.config.TenantContext; |
|
|
|
|
import org.jeecg.common.constant.CommonConstant; |
|
|
|
|
import org.jeecg.common.constant.SymbolConstant; |
|
|
|
|
import org.jeecg.config.JeecgBaseConfig; |
|
|
|
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig; |
|
|
|
|
import org.jeecg.modules.base.service.BaseCommonService; |
|
|
|
|
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.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
@ -100,6 +102,8 @@ public class SysUserController { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ISysUserTenantService userTenantService; |
|
|
|
|
@Resource |
|
|
|
|
private JeecgBaseConfig jeecgBaseConfig; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取租户下用户数据(支持租户隔离) |
|
|
|
@ -514,7 +518,15 @@ public class SysUserController { |
|
|
|
|
String passwordEncode = PasswordUtil.encrypt(sysUserExcel.getUsername(), sysUserExcel.getPassword(), salt); |
|
|
|
|
sysUserExcel.setPassword(passwordEncode); |
|
|
|
|
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++; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
errorLines++; |
|
|
|
@ -1742,4 +1754,25 @@ public class SysUserController { |
|
|
|
|
sysUserService.editTenantUser(sysUser,tenantId,departs,roles); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|