From 1d14ba39daf0422199c44b5b2ffc67d2364b2be2 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期日, 07 四月 2024 17:24:50 +0800 Subject: [PATCH] 工单状态完善 --- ycl-server/src/main/java/com/ycl/platform/service/impl/CheckResultServiceImpl.java | 182 ++++++++++++++------------------------------- 1 files changed, 56 insertions(+), 126 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 b8cf58c..158bb36 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,166 +1,96 @@ 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.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 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 = new CheckResult(); - checkResult.setId(Integer.valueOf(id)); - 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