提交修改

This commit is contained in:
quyixiao 2020-11-18 10:45:34 +08:00
commit 2e7bba668b
26 changed files with 410 additions and 139 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,48 @@ 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 +430,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;
}
@ -417,7 +444,7 @@ public class ResultRecordController extends AbstractController {
resultScore.setWeight(record.getWeight());
}else{
//多人的时候权重平分
resultScore.setWeight(record.getWeight().divide(BigDecimal.valueOf(staffs1.size()), RoundingMode.CEILING));
resultScore.setWeight(record.getWeight().divide(BigDecimal.valueOf(staffs1.size()), RoundingMode.HALF_UP));
}
scoreDtos.add(resultScore);
@ -460,7 +487,7 @@ public class ResultRecordController extends AbstractController {
resultRecortModelDto.setMaxCount(null);
}
List<ResultDetailDto> detailDtos =
resultDetailService.selectDtosByRecordId(resultRecord.getId(), model.getType());
resultDetailService.selectDtosByRecordId(resultRecord.getId(), model.getId());
for (ResultDetailDto dto:detailDtos
) {
//下面设置计算公式
@ -685,6 +712,7 @@ public class ResultRecordController extends AbstractController {
resultDetail.setStaffId(resultRecord.getStaffId());
resultDetail.setRecordId(resultRecord.getId());
resultDetail.setType(model.getType());
resultDetail.setModelId(model.getId());
inserts.add(resultDetail);
}
if(resultDetail.getIsDelete() == null || resultDetail.getIsDelete().intValue() == 0){

View File

@ -19,5 +19,5 @@ public class OwnResultResp {
private String name;
//最后得分
@ApiModelProperty("最后得分")
private BigDecimal lastScore;
private BigDecimal allScore;
}

View File

@ -58,6 +58,8 @@ public class ResultDetailDto {
@ApiModelProperty(value = "评分详细", name = "scoreDtos")
private List<ResultScoreDto> scoreDtos;
@ApiModelProperty(value = "维度id lz_result_model的id", name = "modelId")
private Long modelId;
/**
*
* @return

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

@ -0,0 +1,12 @@
package com.lz.modules.flow.model;
import com.lz.modules.sys.entity.app.ResultRecord;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class StartStartDto {
private int status;
private List<ResultRecord> resultRecordList = new ArrayList<>();
}

View File

@ -138,28 +138,32 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
.collect(Collectors.toList());
}else{
//考评组管理
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());//一个人只会有一个
if(staffRoles.size() == 0){
log.info("非绩效管理员登录查询");
return null;
}
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
if(staffRoleEvaluationGroups.size() == 0){
log.info("查询的管理组为空");
return null;
}
gIds = new ArrayList<>();
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
) {
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
gIds = null;
log.info("管理所有组");
break;
if(staffRoles.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
if(staffRoleEvaluationGroups.size() == 0){
log.info("查询的管理组为空");
return null;
}
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
gIds = new ArrayList<>();
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
) {
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
gIds = null;
log.info("管理所有组");
break;
}
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
}
}
}
List<Long> finalGIds = gIds;
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize())

View File

@ -1,13 +1,21 @@
package com.lz.modules.flow.service.impl;
import ch.qos.logback.classic.Logger;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.lz.common.emun.ChartOptType;
import com.lz.common.emun.CheckStaffType;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums;
import com.lz.modules.app.enums.FlowRecordStatusEnums;
import com.lz.modules.app.enums.RoleEnums;
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.dao.EvaluationStartStaffMapper;
import com.lz.modules.flow.dao.FlowStartMapper;
@ -20,15 +28,22 @@ import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.lz.modules.third.entity.ThirdAppConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -92,6 +107,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
@Override
public FlowStart selectFlowStartById(Long id){
return flowStartMapper.selectFlowStartById(id);
@ -142,6 +159,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系减少数据库查找
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
@ -152,7 +171,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//流程流转中中途加人走的流程
EvaluationGroup evaluationGroup =
evaluationGroupService.selectEvaluationGroupByCopyId(groupStaffs.getEvaluationGroup().getId(),flowStart.getId());
switch (start(evaluationGroup, flowStart, staffManages, staffSimpleInfos, mustRole, selfMustRole, true)){
StartStartDto startDto = start(evaluationGroup, flowStart, staffManages, staffSimpleInfos, mustRole, selfMustRole, true);
switch (startDto.getStatus()){
case 1:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核模板");
@ -164,10 +184,16 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置绩效管理人员");
case 5:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffSimpleInfos);
resultRecords.addAll(startDto.getResultRecordList());
break;
}
dingtalkBusiness.sendWorkMSGWithAsyn(staffSimpleInfos, WorkMsgTypeEnum.START_WORK.getType());
}
initFlowRecordAnsy(resultRecords);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}
@ -189,8 +215,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
log.info("未设置有效考核结束月份");
return R.error("未设置有效考核结束月份");
}
String endDate = sdf.format(flowStart.getStartTime());
flowStart.setName(startDate + "-" + endDate + "绩效考核");
String endDate = sdf.format(flowStart.getEndTime());
flowStart.setName(startDate + "" + endDate + "绩效考核");
}else{
flowStart.setName(startDate + "绩效考核");
}
@ -248,7 +274,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
for (int n = 0; n < evaluationGroups.size(); n++
) {
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
@ -280,8 +307,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
switch (start(evaluationGroup, flowStart, staffManages, staffIds, mustRole, selfMustRole, false)){
StartStartDto startDto = start(evaluationGroup, flowStart, staffManages, staffIds, mustRole, selfMustRole, false);
switch (startDto.getStatus()){
case 1:
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
@ -293,29 +320,36 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
case 5:
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffIds);
resultRecords.addAll(startDto.getResultRecordList());
break;
}
dingtalkBusiness.sendWorkMSGWithAsyn(staffIds, WorkMsgTypeEnum.START_WORK.getType());
}
initFlowRecordAnsy(resultRecords);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}
//isInsert表示是否中途加人
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
private StartStartDto start(EvaluationGroup evaluationGroup, FlowStart flowStart,
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds,
Map<Long, List<FlowChartRole>> mustRole, Map<Long, List<FlowChartRole>> selfMustRole, boolean isInsert){
StartStartDto startStartDto = new StartStartDto();
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置考核模板");
return 1;
startStartDto.setStatus(1);
return startStartDto;
}
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
if(flowCharts.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("无有效绩效流程节点");
return 2;
startStartDto.setStatus(2);
return startStartDto;
}
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
for (FlowChart chart:flowCharts
@ -328,7 +362,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(flowChartDetailRecords.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置考核流程");
return 3;
startStartDto.setStatus(3);
return startStartDto;
}
Map<Long, String> chartNameMaps =
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map下面多次循环减少数据库查找
@ -339,7 +374,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(staffManagers == null || staffManagers.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置绩效管理人员");
return 4;
startStartDto.setStatus(4);
return startStartDto;
}
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
@ -374,10 +410,11 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultTagetLib.setId(null);
resultTagetLibs.add(resultTagetLib);
}
dto.setId(resultModel.getId());
}
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
resultTagetLibService.saveBatch(resultTagetLibs);
}
//拷贝一份流程
for(FlowChartDetailRecord flowChartDetailRecord: flowChartDetailRecords){
@ -391,13 +428,15 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(evaluationGroup == null){
log.info("无法找到拷贝组信息");
return 5;
startStartDto.setStatus(5);
return startStartDto;
}
resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("拷贝组的维度信息错误");
return 1;
startStartDto.setStatus(1);
return startStartDto;
}
for (ResultModelDto modelDto:resultModelDtos
) {
@ -410,6 +449,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<ResultDetail> resultDetails = new ArrayList();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
@ -441,10 +481,14 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
resultRecordService.insertResultRecord(resultRecord);
startStartDto.getResultRecordList().add(resultRecord);
//resultRecordService.initFlowRecord(resultRecord.getId());
//下面生成实际的考核流程
resultRecordService.initFlowRecord(resultRecord.getId());
staffInfo.setRecordId(resultRecord.getId());
for (ResultModelDto modelDto:resultModelDtos
@ -461,8 +505,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setStaffId(resultRecord.getStaffId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetail.setModelId(modelDto.getId());
resultDetails.add(resultDetail);
}
}
@ -471,14 +516,12 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
resultDetailService.saveBatch(resultDetails);
}
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
return 0;
evaluationStartStaffService.saveBatch(evaluationStartStaffs);
startStartDto.setStatus(0);
return startStartDto;
}
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
@ -505,7 +548,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
mustRole.put(flow.getChartId(), flowChartRoles);
}
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String roles = null;
@ -520,8 +562,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
@ -590,13 +630,13 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
//插入记录/flowChart/saveDetailProcs
if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
flowApprovalRoleService.saveBatch(flowApprovalRoles);
//初始化lz_result_details数据
List<ResultDetail> resultDetails = new ArrayList<>();
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<ResultRecord> resultRecords = new ArrayList<>();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
@ -611,7 +651,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
//初始化lz_result_records数据
ResultRecord resultRecord = new ResultRecord();
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
@ -624,6 +663,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultRecord.setEvaluationId(evaluationGroup.getId());
resultRecord.setFlowProcess(0);//设置为目标制定
//下面初始化flow_staff_id_role字段步骤为0的
String roleJSON = "[";
for (int i = 0; i < flowApprovalRoles.size() ;i++){
@ -703,26 +745,37 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
roleJSON += "]";
roleJSON = roleJSON.replace(",]", "]");
resultRecord.setFlowStaffIdRole(roleJSON);
resultRecordService.insertResultRecord(resultRecord);
startStartDto.getResultRecordList().add(resultRecord);
staffInfo.setRecordId(resultRecord.getId());
//下面生成实际的考核流程
resultRecordService.initFlowRecord(resultRecord.getId());
/*ExecutorService executor = Executors.newFixedThreadPool(10);
List<ResultRecord> resultRecords = Lists.newArrayList();
CompletableFuture<List<ResultRecord>> listCompletableFuture = CompletableFuture.supplyAsync(() -> resultRecordService.list(), executor);
try {
resultRecords = listCompletableFuture.get();
} catch (Exception e) {
e.printStackTrace();
}*/
//resultRecordService.initFlowRecord(resultRecord.getId());
//下面生成ResultDetail对象
for (ResultModelDto modelDto:resultModelDtos
) {
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
for (ResultTagetLibDto libDto:
modelDto.getTagetLibs()) {
ResultDetail resultDetail = new ResultDetail();
resultDetail.setRecordId(resultRecord.getId());
resultDetail.setTarget(libDto.getName());
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setStaffId(resultRecord.getId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetail.setModelId(modelDto.getId());
resultDetails.add(resultDetail);
}
}
@ -731,19 +784,17 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
resultDetailService.saveBatch(resultDetails);
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面通知所有参与考核人员
//如果有下面通知所有管理人员
evaluationStartStaffService.saveBatch(evaluationStartStaffs);
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("初始化考核流程失败");
return 5;
startStartDto.setStatus(5);
return startStartDto;
}
return 0;
startStartDto.setStatus(0);
return startStartDto;
}
@Override
@ -755,5 +806,33 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.ok().put("data",staffEntity);
}
private void initFlowRecordAnsy(List<ResultRecord> resultRecords){
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords);
Thread thread = new Thread(threadInitFlowRecord);
thread.start();
}
public class ThreadInitFlowRecord implements Runnable{
List<ResultRecord> resultRecords;
public ThreadInitFlowRecord(List<ResultRecord> resultRecords){
this.resultRecords = resultRecords;
}
@Override
public void run() {
log.info("开始批量初始化流程,数量{}", resultRecords.size());
for (ResultRecord resultRecord:resultRecords
) {
String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
String newNo = oldNo + "_" + resultRecord.getId() + "_" + resultRecord.getStaffId();
ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
resultRecordService.initFlowRecord(resultRecord.getId());
ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
}
}
}
}

