|
@@ -3,14 +3,19 @@ package com.dragon.tj.portal.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.dragon.tj.portal.auth.model.LoginUser;
|
|
|
+import com.dragon.tj.portal.auth.util.SecurityUtils;
|
|
|
import com.dragon.tj.portal.entity.InstallInfo;
|
|
|
import com.dragon.tj.portal.mapper.app.InstallInfoMapper;
|
|
|
import com.dragon.tj.portal.service.InstallInfoService;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
@@ -19,6 +24,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class InstallInfoServiceImpl extends ServiceImpl<InstallInfoMapper, InstallInfo> implements InstallInfoService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InstallInfoMapper installInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
public Set<String> findUsersByAppId(String appId) {
|
|
@@ -33,6 +40,30 @@ public class InstallInfoServiceImpl extends ServiceImpl<InstallInfoMapper, Insta
|
|
|
}
|
|
|
return Sets.newHashSet();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional()
|
|
|
+ public void batchUpdate(List<InstallInfo> list,int isBusiness) {
|
|
|
+ List<Integer> allUpdateAppId = list.stream().map(InstallInfo::getAppId).collect(Collectors.toList());
|
|
|
+ //删除
|
|
|
+ QueryWrapper<InstallInfo> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.in("app_id",allUpdateAppId);
|
|
|
+
|
|
|
+ wrapper.eq(isBusiness == 0,"business_id",isBusiness);
|
|
|
+ wrapper.ne(isBusiness != 0,"business_id",0);
|
|
|
+
|
|
|
+ installInfoMapper.delete(wrapper);
|
|
|
+
|
|
|
+ //更新
|
|
|
+
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ list.forEach(item ->{
|
|
|
+ item.setUserIdcard(loginUser.getIdCard());
|
|
|
+ installInfoMapper.insert(item);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|