From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/ownersCommittee/controller/OwnersCommitteeMemberController.java |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/ownersCommittee/controller/OwnersCommitteeMemberController.java b/src/main/java/org/springblade/modules/ownersCommittee/controller/OwnersCommitteeMemberController.java
index 268c0cb..5510f02 100644
--- a/src/main/java/org/springblade/modules/ownersCommittee/controller/OwnersCommitteeMemberController.java
+++ b/src/main/java/org/springblade/modules/ownersCommittee/controller/OwnersCommitteeMemberController.java
@@ -16,25 +16,28 @@
  */
 package org.springblade.modules.ownersCommittee.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
-import org.springblade.core.secure.BladeUser;
+import org.springblade.common.utils.SpringUtils;
+import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.ownersCommittee.entity.OwnersCommitteeEntity;
 import org.springblade.modules.ownersCommittee.entity.OwnersCommitteeMemberEntity;
+import org.springblade.modules.ownersCommittee.service.IOwnersCommitteeMemberService;
+import org.springblade.modules.ownersCommittee.service.IOwnersCommitteeService;
 import org.springblade.modules.ownersCommittee.vo.OwnersCommitteeMemberVO;
 import org.springblade.modules.ownersCommittee.wrapper.OwnersCommitteeMemberWrapper;
-import org.springblade.modules.ownersCommittee.service.IOwnersCommitteeMemberService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
 
 /**
  * 业委会成员表 控制器
@@ -60,6 +63,7 @@
 		OwnersCommitteeMemberEntity detail = ownersCommitteeService.getOne(Condition.getQueryWrapper(ownersCommittee));
 		return R.data(OwnersCommitteeMemberWrapper.build().entityVO(detail));
 	}
+
 	/**
 	 * 业委会成员表 分页
 	 */
@@ -109,6 +113,18 @@
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入ownersCommittee")
 	public R submit(@Valid @RequestBody OwnersCommitteeMemberEntity ownersCommittee) {
+		long count = ownersCommitteeService.count(Wrappers.<OwnersCommitteeMemberEntity>lambdaQuery()
+			.eq(OwnersCommitteeMemberEntity::getAreaId, ownersCommittee.getAreaId())
+			.eq(OwnersCommitteeMemberEntity::getUserId, ownersCommittee.getUserId()));
+		if (count > 1 && ownersCommittee.getId() != null) {
+			return R.fail("该业委会成员已存在");
+		}
+		long number = ownersCommitteeService.count(Wrappers.<OwnersCommitteeMemberEntity>lambdaQuery()
+			.eq(OwnersCommitteeMemberEntity::getOwnersId, ownersCommittee.getOwnersId()));
+		IOwnersCommitteeService bean = SpringUtils.getBean(IOwnersCommitteeService.class);
+		OwnersCommitteeEntity committeeEntity = bean.getById(ownersCommittee.getOwnersId());
+		committeeEntity.setPeopleTotal(String.valueOf(number));
+		bean.updateById(committeeEntity);
 		return R.status(ownersCommitteeService.saveOrUpdate(ownersCommittee));
 	}
 
@@ -119,7 +135,7 @@
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "逻辑删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(ownersCommitteeService.removeBatchByIds(Func.toLongList(ids)));
+		return R.status(ownersCommitteeService.removeOwnersCommittee(Func.toLongList(ids)));
 	}
 
 

--
Gitblit v1.9.3