Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
6c603fa7be
@ -144,6 +144,19 @@ public class StringUtil extends StringUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static List<Long> splitToLongList(String source, String sep) {
|
||||
List<Long> result = new ArrayList<Long>();
|
||||
if (isBlank(source)) {
|
||||
return result;
|
||||
}
|
||||
String[] tempResult = source.split(sep);
|
||||
for (String item : tempResult) {
|
||||
result.add(NumberUtil.objToLongDefault(item,0));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source 待处理字符串
|
||||
* @return
|
||||
|
||||
@ -117,16 +117,6 @@ public class ReportResultController extends AbstractController{
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/own/result")
|
||||
public R ownResult(Long userId){
|
||||
if(userId == null){
|
||||
//如果id为空,查询自己信息
|
||||
userId = getUserId();
|
||||
}
|
||||
List<OwnResultResp> ownResultResp = resultRecordService.ownResult(userId, ResultRecordStatusEnum.AGREE.getStatus());
|
||||
return R.ok().put("data",ownResultResp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -267,6 +267,13 @@ public class TestController {
|
||||
R r = resultRecordService.initFlowRecord(resultRecordId);
|
||||
}
|
||||
|
||||
// http://localhost:8080/lz_management/test/getAuth?userId=314
|
||||
@RequestMapping("/test/getAuth")
|
||||
public R getAuth(Long userId) throws Exception{
|
||||
Map<String,Integer> map = staffRoleService.getRoleByUserId(userId);
|
||||
return R.ok().put("data",map);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String a = "{\"313\":[17,20,13]}";
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.lz.modules.app.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -10,9 +12,12 @@ import java.math.BigDecimal;
|
||||
* @Date: 2020/9/14 10:07
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("个人成长曲线实体")
|
||||
public class OwnResultResp {
|
||||
//月份
|
||||
private String monthTime;
|
||||
//绩效
|
||||
@ApiModelProperty("绩效类型")
|
||||
private String name;
|
||||
//最后得分
|
||||
@ApiModelProperty("最后得分")
|
||||
private BigDecimal lastScore;
|
||||
}
|
||||
|
||||
@ -40,4 +40,6 @@ public interface RecordAuthMapper extends BaseMapper<RecordAuth> {
|
||||
List<RecordAuth> selectAll();
|
||||
|
||||
List<AuthDto> selectAuthByRoleIds(@Param("roleIds") List<Long> roleIds);
|
||||
|
||||
List<AuthDto> selectAuthByIds(@Param("authIds") List<Long> authIds);
|
||||
}
|
||||
@ -9,6 +9,8 @@ package com.lz.modules.flow.dao;
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.lz.modules.flow.entity.AuthDto;
|
||||
import com.lz.modules.flow.entity.StaffMenu;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -52,4 +54,8 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
|
||||
List<StaffRole> selectPageByRoleLevel(@Param("page") IPage page, @Param("name") String name);
|
||||
|
||||
StaffRole selectStaffRolesByStaffIdDepartmentLevel(@Param("staffId") Long staffId, @Param("departmentLevel") String departmentLevel);
|
||||
|
||||
List<StaffRole> selectAllByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<StaffMenu> selectAllMenus(@Param("userId") Long userId);
|
||||
}
|
||||
@ -42,7 +42,7 @@ public class StaffMenu implements java.io.Serializable {
|
||||
private Long parentId;
|
||||
//授权 id
|
||||
@ApiModelProperty(value = "授权 id", name = "authIds")
|
||||
private Long authIds;
|
||||
private String authIds;
|
||||
@TableField(exist=false)
|
||||
private List<StaffMenu> childs;
|
||||
/**
|
||||
@ -139,14 +139,14 @@ public class StaffMenu implements java.io.Serializable {
|
||||
* 授权 id
|
||||
* @return
|
||||
*/
|
||||
public Long getAuthIds() {
|
||||
public String getAuthIds() {
|
||||
return authIds;
|
||||
}
|
||||
/**
|
||||
* 授权 id
|
||||
* @param authIds
|
||||
*/
|
||||
public void setAuthIds(Long authIds) {
|
||||
public void setAuthIds(String authIds) {
|
||||
this.authIds = authIds;
|
||||
}
|
||||
|
||||
|
||||
@ -47,4 +47,6 @@ public interface RecordAuthService extends IService<RecordAuth> {
|
||||
Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId);
|
||||
|
||||
Map<String, Integer> selectAuthByRoleIds(List<Long> roleIds);
|
||||
|
||||
Map<String, Integer> selectAuthByIds(List<Long> authIds);
|
||||
}
|
||||
@ -61,4 +61,8 @@ public interface StaffRoleService extends IService<StaffRole> {
|
||||
R roleAddOrUpdate(RoleModel roleModel);
|
||||
|
||||
R delete(RoleModel roleModel);
|
||||
|
||||
List<StaffRole> selectAllByStaffId(Long userId);
|
||||
|
||||
Map<String, Integer> getRoleByUserId(Long userId);
|
||||
}
|
||||
@ -129,8 +129,20 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> selectAuthByIds(List<Long> authIds) {
|
||||
Map<String,Integer> map = new HashMap<>();
|
||||
List<AuthDto> list = recordAuthMapper.selectAuthByIds(authIds);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
for(AuthDto authDto:list){
|
||||
map.put(authDto.getIdentity(),authDto.getStatus());
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(auths)) {
|
||||
for(RecordAuth recordAuth : auths){
|
||||
|
||||
@ -32,6 +32,7 @@ import com.lz.modules.sys.entity.SysMenuEntity;
|
||||
import com.lz.modules.sys.entity.SysRoleEntity;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -90,13 +91,16 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private StaffMenuService staffMenuService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
|
||||
@Autowired
|
||||
private RecordAuthService recordAuthService;
|
||||
|
||||
|
||||
@Override
|
||||
public StaffRole selectStaffRoleById(Long id) {
|
||||
return staffRoleMapper.selectStaffRoleById(id);
|
||||
@ -328,7 +332,7 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
List<String> deparmentNames = new ArrayList<>();
|
||||
if (staffRole.getDepartmentId().equals(new Long(2))) {
|
||||
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
|
||||
for(StaffRoleDepartment staffRoleDepartment:staffRoleDepartments){
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(staffRoleDepartment.getDepartmentId());
|
||||
deparmentNames.add(departmentsEntity.getDepartmentName());
|
||||
}
|
||||
@ -360,8 +364,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
|
||||
@Override
|
||||
public R selectRoleDetail(RoleModel roleModel) {
|
||||
StaffRole staffRole= staffRoleMapper.selectById(roleModel.getId());
|
||||
if(staffRole == null ){
|
||||
StaffRole staffRole = staffRoleMapper.selectById(roleModel.getId());
|
||||
if (staffRole == null) {
|
||||
staffRole = new StaffRole();
|
||||
}
|
||||
StaffRoleDetailInfo info = new StaffRoleDetailInfo();
|
||||
@ -407,8 +411,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
return R.ok("更新成功");
|
||||
}
|
||||
} else if (roleModel.getStaffId() != null) { // 员工不为空
|
||||
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(),roleModel.getDepartmentLevel());
|
||||
if(data !=null ){
|
||||
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
|
||||
if (data != null) {
|
||||
return R.error("该管理员己经存在");
|
||||
}
|
||||
staffRole = new StaffRole();
|
||||
@ -458,6 +462,43 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffRole> selectAllByStaffId(Long staffId) {
|
||||
|
||||
return staffRoleMapper.selectAllByStaffId(staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getRoleByUserId(Long userId) {
|
||||
Map<String ,Integer> map = new HashMap<>();
|
||||
List<StaffRole> staffRoleList = staffRoleMapper.selectAllByStaffId(userId);
|
||||
List<StaffMenu> staffMenus = new ArrayList<>();
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(userId);
|
||||
if(new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){
|
||||
List<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType());
|
||||
if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){
|
||||
staffMenus.addAll(staffMenuDepartmentList);
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(staffRoleList)){
|
||||
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(userId);
|
||||
if(CollectionUtils.isNotEmpty(staffMenuList)){
|
||||
staffMenus.addAll(staffMenuList);
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){
|
||||
List<Long> authIds = new ArrayList<>();
|
||||
for(StaffMenu staffMenu:staffMenus){
|
||||
List<Long> ids = StringUtil.splitToLongList(staffMenu.getAuthIds(),",");
|
||||
authIds.addAll(ids);
|
||||
}
|
||||
if(authIds.size() > 0){
|
||||
map = recordAuthService.selectAuthByIds(authIds);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void insertPM(StaffRole staffRole, Long parentId, StaffEntity staffEntity) {
|
||||
staffRole.setEvaluationGroupId(EvaluationGroupEnums.ALL.getType());//全部考评组
|
||||
staffRole.setDepartmentId(DepartmentPMEnums.ALL.getType());//所有部门
|
||||
|
||||
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.enums.ResultRecordStatusEnum;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.equipment.entity.model.BasePage;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
@ -15,6 +17,7 @@ import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.res.ResultRankListRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,6 +39,8 @@ public class ChartController extends AbstractController{
|
||||
private ChartResultService chartResultService;
|
||||
@Autowired
|
||||
private FlowStartMapper flowStartMapper;
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@GetMapping("chart/result")
|
||||
@ApiOperation("获取绩效报表统计")
|
||||
@ -84,11 +89,16 @@ public class ChartController extends AbstractController{
|
||||
|
||||
|
||||
|
||||
@PostMapping("chart/test")
|
||||
public R chartTest(){
|
||||
List<FlowStart> starts = flowStartMapper.selectList(new QueryWrapper<FlowStart>().in("group_ids", Collections.EMPTY_LIST));
|
||||
System.out.println();
|
||||
return null;
|
||||
@RequestMapping("/own/result")
|
||||
@ApiOperation("获取个人成长曲线")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = OwnResultResp.class)})
|
||||
public R ownResult(Long userId){
|
||||
if(userId == null){
|
||||
//如果id为空,查询自己信息
|
||||
userId = getUserId();
|
||||
}
|
||||
List<OwnResultResp> ownResultResps = resultRecordService.ownResult(null);
|
||||
return R.ok().put("data",ownResultResps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ import com.lz.modules.app.enums.SmsTypeEnum;
|
||||
import com.lz.modules.app.service.CodeRecordService;
|
||||
import com.lz.modules.app.service.SmsTemplateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.sys.entity.SysConfigEntity;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.form.SysLoginForm;
|
||||
@ -41,9 +43,7 @@ import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 登录相关
|
||||
@ -64,6 +64,9 @@ public class SysLoginController extends AbstractController {
|
||||
private CodeRecordService codeRecordService;
|
||||
@Resource
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
@Resource
|
||||
private DhgjSmsUtil dhgjSmsUtil;
|
||||
|
||||
@ -71,7 +74,7 @@ public class SysLoginController extends AbstractController {
|
||||
private String environment;
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService ;
|
||||
private StaffService staffService;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
@ -181,7 +184,7 @@ public class SysLoginController extends AbstractController {
|
||||
SysUserEntity user = sysUserService.queryByUserName(form.getUserName());
|
||||
if (user == null) {
|
||||
StaffEntity staffEntity = staffService.selectByPhone(form.getUserName());
|
||||
if(staffEntity != null){
|
||||
if (staffEntity != null) {
|
||||
user = new SysUserEntity();
|
||||
user.setPassword(staffEntity.getPassword());
|
||||
user.setMobile(staffEntity.getMobile());
|
||||
@ -193,7 +196,7 @@ public class SysLoginController extends AbstractController {
|
||||
user.setUsername(staffEntity.getMobile());
|
||||
user.setRealName(staffEntity.getName());
|
||||
user.setUserNo(staffEntity.getMobile());
|
||||
}else{
|
||||
} else {
|
||||
return R.error("账号不存在!");
|
||||
}
|
||||
}
|
||||
@ -218,11 +221,15 @@ public class SysLoginController extends AbstractController {
|
||||
}
|
||||
//生成token,并保存到数据库
|
||||
R r = sysUserTokenService.createToken(user);
|
||||
return r;
|
||||
Map<String,Integer> map = staffRoleService.getRoleByUserId(user.getUserId());
|
||||
return r.put("data",map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
|
||||
@ -61,7 +61,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordByIds(@Param("recordIds") List<Long> recordIds);
|
||||
|
||||
List<OwnResultResp> ownResult(@Param("userId") Long userId, @Param("status") int status);
|
||||
List<OwnResultResp> ownResult(@Param("staffId") Long staffId);
|
||||
|
||||
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds);
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
void sendWorkMSG(StaffEntity mySelf, StaffEntity toSelf, WorkMsgTypeEnum workMsgTypeEnum
|
||||
, Long recordResultId, int count);
|
||||
|
||||
List<OwnResultResp> ownResult(Long userId, int status);
|
||||
List<OwnResultResp> ownResult(Long staffId);
|
||||
|
||||
/**
|
||||
* 人员等级排布
|
||||
|
||||
@ -738,8 +738,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
|
||||
@Override
|
||||
public List<OwnResultResp> ownResult(Long userId, int status) {
|
||||
return resultRecordMapper.ownResult(userId,status);
|
||||
public List<OwnResultResp> ownResult(Long staffId) {
|
||||
return resultRecordMapper.ownResult(staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -281,8 +281,14 @@
|
||||
|
||||
|
||||
<select id="ownResult" resultType="com.lz.modules.app.resp.OwnResultResp">
|
||||
SELECT last_score,DATE_FORMAT(month_time, '%Y-%m') month_time from lz_result_record where is_delete=0 and status = #{status} and type=2 and staff_id = #{userId} ORDER BY month_time limit 6
|
||||
</select>
|
||||
SELECT all_score,name FROM lz_result_record r
|
||||
LEFT JOIN lz_flow_start f
|
||||
ON r.start_id = f.id
|
||||
where r.is_delete = 0 and f.is_delete = 0 and flow_process = 5 and staff_id = #{staffId}
|
||||
order by start_id desc
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
|
||||
SELECT count(score_level) number ,score_level category from lz_result_record where
|
||||
|
||||
@ -108,5 +108,14 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAuthByIds" resultType="com.lz.modules.flow.entity.AuthDto">
|
||||
select * from (select identity ,status from lz_record_auth where id in
|
||||
<foreach item="item" collection="authIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by status desc)a group by identity
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -159,6 +159,17 @@
|
||||
select * from lz_staff_role where is_delete = 0 and department_level = #{departmentLevel} and staff_id =#{staffId}
|
||||
</select>
|
||||
|
||||
<select id="selectAllByStaffId" resultType="com.lz.modules.flow.entity.StaffRole">
|
||||
select * from lz_staff_role where is_delete = 0 and staff_id =#{staffId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllMenus" resultType="com.lz.modules.flow.entity.StaffMenu">
|
||||
select * from lz_staff_menu where id in (
|
||||
select menu_id from lz_staff_role_menu where role_id in (
|
||||
select id from lz_staff_role where staff_id = #{userId}))
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user