| | |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | | .one(); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | return Objects.nonNull(tbDataScreenConfig) ? BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class) : new DataScreenConfigVO(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editRiskLevel(RiskLevelUpdDTO dto) { |
| | | TbDataScreenConfig tbDataScreenConfig = BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class); |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | | .oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.RISK_LEVEL); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editDataIndicatorsConfig(DataIndicatorsUpdDTO dto) { |
| | | TbDataScreenConfig tbDataScreenConfig = BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class); |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.DATA_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> 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 tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.FORMAL_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |