获取绩效详情增加通过token获取最新和startId获取最新的功能

This commit is contained in:
wulin 2020-11-16 11:01:43 +08:00
parent 4cb8605b15
commit 5753686fc3
5 changed files with 54 additions and 5 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,14 +336,38 @@ 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(Map<String, Object> param) {
Long id = null;
Long startId = null;
if(param.containsKey("id")){
id = Long.parseLong(param.get("id").toString());
}else if(param.containsKey("startId")){
startId = Long.parseLong(param.get("startId").toString());
}
SysUserEntity user = getUser();
ResultRecord resultRecord = null;
if(id == null){
//id = getUserId();//
if(startId == null){//根据token获取
resultRecord = lzResultRecordService.selectLastResultRecordByUserId(getUserId());
}else{//根据startId和token获取
resultRecord = lzResultRecordService.selectResultRecordByStaffIdAndStartId(getUserId(), startId);
}
}else{
resultRecord = lzResultRecordService.selectResultRecordById(id);
}
ResultRecord resultRecord = lzResultRecordService.selectResultRecordById(id);
if(resultRecord == null){
return R.error("绩效不存在");
}
/*SysUserEntity user = getUser();
id = resultRecord.getId();
if(resultRecord.getStaffId().longValue() != user.getUserId().longValue()){
//下面判断权限,是否可读
EvaluationStartStaff evaluationStartStaff =
@ -350,7 +375,7 @@ public class ResultRecordController extends AbstractController {
if(evaluationStartStaff == null){//非考核组设置的绩效管理人员下面应在查询其他权限
return R.error("未被授权访问");
}
}*/
}
//获取考核维度等信息
ResultRecordDetailDto resultRecordDetailDto = new ResultRecordDetailDto();
BeanUtils.copyProperties(resultRecord, resultRecordDetailDto);
@ -403,7 +428,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

@ -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

@ -575,5 +575,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>