提交修改
This commit is contained in:
parent
0f43b2697e
commit
8f32cab62e
@ -16,10 +16,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -92,9 +89,12 @@ public class RecordRoleController {
|
||||
}
|
||||
}
|
||||
recordRoleAuths = recordRoleAuthService.selectByRoleId(role.getRoleId());
|
||||
Map<Long, RecordRoleAuth> staffEntityMap = recordRoleAuths.stream().collect(Collectors.toMap(RecordRoleAuth::getAuthId,p->p));
|
||||
Map<Long, RecordRoleAuth> staffEntityMap = new HashMap<>();
|
||||
for(RecordRoleAuth auth : recordRoleAuths){
|
||||
staffEntityMap.put(auth.getAuthId(),auth);
|
||||
}
|
||||
for(Long menuId:menuIds){
|
||||
if(menuId <= 0 ){
|
||||
if(menuId <= 0 || (menuId.toString().endsWith("000000"))){
|
||||
continue;
|
||||
}
|
||||
RecordRoleAuth recordRoleAuth = staffEntityMap.get(menuId);
|
||||
|
||||
@ -27,4 +27,5 @@ public class Auth {
|
||||
private int keyResult35;
|
||||
private int keyResult37;
|
||||
private int editScore;
|
||||
private int deleteDetail;
|
||||
}
|
||||
|
||||
@ -107,7 +107,9 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(auths)) {
|
||||
map = auths.stream().collect(Collectors.toMap(RecordAuth::getIdentity, RecordAuth::getStatus));
|
||||
for(RecordAuth recordAuth : auths){
|
||||
map.put(recordAuth.getIdentity(),recordAuth.getStatus());
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(JSON.toJSONString(map),Auth.class);
|
||||
}
|
||||
|
||||
@ -134,11 +134,7 @@ public class RecordRoleServiceImpl extends ServiceImpl<RecordRoleMapper, RecordR
|
||||
for (int j = i; j < recordAuths.size(); j++) {
|
||||
child = recordAuths.get(j);
|
||||
if (!child.getIdentity().equals(recordAuth.getIdentity())) {
|
||||
if (j == recordAuths.size() - 1) {
|
||||
i = j;
|
||||
} else {
|
||||
i = j - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
String name = "不可见";
|
||||
|
||||
@ -63,7 +63,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
ResultRecord initResult(Long staffId ,Integer recordType,Long roleId) ;
|
||||
|
||||
R checkApproval(Long recordId);
|
||||
R checkApproval(ResultRecord resultRecord,Long userId);
|
||||
|
||||
int getDepartmentLevelIndex(List<Flow> list, int flowIndex);
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.app.utils.t.TwoTuple;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.enums.FlowRecordEnum;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.model.TypeFlowDto;
|
||||
import com.lz.modules.flow.model.TypeRoleDto;
|
||||
@ -41,6 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -353,7 +355,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R checkApproval(Long recordId){
|
||||
public R checkApproval(ResultRecord resultRecord,Long userId){
|
||||
Long recordId = resultRecord.getId();
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
|
||||
if (CollectionUtils.isEmpty(resultDetails)) {
|
||||
return R.error("请先添加绩效。");
|
||||
@ -362,16 +365,28 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
if (sum < 0.7) {
|
||||
return R.error("recordId为[" + recordId + "]绩效权重之和必需等于0.7。");
|
||||
}
|
||||
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
|
||||
List<RecordAuth> listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(userId));
|
||||
Auth auth = recordAuthService.getAuth(listAuth);
|
||||
// 如果是评分,查看是不是所有内容都己经评分
|
||||
if(auth.getEditScore() == 1 ){
|
||||
for(ResultDetail resultDetail : resultDetails ){
|
||||
if(resultDetail.getAcquireScore().compareTo(BigDecimal.ZERO) <= 0 ){
|
||||
return R.error("resultDetail[" + resultDetail.getId() + "] 评分必需 > 0 ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R approval(Long resultRecordId, Long userId) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
R r = resultRecordService.checkApproval(resultRecordId);
|
||||
R r = resultRecordService.checkApproval(resultRecord,userId);
|
||||
if (!r.isSuccess()) {
|
||||
return r;
|
||||
}
|
||||
|
||||
StaffEntity mySelf = staffService.selectStaffById(userId);
|
||||
TwoTuple<Long, List<FlowDepartment>> flowInfo = getFlowInfo(resultRecord.getStaffId(), resultRecord.getType());
|
||||
Long flowId = flowInfo.getFirst();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user