提交修改
This commit is contained in:
parent
4757e4fe1c
commit
eec83608ce
@ -10,6 +10,11 @@ import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.service.RecordAuthService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
@ -26,10 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -42,7 +44,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("user/lzresultrecord")
|
||||
public class ResultRecordController {
|
||||
public class ResultRecordController extends AbstractController {
|
||||
@Autowired
|
||||
private ResultRecordService lzResultRecordService;
|
||||
@Autowired
|
||||
@ -59,13 +61,19 @@ public class ResultRecordController {
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
|
||||
@Autowired
|
||||
private RecordAuthService recordAuthService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@RequiresPermissions("user:lzresultrecord:list")
|
||||
public R list(ResultRecordReq req) {
|
||||
PageUtils page = lzResultRecordService.queryPage(req);
|
||||
SysUserEntity user = getUser();
|
||||
PageUtils page = lzResultRecordService.queryPage(req,user);
|
||||
List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId("0");
|
||||
return R.ok().put("page", page)
|
||||
.put("departmentList1", departmentList1);
|
||||
@ -81,19 +89,32 @@ public class ResultRecordController {
|
||||
@RequestMapping("/getStaffResultDetail")
|
||||
public R getStaffResultDetail(ResultRecordReq req) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
|
||||
StaffEntity staffEntity = staffService.getById(resultRecord.getStaffId());
|
||||
StaffEntity staffEntity = staffService.getById(resultRecord != null ? resultRecord.getStaffId() : getUserId());
|
||||
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectByStaffIds(Arrays.asList(staffEntity.getId()));
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateEntities.get(0);
|
||||
StaffDepartmentDto departmentDto = departmentsService.selectStaffAllDepartments(departmentsStaffRelateEntity.getDepartmentId());
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(req.getRecordResultId());
|
||||
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年MM月dd");
|
||||
List<ResultDetailResp> list = new ArrayList<>();
|
||||
|
||||
int firstRowspan = 0;
|
||||
int secondRowspan = 0;
|
||||
int threeRowspan = 0;
|
||||
int fourRowspan = 0;
|
||||
int fiveRowspan = 0;
|
||||
|
||||
// 获取权限
|
||||
List<RecordAuth> map = new ArrayList<>();
|
||||
Long authId = 0l;
|
||||
if(req.getType() == 1){ //目标新增
|
||||
map = recordAuthService.selectAuthInfo(7l);
|
||||
authId = 7l;
|
||||
}else if(req.getType() == 2){ //业绩编辑
|
||||
map = recordAuthService.selectAuthInfo(8l);
|
||||
authId = 8l;
|
||||
}
|
||||
|
||||
Auth auth = getAuth(map);
|
||||
if (!Collections.isEmpty(resultDetails)) {
|
||||
Map<Integer, Long> details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting()));
|
||||
int type1 = NumberUtil.objToIntDefault(details.get(new Integer(1)), 0);
|
||||
@ -103,7 +124,6 @@ public class ResultRecordController {
|
||||
threeRowspan = type1 + 1 + type2;
|
||||
fourRowspan = type1 + 1 + type2 + 1;
|
||||
fiveRowspan = type1 + 1 + type2 + 2;
|
||||
|
||||
int count = 0;
|
||||
for (ResultDetail resultDetail : resultDetails) {
|
||||
count++;
|
||||
@ -130,8 +150,43 @@ public class ResultRecordController {
|
||||
}
|
||||
list.add(resp);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
int type1 = 1;
|
||||
int type2 = 2;
|
||||
firstRowspan = type1;
|
||||
secondRowspan = type1 + 1;
|
||||
threeRowspan = type1 + 1 + type2;
|
||||
fourRowspan = type1 + 1 + type2 + 1;
|
||||
fiveRowspan = type1 + 1 + type2 + 2;
|
||||
|
||||
ResultDetailResp result = new ResultDetailResp();
|
||||
result.setCheckRange("业绩");
|
||||
result.setCheckWeight(new BigDecimal(0.7));
|
||||
result.setIsAdd(1);
|
||||
result.setIsEdit(1);
|
||||
list.add(result);
|
||||
|
||||
ResultDetailResp respHeader = new ResultDetailResp();
|
||||
respHeader.setKeyResult("业务考核结果");
|
||||
respHeader.setCheckWeight(new BigDecimal(0.7));
|
||||
respHeader.setSuperScore("/");
|
||||
respHeader.setAcquireScore(new BigDecimal(0));
|
||||
respHeader.setScoreComment("/");
|
||||
respHeader.setIsAdd(-1);
|
||||
list.add(respHeader);
|
||||
|
||||
ResultDetailResp wenhua1 = new ResultDetailResp();
|
||||
wenhua1.setCheckRange("文化价值观");
|
||||
wenhua1.setTarget("做人:相信、包容、担当");
|
||||
wenhua1.setCheckWeight(new BigDecimal(0.15));
|
||||
list.add(wenhua1);
|
||||
|
||||
ResultDetailResp wenhua2 = new ResultDetailResp();
|
||||
wenhua2.setCheckRange("文化价值观");
|
||||
wenhua2.setTarget("做人:相信、包容、担当");
|
||||
wenhua2.setCheckWeight(new BigDecimal(0.15));
|
||||
list.add(wenhua2);
|
||||
}
|
||||
ResultDetailResp tail1 = new ResultDetailResp();
|
||||
tail1.setKeyResult("文化价值观考核结果");
|
||||
tail1.setCheckWeight(new BigDecimal(0.3));
|
||||
@ -161,14 +216,38 @@ public class ResultRecordController {
|
||||
.put("department1", departmentDto.getDepartment1())
|
||||
.put("department2", departmentDto.getDepartment2())
|
||||
.put("department3", departmentDto.getDepartment3())
|
||||
.put("checkMonth", sdf3.format(resultRecord.getGmtCreate()))
|
||||
.put("checkMonth", sdf3.format(resultRecord == null ? new Date() : resultRecord.getGmtCreate()))
|
||||
.put("firstRowspan", firstRowspan)
|
||||
.put("secondRowspan", secondRowspan)
|
||||
.put("threeRowspan", threeRowspan)
|
||||
.put("fourRowspan", fourRowspan)
|
||||
.put("fiveRowspan", fiveRowspan)
|
||||
.put("list", list);
|
||||
.put("list", list)
|
||||
.put("auth",auth)
|
||||
.put("authId",authId);
|
||||
}
|
||||
|
||||
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(auths)) {
|
||||
map = auths.stream().collect(Collectors.toMap(RecordAuth::getIdentity, RecordAuth::getStatus));
|
||||
}
|
||||
Auth auth = new Auth();
|
||||
auth.setAdd(NumberUtil.objToIntDefault(map.get("add"),0));
|
||||
auth.setApprovel(NumberUtil.objToIntDefault(map.get("approvel"),0));
|
||||
auth.setCheckResult(NumberUtil.objToIntDefault(map.get("checkResult"),0));
|
||||
auth.setCheckWeight(NumberUtil.objToIntDefault(map.get("checkWeight"),0));
|
||||
auth.setCommit(NumberUtil.objToIntDefault(map.get("commit"),0));
|
||||
auth.setConfirmCommit(NumberUtil.objToIntDefault(map.get("confirmCommit"),0));
|
||||
auth.setKeyResult(NumberUtil.objToIntDefault(map.get("keyResult"),0));
|
||||
auth.setPriority(NumberUtil.objToIntDefault(map.get("priority"),0));
|
||||
auth.setReject(NumberUtil.objToIntDefault(map.get("reject"),0));
|
||||
auth.setScoreComment(NumberUtil.objToIntDefault(map.get("scoreComment"),0));
|
||||
auth.setSuperScore(NumberUtil.objToIntDefault(map.get("superScore"),0));
|
||||
auth.setTarget(NumberUtil.objToIntDefault(map.get("target"),0));
|
||||
auth.setEdit(NumberUtil.objToIntDefault(map.get("edit"),0));
|
||||
return auth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -100,10 +100,7 @@ public class StaffEntity implements Serializable {
|
||||
* 飞书用户的union_id
|
||||
*/
|
||||
private String unionId;
|
||||
/***
|
||||
* 是否为部门领导 0不是 1是
|
||||
*/
|
||||
private Integer isLeader;
|
||||
|
||||
/**
|
||||
* 头像url
|
||||
*/
|
||||
|
||||
@ -28,6 +28,6 @@ public class ResultRecordReq {
|
||||
private BigDecimal weight = new BigDecimal(0);
|
||||
private Integer type;
|
||||
private Long id = new Long (0);
|
||||
|
||||
|
||||
private Integer isSelf = 1;
|
||||
private Long staffId;
|
||||
}
|
||||
|
||||
@ -41,4 +41,6 @@ public class ResultDetailResp {
|
||||
private Integer priority;
|
||||
|
||||
private int isAdd;
|
||||
|
||||
private int isEdit;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateBo = new DepartmentsStaffRelateEntity();
|
||||
departmentsStaffRelateBo.setDepartmentId(departmentId);
|
||||
departmentsStaffRelateBo.setStaffId(staffId.getId());
|
||||
departmentsStaffRelateBo.setIsLeader(staffId.getIsLeader());
|
||||
departmentsStaffRelateBo.setIsLeader(departmentsStaffRelateBo.getIsLeader());
|
||||
departStaffRelateList.add(departmentsStaffRelateBo);
|
||||
} else if (!StringUtil.equals(departmentId, departId)) {
|
||||
departmentsStaffRelateDao.updateByStaffId(departmentId, staffId);
|
||||
|
||||
@ -340,7 +340,6 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
staffEntity.setOpenId(staffBo.getOpenId());
|
||||
staffEntity.setEmployeeId(staffBo.getEmployeeId());
|
||||
staffEntity.setUnionId(staffBo.getUnionId());
|
||||
staffEntity.setIsLeader(staffBo.getIsLeader());
|
||||
staffEntity.setAvatar(staffBo.getAvatar());
|
||||
staffEntity.setJobNumber(staffBo.getEmployeeNo());
|
||||
return staffEntity;
|
||||
|
||||
@ -11,6 +11,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface RecordAuthMapper extends BaseMapper<RecordAuth> {
|
||||
|
||||
@ -30,4 +34,5 @@ public interface RecordAuthMapper extends BaseMapper<RecordAuth> {
|
||||
int deleteRecordAuthById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<RecordAuth> selectAuthInfo(@Param("roleId") Long roleId);
|
||||
}
|
||||
@ -29,9 +29,9 @@ public class RecordAuth implements java.io.Serializable {
|
||||
//名称
|
||||
private String name;
|
||||
//
|
||||
private Long identity;
|
||||
private String identity;
|
||||
//0,不可见。1 可见,不可编辑。2 可编辑
|
||||
private String status;
|
||||
private Integer status;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -126,14 +126,14 @@ public class RecordAuth implements java.io.Serializable {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Long getIdentity() {
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param identity
|
||||
*/
|
||||
public void setIdentity(Long identity) {
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
@ -141,14 +141,14 @@ public class RecordAuth implements java.io.Serializable {
|
||||
* 0,不可见。1 可见,不可编辑。2 可编辑
|
||||
* @return
|
||||
*/
|
||||
public String getStatus() {
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 0,不可见。1 可见,不可编辑。2 可编辑
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
21
src/main/java/com/lz/modules/flow/model/Auth.java
Normal file
21
src/main/java/com/lz/modules/flow/model/Auth.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Auth {
|
||||
private int add;
|
||||
private int approvel;
|
||||
private int checkResult;
|
||||
private int checkWeight;
|
||||
private int commit;
|
||||
private int confirmCommit;
|
||||
private int edit;
|
||||
private int keyResult;
|
||||
private int priority;
|
||||
private int reject;
|
||||
private int scoreComment;
|
||||
private int superScore;
|
||||
private int target;
|
||||
|
||||
}
|
||||
@ -3,6 +3,9 @@ package com.lz.modules.flow.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 审批权限表 服务类
|
||||
@ -30,6 +33,5 @@ public interface RecordAuthService extends IService<RecordAuth> {
|
||||
int deleteRecordAuthById(Long id);
|
||||
|
||||
|
||||
|
||||
|
||||
List<RecordAuth> selectAuthInfo(Long roldId);
|
||||
}
|
||||
@ -7,6 +7,9 @@ import com.lz.modules.flow.service.RecordAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 审批权限表 服务类
|
||||
@ -51,17 +54,15 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
|
||||
return recordAuthMapper.updateCoverRecordAuthById(recordAuth);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteRecordAuthById(Long id){
|
||||
return recordAuthMapper.deleteRecordAuthById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<RecordAuth> selectAuthInfo(Long roleId) {
|
||||
return recordAuthMapper.selectAuthInfo(roleId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -177,12 +177,14 @@ public class SysLoginController extends AbstractController {
|
||||
if (user == null) {
|
||||
StaffEntity staffEntity = staffService.selectByPhone(form.getUserName());
|
||||
if(staffEntity != null){
|
||||
user = new SysUserEntity();
|
||||
user.setPassword(staffEntity.getPassword());
|
||||
user.setMobile(staffEntity.getMobile());
|
||||
user.setUserId(staffEntity.getId());
|
||||
user.setEmail(staffEntity.getEmail());
|
||||
user.setSalt(staffEntity.getSalt());
|
||||
user.setStatus(1);
|
||||
user.setType(1);
|
||||
user.setRealName(staffEntity.getName());
|
||||
user.setUserNo(staffEntity.getMobile());
|
||||
}else{
|
||||
|
||||
@ -42,7 +42,7 @@ public class SysMenuController extends AbstractController {
|
||||
*/
|
||||
@GetMapping("/nav")
|
||||
public R nav(){
|
||||
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
|
||||
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUser());
|
||||
Set<String> permissions = shiroService.getUserPermissions(getUser());
|
||||
return R.ok().put("menuList", menuList).put("permissions", permissions);
|
||||
}
|
||||
|
||||
@ -22,4 +22,5 @@ public interface SysUserTokenDao extends BaseMapper<SysUserTokenEntity> {
|
||||
|
||||
SysUserTokenEntity queryByToken(String token);
|
||||
|
||||
Long insertBySysUserTokenEntity(SysUserTokenEntity tokenEntity);
|
||||
}
|
||||
|
||||
@ -82,6 +82,7 @@ public class OAuth2Realm extends AuthorizingRealm {
|
||||
user.setEmail(staffEntity.getEmail());
|
||||
user.setSalt(staffEntity.getSalt());
|
||||
user.setStatus(1);
|
||||
user.setType(1);
|
||||
user.setRealName(staffEntity.getName());
|
||||
user.setUserNo(staffEntity.getMobile());
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.lz.modules.sys.service.app;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
|
||||
import java.util.List;
|
||||
@ -34,7 +35,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
int deleteResultRecordById(Long id);
|
||||
|
||||
PageUtils queryPage(ResultRecordReq params);
|
||||
PageUtils queryPage(ResultRecordReq params, SysUserEntity user);
|
||||
|
||||
|
||||
void deleteBatchIds(List<Long> asList);
|
||||
|
||||
@ -16,6 +16,7 @@ import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.ResultRecordResp;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -82,15 +83,13 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return resultRecordMapper.updateCoverResultRecordById(resultRecord);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteResultRecordById(Long id) {
|
||||
return resultRecordMapper.deleteResultRecordById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(ResultRecordReq params) {
|
||||
public PageUtils queryPage(ResultRecordReq params, SysUserEntity user) {
|
||||
List<Long> departmentStaffIds = new ArrayList<>();
|
||||
List<Long> staffIds = new ArrayList<>();
|
||||
List<String> departmentIds = new ArrayList<>();
|
||||
@ -124,7 +123,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
departmentStaffIds = new ArrayList<>(setStaffId);
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isNotBlank(params.getName())){
|
||||
List<StaffEntity> staffEntities = staffService.selectByName(params.getName());
|
||||
if(CollectionUtils.isNotEmpty(staffEntities)){
|
||||
@ -135,34 +133,39 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
params.setDepartmentStaffIds(departmentStaffIds);
|
||||
params.setStaffIds(staffIds);
|
||||
|
||||
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
|
||||
page -> resultRecordMapper.selectByCondition(page, params)
|
||||
);
|
||||
PageUtils pageUtils = null;
|
||||
if(params.getIsSelf() == 1 ){ // 我的业绩
|
||||
params.setStaffId(user.getUserId());
|
||||
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
|
||||
page -> resultRecordMapper.selectByCondition(page, params)
|
||||
);
|
||||
}else{ // 我们审批
|
||||
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
|
||||
page -> resultRecordMapper.selectByCondition(page, params)
|
||||
);
|
||||
}
|
||||
|
||||
List<ResultRecord> resultRecords = pageUtils.getList();
|
||||
List<ResultRecordResp> list = new ArrayList<>();
|
||||
|
||||
Set<Long> viewStaffIdSet = resultRecords.stream().map(p->p.getStaffId()).collect(Collectors.toSet());
|
||||
List<Long> viewStaffId = new ArrayList<>(viewStaffIdSet);
|
||||
|
||||
List<StaffEntity> staffEntities = staffService.selectByIds(viewStaffId);
|
||||
List<DepartmentsStaffRelateEntity> staffRelateEntities = departmentsStaffRelateDao.selectByStaffIds(viewStaffId);
|
||||
|
||||
Map<Long ,StaffEntity> staffEntityMap = staffEntities.stream().collect(Collectors.toMap(StaffEntity::getId, p -> p));
|
||||
Map<String, DepartmentsEntity> departmentsEntityMap = tDepartments.stream().collect(Collectors.toMap(p -> p.getDepartmentId(), p -> p));
|
||||
|
||||
Map<Long, DepartmentsStaffRelateEntity> staffRelateEntityMap = staffRelateEntities.stream().collect(Collectors.toMap(p -> p.getStaffId(), p -> p));
|
||||
|
||||
for (ResultRecord resultRecord : resultRecords) {
|
||||
ResultRecordResp resp = new ResultRecordResp();
|
||||
BeanUtils.copyProperties(resultRecord, resp);
|
||||
resp.setStaffName(staffEntityMap.get(resp.getStaffId()) != null ? staffEntityMap.get(resp.getStaffId()).getName() : "");
|
||||
DepartmentsStaffRelateEntity relate = staffRelateEntityMap.get(resp.getStaffId());
|
||||
resp.setDepartmentName(relate != null && departmentsEntityMap.get(relate.getDepartmentId()) != null ?
|
||||
departmentsEntityMap.get(relate.getDepartmentId()).getDepartmentName() : "");
|
||||
list.add(resp);
|
||||
if(CollectionUtils.isNotEmpty(resultRecords)){
|
||||
List<ResultRecordResp> list = new ArrayList<>();
|
||||
Set<Long> viewStaffIdSet = resultRecords.stream().map(p->p.getStaffId()).collect(Collectors.toSet());
|
||||
List<Long> viewStaffId = new ArrayList<>(viewStaffIdSet);
|
||||
List<StaffEntity> staffEntities = staffService.selectByIds(viewStaffId);
|
||||
List<DepartmentsStaffRelateEntity> staffRelateEntities = departmentsStaffRelateDao.selectByStaffIds(viewStaffId);
|
||||
Map<Long ,StaffEntity> staffEntityMap = staffEntities.stream().collect(Collectors.toMap(StaffEntity::getId, p -> p));
|
||||
Map<String, DepartmentsEntity> departmentsEntityMap = tDepartments.stream().collect(Collectors.toMap(p -> p.getDepartmentId(), p -> p));
|
||||
Map<Long, DepartmentsStaffRelateEntity> staffRelateEntityMap = staffRelateEntities.stream().collect(Collectors.toMap(p -> p.getStaffId(), p -> p));
|
||||
for (ResultRecord resultRecord : resultRecords) {
|
||||
ResultRecordResp resp = new ResultRecordResp();
|
||||
BeanUtils.copyProperties(resultRecord, resp);
|
||||
resp.setStaffName(staffEntityMap.get(resp.getStaffId()) != null ? staffEntityMap.get(resp.getStaffId()).getName() : "");
|
||||
DepartmentsStaffRelateEntity relate = staffRelateEntityMap.get(resp.getStaffId());
|
||||
resp.setDepartmentName(relate != null && departmentsEntityMap.get(relate.getDepartmentId()) != null ?
|
||||
departmentsEntityMap.get(relate.getDepartmentId()).getDepartmentName() : "");
|
||||
list.add(resp);
|
||||
}
|
||||
pageUtils.setList(list);
|
||||
}
|
||||
pageUtils.setList(list);
|
||||
return pageUtils;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
public Set<String> getUserPermissions(SysUserEntity user) {
|
||||
List<String> permsList = null;
|
||||
//系统管理员,拥有最高权限
|
||||
if(user.getUserId() == Constant.SUPER_ADMIN || user.getType() == 2){
|
||||
if(user.getUserId() == Constant.SUPER_ADMIN || user.getType() == 1){
|
||||
List<SysMenuEntity> menuList = sysMenuDao.selectList(null);
|
||||
permsList = new ArrayList<>(menuList.size());
|
||||
for(SysMenuEntity menu : menuList){
|
||||
|
||||
@ -15,6 +15,7 @@ import com.lz.modules.sys.oauth2.TokenGenerator;
|
||||
import com.lz.modules.sys.service.SysUserTokenService;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.sys.dao.SysUserTokenDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
@ -25,6 +26,9 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
|
||||
//12小时后过期
|
||||
private final static int EXPIRE = 3600 * 12;
|
||||
|
||||
@Autowired
|
||||
private SysUserTokenDao sysUserTokenDao;
|
||||
|
||||
|
||||
@Override
|
||||
public R createToken(SysUserEntity user ) {
|
||||
@ -45,9 +49,8 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
|
||||
tokenEntity.setUpdateTime(now);
|
||||
tokenEntity.setExpireTime(expireTime);
|
||||
tokenEntity.setType(user.getType());
|
||||
|
||||
//保存token
|
||||
this.save(tokenEntity);
|
||||
sysUserTokenDao.insertBySysUserTokenEntity(tokenEntity);
|
||||
}else{
|
||||
tokenEntity.setToken(token);
|
||||
tokenEntity.setUpdateTime(now);
|
||||
|
||||
@ -84,5 +84,14 @@
|
||||
update lz_record_auth set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<select id="selectAuthInfo" resultType="RecordAuth">
|
||||
select * from (
|
||||
select identity ,status from lz_record_role_auth role_auth left join lz_record_auth auth on role_auth.auth_id = auth.id
|
||||
where role_auth.role_id = #{roleId} ORDER BY status desc ) a GROUP BY identity
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
and sr.role_name like concat('%',#{roleName},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="queryMenuIdListByRoleId" resultType="java.lang.Long">
|
||||
select distinct rm.menu_id from sys_user_role ur
|
||||
LEFT JOIN sys_role_menu rm on ur.role_id = rm.role_id
|
||||
|
||||
@ -3,7 +3,25 @@
|
||||
|
||||
<mapper namespace="com.lz.modules.sys.dao.SysUserTokenDao">
|
||||
|
||||
<select id="queryByToken" resultType="com.lz.modules.sys.entity.SysUserTokenEntity">
|
||||
|
||||
<insert id="insertBySysUserTokenEntity" parameterType="SysUserTokenEntity" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_user_token(
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="token != null">token,</if>
|
||||
<if test="expireTime != null">expire_time,</if>
|
||||
<if test="type != null">type,</if>
|
||||
update_time
|
||||
)values(
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="token != null">#{token},</if>
|
||||
<if test="expireTime != null">#{expireTime},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="queryByToken" resultType="com.lz.modules.sys.entity.SysUserTokenEntity">
|
||||
select * from sys_user_token where token = #{value}
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user