| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.platform.domain.entity.CheckRule; |
| | | import com.ycl.platform.domain.vo.CheckRuleVO; |
| | | import com.ycl.platform.mapper.CheckRuleMapper; |
| | | import com.ycl.platform.service.ICheckRuleService; |
| | | import constant.CheckConstants; |
| | | import org.hibernate.annotations.Check; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import utils.DateUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 考核规则Service业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-01 |
| | | * @date 2024-04-15 |
| | | */ |
| | | @Service |
| | | public class CheckRuleServiceImpl implements ICheckRuleService |
| | | public class CheckRuleServiceImpl extends ServiceImpl<CheckRuleMapper, CheckRule> implements ICheckRuleService |
| | | { |
| | | @Autowired |
| | | private CheckRuleMapper checkRuleMapper; |
| | | |
| | | /** |
| | | * 查询考核规则 |
| | | * |
| | | * @param id 考核规则主键 |
| | | * @return 考核规则 |
| | | */ |
| | |
| | | * @return 考核规则 |
| | | */ |
| | | @Override |
| | | public List<CheckRule> selectCheckRuleList(CheckRule checkRule) |
| | | public CheckRuleVO selectCheckRuleList(CheckRule checkRule) |
| | | { |
| | | return checkRuleMapper.selectCheckRuleList(checkRule); |
| | | List<CheckRule> checkRules = checkRuleMapper.selectCheckRuleList(checkRule); |
| | | Map<Short, List<CheckRule>> map = checkRules.stream().collect(Collectors.groupingBy(CheckRule::getRuleCategory)); |
| | | CheckRuleVO checkRuleVO = new CheckRuleVO() |
| | | .setCarRules(map.get(CheckConstants.Rule_Category_Car)) |
| | | .setFaceRules(map.get(CheckConstants.Rule_Category_Face)) |
| | | .setVideoRules(map.get(CheckConstants.Rule_Category_Video)); |
| | | return checkRuleVO; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public int insertCheckRule(CheckRule checkRule) |
| | | { |
| | | checkRule.setCreateTime(DateUtils.getNowDate()); |
| | | return checkRuleMapper.insertCheckRule(checkRule); |
| | | } |
| | | |
| | | /** |
| | | * 修改考核规则 |
| | | * |
| | | * @param checkRule 考核规则 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateCheckRule(CheckRule checkRule) |
| | | { |
| | | checkRule.setUpdateTime(DateUtils.getNowDate()); |
| | | |
| | | return checkRuleMapper.updateCheckRule(checkRule); |
| | | } |
| | | |