提交修改
This commit is contained in:
parent
17dcef05d1
commit
a2b44bac4e
@ -913,10 +913,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
r.put("waitTime", 3);
|
||||
r.put("sure", 0);
|
||||
return r.put("commentId",commentId);
|
||||
return r.put("commentId", commentId);
|
||||
}
|
||||
|
||||
public R apply( ApprovalDto approvalDto){
|
||||
public R apply(ApprovalDto approvalDto) {
|
||||
switch (approvalDto.getStatus()) {
|
||||
case 1: //1 提交审批,审批通过
|
||||
return newSubmit(approvalDto, null);
|
||||
@ -943,6 +943,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return transfer(approvalDto);
|
||||
case 9:
|
||||
return reset(approvalDto);
|
||||
case 10:
|
||||
return rejectN(approvalDto);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -950,6 +952,57 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
|
||||
private R rejectN(ApprovalDto approvalDto) {
|
||||
FlowRecord f = flowRecordService.selectFlowRecordById(approvalDto.getFlowRecordId());
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(f.getRecordId());
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdGeFlowIndex(f.getRecordId(), f.getFlowIndex());
|
||||
boolean flag = false;
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
// 如果结果录入己经走了
|
||||
if (new Integer(2).equals(flowRecord.getFlowProcess()) && (flowRecord.getStatus() == 1 || flowRecord.getStatus() == 4)) {
|
||||
flowRecord.setStatus(4); //表示流程己经被重置
|
||||
flag = true;
|
||||
} else {
|
||||
if (flowRecord.getStatus() == 4 && f.getId().equals(flowRecord.getId())) {
|
||||
flowRecord.setStatus(0); //表示流程己经被重置
|
||||
} else if (flowRecord.getStatus() == 4) {
|
||||
log.info(flowRecord.getId() + " 跳过不我重置... ");
|
||||
} else {
|
||||
flowRecord.setStatus(0); //表示流程己经被重置
|
||||
}
|
||||
}
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}
|
||||
|
||||
FlowRecord preFlowRecord = flowRecordService.selectPreFlowRecordByRecordIdMinIdStatusList(f.getRecordId(), f.getFlowIndex(), Arrays.asList(1, 2, 4));
|
||||
List<FlowRecord> runing = new ArrayList<>();
|
||||
if (preFlowRecord != null) {
|
||||
runing = flowRecordService.selectFlowRecordByRecordIdFlowIndex(f.getRecordId(), preFlowRecord.getFlowIndex());
|
||||
} else {
|
||||
runing = flowRecordService.selectFlowRecordByRecordIdFlowIndex(f.getRecordId(), 0);
|
||||
}
|
||||
for (FlowRecord r : runing) {
|
||||
r.setStatus(2);
|
||||
resultRecord.setFlowProcess(r.getFlowProcess());
|
||||
flowRecordService.updateFlowRecordById(r);
|
||||
}
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
if (flag) { //如果录入己经走了,设置新的数据,结果录入己走
|
||||
List<FlowRecord> newflowRecords = flowRecordService.selectFlowRecordByRecordId(f.getRecordId());
|
||||
for (int i = 0; i < newflowRecords.size(); i++) {
|
||||
FlowRecord newFlowRecord = newflowRecords.get(i);
|
||||
if (new Integer(2).equals(newFlowRecord.getFlowProcess())) {
|
||||
newFlowRecord.setStatus(4);
|
||||
flowRecordService.updateFlowRecordById(newFlowRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultRecordService.resetData(resultRecord.getId(), 2);
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(resultRecord.getId(), WorkMsgTypeEnum.REJECT.getType());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
private R reset(ApprovalDto approvalDto) {
|
||||
|
||||
switch (approvalDto.getResetFlag()) {
|
||||
@ -964,20 +1017,20 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
private R resetNode(ApprovalDto approvalDto) {
|
||||
FlowRecord f = flowRecordService.selectFlowRecordById(approvalDto.getFlowRecordId());
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(f.getRecordId());
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdGeFlowIndex(f.getRecordId(),f.getFlowIndex());
|
||||
boolean flag = false ;
|
||||
for(FlowRecord flowRecord:flowRecords){
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdGeFlowIndex(f.getRecordId(), f.getFlowIndex());
|
||||
boolean flag = false;
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
// 如果结果录入己经走了
|
||||
if (new Integer(2).equals(flowRecord.getFlowProcess()) && (flowRecord.getStatus() == 1 || flowRecord.getStatus() == 4) ) {
|
||||
if (new Integer(2).equals(flowRecord.getFlowProcess()) && (flowRecord.getStatus() == 1 || flowRecord.getStatus() == 4)) {
|
||||
flowRecord.setStatus(4); //表示流程己经被重置
|
||||
flag = true;
|
||||
}else{
|
||||
} else {
|
||||
flowRecord.setStatus(0); //表示流程己经被重置
|
||||
}
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}
|
||||
|
||||
FlowRecord preFlowRecord = flowRecordService.selectPreFlowRecordByRecordIdMinIdStatusList(f.getRecordId(), f.getFlowIndex(), Arrays.asList(1, 2,4));
|
||||
FlowRecord preFlowRecord = flowRecordService.selectPreFlowRecordByRecordIdMinIdStatusList(f.getRecordId(), f.getFlowIndex(), Arrays.asList(1, 2, 4));
|
||||
List<FlowRecord> runing = new ArrayList<>();
|
||||
if (preFlowRecord != null) {
|
||||
runing = flowRecordService.selectFlowRecordByRecordIdFlowIndex(f.getRecordId(), preFlowRecord.getFlowIndex());
|
||||
@ -990,17 +1043,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowRecordService.updateFlowRecordById(r);
|
||||
}
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
if(flag) { //如果录入己经走了,设置新的数据,结果录入己走
|
||||
if (flag) { //如果录入己经走了,设置新的数据,结果录入己走
|
||||
List<FlowRecord> newflowRecords = flowRecordService.selectFlowRecordByRecordId(f.getRecordId());
|
||||
for(int i = 0 ;i < newflowRecords.size() ; i ++){
|
||||
FlowRecord newFlowRecord = newflowRecords.get(i) ;
|
||||
if (new Integer(2).equals(newFlowRecord.getFlowProcess()) ) {
|
||||
for (int i = 0; i < newflowRecords.size(); i++) {
|
||||
FlowRecord newFlowRecord = newflowRecords.get(i);
|
||||
if (new Integer(2).equals(newFlowRecord.getFlowProcess())) {
|
||||
newFlowRecord.setStatus(4);
|
||||
flowRecordService.updateFlowRecordById(newFlowRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultRecordService.resetData(resultRecord.getId(),2);
|
||||
resultRecordService.resetData(resultRecord.getId(), 2);
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(resultRecord.getId(), WorkMsgTypeEnum.RESET.getType());
|
||||
return R.ok();
|
||||
}
|
||||
@ -1010,27 +1063,27 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
FlowRecord flowRecord = flowRecordService.selectFlowRecordById(approvalDto.getFlowRecordId());
|
||||
Long resultRecordId = approvalDto.getResultRecordId();
|
||||
|
||||
if(flowRecord != null ){
|
||||
resultRecordId = flowRecord.getRecordId();
|
||||
if (flowRecord != null) {
|
||||
resultRecordId = flowRecord.getRecordId();
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(resultRecordId);
|
||||
List<Long> flowRecordIds =new ArrayList<>();
|
||||
boolean flag = false ;
|
||||
for(FlowRecord f: flowRecords){
|
||||
List<Long> flowRecordIds = new ArrayList<>();
|
||||
boolean flag = false;
|
||||
for (FlowRecord f : flowRecords) {
|
||||
flowRecordIds.add(f.getId());
|
||||
//如果录入己经走了,则重置数据后,结果录入还是默认己走
|
||||
if (new Integer(2).equals(f.getFlowProcess()) && (f.getStatus() == 1 || f.getStatus() == 4 )) {
|
||||
if (new Integer(2).equals(f.getFlowProcess()) && (f.getStatus() == 1 || f.getStatus() == 4)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
flowRecordService.deleteFlowRecordByRecordId(resultRecordId);
|
||||
initFlowRecord(resultRecordId);
|
||||
List<FlowRecord> newflowRecords = flowRecordService.selectFlowRecordByRecordId(resultRecordId);
|
||||
for(int i = 0 ;i < newflowRecords.size() ; i ++){
|
||||
flowRecordService.updateFlowRecordIdById(newflowRecords.get(i).getId(),flowRecordIds.get(i));
|
||||
if(flag ){ //如果录入己经走了,设置新的数据,结果录入己走
|
||||
FlowRecord newFlowRecord = newflowRecords.get(i) ;
|
||||
if (new Integer(2).equals(newFlowRecord.getFlowProcess()) ) {
|
||||
for (int i = 0; i < newflowRecords.size(); i++) {
|
||||
flowRecordService.updateFlowRecordIdById(newflowRecords.get(i).getId(), flowRecordIds.get(i));
|
||||
if (flag) { //如果录入己经走了,设置新的数据,结果录入己走
|
||||
FlowRecord newFlowRecord = newflowRecords.get(i);
|
||||
if (new Integer(2).equals(newFlowRecord.getFlowProcess())) {
|
||||
newFlowRecord.setStatus(4);
|
||||
flowRecordService.updateFlowRecordById(newFlowRecord);
|
||||
}
|
||||
@ -1041,7 +1094,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
resultRecord.setFlowProcess(0);
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
resultRecordService.resetData(resultRecordId,approvalDto.getClearFlag());
|
||||
resultRecordService.resetData(resultRecordId, approvalDto.getClearFlag());
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(resultRecord.getId(), WorkMsgTypeEnum.RESET.getType());
|
||||
return R.ok();
|
||||
}
|
||||
@ -1085,7 +1138,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
StaffEntity staffEntity = staffService.selectStaffById(approvalDto.getLoginUserId());
|
||||
if (staffEntity != null) {
|
||||
ResultComment resultComment = new ResultComment();
|
||||
if(approvalDto.getCommentId() !=null && approvalDto.getCommentId() > 0 ){
|
||||
if (approvalDto.getCommentId() != null && approvalDto.getCommentId() > 0) {
|
||||
log.info("更新前评论commentId=" + approvalDto.getCommentId());
|
||||
resultComment = resultCommentService.selectResultCommentById(approvalDto.getCommentId());
|
||||
}
|
||||
@ -1097,10 +1150,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultComment.setStaffId(staffEntity.getId());
|
||||
resultComment.setRecordId(approvalDto.getResultRecordId());
|
||||
resultComment.setOptDesc(optDesc + approvalDto.getMenuName() + flowChart.getName());
|
||||
if (approvalDto.getCommentId() !=null && approvalDto.getCommentId() > 0 ){
|
||||
if (approvalDto.getCommentId() != null && approvalDto.getCommentId() > 0) {
|
||||
resultCommentService.updateResultCommentById(resultComment);
|
||||
log.info("更新后评论commentId=" + resultComment.getId());
|
||||
}else{
|
||||
} else {
|
||||
resultCommentService.insertResultComment(resultComment);
|
||||
log.info("插入后评论commentId=" + resultComment.getId());
|
||||
}
|
||||
@ -1407,7 +1460,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowDetailResp.setStatus(status);
|
||||
StaffEntity staffEntity = staffService.selectStaffById(flowRecord.getApprovalStaffId());
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(flowRecord.getApprovalStaffId());
|
||||
if(departmentsStaffRelateEntity !=null ){
|
||||
if (departmentsStaffRelateEntity != null) {
|
||||
flowDetailResp.setAvatar(staffEntity.getAvatar());
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDetailResp.setDepartName(departmentsEntity.getDepartmentName());
|
||||
@ -1431,8 +1484,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
|
||||
public int getRole(Long loginUserId, DepartmentsStaffRelateEntity departmentsStaffRelateEntity) {
|
||||
if(departmentsStaffRelateEntity == null ){
|
||||
return 0 ;
|
||||
if (departmentsStaffRelateEntity == null) {
|
||||
return 0;
|
||||
}
|
||||
int position = 0;
|
||||
StaffRole staffRole = staffRoleService.selectStaffRolesByStaffIdDepartmentLevelList(loginUserId,
|
||||
@ -1506,17 +1559,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
@Override
|
||||
public R getResetData(RecordDetailDto recordDetailDto) {
|
||||
List<FlowRecord> flowRecordRunning = flowRecordService.selectFlowRecordByRecordIdStatus(recordDetailDto.getResultRecordId(),2);
|
||||
List<FlowRecord> flowRecordRunning = flowRecordService.selectFlowRecordByRecordIdStatus(recordDetailDto.getResultRecordId(), 2);
|
||||
List<FlowRecord> flowRecords = new ArrayList<>();
|
||||
if(CollectionUtils.isEmpty(flowRecordRunning) ){
|
||||
if (CollectionUtils.isEmpty(flowRecordRunning)) {
|
||||
flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId());
|
||||
}else{
|
||||
flowRecords = flowRecordService.selectFlowRecordByRecordIdLeFlowIndex(recordDetailDto.getResultRecordId(),flowRecordRunning.get(0).getFlowIndex() -1 );
|
||||
} else {
|
||||
flowRecords = flowRecordService.selectFlowRecordByRecordIdLeFlowIndex(recordDetailDto.getResultRecordId(), flowRecordRunning.get(0).getFlowIndex() - 1);
|
||||
}
|
||||
int flowIndex = 0;
|
||||
List<ResetDataResp> resetDataResps = new ArrayList<>();
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
if(new Integer(2).equals(flowRecord.getFlowProcess())){ //过虑掉flowProcess
|
||||
if (new Integer(2).equals(flowRecord.getFlowProcess())) { //过虑掉flowProcess
|
||||
continue;
|
||||
}
|
||||
if (flowRecord.getFlowIndex().equals(flowIndex - 1)) { //表示有重复数据
|
||||
@ -1531,39 +1584,39 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
staffNames.add(flowRecord.getApprovalStaffName());
|
||||
resetDataResp.setStaffNames(staffNames);
|
||||
resetDataResps.add(resetDataResp);
|
||||
flowIndex ++ ;
|
||||
flowIndex++;
|
||||
}
|
||||
return R.ok().put("data",resetDataResps);
|
||||
return R.ok().put("data", resetDataResps);
|
||||
}
|
||||
|
||||
//删除指标信息
|
||||
|
||||
/**
|
||||
* clearFlag == 0 全清 1 部分清包括评分标志 2只清楚评分标志
|
||||
*
|
||||
* */
|
||||
*/
|
||||
@Override
|
||||
public R resetData(Long recordId, int clearFlag) {
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
|
||||
|
||||
log.info("需要删除指标个数{}", resultDetails.size());
|
||||
if(resultDetails.size() > 0){
|
||||
if(clearFlag == 0){
|
||||
if (resultDetails.size() > 0) {
|
||||
if (clearFlag == 0) {
|
||||
log.info("全部清空,删除所有指标即可");
|
||||
resultDetailService.deleteResultDetailByRecordId(recordId);
|
||||
for(ResultDetail detail : resultDetails){
|
||||
for (ResultDetail detail : resultDetails) {
|
||||
resultScoreService.deleteResultScoreByDetailId(detail.getId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
//删除指标以外的所有数据,评分、评分说明、结果
|
||||
|
||||
for(ResultDetail detail : resultDetails){
|
||||
if(clearFlag == 1){
|
||||
for (ResultDetail detail : resultDetails) {
|
||||
if (clearFlag == 1) {
|
||||
detail.setCheckResult(null);
|
||||
detail.setAcquireScore(null);
|
||||
detail.setSuperScore(null);
|
||||
resultScoreService.deleteResultScoreByDetailId(detail.getId());
|
||||
}else{
|
||||
} else {
|
||||
resultScoreService.setNoEditScoreByDetailId(detail.getId());
|
||||
}
|
||||
|
||||
@ -1583,7 +1636,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R saveDetail(Long userId,ResultRecordDetailDto dto){
|
||||
public R saveDetail(Long userId, ResultRecordDetailDto dto) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(dto.getId());
|
||||
log.info("数据库中resultRecord{}", resultRecord);
|
||||
resultRecord.setLastScore(dto.getLastScore());
|
||||
@ -1605,15 +1658,15 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
//获取当前绩效的节点
|
||||
boolean isSetKeyResult = false;
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(dto.getId(), 2);
|
||||
if(flowRecords.size() > 0){
|
||||
if(flowRecords.get(0).getFlowProcess().intValue() < 1){
|
||||
if (flowRecords.size() > 0) {
|
||||
if (flowRecords.get(0).getFlowProcess().intValue() < 1) {
|
||||
log.info("制定目标中");
|
||||
isSetKeyResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (ResultRecortModelDto model:dto.getRecortModelDtos()
|
||||
for (ResultRecortModelDto model : dto.getRecortModelDtos()
|
||||
) {
|
||||
int index = 0;
|
||||
BigDecimal weight = BigDecimal.ZERO;
|
||||
@ -1621,46 +1674,46 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return R.error(model.getName() + "维度指标数量不能超过" + model.getMaxCount());
|
||||
}*/
|
||||
|
||||
for (ResultDetailDto detailDto:model.getDetailDtos()
|
||||
for (ResultDetailDto detailDto : model.getDetailDtos()
|
||||
) {//排序
|
||||
ResultDetail resultDetail = new ResultDetail();
|
||||
BeanUtils.copyProperties(detailDto, resultDetail);
|
||||
if(!isSetKeyResult){
|
||||
if(resultDetail.getIsDelete() != null && resultDetail.getIsDelete().intValue() == 1){//被删除了
|
||||
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){
|
||||
} else if (resultDetail.getId() == null) {
|
||||
resultDetail.setIsBack(3);//新增
|
||||
editResultDetails.add(resultDetail);//插入数据库之后会生成id
|
||||
log.info("新增指标");
|
||||
}else {
|
||||
if(resultDetail.getId() != null && mapDetails.containsKey(resultDetail.getId())){
|
||||
} else {
|
||||
if (resultDetail.getId() != null && mapDetails.containsKey(resultDetail.getId())) {
|
||||
//这里判断是否有更新,或者删除
|
||||
boolean isUp = false;
|
||||
ResultDetail resultDetail1 = null;
|
||||
resultDetail1 = mapDetails.get(resultDetail.getId());
|
||||
|
||||
|
||||
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
|
||||
if (!resultDetail.getTarget().equals(resultDetail1.getTarget())) {
|
||||
//打上标识
|
||||
log.info("修改名称");
|
||||
isUp = true;
|
||||
}
|
||||
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
|
||||
if (!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())) {
|
||||
//打上标识
|
||||
log.info("修改关键结果");
|
||||
isUp = true;
|
||||
}
|
||||
|
||||
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
|
||||
if (!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())) {
|
||||
//打上标识
|
||||
log.info("修改权重");
|
||||
isUp = true;
|
||||
}
|
||||
if(isUp){
|
||||
if (isUp) {
|
||||
resultDetail1.setId(null);
|
||||
resultDetail1.setIsBack(2);
|
||||
resultDetail1.setBackId(resultDetail.getId());
|
||||
@ -1675,11 +1728,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultDetail.setPriority(index);
|
||||
|
||||
index++;
|
||||
if(resultDetail.getId() != null){
|
||||
if (resultDetail.getId() != null) {
|
||||
updates.add(resultDetail);
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
resultDetail.setStaffId(resultRecord.getStaffId());
|
||||
resultDetail.setRecordId(resultRecord.getId());
|
||||
resultDetail.setType(model.getType());
|
||||
@ -1688,30 +1741,30 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
//inserts.add(resultDetail);
|
||||
}
|
||||
if(resultDetail.getIsDelete() != null && resultDetail.getIsDelete().intValue() == 1){
|
||||
if (resultDetail.getIsDelete() != null && resultDetail.getIsDelete().intValue() == 1) {
|
||||
//删除任务
|
||||
resultTaskService.deleteResultTasksByDetailId(resultDetail.getId());
|
||||
}else{
|
||||
} else {
|
||||
//更新任务
|
||||
if(userId.longValue() == resultRecord.getStaffId().longValue() &&
|
||||
detailDto.getTaskDtos() != null && detailDto.getTaskDtos().size() > 0){//本人编辑任务才允许提交
|
||||
if (userId.longValue() == resultRecord.getStaffId().longValue() &&
|
||||
detailDto.getTaskDtos() != null && detailDto.getTaskDtos().size() > 0) {//本人编辑任务才允许提交
|
||||
log.info("任务个数{}", detailDto.getTaskDtos().size());
|
||||
int orderBy = 0;
|
||||
for (ResultTaskDto taskDto:detailDto.getTaskDtos()
|
||||
for (ResultTaskDto taskDto : detailDto.getTaskDtos()
|
||||
) {
|
||||
if(taskDto.getId() != null && taskDto.getIsDelete() != null && taskDto.getIsDelete().intValue() == 1){
|
||||
if (taskDto.getId() != null && taskDto.getIsDelete() != null && taskDto.getIsDelete().intValue() == 1) {
|
||||
//删除
|
||||
resultTaskService.deleteTask(taskDto.getId(),userId);
|
||||
}else{
|
||||
resultTaskService.deleteTask(taskDto.getId(), userId);
|
||||
} else {
|
||||
ResultUpdateTaskReq taskReq = new ResultUpdateTaskReq();
|
||||
taskReq.setDetailId(resultDetail.getId());
|
||||
taskReq.setTaskId(taskDto.getId());
|
||||
taskReq.setName(taskDto.getName());
|
||||
taskReq.setOrderBy(orderBy);
|
||||
taskReq.setProcessRate(BigDecimal.valueOf(taskDto.getProcessRate()));
|
||||
R r = resultTaskService.saveOrUpdateResultTask(taskReq,userId);
|
||||
if((int)r.get("code") != 200){
|
||||
throw new RRException((String)r.get("msg"));
|
||||
R r = resultTaskService.saveOrUpdateResultTask(taskReq, userId);
|
||||
if ((int) r.get("code") != 200) {
|
||||
throw new RRException((String) r.get("msg"));
|
||||
}
|
||||
orderBy++;
|
||||
}
|
||||
@ -1722,18 +1775,18 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
// }
|
||||
//if(resultDetail.getIsDelete() == null || resultDetail.getIsDelete().intValue() == 0){
|
||||
BigDecimal score = BigDecimal.ZERO;
|
||||
if(detailDto.getScoreDtos() != null){
|
||||
for (ResultScoreDto scoreDto:detailDto.getScoreDtos()
|
||||
if (detailDto.getScoreDtos() != null) {
|
||||
for (ResultScoreDto scoreDto : detailDto.getScoreDtos()
|
||||
) {
|
||||
//计算得分
|
||||
ResultScore resultScore = new ResultScore();
|
||||
BeanUtils.copyProperties(scoreDto, resultScore);
|
||||
if(scoreDto.getAcquireScore() != null){
|
||||
if (scoreDto.getAcquireScore() != null) {
|
||||
score = score.add(scoreDto.getAcquireScore().multiply(scoreDto.getWeight()));
|
||||
}
|
||||
if(resultScore.getId() == null){
|
||||
if (resultScore.getId() == null) {
|
||||
insertScores.add(resultScore);
|
||||
}else{
|
||||
} else {
|
||||
updateScores.add(resultScore);
|
||||
}
|
||||
resultScore.setDetailId(detailDto.getId());
|
||||
@ -1746,75 +1799,75 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
//下面更新指标记录
|
||||
if(inserts.size() > 0){
|
||||
if (inserts.size() > 0) {
|
||||
resultDetailService.saveBatch(inserts);
|
||||
}
|
||||
if(updates.size() > 0){
|
||||
if (updates.size() > 0) {
|
||||
resultDetailService.updateBatchById(updates);
|
||||
}
|
||||
|
||||
//下面更新评分记录
|
||||
if(insertScores.size() > 0){
|
||||
if (insertScores.size() > 0) {
|
||||
resultScoreService.saveBatch(insertScores);
|
||||
}
|
||||
if(updateScores.size() > 0){
|
||||
if (updateScores.size() > 0) {
|
||||
resultScoreService.updateBatchById(updateScores);
|
||||
}
|
||||
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
String commentId = null;
|
||||
if(dto.getSave() == null){//非暂存
|
||||
if (dto.getSave() == null) {//非暂存
|
||||
//修改评论信息
|
||||
log.info("修改了多少个指标{}", editResultDetails.size());
|
||||
editResultDetails.addAll(resultDetailService.selectNotNoticeResultDetailByRecordId(dto.getId())) ;
|
||||
editResultDetails.addAll(resultDetailService.selectNotNoticeResultDetailByRecordId(dto.getId()));
|
||||
log.info("可能需要写入评论的内容条数{}", editResultDetails.size());
|
||||
//去重
|
||||
mapDetails = editResultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
|
||||
editResultDetails = mapDetails.values().stream().collect(Collectors.toList());
|
||||
if(!isSetKeyResult){
|
||||
if (!isSetKeyResult) {
|
||||
log.info("实际需要写入评论的内容条数{}", editResultDetails.size());
|
||||
if(editResultDetails.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:editResultDetails
|
||||
for (ResultDetail resultDetail1 : editResultDetails
|
||||
) {
|
||||
log.info("修改的对象为{}", resultDetail1);
|
||||
if(resultDetail1.getIsDelete() != null && resultDetail1.getIsDelete().intValue() == 1){
|
||||
if (resultDetail1.getIsDelete() != null && resultDetail1.getIsDelete().intValue() == 1) {
|
||||
commandValue += (commandIndex + ":(删除) 指标" + resultDetail1.getTarget() + "\n");
|
||||
commandIndex++;
|
||||
resultDetail1.setIsBack(1);
|
||||
}else if(resultDetail1.getIsBack().intValue() == 3){
|
||||
} else if (resultDetail1.getIsBack().intValue() == 3) {
|
||||
commandValue += (commandIndex + ":(新增) 指标" + resultDetail1.getTarget() + "\n");
|
||||
commandIndex++;
|
||||
resultDetail1.setIsBack(0);
|
||||
}else{
|
||||
} else {
|
||||
|
||||
ResultDetail resultDetail = mapDetails.get(resultDetail1.getBackId());
|
||||
if(resultDetail != null){
|
||||
if (resultDetail != null) {
|
||||
log.info("修改后的对象为{}", resultDetail1);
|
||||
boolean isUp = false;
|
||||
String value = "";
|
||||
String heard = "";
|
||||
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
|
||||
if (!resultDetail.getTarget().equals(resultDetail1.getTarget())) {
|
||||
//打上标识
|
||||
value += ("(修改) 名称:" +
|
||||
resultDetail1.getTarget()+ " \n(为):\n" + resultDetail.getTarget() + "\n");
|
||||
resultDetail1.getTarget() + " \n(为):\n" + resultDetail.getTarget() + "\n");
|
||||
isUp = true;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
heard = "指标:" + resultDetail1.getTarget() + "\n";
|
||||
}
|
||||
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
|
||||
if (!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())) {
|
||||
//打上标识
|
||||
value += ("(修改) 考核标准:" +
|
||||
resultDetail1.getKeyResult() + "\n(为):\n" + resultDetail.getKeyResult() + "\n");
|
||||
isUp = true;
|
||||
}
|
||||
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
|
||||
if (!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())) {
|
||||
//打上标识
|
||||
value += ("(修改) 权重:" +
|
||||
resultDetail1.getCheckWeight().multiply(new BigDecimal(100)).intValue() + "%\n(为):\n"
|
||||
@ -1822,7 +1875,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
"%\n");
|
||||
isUp = true;
|
||||
}
|
||||
if(isUp){
|
||||
if (isUp) {
|
||||
commandValue += (commandIndex + ":" + heard + value);
|
||||
commandIndex++;
|
||||
resultDetail1.setIsBack(1);
|
||||
@ -1831,7 +1884,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
}
|
||||
}
|
||||
if(commandValue.length() > 0){
|
||||
if (commandValue.length() > 0) {
|
||||
log.info("需要写入评论,具体呢容为{}", commandValue);
|
||||
ResultComment resultComment = new ResultComment();//resultCommentService.selectResultCommentById(dto.getCommentId());
|
||||
log.info("resultComment的值{}", resultComment);
|
||||
@ -1842,12 +1895,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
commentId = resultComment.getId().toString();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (ResultDetail resultDetail1:editResultDetails
|
||||
} else {
|
||||
for (ResultDetail resultDetail1 : editResultDetails
|
||||
) {
|
||||
if(resultDetail1.getIsBack().intValue() == 3){
|
||||
if (resultDetail1.getIsBack().intValue() == 3) {
|
||||
resultDetail1.setIsBack(0);
|
||||
}else{
|
||||
} else {
|
||||
resultDetail1.setIsBack(1);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user