View File

@ -237,29 +237,31 @@ public class DingtalkBusiness {
public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, int type) {
if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) {
//查询第三方id
List<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
@Override
public Long apply(StaffSimpleInfo staffSimpleInfo) {
return staffSimpleInfo.getId();
if(toStaffids.size() > 0){
if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) {
//查询第三方id
List<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
@Override
public Long apply(StaffSimpleInfo staffSimpleInfo) {
return staffSimpleInfo.getId();
}
}).collect(Collectors.toList());
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
Map<Long, StaffSimpleInfo> map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e));
for (StaffSimpleInfo staff : staffSimpleInfos
) {
StaffSimpleInfo staff1 = map.get(staff.getId());
staff1.setEmployeeId(staff1.getEmployeeId());
}
}).collect(Collectors.toList());
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
Map<Long, StaffSimpleInfo> map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e));
for (StaffSimpleInfo staff : staffSimpleInfos
) {
StaffSimpleInfo staff1 = map.get(staff.getId());
staff1.setEmployeeId(staff1.getEmployeeId());
}
}
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
Thread thread = new Thread(threadSendMessage);
thread.start();
return "OK";
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
Thread thread = new Thread(threadSendMessage);
thread.start();
return "OK";
}
return "error";
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.performance.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
@ -12,11 +13,13 @@ import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.performance.req.ChartResultReq;
import com.lz.modules.performance.req.ChartStartsReq;
import com.lz.modules.performance.req.OwnResultReq;
import com.lz.modules.performance.res.ChartStartsRes;
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.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
@ -24,6 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* @Author: djc
@ -94,14 +100,16 @@ public class ChartController extends AbstractController{
@PostMapping("/own/result")
@ApiOperation("获取个人成长曲线")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = OwnResultResp.class)})
public R ownResult(Long userId){
if(userId == null){
public R ownResult(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) OwnResultReq req){
if(req.getUserId() == null){
//如果id为空查询自己信息
userId = getUserId();
req.setUserId(getUserId());
}
List<OwnResultResp> ownResultResps = resultRecordService.ownResult(null);
List<OwnResultResp> ownResultResps = resultRecordService.ownResult(req);
return R.ok().put("data",ownResultResps);
}
}

