|
|
@@ -1,5 +1,6 @@
|
|
|
package com.hotent.project.manager.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -20,6 +21,7 @@ import com.hotent.baseInfo.model.CostDictData;
|
|
|
import com.hotent.baseInfo.model.CostDistrict;
|
|
|
import com.hotent.baseInfo.req.CostProjectSupervisePageReq;
|
|
|
import com.hotent.baseInfo.req.CostTaskSearchReq;
|
|
|
+import com.hotent.constant.BaseConstant;
|
|
|
import com.hotent.constant.NodeConstant;
|
|
|
import com.hotent.constant.TaskStatusConstant;
|
|
|
import com.hotent.enterpriseDeclare.req.CostTaskPageReq;
|
|
|
@@ -35,11 +37,13 @@ import com.hotent.surveyinfo.model.CostSurveyTemplateUpload;
|
|
|
import com.hotent.sys.persistence.manager.DataDictManager;
|
|
|
import com.hotent.sys.persistence.model.DataDict;
|
|
|
import com.hotent.uc.api.model.IUser;
|
|
|
+import com.hotent.uc.exception.BaseException;
|
|
|
import com.hotent.uc.manager.OrgManager;
|
|
|
import com.hotent.uc.manager.UserManager;
|
|
|
import com.hotent.uc.model.Org;
|
|
|
import com.hotent.uc.model.User;
|
|
|
import com.hotent.uc.util.ContextUtil;
|
|
|
+import com.hotent.util.AreaCodeUtil;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
@@ -182,11 +186,10 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
// 获取当前用户
|
|
|
IUser currentUser = ContextUtil.getCurrentUser();
|
|
|
String currentUserId = currentUser.getUserId();
|
|
|
-
|
|
|
+ User user = userService.getById(currentUserId);
|
|
|
LambdaQueryWrapper<CostProjectApproval> approvalQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (req.getType().equals(1) || req.getType().equals(2)) {
|
|
|
- String userId = currentUser.getUserId();
|
|
|
- User user = userService.getById(userId);
|
|
|
+
|
|
|
Integer dataScope = user.getDataScope();
|
|
|
// 只能查自己和自己下属的
|
|
|
if(dataScope != null && dataScope != 0){
|
|
|
@@ -385,6 +388,30 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
// 主办人可以操作主任务,如果主办人可以操作,则canMemberOperate也设置为true
|
|
|
rootTask.setCanLeaderOperate(isRootLeader);
|
|
|
rootTask.setCanMemberOperate(isRootLeader);
|
|
|
+ if (rootApproval.getAreaLevel().equals(user.getDataScope().toString())) {
|
|
|
+ rootTask.setIsPermission(true);
|
|
|
+ }else {
|
|
|
+ rootTask.setIsPermission(false);
|
|
|
+ }
|
|
|
+ /*if (ObjectUtil.isNotEmpty(rootApproval.getAreaCode()) && ObjectUtil.isNotEmpty(rootApproval.getAreaLevel())) {
|
|
|
+ //如果是区县级
|
|
|
+ if (BaseConstant.REGION_LEVEL_COUNTY.equals(rootApproval.getAreaLevel())) {
|
|
|
+ String cityCode = AreaCodeUtil.getCityCode(rootApproval.getAreaCode());
|
|
|
+ String provinceCode = AreaCodeUtil.getProvinceCode(cityCode);
|
|
|
+ rootTask.setCity(cityCode);
|
|
|
+ rootTask.setProvince(provinceCode);
|
|
|
+ rootTask.setCounty(rootApproval.getAreaCode());
|
|
|
+ } else if (BaseConstant.REGION_LEVEL_CITY.equals(rootApproval.getAreaLevel())) {
|
|
|
+ String provinceCode = AreaCodeUtil.getProvinceCode(rootApproval.getAreaCode());
|
|
|
+ rootTask.setProvince(provinceCode);
|
|
|
+ rootTask.setCity(rootApproval.getAreaCode());
|
|
|
+ } else if (BaseConstant.REGION_LEVEL_PROVINCE.equals(rootApproval.getAreaLevel())) {
|
|
|
+ rootTask.setProvince(rootApproval.getAreaCode());
|
|
|
+ } else {
|
|
|
+ rootTask.setProvince("未知编码");
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
} else {
|
|
|
// 如果没有找到对应的approval,默认设置为false
|
|
|
rootTask.setCanLeaderOperate(false);
|
|
|
@@ -424,7 +451,11 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
if (childApproval != null) {
|
|
|
String childLeaderIds = childApproval.getLeaderIds();
|
|
|
String childProjectMembers = childApproval.getProjectMembers();
|
|
|
-
|
|
|
+ if (childApproval.getAreaLevel().equals(user.getDataScope().toString())) {
|
|
|
+ childTask.setIsPermission(true);
|
|
|
+ }else {
|
|
|
+ childTask.setIsPermission(false);
|
|
|
+ }
|
|
|
// 判断当前用户是否是主办人
|
|
|
boolean isChildLeader = false;
|
|
|
if (StringUtil.isNotEmpty(childLeaderIds)) {
|
|
|
@@ -814,7 +845,7 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
costProjectTaskManager.updateById(task);
|
|
|
|
|
|
AuditedUnit auditedUnit = auditedUnitManager.get(enterpriseId);
|
|
|
- User serviceByAccount = userService.getByAccount(auditedUnit.getAccount());
|
|
|
+ User serviceByAccount = userService.getById(auditedUnit.getAccount());
|
|
|
costNoticeManager.sendNotice(task.getProjectId()
|
|
|
, task.getId(), "1"
|
|
|
, title, content
|
|
|
@@ -1142,6 +1173,13 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
if (!"0".equals(task.getPid())) {
|
|
|
return "仅支持主任务进行此操作";
|
|
|
}
|
|
|
+ List<CostProjectTask> taskByProjectId = costProjectTaskManager.findTaskByProjectId(task.getProjectId(), null);
|
|
|
+ List<CostProjectTask> projectTasks = taskByProjectId.stream().filter(t -> !t.getPid().equals("0")).collect(Collectors.toList());
|
|
|
+ List<CostProjectTask> taskList = taskByProjectId.stream().filter(t -> t.getStatus().equals("300") || t.getStatus().equals("400")).collect(Collectors.toList());
|
|
|
+ if (projectTasks.size()==taskList.size()) {
|
|
|
+ throw new BaseException("子任务全部中止或办结,无法扭转下一步!");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
ProjectReviewIssue reviewIssue = projectReviewIssueManager.findByProjectId(task.getProjectId());
|
|
|
if (reviewIssue!=null) {
|
|
|
@@ -1497,7 +1535,7 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
|
|
|
// 统计完成和未完成的任务
|
|
|
long finishCount = tasks.stream()
|
|
|
- .filter(task -> TaskStatusConstant.COMPLETED.getStatusCode().equals(task.getStatus()))
|
|
|
+ .filter(task ->task.getIsGd()!=null && task.getIsGd().equals("1"))
|
|
|
.count();
|
|
|
long nFinishCount = tasks.size() - finishCount;
|
|
|
|
|
|
@@ -1662,8 +1700,13 @@ public class CostProjectTaskManagerImpl extends BaseManagerImpl<CostProjectTaskD
|
|
|
@Override
|
|
|
public List<CostProjectTask> findTaskByProjectId(String projectId, String enterpriseId) {
|
|
|
QueryWrapper<CostProjectTask> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("project_id",projectId);
|
|
|
- wrapper.eq("audited_unit_id",enterpriseId);
|
|
|
+ if (StringUtil.isNotEmpty(projectId)) {
|
|
|
+ wrapper.eq("project_id",projectId);
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotEmpty(enterpriseId)) {
|
|
|
+ wrapper.eq("audited_unit_id",enterpriseId);
|
|
|
+ }
|
|
|
+
|
|
|
return this.list(wrapper);
|
|
|
}
|
|
|
|