| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.system.domain.TbDataScreenConfig; |
| | | import com.ruoyi.system.dto.update.DataIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.FormalIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.RiskLevelUpdDTO; |
| | | import com.ruoyi.system.mapper.TbDataScreenConfigMapper; |
| | | import com.ruoyi.system.query.DataScreenConfigQuery; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-03-13 |
| | | */ |
| | | @Service |
| | | public class TbDataScreenConfigServiceImpl extends ServiceImpl<TbDataScreenConfigMapper, TbDataScreenConfig> implements TbDataScreenConfigService { |
| | | public class TbDataScreenConfigServiceImpl extends |
| | | ServiceImpl<TbDataScreenConfigMapper, TbDataScreenConfig> implements |
| | | TbDataScreenConfigService { |
| | | |
| | | @Override |
| | | public DataScreenConfigVO getRiskLevel() { |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | | .one(); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editRiskLevel(RiskLevelUpdDTO dto) { |
| | | TbDataScreenConfig tbDataScreenConfig = BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.RISK_LEVEL); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataScreenConfigVO> getIndicatorsConfig(DataScreenConfigQuery query) { |
| | | List<TbDataScreenConfig> list = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, query.getType()).list(); |
| | | return BeanUtils.copyList(list, DataScreenConfigVO.class); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editDataIndicatorsConfig(DataIndicatorsUpdDTO dto) { |
| | | TbDataScreenConfig tbDataScreenConfig = BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.DATA_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editFormalIndicatorsConfig(FormalIndicatorsUpdDTO dto) { |
| | | TbDataScreenConfig tbDataScreenConfig = BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | } |
| | | } |