Browse Source

发送信息

wangqifan 3 years ago
parent
commit
a53074ca96

+ 0 - 22
src/main/java/com/izouma/nineth/domain/netease/Msg.java

@@ -1,22 +0,0 @@
-package com.izouma.nineth.domain.netease;
-
-import com.izouma.nineth.domain.BaseEntity;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import javax.persistence.Entity;
-
-@Entity
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@Builder
-public class Msg extends BaseEntity {
-    private String  from;
-    private String  to;
-    private Integer ope;
-    private Integer type;
-    private String  body;
-}

+ 32 - 0
src/main/java/com/izouma/nineth/domain/netease/NeteaseMessage.java

@@ -0,0 +1,32 @@
+package com.izouma.nineth.domain.netease;
+
+import com.izouma.nineth.domain.BaseEntity;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+import java.sql.Timestamp;
+
+@Entity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class NeteaseMessage extends BaseEntity {
+    private Long    msgId;
+    private String  fromId;
+    private String  fromAvatar;
+    private String  fromNickName;
+    private String  toId;
+    private String  toAvatar;
+    private String  toNickName;
+    //ope: 0 单聊消息, 1 群消息
+    private Integer ope;
+    //type: 0 文本消息, 1 图片消息,3 视频消息
+    private Integer type;
+    private String  body;
+    private String  msgInfo;
+    private Long    timetag;
+}

