|
|
@@ -2,6 +2,7 @@ package com.template.controller;
|
|
|
|
|
|
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -259,7 +260,7 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
|
|
|
@Override
|
|
|
public CommonResult warningPushList() {
|
|
|
- List<SmartUser> names = smartUserService.warningPushList();
|
|
|
+ List<WarningUserDto> names = smartUserService.warningPushList();
|
|
|
|
|
|
return CommonResult.ok(names);
|
|
|
}
|
|
|
@@ -272,7 +273,34 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
return CommonResult.fail(ResponseStatusEnum.PARAM_ERROR);
|
|
|
}
|
|
|
|
|
|
- List<SmartUser> smartUsers = smartUserService.getSmartUserByIds(ids);
|
|
|
+ // 获取所有可推送的人
|
|
|
+ LambdaQueryWrapper<SmartUser> wrapper=new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(SmartUser::getIsCancel, 0)
|
|
|
+ .eq(SmartUser::getIsPush,1);
|
|
|
+ List<SmartUser> list = smartUserService.list(wrapper);
|
|
|
+
|
|
|
+// 需要删除的
|
|
|
+ ArrayList<Integer> pushDeleteIds = new ArrayList<>();
|
|
|
+// 不用修改的
|
|
|
+ ArrayList<Integer> pushIds = new ArrayList<>();
|
|
|
+ for (SmartUser smartUser : list) {
|
|
|
+ Integer id = smartUser.getId();
|
|
|
+ if (!ids.contains(id)) {
|
|
|
+ pushDeleteIds.add(id);
|
|
|
+ }else {
|
|
|
+ pushIds.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// 获取需要添加的人
|
|
|
+ ArrayList<Integer> savePushIds = new ArrayList<>();
|
|
|
+ for (Integer id : ids) {
|
|
|
+ if (!pushIds.contains(id)) {
|
|
|
+ savePushIds.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// 添加
|
|
|
+ List<SmartUser> smartUsers = smartUserService.getSmartUserByIds(savePushIds);
|
|
|
|
|
|
for (SmartUser smartUser : smartUsers) {
|
|
|
String gzhOpenId = smartUser.getGzhOpenId();
|
|
|
@@ -283,6 +311,15 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
smartUserService.updateSmartUser(smartUser);
|
|
|
}
|
|
|
|
|
|
+// 删除
|
|
|
+ List<SmartUser> smartUsersDelete = smartUserService.getSmartUserByIds(pushDeleteIds);
|
|
|
+ ArrayList<SmartUser> smartUsersUpdate = new ArrayList<>();
|
|
|
+ for (SmartUser smartUser : smartUsersDelete) {
|
|
|
+ smartUser.setIsPush(0);
|
|
|
+ smartUsersUpdate.add(smartUser);
|
|
|
+ }
|
|
|
+ smartUserService.updateBatchById(smartUsersUpdate);
|
|
|
+
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|
|
|
@@ -294,6 +331,7 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
return CommonResult.fail();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
List<SmartUser> smartUserList = smartUserService.getSmartUserList(ids);
|
|
|
|
|
|
if (ObjectUtils.isEmpty(smartUserList)&&smartUserList.size()==0 ) {
|