|
|
@@ -10,7 +10,9 @@ import com.template.api.SmartWarningControllerAPI;
|
|
|
import com.template.common.result.ResponseStatusEnum;
|
|
|
import com.template.common.utils.*;
|
|
|
import com.template.model.dto.OperationWarningDto;
|
|
|
+import com.template.model.dto.WarningDeletePushDto;
|
|
|
import com.template.model.dto.WarningSavePushDto;
|
|
|
+import com.template.model.dto.WarningUserDto;
|
|
|
import com.template.model.pojo.SmartDepartment;
|
|
|
import com.template.model.pojo.SmartUser;
|
|
|
import com.template.model.pojo.SmartWarning;
|
|
|
@@ -23,6 +25,7 @@ import com.template.services.SmartUserService;
|
|
|
import com.template.services.SmartWarningService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
@@ -239,18 +242,18 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CommonResult warningUserList(int currentPage, int pageCount, Integer departmentId, String name) {
|
|
|
+ public CommonResult warningUserList(int currentPage, int pageCount, String name) {
|
|
|
//获取该部门下的所有子级部门ID
|
|
|
- List<Integer> childDepartmentIds = new ArrayList<>();
|
|
|
- List<SmartDepartment> departments = smartDepartmentService.list(null);
|
|
|
- childDepartmentIds.add(departmentId);
|
|
|
- QueryDepartmentTreeRecords(departmentId, departments, childDepartmentIds);
|
|
|
-
|
|
|
- if (departmentId == null) {
|
|
|
- childDepartmentIds = null;
|
|
|
- }
|
|
|
+// List<Integer> childDepartmentIds = new ArrayList<>();
|
|
|
+// List<SmartDepartment> departments = smartDepartmentService.list(null);
|
|
|
+// childDepartmentIds.add(departmentId);
|
|
|
+// QueryDepartmentTreeRecords(departmentId, departments, childDepartmentIds);
|
|
|
+//
|
|
|
+// if (departmentId == null) {
|
|
|
+// childDepartmentIds = null;
|
|
|
+// }
|
|
|
|
|
|
- PageUtils<UserVo> result = smartUserService.warningUserList(currentPage, pageCount, childDepartmentIds, name);
|
|
|
+ PageUtils<WarningUserDto> result = smartUserService.warningUserList(currentPage, pageCount, name);
|
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
|
|
|
|
@@ -274,7 +277,7 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
for (SmartUser smartUser : smartUsers) {
|
|
|
String gzhOpenId = smartUser.getGzhOpenId();
|
|
|
if (ObjectUtils.isEmpty(gzhOpenId)) {
|
|
|
- return CommonResult.fail(smartUser.getName()+ "未关联公众号");
|
|
|
+ return CommonResult.fail(smartUser.getName() + "未关联公众号");
|
|
|
}
|
|
|
smartUser.setIsPush(1);
|
|
|
smartUserService.updateSmartUser(smartUser);
|
|
|
@@ -284,20 +287,31 @@ public class SmartWarningController implements SmartWarningControllerAPI {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CommonResult warningDeletePush(Integer id) {
|
|
|
+ public CommonResult warningDeletePush(WarningDeletePushDto warningDeletePushDto) {
|
|
|
+ List<Integer> ids = warningDeletePushDto.getIds();
|
|
|
|
|
|
- if (ObjectUtils.isEmpty(id)) {
|
|
|
+ if (ObjectUtils.isEmpty(ids) && ids.size() == 0) {
|
|
|
return CommonResult.fail();
|
|
|
}
|
|
|
|
|
|
- SmartUser smartById = smartUserService.getSmartById(id);
|
|
|
+ List<SmartUser> smartUserList = smartUserService.getSmartUserList(ids);
|
|
|
|
|
|
- if (ObjectUtils.isEmpty(smartById)) {
|
|
|
- return CommonResult.fail();
|
|
|
+ if (ObjectUtils.isEmpty(smartUserList)&&smartUserList.size()==0 ) {
|
|
|
+ return CommonResult.fail("无该用户");
|
|
|
}
|
|
|
- smartById.setIsPush(0);
|
|
|
- int result = smartUserService.updateSmartUser(smartById);
|
|
|
- return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
|
|
|
+ ArrayList<SmartUser> smartUsers = new ArrayList<>();
|
|
|
+
|
|
|
+ for (SmartUser smartUser : smartUserList) {
|
|
|
+ smartUser.setIsPush(0);
|
|
|
+ smartUsers.add(smartUser);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ boolean b = smartUserService.updateBatchById(smartUsers);
|
|
|
+ if (b) {
|
|
|
+ return CommonResult.ok("删除成功");
|
|
|
+ }
|
|
|
+ return CommonResult.fail("删除失败");
|
|
|
}
|
|
|
|
|
|
|