123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- package com.fdkankan.manage.service.impl;
- import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
- import com.fdkankan.manage.entity.JySceneAuth;
- import com.fdkankan.manage.entity.JySceneUserAuth;
- import com.fdkankan.manage.mapper.IJySceneAuthMapper;
- import com.fdkankan.manage.service.IJySceneAuthService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.fdkankan.manage.service.IJySceneUserAuthService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author
- * @since 2023-08-30
- */
- @Service
- public class JySceneAuthServiceImpl extends ServiceImpl<IJySceneAuthMapper, JySceneAuth> implements IJySceneAuthService {
- @Override
- public JySceneAuth getByNum(String num) {
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(JySceneAuth::getNum,num);
- return this.getOne(wrapper);
- }
- @Override
- public HashMap<String, JySceneAuth> getByNumList(List<String> numList) {
- HashMap<String, JySceneAuth> map = new HashMap<>();
- if(numList.isEmpty()){
- return map;
- }
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(JySceneAuth::getNum,numList);
- List<JySceneAuth> list = this.list(wrapper);
- list.forEach(e -> map.put(e.getNum(),e));
- return map;
- }
- @Override
- public List<String> getOpenNumList() {
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(JySceneAuth::getAuthType,1);
- List<JySceneAuth> list = this.list(wrapper);
- if(list.isEmpty()){
- return new ArrayList<>();
- }
- return list.stream().map(JySceneAuth::getNum).collect(Collectors.toList());
- }
- @Override
- public List<String> getNumListByPlatform(Integer platformId, Integer authType) {
- List<JySceneAuth> list = this.getBaseMapper().getNumListByPlatform(platformId,authType);
- return list.stream().map(JySceneAuth::getNum).collect(Collectors.toList());
- }
- @Override
- public void updateAuthTypeByNum(String num, Integer authType) {
- JySceneAuth auth = this.getByNum(num);
- if(auth == null){
- auth = new JySceneAuth(authType);
- auth.setNum(num);
- this.save(auth);
- return;
- }
- LambdaUpdateWrapper<JySceneAuth> wrapper = new LambdaUpdateWrapper<>();
- wrapper.eq(JySceneAuth::getNum,num);
- wrapper.set(JySceneAuth::getAuthType,authType);
- this.update(wrapper);
- }
- @Override
- public void updateAuthTypeByCaseId(Integer caseId, Integer authType) {
- JySceneAuth auth = this.getByCaseId(caseId);
- if(auth == null){
- auth = new JySceneAuth(authType);
- auth.setCaseId(caseId);
- this.save(auth);
- return;
- }
- LambdaUpdateWrapper<JySceneAuth> wrapper = new LambdaUpdateWrapper<>();
- wrapper.eq(JySceneAuth::getCaseId,caseId);
- wrapper.set(JySceneAuth::getAuthType,authType);
- this.update(wrapper);
- }
- @Override
- public JySceneAuth getByCaseId(Integer caseId) {
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(JySceneAuth::getCaseId,caseId);
- return this.getOne(wrapper);
- }
- @Override
- public List<JySceneAuth> getAllCase() {
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.isNotNull(JySceneAuth::getCaseId);
- return this.list(wrapper);
- }
- @Autowired
- IJySceneUserAuthService jySceneUserAuthService;
- @Override
- public void delByNumList(List<String> numList) {
- if(numList.isEmpty()){
- return;
- }
- LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(JySceneAuth::getNum,numList);
- this.remove(wrapper);
- LambdaQueryWrapper<JySceneUserAuth> wrapper2 = new LambdaQueryWrapper<>();
- wrapper2.in(JySceneUserAuth::getNum,numList);
- jySceneUserAuthService.remove(wrapper2);
- }
- }
|