This commit is contained in:
@jyuhsin
2024-12-31 16:29:09 +08:00
parent 6445645597
commit cd6452721f
10 changed files with 490 additions and 92 deletions
@@ -1,7 +1,9 @@
package io.v.nutz.sys.controllers.platform.sys.club.applyIn;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.DateUtil;
@@ -11,6 +13,7 @@ import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.model.Audit;
import io.v.nutz.sys.constant.club.ClubRegistAuditState;
import io.v.nutz.sys.controllers.platform.sys.handler.ClubUserApplyToDoHandler;
import io.v.nutz.sys.models.Sys_club;
import io.v.nutz.sys.models.Sys_club_user;
import io.v.nutz.sys.services.SysClubService;
import io.v.nutz.sys.services.SysClubUserService;
@@ -25,6 +28,8 @@ import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback;
import org.nutz.dao.util.Daos;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@@ -81,35 +86,44 @@ public class ClubApplyInController {
@Param(value = "pageOrderName", required = false) String pageOrderName,
@Param(value = "pageOrderBy", required = false) String pageOrderBy,
@Param(value = "clubType", required = false) String clubType) {
Sql sql = Sqls.create("SELECT" +
" club.*," +
" fzr.username fzrname," +
" unit.`name` fzr_unit_name," +
" (select yearAuditStatus from sys_club_user where clubid = club.id and userid = @userid and year(yearAudit) = @year and isNormal = true and yearAuditStatus is not null) as yearAuditStatus," +
" (select GROUP_CONCAT(username) from sys_user where id in (select userid from sys_club_user u where u.clubid=club.id and u.sf=1 and isNormal = true)) as hz," +
" (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 5 and isNormal = true ) cynum," +
" (SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` in (1, 3) and isNormal = true) approvalnum," +
" (SELECT status FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) status," +
" (select count(*) from sys_user where userState='在职' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as worknum," +
" (select count(*) from sys_user where userState='退休' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as outnum" +
" FROM" +
" `sys_club` club" +
" LEFT JOIN sys_user fzr ON club.concatPerson = fzr.id" +
" LEFT JOIN sys_unit unit ON fzr.unitid = unit.id $condition")
Sql sql = Sqls.create("""
SELECT
club.*,
fzr.username fzrname,
unit.`name` fzr_unit_name,
(select yearAuditStatus from sys_club_user where clubid = club.id and userid = @userid and year(yearAudit) = @year and isNormal = true and yearAuditStatus is not null) as yearAuditStatus,
(select GROUP_CONCAT(username) from sys_user where id in (select userid from sys_club_user u where u.clubid=club.id and u.sf=1 and isNormal = true)) as hz,
(SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` = 5 and isNormal = true ) cynum,
(SELECT count( 1 ) FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.`status` in (1, 3) and isNormal = true) approvalnum,
(SELECT status FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) status,
(SELECT invite FROM sys_club_user scu WHERE scu.clubid = club.id AND scu.userid = @userid and isNormal = true) invite,
(select count(*) from sys_user where userState='在职' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as worknum,
(select count(*) from sys_user where userState='退休' and id in (select userid from sys_club_user where clubid = club.id and `status` = 5 and isNormal = true)) as outnum
FROM
`sys_club` club
LEFT JOIN sys_user fzr ON club.concatPerson = fzr.id
LEFT JOIN sys_unit unit ON fzr.unitid = unit.id
$condition
""")
.setParam("userid", ShiroUtil.getPrincipalProperty("id"))
.setParam("year", cn.hutool.core.date.DateUtil.thisYear());
Cnd cnd = Cnd.NEW();
cnd.and("isjs", "=", false);
cnd.and("state", "=", ClubRegistAuditState.SCHOOL_PASS);
if (StrUtil.isNotBlank(clubType)) {
cnd.and("club.type", "=", clubType);
}
if (isjr) {
cnd.and("club.id in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '" + ShiroUtil.getPrincipalProperty("id") + "') and 1", "=", 1);
cnd.and("club.id in (SELECT clubid from sys_club_user WHERE isNormal = true and status in (1,3,5) and userid = '" + ShiroUtil.getPrincipalProperty("id") + "') and 1", "=", 1);
} else {
cnd.and("club.id not in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '" + ShiroUtil.getPrincipalProperty("id") + "' and status not in (2, 4) ) and 1", "=", 1);
SqlExpressionGroup group = new SqlExpressionGroup();
group.and("state", "=", ClubRegistAuditState.SCHOOL_PASS);
group.or(new Static("club.id in (select clubid from sys_club_user where userid = '%s' and invite = true and status in (6, 7))"
.formatted(ShiroUtil.getPlatformUid())));
cnd.and(group);
cnd.and("club.id not in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '" + ShiroUtil.getPrincipalProperty("id") + "' and status not in (2, 4, 6, 7) ) and 1", "=", 1);
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
@@ -122,7 +136,6 @@ public class ClubApplyInController {
}
sql.setCondition(cnd);
return sysClubService.listPage(pageNumber, pageSize, sql);
}
@@ -132,28 +145,34 @@ public class ClubApplyInController {
@RequiresPermissions("sys.club.sq")
@Aop(TransAop.READ_COMMITTED)
public Object submit(Sys_club_user sys_club_user) {
Sys_club sysClub = dao.fetch(Sys_club.class, sys_club_user.getClubid());
Sys_club_user sysClubUser = dao.fetch(Sys_club_user.class, Cnd.where("clubid", "=", sys_club_user.getClubid()).and("userid", "=", ShiroUtil.getUserId()));
sys_club_user.setInvite(sysClubUser.getInvite());
sysClubUserService.clear(Cnd.where("clubid", "=", sys_club_user.getClubid()).and("userid", "=", ShiroUtil.getPrincipalProperty("id")));
boolean isInvite = sys_club_user.getInvite() && Objects.equals(sysClub.getState(), ClubRegistAuditState.NOT_SUBMIT);
String dateTime = DateUtil.getDateTime();
sys_club_user.setUserid(ShiroUtil.getPrincipalProperty("id").toString());
sys_club_user.setJoin_time(dateTime);
sys_club_user.setSf(2);
sys_club_user.setStatus(1);
sys_club_user.setStatus(isInvite ? 5 : 1);
sys_club_user.setIsjf(false);
sys_club_user.setIsNormal(true);
sys_club_user.setGiveMoney(true);
Sys_club_user clubUser = sysClubUserService.insert(sys_club_user);
//插入后,发起待办流程
ClubUserApplyToDoHandler.START_PROCESS.exec(clubUser);
//发任务给协会会长
ClubUserApplyToDoHandler.CREATE_CLUB_TASK.exec(clubUser);
//完成申请人的任务(申请拒绝的情况)
ClubUserApplyToDoHandler.COMPLETE_APPLY_TASK.exec(clubUser);
if(sys_club_user.getStatus() != 5) {
//插入后,发起待办流程
ClubUserApplyToDoHandler.START_PROCESS.exec(clubUser);
//发任务给协会会长
ClubUserApplyToDoHandler.CREATE_CLUB_TASK.exec(clubUser);
//完成申请人的任务(申请拒绝的情况)
ClubUserApplyToDoHandler.COMPLETE_APPLY_TASK.exec(clubUser);
//根据协会id查询协会负责人,发短信
Sql sql = Sqls.create("""
//根据协会id查询协会负责人,发短信
Sql sql = Sqls.create("""
SELECT
u.loginname as loginName,
u.username as userName,
@@ -169,19 +188,20 @@ public class ClubApplyInController {
sys_club c ON c.id = r.stid
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("stid", "=", sys_club_user.getClubid());
cnd.and("roleId", "in", Lang.array(Roles.club01, Roles.club02, Roles.club03, Roles.club04));
sql.setCondition(cnd);
List<NutMap> list = baseService.listMap(sql);
Cnd cnd = Cnd.NEW();
cnd.and("stid", "=", sys_club_user.getClubid());
cnd.and("roleId", "in", Lang.array(Roles.club01, Roles.club02, Roles.club03, Roles.club04));
sql.setCondition(cnd);
List<NutMap> list = baseService.listMap(sql);
String platformUsername = ShiroUtil.getPlatformUsername();
String platformUsername = ShiroUtil.getPlatformUsername();
list.forEach(item -> {
String content = "%s老师您好,%s老师于%s申请加入%s,请登陆智慧工会进行审核!".formatted(item.getString("userName")
, platformUsername, dateTime, item.getString("name"));
//msgApi.sendWxMsg(person, content);
});
list.forEach(item -> {
String content = "%s老师您好,%s老师于%s申请加入%s,请登陆智慧工会进行审核!".formatted(item.getString("userName")
, platformUsername, dateTime, item.getString("name"));
//msgApi.sendWxMsg(person, content);
});
}
return null;
}
@@ -303,4 +323,38 @@ public class ClubApplyInController {
Cnd.where("clubid", "=", id).and("userid", "=", ShiroUtil.getUserId()).and("isNormal", "=", true));
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.club.sq")
public Object inviteNotAgree(String clubId) {
Sys_club_user clubUser = dao.fetch(Sys_club_user.class, Cnd.where("clubid", "=", clubId).and("userid", "=", ShiroUtil.getUserId()));
clubUser.setStatus(7);
dao.update(clubUser);
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.club.sq")
public Object inviteAgree(String clubId) {
//同意直接审核通过
Sys_club_user clubUser = dao.fetch(Sys_club_user.class, Cnd.where("clubid", "=", clubId).and("userid", "=", ShiroUtil.getUserId()));
clubUser.setStatus(5);
dao.update(clubUser);
return null;
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.club.sq")
public Object rollbackInvite(String clubId) {
Sys_club_user clubUser = dao.fetch(Sys_club_user.class, Cnd.where("clubid", "=", clubId).and("userid", "=", ShiroUtil.getUserId()));
clubUser.setStatus(6);
dao.update(clubUser);
return null;
}
}
@@ -1,15 +1,17 @@
package io.v.nutz.sys.controllers.platform.sys.club.regist;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.model.Audit;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_club_sponsor;
import io.v.nutz.sys.models.Sys_club_user;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.sys.models.*;
import io.v.nutz.sys.services.SysClubService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
@@ -27,6 +29,10 @@ import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author JyuHsin
* @Date 2022/4/14
@@ -46,6 +52,9 @@ public class ClubMyApplyController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@At("")
@Ok("beetl:/platform/sys/club/regist/clubMyApply.html")
@RequiresPermissions("sys.club.clubRegist.clubMyApply")
@@ -145,18 +154,69 @@ public class ClubMyApplyController {
if (Strings.isNotBlank(result.getString("xldAuditId"))) {
result.put("xldAudit", dao.fetch(Audit.class, result.getString("xldAuditId")));
}
result.setv("clubuser", baseService.listMap(Sqls.create("SELECT\n" +
"\tscu.*,\n" +
"\tu.username,u.loginname,\n" +
"\tu.sex,\n" +
"\tu.mobile,\n" +
"\tunit.`name` unitname \n" +
"FROM\n" +
"\tsys_club_user scu\n" +
"\tLEFT JOIN sys_user u ON scu.userid = u.id\n" +
"\tLEFT JOIN sys_unit unit ON u.unitid = unit.id\n" +
"\tWHERE scu.clubid = @clubid and scu.status = 5 and isNormal = true\n" +
"\tORDER BY FIELD( scu.sf, 1, 3, 4, 5, 2 ),scu.join_time DESC").setParam("clubid", id)));
result.setv("clubuser", baseService.listMap(Sqls.create("""
SELECT
scu.*,
scu.userid as userId,
u.username,
u.loginname,
u.sex,
u.mobile,
unit.`name` unitname
FROM
sys_club_user scu
LEFT JOIN sys_user u ON scu.userid = u.id
LEFT JOIN sys_unit unit ON u.unitid = unit.id
WHERE scu.clubid = @clubid and scu.status in (5, 6) and isNormal = true
ORDER BY FIELD( scu.sf, 1, 3, 4, 5, 2 ),scu.join_time DESC
""").setParam("clubid", id)));
return result;
}
@At
@ViReturn
@RequiresPermissions("sys.club.clubRegist.clubMyApply")
public Object getInviteUser(String id) {
Sql sql = Sqls.create("""
SELECT
cu.*,
u.username,
u.loginname,
u.unitname,
u.sex,
u.mobile
FROM
sys_club_user cu
LEFT JOIN USER u ON cu.userId = u.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("cu.clubid", "=", id);
cnd.and("cu.invite", "=", true);
cnd.desc("cu.status");
sql.setCondition(cnd);
return baseService.listMap(sql);
}
@At
@ViReturn
@RequiresPermissions("sys.club.clubRegist.clubMyApply")
public Object sendDingTalkMsg(String id, String[] userList) {
if(StrUtil.isBlank(id)) {
return Result.error("推送失败,协会信息为空");
}
if(userList.length == 0) {
return Result.error("推送失败,人员信息为空");
}
Sys_club sysClub = dao.fetch(Sys_club.class, id);
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.where("loginname", "in", userList));
Map<String, Sys_user> userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, o -> o));
for (String user : userList) {
Sys_user sysUser = userMap.get(user);
String content = "%s老师您好,欢迎加入%s,请进入入会申请进行确认!".formatted(sysUser.getUsername(), sysClub.getName())
+ Globals.AppDomain + "/platform/sys/club/sq/mobile";
msgApi.sendMsg(List.of("DingTalk"), user, 1, "协会入会邀请", content, "", "");
}
return null;
}
}
@@ -2,6 +2,7 @@ package io.v.nutz.sys.controllers.platform.sys.club.regist;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.result.Result;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.constant.club.ClubRegistAuditState;
@@ -27,6 +28,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author JyuHsin
@@ -71,8 +73,11 @@ public class ClubRegistApplyController {
@RequiresPermissions("sys.club.clubRegist.clubRegistApply")
public Object doAdd(@Param(value = "club", required = false) Sys_club club,
@Param(value = "isSave", required = false) Boolean isSave,
@Param(value = "::managePerson", required = false) List<NutMap> managePerson) throws IOException {
@Param(value = "::managePerson", required = false) List<NutMap> managePerson,
@Param(value = "::clubUserList", required = false) List<NutMap> clubUserList) throws IOException {
if(!sysClubService.getInviteAgree(club)) {
return Result.error("邀请会员中确认人数暂未达到20人");
}
club.setIsjs(false);
if (ShiroUtil.hasAnyRoles("sysadmin, A06, xxhgly")) {
club.setFoundTime(DateUtil.getDateTime());
@@ -116,6 +121,25 @@ public class ClubRegistApplyController {
}
}
});
//协会成员
List<String> manageUserIdList = managePerson.stream().map(o -> o.getString("userId")).toList();
clubUserList.forEach(item -> {
if (StrUtil.isNotBlank(item.getString("userId")) && !manageUserIdList.contains(item.getString("userId"))) {
Sys_club_user cUser = new Sys_club_user();
cUser.setClubid(sysClub.getId());
cUser.setUserid(item.getString("userId"));
cUser.setJoin_time(DateUtil.getDateTime());
cUser.setSf(2);
cUser.setIsjf(true);
cUser.setStatus(6);
cUser.setGiveMoney(true);
cUser.setIsNormal(true);
cUser.setInvite(true);
clubUsers.add(cUser);
}
});
if (ShiroUtil.hasAnyRoles("sysadmin, A06, xxhgly")) {
dao.insert(userRoles);
}
@@ -145,10 +169,15 @@ public class ClubRegistApplyController {
public Object doEdit(@Param(value = "club", required = false) Sys_club club,
@Param(value = "isSave", required = false) Boolean isSave,
@Param(value = "::deleteIds", required = false) List<String> deleteIds,
@Param(value = "::managePerson", required = false) List<NutMap> managePerson) throws IOException {
@Param(value = "::managePerson", required = false) List<NutMap> managePerson,
@Param(value = "::clubUserList", required = false) List<NutMap> clubUserList) throws IOException {
if(!isSave && Objects.equals(club.getState(), ClubRegistAuditState.NOT_SUBMIT) && !sysClubService.getInviteAgree(club)) {
return Result.error("邀请会员中确认人数暂未达到20人");
}
//如果不是管理员,并且点的提交按钮
if (!isSave && !ShiroUtil.hasAnyRoles("sysadmin, A06, xxhgly")) {
if (!isSave && Objects.equals(club.getUserid(), ShiroUtil.getUserId())) {
club.setState(club.getSponsorType() == 1 ? ClubRegistAuditState.UNIT_PART_READY : ClubRegistAuditState.XT_READY);
club.setXtAuditId("");
club.setXldAuditId("");
@@ -194,6 +223,27 @@ public class ClubRegistApplyController {
}
});
List<String> manageUserIdList = managePerson.stream().map(o -> o.getString("userId")).toList();
clubUserList.forEach(item -> {
if (StrUtil.isNotBlank(item.getString("userId")) && !manageUserIdList.contains(item.getString("userId"))) {
int count = dao.count(Sys_club_user.class, Cnd.where("clubid", "=", club.getId())
.and("userid", "=", item.getString("userId")));
if(count == 0) {
Sys_club_user cUser = new Sys_club_user();
cUser.setClubid(club.getId());
cUser.setUserid(item.getString("userId"));
cUser.setJoin_time(DateUtil.getDateTime());
cUser.setSf(2);
cUser.setIsjf(true);
cUser.setStatus(6);
cUser.setGiveMoney(true);
cUser.setIsNormal(true);
cUser.setInvite(true);
clubUsers.add(cUser);
}
}
});
if(ShiroUtil.hasAnyRoles("sysadmin, A06, xxhgly") && Objects.equals(club.getState(), ClubRegistAuditState.SCHOOL_PASS)) {
dao.clear(Sys_user_role.class, Cnd.where("stid", "=", club.getId())
.and("roleid", "in", Lang.array(Roles.club01, Roles.club02, Roles.club03, Roles.club04)));
@@ -72,7 +72,7 @@ public class Sys_club_user extends BaseModel {
private Integer yearAuditStatus;
@Column
@Comment("状态(1 待协会审核 2 协会审核不通过 3 待校工会审核 4 校工会审核不通过 5 通过)")
@Comment("状态(1 待协会审核 2 协会审核不通过 3 待校工会审核 4 校工会审核不通过 5 通过 6 待邀请确认")
@ColDefine(type = ColType.INT, width = 4)
private Integer status;
@@ -215,4 +215,10 @@ public class Sys_club_user extends BaseModel {
@Comment("会长审核id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String clubAuditId;
@Column
@Comment("是否注册时邀请")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean invite;
}
@@ -10,4 +10,6 @@ import org.nutz.dao.Cnd;
public interface SysClubService extends BaseService<Sys_club> {
Pagination pageData(Cnd cnd, PageForm page, Integer year, String name);
Boolean getInviteAgree(Sys_club club);
}
@@ -1,9 +1,11 @@
package io.v.nutz.sys.services.impl;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_club;
import io.v.nutz.sys.models.Sys_club_user;
import io.v.nutz.sys.services.SysClubService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
@@ -46,4 +48,14 @@ public class SysClubServiceImpl extends BaseServiceImpl<Sys_club> implements Sys
sql.setCondition(cnd);
return listPageMap(page.getPageNumber(), page.getPageSize(), sql);
}
@Override
public Boolean getInviteAgree(Sys_club club) {
if(StrUtil.isBlank(club.getId())) {
return false;
}
int count = dao().count(Sys_club_user.class, Cnd.where("clubid", "=", club.getId())
.and("invite", "=", true).and("status", "=", 5));
return count >= 20;
}
}
@@ -116,8 +116,16 @@
align="center"></el-table-column>
<el-table-column label="电话" width="150px" prop="mobile" header-align="center"
align="center"></el-table-column>
<el-table-column label="所属单位" prop="unitname" header-align="center" show-overflow-tooltip="true"
<el-table-column label="所属单位" prop="unitname" header-align="center" show-overflow-tooltip
align="center"></el-table-column>
<el-table-column label="是否同意邀请" prop="unitname" header-align="center"
align="center">
<template v-slot="{row}">
<span class="text-success" v-if="row.invite === true && row.status === 5"></span>
<span v-if="row.invite === true && row.status !== 5"></span>
<span v-if="row.invite === false">未邀请</span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
@@ -27,6 +27,7 @@ layout("/mobile/platform.html"){
.van-button--small {
border-radius: 6px;
height: 26px;
font-size: 13px;
}
.van-col {
@@ -216,14 +217,14 @@ layout("/mobile/platform.html"){
<van-divider></van-divider>
<div style="display: flex; justify-content: flex-end">
<div>
<van-button @click="openInfo(o, 'view')" color="#1867b0"
size="small" style="margin-right: 8px" type="primary">
查看
</van-button>
<van-button @click="openInfo(o, 'view')" color="#1867b0"
size="small" style="margin-right: 8px" type="primary">
查看
</van-button>
<div v-if="o.state > 800">
<van-button @click="rollback(o)" color="#1867b0"
size="small" style="margin-right: 8px" type="primary"
v-if="pageForm.isjr === true && o.status==1">申请
v-if="pageForm.isjr === true && o.status==1">申请
</van-button>
<van-button @click="openInfo(o, 'join')"
color="#1867b0" v-if="pageForm.isjr === false"
@@ -231,6 +232,25 @@ layout("/mobile/platform.html"){
我要加入
</van-button>
</div>
<div v-else>
<template v-if="o.status == 7">
<van-button @click="rollbackInvite(o)" color="#1867b0"
size="small" style="margin-right: 8px" type="primary">撤回
</van-button>
</template>
<template v-else>
<van-button @click="inviteNotAgree(o)"
color="#1867b0" v-if="pageForm.isjr === false"
size="small" style="margin-right: 8px" type="primary">
不同意
</van-button>
<van-button @click="openInfo(o, 'join')"
color="#1867b0" v-if="pageForm.isjr === false"
size="small" style="margin-right: 8px" type="primary">
同意
</van-button>
</template>
</div>
</div>
</div>
</div>
@@ -436,6 +456,28 @@ layout("/mobile/platform.html"){
}
},
methods: {
async rollbackInvite(o) {
const confirm = await vant.Dialog.confirm({
title: '提示',
message: '您确定要撤回吗?',
})
if (confirm === "confirm") {
const resp = await $.post('/platform/sys/club/sq/rollbackInvite', {clubId: o.id})
vant.Toast(resp.msg)
this.doSearch()
}
},
async inviteNotAgree(o) {
const confirm = await vant.Dialog.confirm({
title: '提示',
message: '您确定要不同意的' + o.name + '的入会邀请吗?',
})
if (confirm === "confirm") {
const resp = await $.post('/platform/sys/club/sq/inviteNotAgree', {clubId: o.id})
vant.Toast(resp.msg)
this.doSearch()
}
},
showCode(type) {
if(type === 'QQ' && this.clickRow.qqgroupcode) {
const ids = JSON.parse(this.clickRow.qqgroupcode).map(o => FILE_DOMAIN + '/fileStreamPreview?id=' + o.id)
@@ -444,6 +486,7 @@ layout("/mobile/platform.html"){
const ids = JSON.parse(this.clickRow.wechatgroupcode).map(o => FILE_DOMAIN + '/fileStreamPreview?id=' + o.id)
vant.ImagePreview({images: ids})
}
vant.Toast('暂无二维码')
},
doSearch() {
this.pageForm.pageNumber = 1
@@ -71,9 +71,10 @@ layout("/layouts/platform.html"){
</template>
</el-table-column>
<el-table-column label="操作" width="300px">
<el-table-column label="操作" width="400px">
<template scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button @click="sendDingTalkMsg(row)" size="mini" type="primary">发送钉钉消息</el-button>
<template v-if="${@shiro.hasRole('sysadmin')} || ${@shiro.hasRole('A06')} || ${@shiro.hasRole('xxhgly')}">
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
<el-button @click="deleteDo(row)" size="mini" type="danger">删除</el-button>
@@ -96,6 +97,29 @@ layout("/layouts/platform.html"){
</guava>
<el-dialog :visible.sync="inviteUserDialog" title="邀请人员" width="60%" top="2%">
<el-table :data="inviteUserTableData" size="mini" max-height="600px" @selection-change="handleSelectionChange">
<el-table-column :selectable="(row) => {return row.status !== 5}" type="selection" width="55"></el-table-column>
<el-table-column label="序号" type="index" width="80"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="所属单位" prop="unitname" show-overflow-tooltip></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column>
<el-table-column label="是否同意邀请" prop="invite">
<template slot-scope="{row}">
<span class="text-success" v-if="row.invite === true && row.status === 5"></span>
<span v-if="row.invite === true && row.status !== 5"></span>
<span v-if="row.invite === false || row.invite === null || row.invite == undefined">未邀请</span>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="inviteUserDialog = false">取消</el-button>
<el-button type="primary" @click="sendDo">发送</el-button>
</span>
</el-dialog>
</div>
<script>
@@ -113,9 +137,49 @@ layout("/layouts/platform.html"){
},
tableData: [],
schoolAudit: false,
inviteUserTableData: [],
inviteUserDialog: false,
multipleSelection: [],
clickRow: {},
}
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val
},
async sendDingTalkMsg(row) {
this.clickRow = row
const resp = await $.post('/platform/sys/club/clubMyApply/getInviteUser', {id: row.id})
this.inviteUserTableData = resp.data
this.inviteUserDialog = true
},
async sendDo() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请选择推送人员')
return
}
const confirm = await this.$confirm('您选择了' + this.multipleSelection.length + '位人员,请再次确认是否要推送?' +
'<br><span style="color: red">注:推送后消息不可撤回!</span>', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
})
if (confirm === "confirm") {
const resp = await $.post('/platform/sys/club/clubMyApply/sendDingTalkMsg', {
id: this.clickRow.id,
userList: JSON.stringify(this.multipleSelection.map(o => o.loginname))
})
if(resp.code === 0) {
this.$message.success(resp.msg)
this.doSearch()
} else {
this.$message.warning(resp.msg)
}
}
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
@@ -22,6 +22,7 @@ layout("/layouts/platform.html"){
<el-step title="协会基本信息"></el-step>
<el-step title="协会发起人"></el-step>
<el-step title="协会理事机构"></el-step>
<el-step title="协会成员"></el-step>
</el-steps>
<div style="margin-top: 10px">
@@ -191,7 +192,7 @@ layout("/layouts/platform.html"){
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username + ' - ' + item.unitname"
:label="item.username"
:value="item.id">
</el-option>
</el-select>
@@ -250,7 +251,7 @@ layout("/layouts/platform.html"){
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username + ' - ' + item.unitname"
:label="item.username"
:value="item.id">
</el-option>
</el-select>
@@ -282,16 +283,76 @@ layout("/layouts/platform.html"){
</el-table-column>
</el-table>
</div>
<div v-show="activeName === '4'">
<vi-title2 title="请选择协会成员(至少提交20人)"></vi-title2>
<el-table :data="clubUserTableData">
<el-table-column label="序号" type="index" width="80"></el-table-column>
<el-table-column label="姓名" prop="userId">
<template slot-scope="scope">
<el-select
style="width: 100%"
v-model="scope.row.userId"
filterable remote
@change="(val) => { clubUserChange(val, scope.row, scope.$index) }"
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userRemoteMethod"
:loading="userLoading">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="工号" prop="loginname">
<template slot-scope="scope">
<el-input :value="scope.row.loginname" readonly></el-input>
</template>
</el-table-column>
<el-table-column label="所属单位" prop="unitname">
<template slot-scope="scope">
<el-input :value="scope.row.unitname" readonly></el-input>
</template>
</el-table-column>
<el-table-column label="联系电话" prop="mobile">
<template slot-scope="scope">
<el-input :value="scope.row.mobile" readonly></el-input>
</template>
</el-table-column>
<el-table-column label="是否同意邀请" prop="mobile">
<template slot-scope="{row}">
<span class="text-success" v-if="row.invite === true && row.status === 5"></span>
<span v-if="row.invite === true && row.status !== 5"></span>
<span v-if="row.invite === false || row.invite === null || row.invite == undefined">未邀请</span>
</template>
</el-table-column>
<el-table-column>
<template slot="header" slot-scope="scope">
<el-button type="primary" @click="clubUserTableData.push({})" size="mini">增加</el-button>
</template>
<template slot-scope="scope">
<el-button type="danger"
@click="clubUserDeleteRow(scope.row, scope.$index)" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-row class="mt20" justify="end" type="flex">
<el-button v-if="GetQueryString('id') !== '' || GetQueryString('from') !== ''" @click="doBack">返回</el-button>
<el-button v-if="activeName === '2'" type="primary" @click="activeName = '1'">上一步</el-button>
<el-button v-if="activeName === '3'" type="primary" @click="activeName = '2'">上一步</el-button>
<el-button v-if="activeName === '4'" type="primary" @click="activeName = '3'">上一步</el-button>
<el-button v-if="activeName === '1'" type="primary" @click="activeName = '2'">下一步</el-button>
<el-button v-if="activeName === '2'" type="primary" @click="activeName = '3'">下一步</el-button>
<el-button v-if="activeName === '3'" type="primary" @click="activeName = '4'">下一步</el-button>
<el-button type="primary" @click="doHandle(true)">保存</el-button>
<el-button :disabled="activeName !== '3'" type="primary" @click="doHandle(false)">提交</el-button>
<el-button type="primary" @click="doHandle(false)">提交</el-button>
</el-row>
</el-card>
</guava>
@@ -304,6 +365,7 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins],
data() {
return {
clubUserTableData: [],
sponsorData: [
{},
{},
@@ -315,11 +377,14 @@ layout("/layouts/platform.html"){
sponsorType: 1,
},
formRules: {
name: [{required: true, message: '请填写协会名称', trigger: ['blur', 'change']}],
code: [{required: true, message: '请填写协会编码', trigger: ['blur', 'change']}],
type: [{required: true, message: '请选择协会类型', trigger: ['blur', 'change']}],
fzr: [{required: true, message: '请选择协会联系人', trigger: ['blur', 'change']}],
sponsorType: [{required: true, message: '请选择发起类型', trigger: ['blur', 'change']}],
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
code: [{required: true, message: '必填', trigger: ['blur', 'change']}],
type: [{required: true, message: '必填', trigger: ['blur', 'change']}],
fzr: [{required: true, message: '必填', trigger: ['blur', 'change']}],
sponsorType: [{required: true, message: '必填', trigger: ['blur', 'change']}],
establishReport: [{required: true, message: '必填', trigger: ['blur', 'change']}],
rulesFile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
yearPlanFile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
typeOptions: [],
userLoading: false,
@@ -347,6 +412,29 @@ layout("/layouts/platform.html"){
}
this.managePerson.splice(index, 1)
},
clubUserChange(val, row, index) {
const cloneData = clone(this.clubUserTableData)
cloneData.splice(index, 1)
const u = cloneData.find(o => val && o.userId === val)
if (u) {
this.$message.warning('协会成员不能重复')
this.$set(row, 'loginname', '')
this.$set(row, 'unitname', '')
this.$set(row, 'mobile', '')
this.$set(row, 'userId', '')
return
}
const user = this.userOptions.find(o => o.id === val)
row.loginname = user.loginname
row.unitname = user.unitname
row.mobile = user.mobile
},
clubUserDeleteRow(row, index) {
if (row.id) {
this.deleteIds.push(row.id)
}
this.clubUserTableData.splice(index, 1)
},
sponsorDeleteRow(row, index) {
this.sponsorData.splice(index, 1)
},
@@ -457,24 +545,29 @@ layout("/layouts/platform.html"){
this.formData.yearPlanFile = JSON.parse(this.formData.yearPlanFile)
}
resp.data.clubuser = resp.data.clubuser.filter(o => o.sf !== 2)
resp.data.clubuser.forEach(item => {
let mUser = resp.data.clubuser.filter(o => o.sf !== 2)
mUser.forEach(item => {
const role = this.roleList.find(o => o.sf === item.sf)
if (role) {
item.roleId = role.id
item.userId = item.userid
}
})
this.managePerson = clone(resp.data.clubuser)
this.managePerson = clone(mUser)
let cUser = resp.data.clubuser.filter(o => o.sf === 2)
this.clubUserTableData = clone(cUser)
let cUserList = cUser.map(o => o.userid)
let users = mUser.map(o => o.userId)
let users = resp.data.clubuser.map(o => o.userId)
let array = []
if(resp.data.sponsor) {
this.sponsorData = []
array = resp.data.sponsor.split(',')
this.formData.sponsor = array
}
users = [...new Set(users.concat(array))]
users = [...new Set(users.concat(array).concat(cUserList))]
this.userOptions = await queryUserByIds(users)
array.forEach(item => {
let row = {}
@@ -488,7 +581,6 @@ layout("/layouts/platform.html"){
}
},
async doHandle(flag) {
try {
let valid = true
if(flag) {
@@ -528,9 +620,20 @@ layout("/layouts/platform.html"){
this.$message.warning('请填写理事机构信息')
return
}
if (!flag && this.managePerson.length < 3) {
/*if (!flag && this.managePerson.length < 3) {
this.$message.warning('理事机构成员要求不少于3人')
return
}*/
let clubUserValid = false
this.managePerson.forEach(item => {
if(!item.userId) {
clubUserValid = true
return
}
})
if (!flag && (this.clubUserTableData.length < 20 || clubUserValid)) {
this.$message.warning('请至少选择20位协会成员')
return
}
const cloneData = clone(this.formData)
let array = []
@@ -548,21 +651,17 @@ layout("/layouts/platform.html"){
isSave: flag,
isSchool: false,
managePerson: this.managePerson,
clubUserList: this.clubUserTableData,
deleteIds: JSON.stringify(this.deleteIds),
})
if (resp.code === 0) {
this.$notify({
title: '成功',
message: resp.msg,
type: 'success',
duration: 500,
onClose: () => {
sublime.jumpPagePjax('/platform/sys/club/clubMyApply')
}
});
this.$message.success(resp.msg)
sublime.jumpPagePjax('/platform/sys/club/clubMyApply')
} else {
this.$message.warning(resp.msg)
}
} catch (e) {
this.$message.warning('存在必填项未填写')
this.$message.warning('协会基本信息存在必填项未填写')
}
},
async getClubCode() {