|
@@ -9,8 +9,10 @@ import com.ruoyi.app.service.ITbAppUserService;
|
|
|
import com.ruoyi.app.service.ITbFamilyMemberService;
|
|
|
import com.ruoyi.app.service.ITbMemberMiddleService;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.PushUtil;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.app.mapper.TbFamilyMapper;
|
|
@@ -19,6 +21,7 @@ import com.ruoyi.app.service.ITbFamilyService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -106,9 +109,48 @@ public class TbFamilyServiceImpl extends ServiceImpl<TbFamilyMapper, TbFamily> i
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return AjaxResult.error("申请失败");
|
|
|
}
|
|
|
+ // 推送
|
|
|
+ push(memberVo.getNickName(),memberVo.getFamilyId());
|
|
|
return AjaxResult.success("申请成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 推送
|
|
|
+ * @param userName
|
|
|
+ * @param familyId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Async
|
|
|
+ protected boolean push(String userName, Long familyId){
|
|
|
+ // 家族信息
|
|
|
+ TbFamily family = familyService.getById(familyId);
|
|
|
+ if (family == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 管理员列表
|
|
|
+ List<AppMemberVo> memberVos = memberService.myMemberList(new LambdaQueryWrapper<AppMemberVo>()
|
|
|
+ .eq(AppMemberVo::getFamilyId,familyId)
|
|
|
+ .eq(AppMemberVo::getStatus,"2")
|
|
|
+ .eq(AppMemberVo::getAdmin,"Y")
|
|
|
+ );
|
|
|
+ if (memberVos.size() <= 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 管理员ClientId
|
|
|
+ List<String> cids = new ArrayList<>();
|
|
|
+ memberVos.forEach(item -> {
|
|
|
+ cids.add(item.getClientId());
|
|
|
+ });
|
|
|
+ if (cids.size() <= 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ builder.append(userName);
|
|
|
+ builder.append("申请加入");
|
|
|
+ builder.append(family.getFullName());
|
|
|
+ return PushUtil.sendMessage("家族通知",builder.toString(),cids);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean saveFamily(TbFamily family){
|
|
|
if (familyService.save(family)) {
|