View File

@ -32,11 +32,12 @@ public class UserTaskController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskListRes.class)})
public R list(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) AssessTaskReq req){
PageUtils pageUtils;
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
pageUtils = assessService.userTaskList(req, userId);
} catch (Exception e) {
log.error("获取用户事项异常 userId:" ,e);
log.error("获取用户事项异常 userId:" + userId,e);
return R.error(e.getMessage());
}
return R.ok().put("data",pageUtils);

View File

@ -14,8 +14,8 @@ import lombok.Data;
@ApiModel("获取报表等级详情实体")
public class ChartResultReq extends BasePage{
@ApiModelProperty(value = "部门id",name = "departmentId")
private String departmentId;
@ApiModelProperty(value = "部门ids,逗号隔开",name = "departmentIds")
private String departmentIds;
@ApiModelProperty(value = "考核id",name = "startId")
private Long startId;

View File

@ -0,0 +1,27 @@
package com.lz.modules.performance.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2020/11/16 16:50
*/
@Data
@ApiModel("个人曲线请求实体")
public class OwnResultReq {
@ApiModelProperty("用户id,可不传")
private Long userId;
@ApiModelProperty("开始时间,必传")
private String startTime;
@ApiModelProperty("结束时间,必传")
private String endTime;
@ApiModelProperty("条数,默认6条")
private Integer size = 6;
}

View File

@ -122,7 +122,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
}else {
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId(),mandepartmentIds);
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds);
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "");
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + ""+ i + "");
}
data.add(res);

