提交候tgit

This commit is contained in:
quyixiao 2020-12-15 16:31:58 +08:00
commit 72f9918bab
13 changed files with 177 additions and 35 deletions

View File

@ -19,6 +19,7 @@ import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.resp.Step;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.*;
@ -27,6 +28,7 @@ import com.lz.modules.flow.service.*;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dto.ResultTaskDto;
import com.lz.modules.performance.dto.StaffTypeDto;
import com.lz.modules.performance.req.ResultUpdateTaskReq;
import com.lz.modules.performance.entity.ResultTask;
@ -48,6 +50,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.commons.lang.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
@ -134,9 +137,13 @@ public class ResultRecordController extends AbstractController {
private ResourceService resourceService;
@Autowired
private ChartResultService chartResultService;
@Autowired
private FlowStartService flowStartService;
@Autowired
private ResultTaskService resultTaskService;
@Autowired
private StaffOccupationService staffOccupationService;
@ -632,6 +639,44 @@ public class ResultRecordController extends AbstractController {
resultRecordDetailDto.setWeight(weight);
resultRecordDetailDto.setRecortModelDtos(resultRecortModelDtos);
//增加导出所需数据
List<String> depIds = Lists.newArrayList(resultRecord.getDepartmentId());
Map<Long, List<String>> map = departmentsService.selectDepartmentTreeByDepIds(depIds);
List<String> names = map.get(Long.valueOf(resultRecord.getDepartmentId()));
if(CollectionUtils.isNotEmpty(names)){
Collections.reverse(names);
int size = names.size();
if(size>0 && StringUtils.isNotBlank(names.get(0))){
resultRecordDetailDto.setDepartmentOne(names.get(0));
}
if(size>1 && StringUtils.isNotBlank(names.get(1))){
resultRecordDetailDto.setDepartmentTwo(names.get(1));
}
if(size>2 && StringUtils.isNotBlank(names.get(2))){
resultRecordDetailDto.setDepartmentThree(names.get(2));
}
}
List<Long> staffIds = Lists.newArrayList(resultRecord.getStaffId());
List<StaffTypeDto> staffTypeDtos = staffOccupationService.selectStaffTypesByStaffIds(staffIds);
if(CollectionUtils.isNotEmpty(staffTypeDtos)){
resultRecordDetailDto.setPosition(staffTypeDtos.get(0).getPosition());
}
FlowStart flowStart = flowStartService.selectFlowStartById(resultRecord.getStartId());
if(flowStart != null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
String startDate = sdf.format(flowStart.getStartTime());
if(flowStart.getCycleType().intValue() != 0){
String endDate = sdf.format(flowStart.getEndTime());
resultRecordDetailDto.setAssessCycle(startDate + "" + endDate );
}else{
resultRecordDetailDto.setAssessCycle(startDate);
}
}
return R.ok().put("data", resultRecordDetailDto);
}
@ -767,6 +812,7 @@ public class ResultRecordController extends AbstractController {
resultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
List<ResultDetail> updateResultDetails = new ArrayList<>();
List<ResultDetail> editResultDetails = new ArrayList<>();//涉及到修改的指标保存方便后面生成修改记录
//获取当前绩效的节点
boolean isSetKeyResult = false;
@ -802,11 +848,15 @@ public class ResultRecordController extends AbstractController {
BeanUtils.copyProperties(detailDto, resultDetail);
if(!isSetKeyResult){
if(resultDetail.getIsDelete() != null && resultDetail.getIsDelete().intValue() == 1){//被删除了
log.info("指标被删除了");
resultDetail.setIsBack(2);
resultDetail.setBackId(resultDetail.getId());
updateResultDetails.add(resultDetail);
editResultDetails.add(resultDetail);
}else if(resultDetail.getId() == null){
resultDetail.setIsBack(3);//新增
editResultDetails.add(resultDetail);//插入数据库之后会生成id
log.info("新增指标");
}else {
if(resultDetail.getId() != null && mapDetails.containsKey(resultDetail.getId())){
//这里判断是否有更新或者删除
@ -817,15 +867,18 @@ public class ResultRecordController extends AbstractController {
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识
log.info("修改名称");
isUp = true;
}
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
//打上标识
log.info("修改关键结果");
isUp = true;
}
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识
log.info("修改权重");
isUp = true;
}
if(isUp){
@ -833,6 +886,7 @@ public class ResultRecordController extends AbstractController {
resultDetail1.setIsBack(2);
resultDetail1.setBackId(resultDetail.getId());
inserts.add(resultDetail1);
editResultDetails.add(resultDetail1);//插入数据库之后会生成id
}
}
}
@ -907,16 +961,11 @@ public class ResultRecordController extends AbstractController {
}
}
//下面不限权重的计算权重之和是否超标
/*if(model.getWeight() != null && model.getWeight().compareTo(BigDecimal.ZERO) != 0
&& weight.compareTo(model.getWeight()) == 1){
return R.error(model.getName() + "的指标之和不能超过" + model.getWeight().multiply(BigDecimal.valueOf(100)) + "%");
}*/
}
//下面更新指标记录
/*if(inserts.size() > 0){
if(inserts.size() > 0){
resultDetailService.saveBatch(inserts);
}*/
}
if(updates.size() > 0){
resultDetailService.updateBatchById(updates);
}
@ -933,21 +982,21 @@ public class ResultRecordController extends AbstractController {
if(dto.getCommentId() != null && dto.getCommentId().intValue() > 0){
//修改评论信息
updateResultDetails.addAll(resultDetailService.selectNotNoticeResultDetailByRecordId(dto.getId())) ;
editResultDetails.addAll(resultDetailService.selectNotNoticeResultDetailByRecordId(dto.getId())) ;
log.info("可能需要写入评论的内容条数{}", updateResultDetails.size());
//去重
mapDetails = updateResultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
updateResultDetails = mapDetails.values().stream().collect(Collectors.toList());
mapDetails = editResultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
editResultDetails = mapDetails.values().stream().collect(Collectors.toList());
if(!isSetKeyResult){
log.info("实际需要写入评论的内容条数{}", updateResultDetails.size());
if(updateResultDetails.size() > 0){
if(editResultDetails.size() > 0){
updates.addAll(inserts);
mapDetails = updates.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
String commandValue = "";
int commandIndex = 1;
for (ResultDetail resultDetail1:updateResultDetails
for (ResultDetail resultDetail1:editResultDetails
) {
log.info("修改的对象为{}", resultDetail1);
if(resultDetail1.getIsDelete().intValue() == 1){
@ -1014,7 +1063,7 @@ public class ResultRecordController extends AbstractController {
}
}
}else{
for (ResultDetail resultDetail1:updateResultDetails
for (ResultDetail resultDetail1:editResultDetails
) {
if(resultDetail1.getIsBack().intValue() == 3){
resultDetail1.setIsBack(0);
@ -1023,7 +1072,7 @@ public class ResultRecordController extends AbstractController {
}
}
}
resultDetailService.updateBatchById(updateResultDetails);
resultDetailService.updateBatchById(editResultDetails);
}
return R.ok();

View File

@ -85,6 +85,22 @@ public class ResultRecordDetailDto {
List<ResultRecortModelDto> recortModelDtos;
@ApiModelProperty(value = "当前指标权重之和", name = "weight")
BigDecimal weight;
//新增导出所需数据
@ApiModelProperty(value = "考核周期", name = "assessCycle")
private String assessCycle;
//一级部门
@ApiModelProperty(value = "一级部门", name = "departmentOne")
private String departmentOne;
//二级部门
@ApiModelProperty(value = "二级部门", name = "departmentTwo")
private String departmentTwo;
//三级部门
@ApiModelProperty(value = "三级部门", name = "departmentThree")
private String departmentThree;
@ApiModelProperty(value = "职位", name = "position")
private String position;
/**
*
* @return

View File

@ -260,7 +260,7 @@ 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<StartStartDto> resultRecords = new ArrayList<>();
List<StartStartDto> startStartDtos = new ArrayList<>();
for (int n = 0; n < evaluationGroups.size(); n++
) {
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
@ -307,11 +307,11 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffIds);
resultRecords.add(startDto);
startStartDtos.add(startDto);
break;
}
}
initFlowRecordAnsy(resultRecords, noticeStaff);
initFlowRecordAnsy(startStartDtos, noticeStaff);
//dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}
@ -774,7 +774,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(resultRecord.getId());
resultDetail.setStaffId(resultRecord.getStaffId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetail.setModelId(modelDto.getId());
resultDetails.add(resultDetail);

View File

@ -710,7 +710,7 @@ public class DingtalkBusiness {
} else {
url += "?halokit=" + System.currentTimeMillis();
}
url += ("&detail=1&id=" + resultDetail.getRecordId());
url += ("&detail=1&id=" + resultDetail.getRecordId() + "&detailId=" + resultDetail.getId());
url = URLEncoder.encode(url);
@ -720,7 +720,7 @@ public class DingtalkBusiness {
if (token != null && token.length() > 0) {
StaffSimpleInfo fromStaffSimpleInfo = staffService.selectStaffSimpleInfo(taskProcessRecord.getStaffId());
if (taskProcessRecord.getStaffId().longValue() != resultDetail.getId().longValue()) {
if (taskProcessRecord.getStaffId().longValue() != resultDetail.getStaffId().longValue()) {
//自己评论自己的不允许给自己发消息
StaffSimpleInfo toStaffSimpleInfo = staffService.selectStaffSimpleInfo(resultDetail.getStaffId());
@ -760,7 +760,7 @@ public class DingtalkBusiness {
info.setEmployeeId(userIds);
logger.info("推送的人员信息{}", info);
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_REPLY_COMMENT.getTitle(),
WorkMsgTypeEnum.TASK_REPLY_COMMENT.getContent(), WorkMsgTypeEnum.TASK_REPLY_COMMENT.getBtnText(), url, token);
content, WorkMsgTypeEnum.TASK_REPLY_COMMENT.getBtnText(), url, token);
m = 0;
userIds = "";
continue;

View File

@ -1,11 +1,13 @@
package com.lz.modules.job.task;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.enums.ResultFlowProcessEnum;
import com.lz.modules.sys.service.app.ResultRecordService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,11 +38,15 @@ public class ResultTaskNoticJob implements ITask {
@Override
public void run(String params) {
logger.info("绩效任务填写通知开始。。。");
List<Long> ids = resultRecordService.selectStaffIdsByFlowProcess(process);
List<StaffEntity> staffEntities = staffService.selectByIds(ids);
String res = dingtalkBusiness.sendTaskInputMsg(staffEntities);
logger.info("绩效任务填写通知响应:" + res);
if(CollectionUtils.isNotEmpty(ids)){
logger.info("通知人员id: " + JSON.toJSONString(ids));
List<StaffEntity> staffEntities = staffService.selectByIds(ids);
String res = dingtalkBusiness.sendTaskInputMsg(staffEntities);
logger.info("绩效任务填写通知响应:" + res);
}
}
}

View File

@ -5,20 +5,28 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.StyleSet;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.model.ResultDetailDto;
import com.lz.modules.flow.model.ResultRecordDetailDto;
import com.lz.modules.flow.model.ResultRecortModelDto;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dto.RecordDetailExportDto;
import com.lz.modules.performance.enums.ResultFlowProcessEnum;
import com.lz.modules.performance.req.ChartResultReq;
import com.lz.modules.performance.res.LevelDetailExportRes;
import com.lz.modules.performance.service.ChartResultService;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -30,6 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -43,9 +52,19 @@ import java.util.stream.Collectors;
@Slf4j
@Api(value="导出excel接口", tags={"导出表格"})
public class ExportController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ChartResultService chartResultService;
@Autowired
DingtalkBusiness dingtalkBusiness;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private StaffService staffService;
static final List<Integer> process = Lists.newArrayList(ResultFlowProcessEnum.TARGET.getStatus(), ResultFlowProcessEnum.CONFIRM.getStatus(),
ResultFlowProcessEnum.DO.getStatus(), ResultFlowProcessEnum.WRITE.getStatus());
@GetMapping("/export/levelDetail")
@ApiOperation("导出等级详情")
@ -87,7 +106,15 @@ public class ExportController {
}
@GetMapping("/testDingTalkTask")
public void testDingTalkTask(){
List<Long> ids = resultRecordService.selectStaffIdsByFlowProcess(process);
log.info(JSON.toJSONString(ids));
List<Long> objects = Lists.newArrayList(313L,314L,294L);
List<StaffEntity> staffEntities = staffService.selectByIds(objects);
String res = dingtalkBusiness.sendTaskInputMsg(staffEntities);
logger.info("绩效任务填写通知响应:" + res);
}

View File

@ -57,6 +57,9 @@ public class ResultTaskController extends AbstractController{
@ApiOperation("任务变更记录")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskProcessRecordDto.class)})
public R changeTaskList(@RequestBody ChangeTaskListReq req){
if(req.getStaffId()==null){
req.setStaffId(getUserId());
}
PageUtils pageUtils = taskProcessRecordService.selectTaskProcessRecordsByTaskId(req);
return R.ok().put("data",pageUtils);
}

View File

@ -44,6 +44,17 @@ public class TaskProcessRecordDto {
@ApiModelProperty(value = "职位", name = "position")
private String position;
@ApiModelProperty(value = "@员工id", name = "atStaffIds")
private String atStaffIds;
@ApiModelProperty(value = "@员工姓名", name = "atStaffNames")
private String atStaffNames;
@ApiModelProperty(value = "是不是自己的评论", name = "isSelf")
private int isSelf;
private Long staffId;
private Long taskId;
private Long detailId;

View File

@ -23,4 +23,7 @@ public class ChangeTaskListReq extends BasePage {
@ApiModelProperty(value="0:记录 不传全部",name = "useType")
private Integer useType;
@ApiModelProperty(value="员工id",name = "staffId")
private Long staffId;
}

View File

@ -110,12 +110,26 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(resultTaskDto.getId());
if(taskProcessRecordDto != null){
//resultTaskDto.setLabel(taskProcessRecordDto.getLabel());
ProcessRecordEnum byType = ProcessRecordEnum.findByType(taskProcessRecordDto.getType());
Optional.ofNullable(byType).ifPresent(processRecordEnum -> resultTaskDto.setTypeDesc(byType.getDesc()));
if(finalStaffEntity !=null){
resultTaskDto.setAvatar(finalStaffEntity.getAvatar());
resultTaskDto.setStaffName(finalStaffEntity.getName());
if(taskProcessRecordDto.getUseType()==0){
ProcessRecordEnum byType = ProcessRecordEnum.findByType(taskProcessRecordDto.getType());
Optional.ofNullable(byType).ifPresent(processRecordEnum -> resultTaskDto.setTypeDesc(byType.getDesc()));
if(finalStaffEntity !=null){
resultTaskDto.setAvatar(finalStaffEntity.getAvatar());
resultTaskDto.setStaffName(finalStaffEntity.getName());
}
}
if(taskProcessRecordDto.getUseType()==1){
resultTaskDto.setTypeDesc(taskProcessRecordDto.getLabel());
StaffEntity staffEntity1 = staffService.selectStaffById(taskProcessRecordDto.getStaffId());
if(staffEntity1 !=null){
resultTaskDto.setAvatar(staffEntity1.getAvatar());
resultTaskDto.setStaffName(staffEntity1.getName());
}
}
}
});

View File

@ -140,6 +140,19 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
});
Optional.ofNullable(staffOccupationByStaffId).ifPresent(staffOccupationEntity -> dto.setPosition(staffOccupationEntity.getPosition()));
if (dto.getUseType()==1 ) {
if(dto.getStaffId().equals(req.getStaffId())){
dto.setIsSelf(1);
}
staffEntity = staffService.selectStaffById(dto.getStaffId());
Optional.ofNullable(staffEntity).ifPresent(staffEntity12 -> {
dto.setAvatar(staffEntity12.getAvatar());
dto.setStaffName(staffEntity12.getName());
StaffOccupationEntity staffOccupation= staffOccupationService.getStaffOccupationByStaffId(staffEntity12.getId());
Optional.ofNullable(staffOccupation).ifPresent(staffOccupationEntity -> dto.setPosition(staffOccupationEntity.getPosition()));
});
}
}
}

View File

@ -645,7 +645,7 @@
<select id="selectStaffIdsByFlowProcess" resultType="long">
select staff_id from lz_result_record where is_delete = 0
select DISTINCT (staff_id) from lz_result_record where is_delete = 0 and start_id !=0
and flow_process in (
<foreach collection="flowProcess" item="process" separator=",">
#{process}

View File

@ -131,7 +131,7 @@
<select id="selectTaskProcessRecordsByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
select gmt_create,remark,label,type,name,use_type,detail_id,task_id from lz_task_process_record where task_id=#{taskId}
select gmt_create,remark,label,type,name,use_type,detail_id,task_id,staff_id,at_staff_ids,at_staff_names from lz_task_process_record where task_id=#{taskId}
<if test="useType !=null">
and use_type = #{useType}
</if>
@ -143,13 +143,13 @@
</update>
<select id="selectTaskProcessRecordLastByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
select gmt_create,remark,label,type from lz_task_process_record where task_id=#{taskId} and is_delete = 0
select gmt_create,remark,label,type,use_type,task_id,detail_id,staff_id,at_staff_ids,at_staff_names from lz_task_process_record where task_id=#{taskId} and is_delete = 0
order by id desc limit 1
</select>
<select id="selectTaskProcessRecordsByTaskIdsAndType" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
select gmt_create,remark,label,type,use_type,task_id,detail_id from lz_task_process_record where is_delete = 0
select gmt_create,remark,label,type,use_type,task_id,detail_id,staff_id,at_staff_ids,at_staff_names from lz_task_process_record where is_delete = 0
<if test="useType !=null">
and use_type = #{useType}
</if>