Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-11-16 15:51:16 +08:00
commit bcbde5833b
6 changed files with 71 additions and 14 deletions

View File

@ -31,6 +31,7 @@ import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -335,22 +336,51 @@ public class ResultRecordController extends AbstractController {
*/ */
@GetMapping("/getDetail") @GetMapping("/getDetail")
@ApiOperation("获取绩效详情-吴林") @ApiOperation("获取绩效详情-吴林")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "绩效id可为空为空时使用token的用户获取"),
@ApiImplicitParam(name = "startId", value = "任务id可为空为空时使用token的用户获取")})
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = ResultRecordDetailDto.class)}) @ApiResponses({@ApiResponse(code = 200, message = "成功", response = ResultRecordDetailDto.class)})
public R getDetail(@RequestParam @ApiParam("绩效id") Long id) { public R getDetail(@RequestParam Map<String, Object> param) {
Long id = null;
Long startId = null;
SysUserEntity user = getUser();
ResultRecord resultRecord = null;
ResultRecord resultRecord = lzResultRecordService.selectResultRecordById(id); if(param.containsKey("id")){
if(resultRecord == null){ String value = param.get("id").toString();
return R.error("绩效不存在"); if(value.length() > 0){
} id = Long.parseLong(value);
/*SysUserEntity user = getUser(); resultRecord = lzResultRecordService.selectResultRecordById(id);
if(resultRecord.getStaffId().longValue() != user.getUserId().longValue()){ if(resultRecord == null){
//下面判断权限,是否可读 return R.error("绩效不存在");
EvaluationStartStaff evaluationStartStaff = }
evaluationStartStaffService.selectManagerEvaluationStartStaff(resultRecord.getEvaluationId(), user.getUserId()); //下面判断权限
if(evaluationStartStaff == null){//非考核组设置的绩效管理人员下面应在查询其他权限 if(user.getUserId().longValue() != resultRecord.getStaffId().longValue()){
return R.error("未被授权访问"); //不是自己的绩效判断是否为绩效管理人员老板部门管理人员
log.info("不是自己的绩效");
}
} }
}*/
}else if(param.containsKey("startId")){//根据startId和token获取
String value = param.get("startId").toString();
if(value.length() > 0){
startId = Long.parseLong(value);
resultRecord = lzResultRecordService.selectResultRecordByStaffIdAndStartId(getUserId(), startId);
if(resultRecord == null){
return R.error("绩效不存在");
}
}
}else{
//根据token获取
resultRecord = lzResultRecordService.selectLastResultRecordByUserId(getUserId());
if(resultRecord == null){
return R.error("绩效不存在");
}
}
//获取考核维度等信息 //获取考核维度等信息
ResultRecordDetailDto resultRecordDetailDto = new ResultRecordDetailDto(); ResultRecordDetailDto resultRecordDetailDto = new ResultRecordDetailDto();
BeanUtils.copyProperties(resultRecord, resultRecordDetailDto); BeanUtils.copyProperties(resultRecord, resultRecordDetailDto);
@ -403,7 +433,7 @@ public class ResultRecordController extends AbstractController {
//流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回 //流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点 List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点
if(flowRecords.get(0).getType().intValue() == 1){ if(flowRecords.get(0).getType().intValue() == 1){
//或签 //或签,这里还有优化多个评分节点时针对每个节点是否为或签
isOrScore = true; isOrScore = true;
} }

View File

@ -37,6 +37,9 @@ public class ResultRecordDetailDto {
@ApiModelProperty(value = "员工id", name = "staffId") @ApiModelProperty(value = "员工id", name = "staffId")
private Long staffId; private Long staffId;
@ApiModelProperty(value = "任务id", name = "startId")
private Long startId;
//使用的哪个等级等级组idlz_result_grade的group_id //使用的哪个等级等级组idlz_result_grade的group_id

View File

@ -96,4 +96,8 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ToScoreDingTalkDto> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId); List<ToScoreDingTalkDto> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);
int countAssessNumJoin(@Param("req")AssessDetailReq req); int countAssessNumJoin(@Param("req")AssessDetailReq req);
ResultRecord selectLastResultRecordByUserId(@Param("userId") Long userId);
ResultRecord selectResultRecordByStaffIdAndStartId(@Param("userId") Long userId, @Param("startId") Long startId);
} }

View File

@ -114,4 +114,8 @@ public interface ResultRecordService extends IService<ResultRecord> {
R newApproval(ApprovalDto approvalDto) throws Exception; R newApproval(ApprovalDto approvalDto) throws Exception;
R newResultRecordList(RecordDetailDto recordDetailDto); R newResultRecordList(RecordDetailDto recordDetailDto);
ResultRecord selectLastResultRecordByUserId(Long userId);
ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId);
} }

View File

@ -1314,4 +1314,13 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return new Flow(); return new Flow();
} }
@Override
public ResultRecord selectLastResultRecordByUserId(Long userId){
return resultRecordMapper.selectLastResultRecordByUserId(userId);
}
@Override
public ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId){
return resultRecordMapper.selectResultRecordByStaffIdAndStartId(userId, startId);
}
} }

View File

@ -580,5 +580,12 @@
and evaluation_id = #{evaluationId} and evaluation_id = #{evaluationId}
</select> </select>
<select id="selectLastResultRecordByUserId" resultType="ResultRecord" >
select * from lz_result_record where staff_id=#{userId} and is_delete = 0 order by id desc limit 1
</select>
<select id="selectResultRecordByStaffIdAndStartId" resultType="ResultRecord" >
select * from lz_result_record where staff_id=#{userId} and is_delete = 0 and start_id = #{startId} order by id desc limit 1
</select>
</mapper> </mapper>