|
@@ -8,8 +8,11 @@ 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.AppInfo;
|
|
|
import com.dragon.tj.portal.entity.InstallInfo;
|
|
|
+import com.dragon.tj.portal.mapper.app.AppInfoMapper;
|
|
|
import com.dragon.tj.portal.mapper.app.InstallInfoMapper;
|
|
|
+import com.dragon.tj.portal.service.AppService;
|
|
|
import com.dragon.tj.portal.service.InstallInfoService;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -18,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -27,6 +31,9 @@ public class InstallInfoServiceImpl extends ServiceImpl<InstallInfoMapper, Insta
|
|
|
@Autowired
|
|
|
private InstallInfoMapper installInfoMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AppService appService;
|
|
|
+
|
|
|
@Override
|
|
|
public Set<String> findUsersByAppId(String appId) {
|
|
|
LambdaQueryWrapper<InstallInfo> wrapper = Wrappers.lambdaQuery();
|
|
@@ -46,12 +53,24 @@ public class InstallInfoServiceImpl extends ServiceImpl<InstallInfoMapper, Insta
|
|
|
public void batchUpdate(List<InstallInfo> list,int isBusiness) {
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
|
- //删除所有收藏
|
|
|
- QueryWrapper<InstallInfo> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq(loginUser != null,"user_idcard",loginUser.getIdCard());
|
|
|
- wrapper.eq(isBusiness == 0,"business_id",isBusiness);
|
|
|
- wrapper.ne(isBusiness != 0,"business_id",0);
|
|
|
- installInfoMapper.delete(wrapper);
|
|
|
+ if(list.size()>0){
|
|
|
+ Map<String, List<Long>> appTypes = getAppTypes(loginUser.getIdCard());
|
|
|
+ List<Long> specialAppIds = appTypes.get("special");
|
|
|
+// List<Long> otherAppIds = appTypes.get("other");
|
|
|
+ AppInfo detail = appService.detail(list.get(0).getAppId().longValue());
|
|
|
+
|
|
|
+ QueryWrapper<InstallInfo> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq(loginUser != null,"user_idcard",loginUser.getIdCard());
|
|
|
+ wrapper.eq(isBusiness == 0,"business_id",isBusiness);
|
|
|
+ wrapper.ne(isBusiness != 0,"business_id",0);
|
|
|
+ if(detail.getIsSpecial() == 1){
|
|
|
+ //删除专项工具应用
|
|
|
+ wrapper.in("app_id",specialAppIds);
|
|
|
+ }else {
|
|
|
+ wrapper.notIn("app_id",specialAppIds);
|
|
|
+ }
|
|
|
+ installInfoMapper.delete(wrapper);
|
|
|
+ }
|
|
|
|
|
|
//更新
|
|
|
list.forEach(item ->{
|
|
@@ -60,6 +79,18 @@ public class InstallInfoServiceImpl extends ServiceImpl<InstallInfoMapper, Insta
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String,List<Long>> getAppTypes(String idCard){
|
|
|
+
|
|
|
+ QueryWrapper wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.select("app_id");
|
|
|
+ wrapper.eq("user_idcard",idCard);
|
|
|
+ List<Long> appIds = installInfoMapper.selectObjs(wrapper);
|
|
|
+
|
|
|
+ Map<String,List<Long>> appType = appService.checkAppTypeById(appIds);
|
|
|
+
|
|
|
+ return appType;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|