From 55bc47597ec70b4403c6c8edbae493bad0c3ca56 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 22 四月 2024 09:05:45 +0800
Subject: [PATCH] 调用优云、海康威视接口响应DTO
---
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java | 188 ++++++++++++++--------------------------------
1 files changed, 58 insertions(+), 130 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java
index 870ff90..d8ba31d 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java
@@ -1,169 +1,97 @@
package com.ycl.platform.service.impl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.ycl.exception.ServiceException;
-import com.ycl.platform.domain.entity.CheckResult;
-import com.ycl.platform.domain.form.ManualScoreForm;
-import com.ycl.platform.mapper.CheckResultMapper;
-import com.ycl.platform.service.CheckResultService;
-import com.ycl.system.Result;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ycl.platform.domain.form.CheckResultForm;
-import com.ycl.platform.domain.vo.CheckResultVO;
-import com.ycl.platform.domain.query.CheckResultQuery;
+import com.ycl.platform.domain.entity.CheckResult;
+import com.ycl.platform.mapper.CheckResultMapper;
+import com.ycl.platform.service.ICheckResultService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import utils.DateUtils;
+
import java.util.List;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ycl.system.page.PageUtil;
-import org.springframework.stereotype.Service;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.beans.BeanUtils;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-import java.util.ArrayList;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
-import lombok.RequiredArgsConstructor;
-import org.springframework.util.StringUtils;
-
/**
- * 鑰冩牳缁撴灉 鏈嶅姟瀹炵幇绫�
- *
- * @author xp
- * @since 2024-03-07
+ * 鑰冩牳缁撴灉Service涓氬姟灞傚鐞�
+ *
+ * @author ruoyi
+ * @date 2024-04-01
*/
@Service
-@RequiredArgsConstructor
-public class CheckResultServiceImpl extends ServiceImpl<CheckResultMapper, CheckResult> implements CheckResultService {
-
- private final CheckResultMapper checkResultMapper;
+public class CheckResultServiceImpl extends ServiceImpl<CheckResultMapper, CheckResult> implements ICheckResultService
+{
+ @Autowired
+ private CheckResultMapper checkResultMapper;
/**
- * 娣诲姞
- * @param form
- * @return
+ * 鏌ヨ鑰冩牳缁撴灉
+ *
+ * @param id 鑰冩牳缁撴灉涓婚敭
+ * @return 鑰冩牳缁撴灉
*/
@Override
- public Result add(CheckResultForm form) {
- CheckResult entity = CheckResultForm.getEntityByForm(form, null);
- if(baseMapper.insert(entity) > 0) {
- return Result.ok("娣诲姞鎴愬姛");
- }
- return Result.error("娣诲姞澶辫触");
+ public CheckResult selectCheckResultById(Long id)
+ {
+ return checkResultMapper.selectCheckResultById(id);
}
/**
- * 淇敼
- * @param form
- * @return
+ * 鏌ヨ鑰冩牳缁撴灉鍒楄〃
+ *
+ * @param checkResult 鑰冩牳缁撴灉
+ * @return 鑰冩牳缁撴灉
*/
@Override
- public Result update(CheckResultForm form) {
-
- CheckResult entity = baseMapper.selectById(form.getId());
-
- // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
- Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
- BeanUtils.copyProperties(form, entity);
- if (baseMapper.updateById(entity) > 0) {
- return Result.ok("淇敼鎴愬姛");
- }
- return Result.error("淇敼澶辫触");
+ public List<CheckResult> selectCheckResultList(CheckResult checkResult)
+ {
+ return checkResultMapper.selectCheckResultList(checkResult);
}
/**
- * 鎵归噺鍒犻櫎
- * @param ids
- * @return
+ * 鏂板鑰冩牳缁撴灉
+ *
+ * @param checkResult 鑰冩牳缁撴灉
+ * @return 缁撴灉
*/
@Override
- public Result remove(List<String> ids) {
- if(baseMapper.deleteBatchIds(ids) > 0) {
- return Result.ok("鍒犻櫎鎴愬姛");
- }
- return Result.error("鍒犻櫎澶辫触");
+ public int insertCheckResult(CheckResult checkResult)
+ {
+ return checkResultMapper.insertCheckResult(checkResult);
}
/**
- * id鍒犻櫎
- * @param id
- * @return
+ * 淇敼鑰冩牳缁撴灉
+ *
+ * @param checkResult 鑰冩牳缁撴灉
+ * @return 缁撴灉
*/
@Override
- public Result removeById(String id) {
- if(baseMapper.deleteById(id) > 0) {
- return Result.ok("鍒犻櫎鎴愬姛");
- }
- return Result.error("鍒犻櫎澶辫触");
+ public int updateCheckResult(CheckResult checkResult)
+ {
+ checkResult.setUpdateTime(DateUtils.getNowDate());
+ return checkResultMapper.updateCheckResult(checkResult);
}
/**
- * 鍒嗛〉鏌ヨ
- * @param query
- * @return
+ * 鎵归噺鍒犻櫎鑰冩牳缁撴灉
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳缁撴灉涓婚敭
+ * @return 缁撴灉
*/
@Override
- public Result page(CheckResultQuery query) {
- query.setTime();
- IPage page = PageUtil.getPage(query, CheckResult.class);
- baseMapper.page(page, query);
- return Result.ok().data(page.getRecords()).total(page.getTotal());
+ public int deleteCheckResultByIds(Long[] ids)
+ {
+ return checkResultMapper.deleteCheckResultByIds(ids);
}
/**
- * 鏍规嵁id鏌ユ壘
- * @param id
- * @return
+ * 鍒犻櫎鑰冩牳缁撴灉淇℃伅
+ *
+ * @param id 鑰冩牳缁撴灉涓婚敭
+ * @return 缁撴灉
*/
@Override
- public Result detail(String id) {
-
- CheckResult entity = baseMapper.selectById(id);
- Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
- CheckResultVO vo = CheckResultVO.getVoByEntity(entity, null);
- return Result.ok().data(vo);
- }
-
- /**
- * 鍒楄〃
- * @return
- */
- @Override
- public Result all() {
- List<CheckResult> entities = baseMapper.selectList(null);
- List<CheckResultVO> vos = entities.stream()
- .map(
- entity -> CheckResultVO.getVoByEntity(entity, null)
- )
- .collect(Collectors.toList());
- return Result.ok().data(vos);
- }
-
- @Override
- public Result manualScore(ManualScoreForm form) {
- CheckResult checkResult = baseMapper.selectById(form.getId());
- if (Objects.isNull(checkResult)) {
- throw new ServiceException("鑰冩牳缁撴灉涓嶅瓨鍦�");
- }
- checkResult.setManualScore(form.getManualScore());
- checkResult.setCheckScore(form.getManualScore().add(checkResult.getSystemScore()));
- baseMapper.updateById(checkResult);
- return Result.ok();
- }
-
- @Override
- public Result publishById(String id) {
- CheckResult checkResult = baseMapper.selectById(id);
- if(Objects.equals(1, checkResult.getPublish())) {
- checkResult.setPublish(0);
- } else {
- checkResult.setPublish(1);
- }
- if(baseMapper.updateById(checkResult) > 0) {
- return Result.ok("鍙戝竷鎴愬姛");
- }
- return Result.error("鍙戝竷澶辫触");
+ public int deleteCheckResultById(Long id)
+ {
+ return checkResultMapper.deleteCheckResultById(id);
}
}
--
Gitblit v1.8.0