From c784b78aefd07e81c9c15745184cb2dc44f097a5 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 17 一月 2025 16:51:34 +0800
Subject: [PATCH] 流程部门树不加数据权限
---
business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java | 79 +++++++++++++++------------------------
1 files changed, 31 insertions(+), 48 deletions(-)
diff --git a/business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java
index e2c80b6..78f132c 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java
@@ -9,8 +9,8 @@
import com.ycl.domain.entity.ProjectPlanInfo;
import com.ycl.domain.entity.ProjectPlanRecord;
import com.ycl.domain.form.ProjectPlanInfoForm;
+import com.ycl.domain.form.ProjectPlanInfoRequestForm;
import com.ycl.domain.query.ProjectPlanInfoQuery;
-import com.ycl.domain.vo.ProjectPlanInfoRequest;
import com.ycl.domain.vo.ProjectPlanInfoResponseVO;
import com.ycl.domain.vo.ProjectPlanInfoVO;
import com.ycl.framework.utils.PageUtil;
@@ -20,7 +20,6 @@
import com.ycl.service.ProjectPlanInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -112,7 +111,7 @@
* @return
*/
@Override
- public Result detail(Integer id) {
+ public Result detail(Long id) {
ProjectPlanInfoResponseVO vo = new ProjectPlanInfoResponseVO();
vo.setList(new LambdaQueryChainWrapper<>(baseMapper).eq(ProjectPlanInfo::getProjectPlanRecordId, id).list());
vo.setActualInvest(new LambdaQueryChainWrapper<>(projectPlanRecordMapper).eq(ProjectPlanRecord::getId, id).one().getActualInvest());
@@ -134,65 +133,57 @@
@Transactional(rollbackFor = Exception.class)
@Override
- public Result addPlanInfo(ProjectPlanInfoRequest request) {
- if (request.getAddList() == null || request.getAddList().isEmpty()) {{
- return Result.error("璇烽�夋嫨瑕佹坊鍔犵殑璁″垝椤�");
- }}
+ public Result addPlanInfo(ProjectPlanInfoRequestForm form) {
// 鍒犻櫎鍘熸湁璁板綍
new LambdaUpdateChainWrapper<>(baseMapper)
- .eq(ProjectPlanInfo::getProjectPlanRecordId, request.getProjectPlanRecordId())
- .set(ProjectPlanInfo::getDeleted, 1)
- .update();
+ .eq(ProjectPlanInfo::getProjectPlanRecordId, form.getProjectPlanRecordId())
+ .remove();
// 鎵归噺鎻掑叆鏂拌褰�
List<ProjectPlanInfo> list = new ArrayList<>();
- request.getAddList().forEach(item -> {
+ form.getAddList().forEach(item -> {
ProjectPlanInfo projectPlanInfo = new ProjectPlanInfo();
- projectPlanInfo.setProjectPlanRecordId(request.getProjectPlanRecordId().longValue());
+ projectPlanInfo.setProjectPlanRecordId(form.getProjectPlanRecordId());
projectPlanInfo.setTitle(item.getTitle()); // 璁″垝椤规爣棰�
projectPlanInfo.setPlanStatus(0); // 璁″垝椤圭姸鎬佷负鏈紑濮�
projectPlanInfo.setProgressStatus(0); // 璁″垝椤硅繘搴︿负鏈紑濮�
projectPlanInfo.setStartTime(item.getStartTime()); // 璁″垝椤瑰紑濮嬫椂闂�
projectPlanInfo.setEndTime(item.getEndTime()); // 璁″垝椤圭粨鏉熸椂闂�
- projectPlanInfo.setDeleted(0);// 鏈垹闄�
list.add(projectPlanInfo);
});
- list.stream().forEach(i -> {
- baseMapper.insert(i);
- });
+ this.saveBatch(list);
// 鏇存柊璁″垝璁板綍鐨勬姇璧�,浠ュ強涓婃姤鐘舵��
new LambdaUpdateChainWrapper<>(projectPlanRecordMapper)
- .eq(ProjectPlanRecord::getId, request.getProjectPlanRecordId())
- .set(ProjectPlanRecord::getActualInvest, request.getActualInvest())
+ .eq(ProjectPlanRecord::getId, form.getProjectPlanRecordId())
+ .set(ProjectPlanRecord::getActualInvest, form.getActualInvest())
.set(ProjectPlanRecord::getReportStatus, 0)
.update();
// 鏂板涓�鏉″鏍歌褰�
- ProjectPlanExamineRecord item = new ProjectPlanExamineRecord();
- item.setProjectPlanRecordId(request.getProjectPlanRecordId().longValue());
- item.setEventType(0); // 璁″垝涓婃姤
- item.setGmtCreate(new Date()); // 鍒涘缓鏃堕棿
- item.setDeleted(0); // 鏈垹闄�
- list.stream().forEach(i -> {
- item.setProjectPlanInfoId(i.getId().longValue());
+ for (ProjectPlanInfo i : list){
+ ProjectPlanExamineRecord item = new ProjectPlanExamineRecord();
+ item.setProjectPlanRecordId(form.getProjectPlanRecordId());
+ item.setEventType(0); // 璁″垝涓婃姤
+ item.setProjectPlanInfoId(i.getId());
projectPlanExamineRecordMapper.insert(item);
- });
+ }
return Result.ok("娣诲姞鎴愬姛");
}
@Override
- public Result savePlanInfo(ProjectPlanInfo item, Integer planRecordId) {
- item.setProjectPlanRecordId(planRecordId.longValue()); // 椤圭洰璁″垝璁板綍id
- item.setProgressStatus(0); // 鏈紑濮�
- item.setDeleted(0); // 鏈垹闄�
- item.setPlanStatus(0); // 鏈鏍�
+ public Result savePlanInfo(ProjectPlanInfoForm form, Long planRecordId) {
+ ProjectPlanInfo entity = new ProjectPlanInfo();
+ BeanUtils.copyProperties(form, entity);
+ entity.setProjectPlanRecordId(planRecordId); // 椤圭洰璁″垝璁板綍id
+ entity.setProgressStatus(0); // 鏈紑濮�
+ entity.setPlanStatus(0); // 鏈鏍�
// 鍒ゆ柇id鏄惁瀛樺湪锛屽瓨鍦ㄥ垯鏇存柊锛屼笉瀛樺湪鍒欐柊澧�
- if (item.getId() == null) {
- baseMapper.insert(item);
+ if (entity.getId() == null) {
+ baseMapper.insert(entity);
} else {
- new LambdaUpdateChainWrapper<>(baseMapper).eq(ProjectPlanInfo::getId, item.getId())
- .set(ProjectPlanInfo::getTitle, item.getTitle())
- .set(ProjectPlanInfo::getStartTime, item.getStartTime())
- .set(ProjectPlanInfo::getEndTime, item.getEndTime())
+ new LambdaUpdateChainWrapper<>(baseMapper).eq(ProjectPlanInfo::getId, entity.getId())
+ .set(ProjectPlanInfo::getTitle, entity.getTitle())
+ .set(ProjectPlanInfo::getStartTime, entity.getStartTime())
+ .set(ProjectPlanInfo::getEndTime, entity.getEndTime())
.update();
}
return Result.ok("淇濆瓨鎴愬姛");
@@ -216,14 +207,6 @@
.orderByDesc(ProjectPlanExamineRecord::getGmtCreate)
.last("LIMIT 1")
.one();
- // 鏂板涓�鏉″鏍歌褰�
-// item.setId(null);
-// item.setEventType(1);
-// item.setDelayStartTime(request.getStartTime());
-// item.setDelayEndTime(request.getEndTime());
-// item.setGmtCreate(null);
-// item.setGmtUpdate(null);
-// projectPlanExamineRecordMapper.insertOne(item);
// 鏇存柊鍘熸潵鐨勫鏍歌褰�
item.setEventType(1);
item.setDelayStartTime(request.getStartTime());
@@ -233,6 +216,7 @@
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public Result resubmitPlanInfo(ProjectPlanInfoForm form) {
// 鏇存柊閲嶆柊涓婃姤鍚庣殑鍐呭
new LambdaUpdateChainWrapper<>(baseMapper)
@@ -245,11 +229,10 @@
// 鏂板涓�鏉¤鍒掍笂鎶ョ殑瀹℃牳璁板綍
ProjectPlanExamineRecord item = new ProjectPlanExamineRecord();
- item.setProjectPlanRecordId(form.getProjectPlanRecordId().longValue());
- item.setProjectPlanInfoId(form.getId().longValue());
+ item.setProjectPlanRecordId(form.getProjectPlanRecordId());
+ item.setProjectPlanInfoId(form.getId());
item.setEventType(0); // 璁″垝涓婃姤
item.setGmtCreate(new Date());
- item.setDeleted(0); // 鏈垹闄�
projectPlanExamineRecordMapper.insert(item);
return Result.ok("閲嶆柊涓婃姤鎴愬姛");
}
--
Gitblit v1.8.0