From 009e3e6fe18e3229ef1a6b2a39c9de57dd9d34bc Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 31 七月 2024 15:58:38 +0800
Subject: [PATCH] 数据中心响应类调整
---
ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
index 46aee9b..3230e09 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java
@@ -8,6 +8,7 @@
import com.ycl.platform.domain.entity.YwPeople;
import com.ycl.platform.domain.entity.YwPoint;
import com.ycl.platform.domain.entity.YwUnit;
+import com.ycl.platform.domain.form.ReportAuditingForm;
import com.ycl.platform.domain.form.ReportForm;
import com.ycl.platform.domain.query.ReportQuery;
import com.ycl.platform.domain.vo.ReportVO;
@@ -19,14 +20,17 @@
import com.ycl.system.Result;
import com.ycl.system.page.PageUtil;
import com.ycl.utils.SecurityUtils;
+import com.ycl.utils.uuid.IdUtils;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -58,6 +62,7 @@
form.setUnitId(people.getBelongUnit());
Report entity = ReportForm.getEntityByForm(form, null);
entity.setStatus(0);
+ entity.setIdentify(IdUtils.timeAddRandomNO(3));
if(baseMapper.insert(entity) > 0) {
return Result.ok("娣诲姞鎴愬姛");
}
@@ -73,14 +78,25 @@
public Result update(ReportForm form) {
Report entity = baseMapper.selectById(form.getId());
-
// 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
- BeanUtils.copyProperties(form, entity);
- if (baseMapper.updateById(entity) > 0) {
- return Result.ok("淇敼鎴愬姛");
+
+ if (0 == entity.getStatus()) {
+ // 寰呭鏍哥殑鐩存帴鏀�
+ BeanUtils.copyProperties(form, entity);
+ baseMapper.updateById(entity);
+ } else if (2 == entity.getStatus()) {
+ // 濡傛灉鏄湭瀹℃牳閫氳繃锛岃繘琛屼慨鏀癸紝閭d箞鐩存帴鏂板锛堜负浜嗕繚瀛樺鏍歌褰曪級
+ Report report = new Report();
+ BeanUtils.copyProperties(entity, report);
+ BeanUtils.copyProperties(form, report);
+ report.setId(null);
+ report.setStatus(0);
+ report.setAuditingTime(null);
+ report.setAuditOpinion(null);
+ baseMapper.insert(report);
}
- return Result.error("淇敼澶辫触");
+ return Result.ok("淇敼鎴愬姛");
}
/**
@@ -116,8 +132,9 @@
*/
@Override
public Result page(ReportQuery query) {
- List<ReportVO> page = baseMapper.page(query);
- return Result.ok().data(page).total(page.size());
+ IPage<ReportVO> page = PageUtil.getPage(query, ReportVO.class);
+ baseMapper.page(page, query);
+ return Result.ok().data(page).total(page.getTotal());
}
/**
@@ -170,8 +187,8 @@
IPage<Report> page = new LambdaQueryChainWrapper<>(baseMapper)
.eq(StringUtils.isNotBlank(query.getReportType()), Report::getReportType, query.getReportType())
- .le(Objects.nonNull(query.getBeginCreateTime()), Report::getBeginCreateTime, query.getBeginCreateTime())
- .ge(Objects.nonNull(query.getEndCreateTime()), Report::getEndCreateTime, query.getEndCreateTime())
+// .le(Objects.nonNull(query.getBeginCreateTime()), Report::getBeginCreateTime, query.getBeginCreateTime())
+// .ge(Objects.nonNull(query.getEndCreateTime()), Report::getEndCreateTime, query.getEndCreateTime())
.in(!CollectionUtils.isEmpty(query.getPointIdList()), Report::getPointId, query.getPointIdList())
.in(!CollectionUtils.isEmpty(query.getPeopleIdList()), Report::getPeopleId, query.getPeopleIdList())
.orderByDesc(Report::getCreateTime)
@@ -194,4 +211,27 @@
return vos;
}
+
+ @Override
+ public Result auditingRecord(Integer id) {
+ List<ReportVO> reportList = baseMapper.examineRecord(id);
+ return Result.ok().data(reportList);
+ }
+
+ @Override
+ public Result auditing(ReportAuditingForm form) {
+ Report report = baseMapper.selectById(form.getId());
+ if (Objects.isNull(report)) {
+ throw new RuntimeException("瀹℃牳鐨勬姤澶囦笉瀛樺湪");
+ }
+ if (form.getAuditingResult()) {
+ report.setStatus(1);
+ } else {
+ report.setStatus(2);
+ }
+ report.setAuditOpinion(form.getAuditOpinion());
+ report.setAuditingTime(new Date());
+ baseMapper.updateById(report);
+ return Result.ok("鎿嶄綔鎴愬姛");
+ }
}
--
Gitblit v1.8.0