feat: 内部工作组相关变更
This commit is contained in:
+18
-16
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -12,7 +13,6 @@ import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.ImportExcelUtil;
|
||||
import com.jero.common.util.IntekeyUtils;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsWorkingGroupUser;
|
||||
import com.jero.modules.sys.entity.LawsWorkingGroupUserImport;
|
||||
import com.jero.modules.sys.service.ILawsWorkingGroupUserService;
|
||||
@@ -29,7 +29,6 @@ import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -61,7 +60,6 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@@ -156,7 +154,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
LawsWorkingGroupUser lawsWorkingGroupUser = lawsWorkingGroupUserService.getById(map.get("id"));
|
||||
if(Objects.isNull(lawsWorkingGroupUser)){
|
||||
if (Objects.isNull(lawsWorkingGroupUser)) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
// 校验是否有权限
|
||||
@@ -226,9 +224,9 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
all.add(lawsWorkingGroupUser);
|
||||
}
|
||||
//校验导入正确性,msg是错误信息
|
||||
List<String> msg = importExcelCheck(all,workingGroupId);
|
||||
List<String> msg = importExcelCheck(all, workingGroupId);
|
||||
if (!CollectionUtils.isEmpty(msg)) {
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR),msg);
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR), msg);
|
||||
}
|
||||
for (LawsWorkingGroupUser groupUser : all) {
|
||||
String username = groupUser.getUsername();
|
||||
@@ -249,21 +247,25 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperation(value = "内部工作组人员关联表-导出", notes = "内部工作组人员关联表-导出")
|
||||
@GetMapping(value = "/export")
|
||||
public ModelAndView template(@RequestParam(required = false) String workingGroupId, @RequestParam(required = false) String realname, @RequestParam(required = false) String username, @RequestParam(required = false) String userRoleName, @RequestParam(required = false) String userPostName, HttpServletRequest request) {
|
||||
return lawsWorkingGroupUserService.export(workingGroupId,realname,username,userRoleName,userPostName, request);
|
||||
public ModelAndView template(@RequestParam(required = false) String workingGroupId,
|
||||
@RequestParam(required = false) String realname,
|
||||
@RequestParam(required = false) String username,
|
||||
@RequestParam(required = false) String userRoleName,
|
||||
@RequestParam(required = false) String userPostName, HttpServletRequest request) {
|
||||
return lawsWorkingGroupUserService.export(workingGroupId, realname, username, userRoleName, userPostName, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据校验错误信息
|
||||
*/
|
||||
public List<String> importExcelCheck(List<LawsWorkingGroupUser> all,String workingGroupId) {
|
||||
return validateWorkNo(all,workingGroupId);
|
||||
public List<String> importExcelCheck(List<LawsWorkingGroupUser> all, String workingGroupId) {
|
||||
return validateWorkNo(all, workingGroupId);
|
||||
}
|
||||
|
||||
private List<String> validateWorkNo(List<LawsWorkingGroupUser> all,String workingGroupId) {
|
||||
private List<String> validateWorkNo(List<LawsWorkingGroupUser> all, String workingGroupId) {
|
||||
List<SysUser> listSysUser = sysUserService.list();
|
||||
LambdaQueryWrapper<LawsWorkingGroupUser> queryLawsWorkingGroupUser = new LambdaQueryWrapper<>();
|
||||
queryLawsWorkingGroupUser.eq(LawsWorkingGroupUser::getWorkingGroupId,workingGroupId);
|
||||
queryLawsWorkingGroupUser.eq(LawsWorkingGroupUser::getWorkingGroupId, workingGroupId);
|
||||
Set<String> existingWorkNos = lawsWorkingGroupUserService.list(queryLawsWorkingGroupUser).stream().map(LawsWorkingGroupUser::getUserId).collect(Collectors.toSet());
|
||||
return IntStream.range(0, all.size())
|
||||
.mapToObj(i -> {
|
||||
@@ -276,14 +278,14 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
if (StringUtils.isBlank(realname)) {
|
||||
return MessageUtils.getMessage(ResultCommon.THE_REAL_NAME_CANNOT_BE_EMPTY_EXPORT, (i + 2));
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(listSysUser)){
|
||||
if (!CollectionUtils.isEmpty(listSysUser)) {
|
||||
String finalUsername = username;
|
||||
Optional<SysUser> op = listSysUser.stream().filter(o->Objects.equals(o.getUsername(), finalUsername)).findFirst();
|
||||
if(!op.isPresent()){
|
||||
Optional<SysUser> op = listSysUser.stream().filter(o -> Objects.equals(o.getUsername(), finalUsername)).findFirst();
|
||||
if (!op.isPresent()) {
|
||||
return MessageUtils.getMessage(ResultCommon.JOB_NUMBER_DOES_NOT_EXIST_EXPORT, (i + 2));
|
||||
}
|
||||
username = op.get().getId();
|
||||
if(!Objects.equals(op.get().getRealname(),realname)){
|
||||
if (!Objects.equals(op.get().getRealname(), realname)) {
|
||||
return MessageUtils.getMessage(ResultCommon.THE_REAL_NAME_AND_JOB_NUMBER_MISMATCH_EXPORT, (i + 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.jero.modules.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 内部工作组人员关联表
|
||||
@@ -90,6 +90,10 @@ public class LawsWorkingGroupUser implements Serializable {
|
||||
@Excel(name = "岗位",width = 15)
|
||||
private String userPostName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "1领导 2成员")
|
||||
private String searchType;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "姓名工号通用查询字段")
|
||||
private String realnameOrUsername;
|
||||
|
||||
+11
-6
@@ -75,7 +75,7 @@ public class LawsWorkingGroupUserServiceImpl extends ServiceImpl<LawsWorkingGrou
|
||||
String userPostName = lawsWorkingGroupUser.getUserPostName();
|
||||
String workingGroupId = lawsWorkingGroupUser.getWorkingGroupId();
|
||||
|
||||
QueryWrapper<LawsWorkingGroupUser> wrapper = getWrapper(realname, userName, userRoleName, userPostName, workingGroupId);
|
||||
QueryWrapper<LawsWorkingGroupUser> wrapper = getWrapper(realname, userName, userRoleName, userPostName, workingGroupId, lawsWorkingGroupUser.getSearchType());
|
||||
if (StringUtils.isNotBlank(lawsWorkingGroupUser.getRealnameOrUsername())) {
|
||||
QueryWrapper<SysUser> userWrapper = new QueryWrapper<>();
|
||||
userWrapper.like("realname", lawsWorkingGroupUser.getRealnameOrUsername())
|
||||
@@ -91,13 +91,18 @@ public class LawsWorkingGroupUserServiceImpl extends ServiceImpl<LawsWorkingGrou
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private QueryWrapper<LawsWorkingGroupUser> getWrapper(String realname, String userName, String userRoleName, String userPostName, String workingGroupId) {
|
||||
List<String> workingGroupIds = getWorkingGroupIds(workingGroupId);
|
||||
private QueryWrapper<LawsWorkingGroupUser> getWrapper(String realname, String userName, String userRoleName, String userPostName, String workingGroupId, String searchType) {
|
||||
QueryWrapper<LawsWorkingGroupUser> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("user_id","max(working_group_id) as working_group_id","max(id) as id");
|
||||
if(!CollectionUtils.isEmpty(workingGroupIds)){
|
||||
wrapper.in("working_group_id", workingGroupIds);
|
||||
if (searchType == null || searchType.equals("2")) {
|
||||
List<String> workingGroupIds = getWorkingGroupIds(workingGroupId);
|
||||
if(!CollectionUtils.isEmpty(workingGroupIds)){
|
||||
wrapper.in("working_group_id", workingGroupIds);
|
||||
}
|
||||
} else {
|
||||
wrapper.eq("working_group_id", workingGroupId);
|
||||
}
|
||||
|
||||
if (!StringUtils.isAllBlank(realname, userName, userRoleName, userPostName)){
|
||||
List<String> ids = lawsWorkingGroupUserSearch(realname, userName, userRoleName, userPostName);
|
||||
if (CollectionUtils.isEmpty(ids)){
|
||||
@@ -204,7 +209,7 @@ public class LawsWorkingGroupUserServiceImpl extends ServiceImpl<LawsWorkingGrou
|
||||
//获取数据,分为三种情况:1、选中ID;2、没选ID且选了姓名、工号、角色、岗位四个筛选框;3、没选ID且没选四个筛选框
|
||||
List<LawsWorkingGroupUser> dos;
|
||||
|
||||
QueryWrapper<LawsWorkingGroupUser> wrapper = getWrapper(realname, userName, userRoleName, userPostName, workingGroupId);
|
||||
QueryWrapper<LawsWorkingGroupUser> wrapper = getWrapper(realname, userName, userRoleName, userPostName, workingGroupId, null);
|
||||
|
||||
//获取选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
|
||||
Reference in New Issue
Block a user