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

View File

@ -37,6 +37,9 @@ public class ResultRecordDetailDto {
@ApiModelProperty(value = "员工id", name = "staffId")
private Long staffId;
@ApiModelProperty(value = "任务id", name = "startId")
private Long startId;
//使用的哪个等级等级组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);
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 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();
}
@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}
</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>