View File

@ -69,11 +69,18 @@ public class AssessServiceImpl implements AssessService {
dtos.stream().forEach(taskListDto -> {
TaskListRes res = new TaskListRes();
StaffEntity staffEntity = staffService.selectStaffById(taskListDto.getRecordStaffId());
res.setAvatar(Optional.ofNullable(staffEntity.getAvatar()).orElse(StringUtil.EMPTY));
String name = staffEntity.getName();
if(taskListDto.getRecordStaffId().equals(taskListDto.getApprovalStaffId())){
name = "";
String name = "";
if(staffEntity!=null){
res.setAvatar(Optional.ofNullable(staffEntity.getAvatar()).orElse(StringUtil.EMPTY));
name = staffEntity.getName();
if(taskListDto.getRecordStaffId().equals(taskListDto.getApprovalStaffId())){
name = "";
}
}else {
name = "未知";
log.info("未找到此人信息 staffId: " + taskListDto.getRecordStaffId());
}
FlowStart start = flowStartService.selectFlowStartById(taskListDto.getStartId());
//根据状态拼接文案
String startName = start == null ? "" : start.getName();

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.lz.common.exception.RRException;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
@ -182,9 +183,18 @@ public class ChartResultServiceImpl implements ChartResultService {
@Override
public PageUtils selectChartDetailList(ChartResultReq req) {
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
String departmentIds = req.getDepartmentIds();
Set<String> allDepart = Sets.newHashSet();
if(StringUtil.isNotBlank(departmentIds)){
String[] split = departmentIds.split(",");
for(String s:split){
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
allDepart.addAll(deparmentIds);
}
}
List<String> allDeparmentIds = new ArrayList<>(allDepart);
//自己管理的和所有的部门交集
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds));
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
if(mandepartmentIds!=null ){
if(mandepartmentIds.size()==0){
@ -196,9 +206,14 @@ public class ChartResultServiceImpl implements ChartResultService {
return new PageUtils();
}
}
else {
//如果掌管所有部门查询请求部门
mandepartmentIds = allDeparmentIds;
}
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
List<String> finalMandepartmentIds = mandepartmentIds;
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
page -> resultRecordMapper.selectChartDetailList(page,mandepartmentIds,req.getStartId(),req.getScoreLevel())
page -> resultRecordMapper.selectChartDetailList(page, finalMandepartmentIds,req.getStartId(),req.getScoreLevel())
);
return pageUtils;
}

View File

@ -45,5 +45,5 @@ public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
Long insertResultDetails(@Param("list") List<ResultDetail> resultDetails);
List<ResultDetailDto> selectDtosByRecordId(@Param("recordResultId") Long id, @Param("type") int type);
List<ResultDetailDto> selectDtosByRecordId(@Param("recordResultId") Long id, @Param("modelId") Long modelId);
}

View File

@ -18,6 +18,7 @@ import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.flow.model.ResultRecordDto;
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.OwnResultReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.ChartStatistical;
import com.lz.modules.sys.entity.app.ResultRecord;
@ -61,7 +62,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ResultRecord> selectResultRecordByIds(@Param("recordIds") List<Long> recordIds);
List<OwnResultResp> ownResult(@Param("staffId") Long staffId);
List<OwnResultResp> ownResult(@Param("req") OwnResultReq req);
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds);
@ -96,4 +97,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

@ -1,57 +1,78 @@
package com.lz.modules.sys.entity.app;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 菜单权限表
* </p>*绩效详情表
* </p>*业绩详情表
* @author quyixiao
* @since 2020-08-28
* @since 2020-11-17
*/
@Data
@TableName("lz_result_detail")
@ApiModel(value = "业绩详情表")
public class ResultDetail implements java.io.Serializable {
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除状态1删除0有效
@ApiModelProperty(value = "是否删除状态1删除0有效", name = "isDelete")
private Integer isDelete;
//创建时间
@ApiModelProperty(value = "创建时间", name = "gmtCreate")
private Date gmtCreate;
//最后修改时间
@ApiModelProperty(value = "最后修改时间", name = "gmtModified")
private Date gmtModified;
//1绩效2文化价值观
//1业绩2文化价值观
@ApiModelProperty(value = "1业绩2文化价值观", name = "type")
private Integer type;
//目标
@ApiModelProperty(value = "目标", name = "target")
private String target;
//关键结果
@ApiModelProperty(value = "关键结果", name = "keyResult")
private String keyResult;
//关键结果_3.5标准
@ApiModelProperty(value = "关键结果_3.5标准", name = "keyResult35")
private String keyResult35;
//关键结果3.7分标准
@ApiModelProperty(value = "关键结果3.7分标准", name = "keyResult37")
private String keyResult37;
//考核权重
@ApiModelProperty(value = "考核权重", name = "checkWeight")
private BigDecimal checkWeight;
//考核结果
@ApiModelProperty(value = "考核结果", name = "checkResult")
private String checkResult;
//直属上级评分
@ApiModelProperty(value = "直属上级评分", name = "superScore")
private String superScore;
//得分
@ApiModelProperty(value = "得分", name = "acquireScore")
private BigDecimal acquireScore;
//评分说明
@ApiModelProperty(value = "评分说明", name = "scoreComment")
private String scoreComment;
//记录id
@ApiModelProperty(value = "记录id ", name = "recordId")
private Long recordId;
//用户id
@ApiModelProperty(value = "用户id", name = "staffId")
private Long staffId;
//优先级从大到小
@ApiModelProperty(value = "优先级,从大到小", name = "priority")
private Integer priority;
//维度id lz_result_model的id
@ApiModelProperty(value = "维度id lz_result_model的id", name = "modelId")
private Long modelId;
/**
*
* @return
@ -113,14 +134,14 @@ public class ResultDetail implements java.io.Serializable {
}
/**
* 12文化价值观
* 12文化价值观
* @return
*/
public Integer getType() {
return type;
}
/**
* 12文化价值观
* 12文化价值观
* @param type
*/
public void setType(Integer type) {
@ -307,6 +328,21 @@ public class ResultDetail implements java.io.Serializable {
this.priority = priority;
}
/**
* 维度id lz_result_model的id
* @return
*/
public Long getModelId() {
return modelId;
}
/**
* 维度id lz_result_model的id
* @param modelId
*/
public void setModelId(Long modelId) {
this.modelId = modelId;
}
@Override
public String toString() {
return "ResultDetail{" +
@ -327,6 +363,7 @@ public class ResultDetail implements java.io.Serializable {
",recordId=" + recordId +
",staffId=" + staffId +
",priority=" + priority +
",modelId=" + modelId +
"}";
}
}

View File

@ -69,5 +69,5 @@ public interface ResultDetailService extends IService<ResultDetail> {
Long insertResultDetails(List<ResultDetail> resultDetails);
List<ResultDetailDto> selectDtosByRecordId(Long id, int type);
List<ResultDetailDto> selectDtosByRecordId(Long id, Long modelId);
}

View File

@ -15,6 +15,7 @@ import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.OwnResultReq;
import com.lz.modules.performance.res.ChartStatistical;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
@ -77,7 +78,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
void sendWorkMSG(StaffEntity mySelf, StaffEntity toSelf, WorkMsgTypeEnum workMsgTypeEnum
, Long recordResultId, int count);
List<OwnResultResp> ownResult(Long staffId);
List<OwnResultResp> ownResult(OwnResultReq req);
/**
* 人员等级排布
@ -114,4 +115,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

@ -336,8 +336,8 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
}
@Override
public List<ResultDetailDto> selectDtosByRecordId(Long id, int type){
return resultDetailMapper.selectDtosByRecordId(id, type);
public List<ResultDetailDto> selectDtosByRecordId(Long id, Long modelId){
return resultDetailMapper.selectDtosByRecordId(id, modelId);
}
}

View File

@ -33,6 +33,7 @@ import com.lz.modules.flow.enums.FlowRecordEnum;
import com.lz.modules.flow.model.*;
import com.lz.modules.flow.service.*;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.req.OwnResultReq;
import com.lz.modules.performance.res.ChartStatistical;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.SysUserEntity;
@ -743,8 +744,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Override
public List<OwnResultResp> ownResult(Long staffId) {
return resultRecordMapper.ownResult(staffId);
public List<OwnResultResp> ownResult(OwnResultReq req) {
return resultRecordMapper.ownResult(req);
}
@Override
@ -1314,4 +1315,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

@ -21,12 +21,13 @@
<result column="record_id" property="recordId"/>
<result column="staff_id" property="staffId"/>
<result column="priority" property="priority"/>
<result column="model_id" property="modelId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority, model_id AS modelId
</sql>
@ -52,6 +53,7 @@
<if test="recordId != null">record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="priority != null">priority, </if>
<if test="modelId != null">model_id, </if>
is_delete,
gmt_create,
gmt_modified
@ -69,6 +71,7 @@
<if test="recordId != null">#{ recordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="priority != null">#{ priority}, </if>
<if test="modelId != null">#{ modelId}, </if>
0,
now(),
now()
@ -94,10 +97,11 @@
<if test="scoreComment != null">score_comment = #{scoreComment},</if>
<if test="recordId != null">record_id = #{recordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="priority != null">priority = #{priority}</if>
<if test="priority != null">priority = #{priority},</if>
<if test="modelId != null">model_id = #{modelId}</if>
</trim>
,gmt_modified = now()
where id = #{id} limit 1
where id = #{id}
</update>
@ -119,7 +123,8 @@
score_comment = #{scoreComment},
record_id = #{recordId},
staff_id = #{staffId},
priority = #{priority}
priority = #{priority},
model_id = #{modelId}
,gmt_modified = now()
where id = #{id}
</update>
@ -158,6 +163,7 @@
record_id,
staff_id,
priority,
model_id,
is_delete
)values
<foreach collection="list" item="item" separator=",">
@ -173,13 +179,14 @@
#{ item.recordId},
#{ item.staffId},
#{ item.priority},
#{item.modelId},
0
)
</foreach>
</insert>
<select id="selectDtosByRecordId" resultType="com.lz.modules.flow.model.ResultDetailDto">
select * from lz_result_detail where record_id=#{recordResultId} and type = #{type} and is_delete = 0 order by priority asc
select * from lz_result_detail where record_id=#{recordResultId} and model_id = #{modelId} and is_delete = 0 order by priority asc
</select>
</mapper>

View File

@ -281,11 +281,18 @@
<select id="ownResult" resultType="com.lz.modules.app.resp.OwnResultResp">
SELECT all_score,name FROM lz_result_record r
SELECT all_score,CONCAT_WS('至',DATE_FORMAT(start_time,'%Y.%m'),DATE_FORMAT(end_time,'%Y.%m')) as '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
where r.is_delete = 0 and f.is_delete = 0 and flow_process = 5 and staff_id = #{req.userId}
<if test="req.startTime != null and req.endTime!=null">
and (
(DATE_FORMAT(start_time,'%Y-%m') &lt;= #{req.startTime} and DATE_FORMAT(end_time,'%Y-%m') &gt;= #{req.endTime})
or (DATE_FORMAT(end_time,'%Y-%m') &lt;= #{req.endTime} and DATE_FORMAT(end_time,'%Y-%m') &gt;= #{req.startTime})
or (DATE_FORMAT(start_time,'%Y-%m') &lt;= #{req.endTime} and DATE_FORMAT(start_time,'%Y-%m') &gt;= #{req.startTime})
)
</if>
order by start_id desc limit #{req.size}
</select>
@ -379,7 +386,7 @@
</select>
<select id="countNumByScoreLevel" resultType="com.lz.modules.performance.res.ChartStatistical">
SELECT count(1) num,score_level,case score_level is null WHEN true THEN '无等级' ELSE score_level END as 'desc' from lz_result_record where is_delete=0
SELECT count(1) num,case score_level is null WHEN true THEN '' ELSE score_level END score_level,case score_level is null WHEN true THEN '无等级' ELSE score_level END 'desc' from lz_result_record where is_delete=0
and start_id =#{startId}
<if test="evaluationIds !=null and evaluationIds.size()!=0">
and evaluation_id in (
@ -412,7 +419,12 @@
)
</if>
<if test="scoreLevel !=null">
and r.score_level = #{scoreLevel}
<if test="scoreLevel == ''">
and r.score_level is null
</if>
<if test="scoreLevel != ''">
and r.score_level = #{scoreLevel}
</if>
</if>
ORDER BY all_score desc
</select>
@ -575,5 +587,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>

View File

@ -175,7 +175,7 @@
<select id="selectFinishTasksByApprovalStaffId" resultType="com.lz.modules.performance.dto.TaskListDto">
SELECT DISTINCT(record_id),f.flow_process,f.flow_name,current_approval_staff_id,staff_id,start_id,r.gmt_modified,f.type from lz_flow_record f
SELECT DISTINCT(record_id),f.flow_process,f.flow_name,f.approval_staff_id,f.record_staff_id,start_id,r.gmt_modified,f.type from lz_flow_record f
LEFT JOIN lz_result_record r
ON f.record_id = r.id
where f.is_delete=0 and r.is_delete=0

View File

@ -126,7 +126,7 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_result_score"));
list.add(new TablesBean("lz_result_detail"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();