自动配置项目可见性,修改提交审核可见性逻辑

master
OathK1per 2021-12-30 16:56:22 +08:00
parent 2e39095430
commit 8bb6453d14
2 changed files with 28 additions and 1 deletions

View File

@ -8,8 +8,10 @@ import cn.palmte.work.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.jfunc.common.db.utils.Pagination;
import top.jfunc.common.utils.CollectionUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -35,6 +37,10 @@ public class ProjectEstimateService {
private ProjectRepository projectRepository;
@Autowired
private SysConfigService sysConfigService;
@Autowired
private Pagination pagination;
@Autowired
private ProjectVisibleRepository projectVisibleRepository;
public void clearEstimate(Project project){
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
@ -277,6 +283,27 @@ public class ProjectEstimateService {
}else {
//第一次或者重新发起一个流程实例【第一次或者以前的审批都已经过了】
projectInstanceService.startEstimateProcessInstance(projectInDb, admin);
int type = projectInDb.getType();
List<SysUserRole> userIds = new ArrayList<>();
if (type == 1) {
String sql = "select sur.user_id from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sr.is_deleted = 0 and sur.is_deleted = 0 and sr.level in (1,2,3,4,5,6)";
userIds = pagination.find(sql, SysUserRole.class);
} else if (type == 2) {
String sql = "select sur.user_id from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sr.is_deleted = 0 and sur.is_deleted = 0 and sr.level in (1,2,3,5,6)";
userIds = pagination.find(sql, SysUserRole.class);
} else if (type == 3) {
String sql = "select sur.user_id from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sr.is_deleted = 0 and sur.is_deleted = 0 and sr.level in (1,2,3,6)";
userIds = pagination.find(sql, SysUserRole.class);
}
List<ProjectVisible> pvs = new ArrayList<>();
for (SysUserRole sysUserRole : userIds) {
ProjectVisible pv = new ProjectVisible();
pv.setProjectId(projectInDb.getId());
pv.setType(2);
pv.setTid(sysUserRole.getUserId());
pvs.add(pv);
}
projectVisibleRepository.save(pvs);
}
}

View File

@ -278,7 +278,7 @@
onclick="location.href='${base}/project/detail?id=${list.id}'"><span
class="am-icon-pencil-square-o"></span>查看
</button>-->
<#if list.approveStatusEstimate == 0 || list.approveStatusBudget == 0 || list.approveStatusSettle == 0 || list.approveStatusFinal == 0>
<#if (list.creatorId==adminId && list.approveStatusEstimate == 0) || (list.creatorId==adminId && list.approveStatusBudget == 0) || (admin.getRoleLevel() = 6 && list.approveStatusSettle == 0) || ((admin.getRoleLevel() = 2 || admin.getRoleLevel() = 6) && list.approveStatusFinal == 0)>
<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="approveProject(${list.id})"><span