+ 16 - 0
src/main/java/com/izouma/nineth/repo/Netease/NeteaseMessageRepo.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.repo.netease;
+
+import com.izouma.nineth.domain.netease.NeteaseMessage;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface NeteaseMessageRepo extends JpaRepository<NeteaseMessage, Long>, JpaSpecificationExecutor<NeteaseMessage> {
+    @Query("update NeteaseMessage t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+}

+ 61 - 0
src/main/java/com/izouma/nineth/service/netease/NeteaseMessageService.java

@@ -0,0 +1,61 @@
+package com.izouma.nineth.service.netease;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.izouma.nineth.domain.User;
+import com.izouma.nineth.domain.netease.NeteaseMessage;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.UserRepo;
+import com.izouma.nineth.repo.netease.NeteaseMessageRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import net.bytebuddy.agent.builder.AgentBuilder;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@AllArgsConstructor
+public class NeteaseMessageService {
+
+    private NeteaseMessageRepo neteaseMessageRepo;
+    private NeteaseUserService neteaseUserService;
+    private UserRepo           userRepo;
+
+    public Page<NeteaseMessage> all(PageQuery pageQuery) {
+        return neteaseMessageRepo
+                .findAll(JpaUtils.toSpecification(pageQuery, NeteaseMessage.class), JpaUtils.toPageRequest(pageQuery));
+    }
+
+    public NeteaseMessage sendMessage(NeteaseMessage msg) {
+        User from = userRepo.findById(Long.valueOf(msg.getFromId())).orElseThrow(new BusinessException("未找到用户"));
+        User to = userRepo.findById(Long.valueOf(msg.getToId())).orElseThrow(new BusinessException("未找到用户"));
+        msg.setFromAvatar(from.getAvatar());
+        msg.setFromNickName(from.getNickname());
+        msg.setToAvatar(to.getAvatar());
+        msg.setToNickName(to.getNickname());
+        String url = "msg/sendMsg.action";
+        String contentType = "application/x-www-form-urlencoded;charset=utf-8";
+        Map<String, Object> params = new HashMap<>();
+        params.put("from", msg.getFromId());
+        params.put("to", msg.getToId());
+        params.put("ope", msg.getOpe());
+        params.put("type", msg.getType());
+        params.put("body", msg.getBody());
+        String result = neteaseUserService.httpPost(url, contentType, params);
+        JSONObject jsonObject = JSON.parseObject(result);
+        Integer code = jsonObject.getInteger("code");
+        if (code != 200) {
+            throw new BusinessException("发信出错,请检查后重新发送");
+        }
+        JSONObject data = jsonObject.getJSONObject("data");
+        msg.setMsgId(data.getLong("msgid"));
+        msg.setTimetag(data.getLong("timetag"));
+        return neteaseMessageRepo.save(msg);
+    }
+}

+ 3 - 3
src/main/java/com/izouma/nineth/service/netease/NeteaseUserService.java

@@ -34,7 +34,7 @@ public class NeteaseUserService {
                 .findAll(JpaUtils.toSpecification(pageQuery, NeteaseUser.class), JpaUtils.toPageRequest(pageQuery));
     }
 
-    public String httpPost(String url, String contentType, Map<String, String> params) {
+    public String httpPost(String url, String contentType, Map<String, Object> params) {
         Map<String, String> headers = new HashMap<>();
         String appKey = "872dd9d0a0f8eda25b579654745db459";
         String nonce = RandomStringUtils.randomAlphabetic(32);
@@ -57,7 +57,7 @@ public class NeteaseUserService {
         User user = userRepo.findById(userId).orElseThrow(new BusinessException("暂无用户信息"));
         String url = "user/create.action";
         String contentType = "application/x-www-form-urlencoded;charset=utf-8";
-        Map<String, String> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>();
         params.put("accid", String.valueOf(user.getId()));
         params.put("name", user.getNickname());
         params.put("mobile", "+86-" + user.getPhone());
@@ -82,7 +82,7 @@ public class NeteaseUserService {
         NeteaseUser record = neteaseUserRepo.findById(userId).orElseThrow(new BusinessException("该用户暂无注册信息"));
         String url = "user/update.refreshToken";
         String contentType = "application/x-www-form-urlencoded;charset=utf-8";
-        Map<String, String> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>();
         params.put("accid", String.valueOf(userId));
         String result = httpPost(url, contentType, params);
         JSONObject jsonObject = JSON.parseObject(result);

+ 2 - 2
src/main/java/com/izouma/nineth/service/netease/TeamService.java

@@ -54,7 +54,7 @@ public class TeamService {
     }
 
     public Team create(Team team) {
-        Map<String, String> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>();
         params.put("tname", team.getName());
         params.put("owner", team.getOwnerid());
         params.put("members", JSONObject.toJSONString(team.getMembers()));
@@ -77,7 +77,7 @@ public class TeamService {
         List<String> ids = new ArrayList<>();
         ids.add(id);
         Team team = teamRepo.findById(Long.valueOf(tid)).orElseThrow(new BusinessException("未找到群聊"));
-        Map<String, String> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>();
         params.put("tid", tid);
         params.put("owner", team.getOwnerid());
         params.put("members", JSONObject.toJSONString(ids));

+ 69 - 0
src/main/java/com/izouma/nineth/web/Netease/NeteaseMessageController.java

@@ -0,0 +1,69 @@
+package com.izouma.nineth.web.netease;
+
+import com.izouma.nineth.web.BaseController;
+import com.izouma.nineth.domain.netease.NeteaseMessage;
+import com.izouma.nineth.service.netease.NeteaseMessageService;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.netease.NeteaseMessageRepo;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+
+import lombok.AllArgsConstructor;
+import org.apache.commons.validator.Msg;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/neteaseMessage")
+@AllArgsConstructor
+public class NeteaseMessageController extends BaseController {
+    private NeteaseMessageService neteaseMessageService;
+    private NeteaseMessageRepo    neteaseMessageRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public NeteaseMessage save(@RequestBody NeteaseMessage record) {
+        if (record.getId() != null) {
+            NeteaseMessage orig = neteaseMessageRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return neteaseMessageRepo.save(orig);
+        }
+        return neteaseMessageRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<NeteaseMessage> all(@RequestBody PageQuery pageQuery) {
+        return neteaseMessageService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public NeteaseMessage get(@PathVariable Long id) {
+        return neteaseMessageRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        neteaseMessageRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<NeteaseMessage> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+
+    @PostMapping("/sendMsg")
+    public NeteaseMessage get(@RequestBody NeteaseMessage msg) {
+        return neteaseMessageService.sendMessage(msg);
+    }
+}
+

+ 16 - 0
src/main/vue/src/router.js

@@ -1459,6 +1459,22 @@ const router = new Router({
                     meta: {
                        title: '群组',
                     },
+               },
+                {
+                    path: '/neteaseMessageEdit',
+                    name: 'NeteaseMessageEdit',
+                    component: () => import(/* webpackChunkName: "neteaseMessageEdit" */ '@/views/NeteaseMessageEdit.vue'),
+                    meta: {
+                       title: '信息编辑',
+                    },
+                },
+                {
+                    path: '/neteaseMessageList',
+                    name: 'NeteaseMessageList',
+                    component: () => import(/* webpackChunkName: "neteaseMessageList" */ '@/views/NeteaseMessageList.vue'),
+                    meta: {
+                       title: '信息',
+                    },
                }
                 /**INSERT_LOCATION**/
             ]

+ 112 - 0
src/main/vue/src/views/NeteaseMessageEdit.vue

@@ -0,0 +1,112 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                删除
+            </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right"
+                         size="small"
+                         style="max-width: 500px;">
+                        <el-form-item prop="from" label="发送用户">
+                                    <el-input v-model="formData.from"></el-input>
+                        </el-form-item>
+                        <el-form-item prop="to" label="收信用户">
+                                    <el-input v-model="formData.to"></el-input>
+                        </el-form-item>
+                        <el-form-item prop="ope" label="发信类型">
+                                    <el-input-number type="number" v-model="formData.ope"></el-input-number>
+                        </el-form-item>
+                        <el-form-item prop="type" label="信息类型">
+                                    <el-input-number type="number" v-model="formData.type"></el-input-number>
+                        </el-form-item>
+                        <el-form-item prop="body" label="信息主题">
+                                    <el-input v-model="formData.body"></el-input>
+                        </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary">
+                            保存
+                        </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+    export default {
+        name: 'NeteaseMessageEdit',
+        created() {
+            if (this.$route.query.id) {
+                this.$http
+                    .get('neteaseMessage/get/' + this.$route.query.id)
+                    .then(res => {
+                        this.formData = res;
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    });
+            }
+        },
+        data() {
+            return {
+                saving: false,
+                formData: {
+                },
+                rules: {
+                },
+            }
+        },
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                let data = {...this.formData};
+
+                this.saving = true;
+                this.$http
+                    .post('/neteaseMessage/save', data, {body: 'json'})
+                    .then(res => {
+                        this.saving = false;
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.saving = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            onDelete() {
+                this.$confirm('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/neteaseMessage/del/${this.formData.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped></style>

+ 175 - 0
src/main/vue/src/views/NeteaseMessageList.vue

@@ -0,0 +1,175 @@
+<template>
+    <div  class="list-view">
+        <page-title>
+            <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading" class="filter-item">
+                新增
+            </el-button>
+            <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData" class="filter-item">
+                导出
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                    placeholder="搜索..."
+                    v-model="search"
+                    clearable
+                    class="filter-item search"
+                    @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table :data="tableData" row-key="id" ref="table"
+                  header-row-class-name="table-header-row"
+                  header-cell-class-name="table-header-cell"
+                  row-class-name="table-row" cell-class-name="table-cell"
+                  :height="tableHeight" v-loading="fetchingData">
+            <el-table-column v-if="multipleMode" align="center" type="selection"
+                             width="50">
+            </el-table-column>
+            <el-table-column prop="id" label="ID" width="100">
+            </el-table-column>
+                                <el-table-column prop="from" label="发送用户"
+>
+                    </el-table-column>
+                    <el-table-column prop="to" label="收信用户"
+>
+                    </el-table-column>
+                    <el-table-column prop="ope" label="发信类型"
+>
+                    </el-table-column>
+                    <el-table-column prop="type" label="信息类型"
+>
+                    </el-table-column>
+                    <el-table-column prop="body" label="信息主题"
+>
+                    </el-table-column>
+            <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right"
+                    width="150">
+                <template slot-scope="{row}">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination background @size-change="onSizeChange"
+                           @current-change="onCurrentChange" :current-page="page"
+                           :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize"
+                           layout="total, sizes, prev, pager, next, jumper"
+                           :total="totalElements">
+            </el-pagination>
+        </div>
+
+    </div>
+</template>
+<script>
+    import { mapState } from "vuex";
+    import pageableTable from "@/mixins/pageableTable";
+
+    export default {
+        name: 'NeteaseMessageList',
+        mixins: [pageableTable],
+        data() {
+            return {
+                multipleMode: false,
+                search: "",
+                url: "/neteaseMessage/all",
+                downloading: false,
+            }
+        },
+        computed: {
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            beforeGetData() {
+                return { search: this.search, query: { del: false } };
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            addRow() {
+                this.$router.push({
+                    path: "/neteaseMessageEdit",
+                    query: {
+                        ...this.$route.query
+                    }
+                });
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: "/neteaseMessageEdit",
+                    query: {
+                    id: row.id
+                    }
+                });
+            },
+            download() {
+                this.downloading = true;
+                this.$axios
+                    .get("/neteaseMessage/excel", { 
+                        responseType: "blob",
+                        params: { size: 10000 }
+                    })
+                    .then(res => {
+                        console.log(res);
+                        this.downloading = false;
+                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                        const link = document.createElement("a");
+                        link.href = downloadUrl;
+                        link.setAttribute(
+                            "download",
+                            res.headers["content-disposition"].split("filename=")[1]
+                        );
+                        document.body.appendChild(link);
+                        link.click();
+                        link.remove();
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.downloading = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            },
+            deleteRow(row) {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/neteaseMessage/del/${row.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 42 - 2
src/test/java/com/izouma/nineth/service/UserServiceTest.java

@@ -1,10 +1,13 @@
 package com.izouma.nineth.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.alipay.api.AlipayApiException;
 import com.huifu.adapay.core.exception.BaseAdaPayException;
 import com.izouma.nineth.ApplicationTests;
 import com.izouma.nineth.config.Constants;
 import com.izouma.nineth.domain.IdentityAuth;
+import com.izouma.nineth.domain.netease.NeteaseMessage;
+import com.izouma.nineth.domain.netease.Team;
 import com.izouma.nineth.domain.User;
 import com.izouma.nineth.dto.BankValidate;
 import com.izouma.nineth.dto.PageQuery;
@@ -12,10 +15,13 @@ import com.izouma.nineth.dto.UserBankCard;
 import com.izouma.nineth.dto.UserRegister;
 import com.izouma.nineth.enums.AuthStatus;
 import com.izouma.nineth.enums.InviteType;
+import com.izouma.nineth.enums.netease.TeamType;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.IdentityAuthRepo;
 import com.izouma.nineth.repo.UserBankCardRepo;
 import com.izouma.nineth.repo.UserRepo;
+import com.izouma.nineth.service.netease.NeteaseMessageService;
+import com.izouma.nineth.service.netease.TeamService;
 import com.izouma.nineth.service.storage.StorageService;
 import com.izouma.nineth.utils.BankUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -24,6 +30,8 @@ import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -49,6 +57,10 @@ public class UserServiceTest extends ApplicationTests {
     private AdapayMerchantService adapayMerchantService;
     @Autowired
     private IdentityAuthRepo      identityAuthRepo;
+    @Autowired
+    private TeamService           teamService;
+    @Autowired
+    private NeteaseMessageService neteaseMessageService;
 
     @Test
     public void findByUsernameAndDelFalse1() {
@@ -139,7 +151,8 @@ public class UserServiceTest extends ApplicationTests {
         String bankNo = "6222024301070380165";
         String phone = "15077886171";
         User user = userRepo.findById(userId).orElseThrow(new BusinessException("用户不存在"));
-        IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
+        IdentityAuth identityAuth = identityAuthRepo
+                .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
                 .orElseThrow(new BusinessException("用户未认证"));
         if (identityAuth.isOrg()) {
             //throw new BusinessException("企业认证用户请绑定对公账户");
@@ -152,7 +165,9 @@ public class UserServiceTest extends ApplicationTests {
             throw new BusinessException("暂不支持此卡");
         }
 
-        adapayMerchantService.createMemberForAll(userId.toString(), user.getPhone(), identityAuth.getRealName(), identityAuth.getIdNo());
+        adapayMerchantService
+                .createMemberForAll(userId.toString(), user.getPhone(), identityAuth.getRealName(), identityAuth
+                        .getIdNo());
         user.setMemberId(user.getId().toString());
         userRepo.save(user);
 
@@ -217,4 +232,29 @@ public class UserServiceTest extends ApplicationTests {
     public void checkauth() throws AlipayApiException {
         userService.checkFaceAuth("7160e6a875cb67648bc7a3cce6e5397e");
     }
+
+    @Test
+    public void teamTest() {
+        Team team = new Team();
+        team.setName("测试大厅2");
+        team.setOwnerid("9859");
+        List<String> members = new ArrayList<>();
+        members.add("7956591");
+        team.setMembers(members);
+        team.setCustom(TeamType.PUBLIC);
+        teamService.create(team);
+    }
+
+    @Test
+    public void sendMessage() {
+        NeteaseMessage neteaseMessage = new NeteaseMessage();
+        neteaseMessage.setFromId("9859");
+        neteaseMessage.setToId("9850");
+        neteaseMessage.setOpe(0);
+        neteaseMessage.setType(0);
+        Map<String, Object> body = new HashMap<>();
+        body.put("msg", "这是一条测试消息");
+        neteaseMessage.setBody(JSONObject.toJSONString(body));
+        neteaseMessageService.sendMessage(neteaseMessage);
+    }
 }