commit
This commit is contained in:
+8
-21
@@ -10,9 +10,6 @@ import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.smartbenefits.models.*;
|
||||
import com.budwk.app.zhgh.activity.smartbenefits.service.SmartBenefitsActivityService;
|
||||
import com.budwk.app.zhgh.club.model.SysClub;
|
||||
@@ -26,6 +23,8 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -53,8 +52,6 @@ public class SmartBenefitsManageController {
|
||||
@Inject
|
||||
private SmartBenefitsActivityService smartBenefitsActivityManageService;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@@ -245,24 +242,14 @@ public class SmartBenefitsManageController {
|
||||
@Ok("json:full")
|
||||
@ApiOperation("通知报名人员")
|
||||
@SaCheckPermission("smartbenefits.manage")
|
||||
public Result sendNotify(@Param("activityId") String activityId, @Param("content") String content) {
|
||||
if (StrUtil.isBlank(activityId) || StrUtil.isBlank(content)) {
|
||||
public Result sendNotify(@Param("activityId") String activityId, @Param("courseIds") String courseIds, @Param("content") String content) {
|
||||
if (StrUtil.isBlank(activityId) || StrUtil.isBlank(courseIds) || StrUtil.isBlank(content)) {
|
||||
return Result.error("参数不完整");
|
||||
}
|
||||
// 查询该活动下所有报名人员(state=1为正常报名)
|
||||
List<SmartBenefitsUser> userList = dao.query(SmartBenefitsUser.class, Cnd.where("activityId", "=", activityId).and("state", "=", 1));
|
||||
if (userList.isEmpty()) {
|
||||
return Result.error("该活动暂无报名人员");
|
||||
List<String> courseIdList = Json.fromJsonAsList(String.class, courseIds);
|
||||
if (Lang.isEmpty(courseIdList)) {
|
||||
return Result.error("请选择要通知的分活动");
|
||||
}
|
||||
// 获取所有报名人员的userId
|
||||
List<String> userIds = userList.stream().map(SmartBenefitsUser::getUserId).distinct().toList();
|
||||
// 查询用户信息获取loginname
|
||||
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.where("id", "in", userIds));
|
||||
List<String> loginNames = sysUsers.stream().map(Sys_user::getLoginname).filter(StrUtil::isNotBlank).toList();
|
||||
if (loginNames.isEmpty()) {
|
||||
return Result.error("未找到有效的报名人员");
|
||||
}
|
||||
sysMsgService.sendMsg(loginNames, "智享惠生活活动通知", content, SecurityUtil.getUserId());
|
||||
return Result.success("通知发送成功");
|
||||
return smartBenefitsActivityManageService.sendNotify(activityId, courseIdList, content);
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -2,6 +2,7 @@ package com.budwk.app.zhgh.activity.smartbenefits.service;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.activity.smartbenefits.models.SmartBenefitsActivity;
|
||||
import com.budwk.app.zhgh.activity.smartbenefits.models.SmartBenefitsCourse;
|
||||
@@ -132,4 +133,14 @@ public interface SmartBenefitsActivityService extends BaseService<SmartBenefitsA
|
||||
* @param smartBenefitsUser
|
||||
*/
|
||||
void doSignUpInsteadApply(SmartBenefitsUser smartBenefitsUser);
|
||||
|
||||
/**
|
||||
* 按活动下的分活动通知报名人员。
|
||||
*
|
||||
* @param activityId 主活动ID,用于限定本次通知所属活动
|
||||
* @param courseIds 分活动ID列表,至少选择一个;仅通知这些分活动下正常报名人员
|
||||
* @param content 通知正文内容
|
||||
* @return Result,成功时返回通知发送成功,失败时返回无报名人员或无有效接收人等原因
|
||||
*/
|
||||
Result sendNotify(String activityId, List<String> courseIds, String content);
|
||||
}
|
||||
|
||||
+46
@@ -3,8 +3,11 @@ package com.budwk.app.zhgh.activity.smartbenefits.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.smartbenefits.models.*;
|
||||
@@ -41,6 +44,8 @@ public class SmartBenefitsActivityServiceImpl extends BaseServiceImpl<SmartBenef
|
||||
|
||||
@Inject
|
||||
private SmartBenefitsActivityStatisticsService statisticsService;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
public SmartBenefitsActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
@@ -582,4 +587,45 @@ public class SmartBenefitsActivityServiceImpl extends BaseServiceImpl<SmartBenef
|
||||
asyncInsertUserCourse(smartBenefitsUser.getActivityId(), smartBenefitsUser.getCourseId(), smartBenefitsUser.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result sendNotify(String activityId, List<String> courseIds, String content) {
|
||||
if (StrUtil.isBlank(activityId) || Lang.isEmpty(courseIds) || StrUtil.isBlank(content)) {
|
||||
return Result.error("参数不完整");
|
||||
}
|
||||
|
||||
// 按主活动和所选分活动限定通知范围,仅发送给正常报名人员;state=3 是候补转正常后的状态。
|
||||
List<SmartBenefitsUser> userList = dao().query(
|
||||
SmartBenefitsUser.class,
|
||||
Cnd.where("activityId", "=", activityId)
|
||||
.and("courseId", "in", courseIds)
|
||||
.and("state", "in", List.of(1, 3))
|
||||
);
|
||||
if (Lang.isEmpty(userList)) {
|
||||
return Result.error("所选分活动暂无报名人员");
|
||||
}
|
||||
|
||||
List<String> userIds = userList.stream()
|
||||
.map(SmartBenefitsUser::getUserId)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (Lang.isEmpty(userIds)) {
|
||||
return Result.error("未找到有效的报名人员");
|
||||
}
|
||||
|
||||
List<Sys_user> sysUsers = dao().query(Sys_user.class, Cnd.where("id", "in", userIds));
|
||||
List<String> loginNames = sysUsers.stream()
|
||||
.map(Sys_user::getLoginname)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (Lang.isEmpty(loginNames)) {
|
||||
return Result.error("未找到有效的报名人员");
|
||||
}
|
||||
|
||||
sysMsgService.sendMsg(loginNames, "智享惠生活活动通知", content, SecurityUtil.getUserId());
|
||||
return Result.success("通知发送成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,21 @@ layout("/layouts/platform.html"){
|
||||
:visible.sync="notifyDialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
width="50%">
|
||||
<el-select
|
||||
v-model="notifyCourseIds"
|
||||
multiple
|
||||
filterable
|
||||
clearable
|
||||
:loading="notifyCourseLoading"
|
||||
placeholder="请选择要通知的分活动"
|
||||
style="width: 100%; margin-bottom: 15px">
|
||||
<el-option
|
||||
v-for="item in notifyCourseList"
|
||||
:key="item.id"
|
||||
:label="item.courseName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
@@ -138,7 +153,7 @@ layout("/layouts/platform.html"){
|
||||
</el-input>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="notifyDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="sendNotify">发 送</el-button>
|
||||
<el-button type="primary" :loading="notifyLoading" @click="sendNotify">发 送</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</guava>
|
||||
@@ -175,6 +190,10 @@ layout("/layouts/platform.html"){
|
||||
notifyDialogVisible: false,
|
||||
notifyContent: '',
|
||||
notifyActivityId: '',
|
||||
notifyCourseIds: [],
|
||||
notifyCourseList: [],
|
||||
notifyCourseLoading: false,
|
||||
notifyLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -206,28 +225,51 @@ layout("/layouts/platform.html"){
|
||||
openNotifyDialog(row) {
|
||||
this.notifyActivityId = row.id
|
||||
this.notifyContent = ''
|
||||
this.notifyCourseIds = []
|
||||
this.notifyCourseList = []
|
||||
this.notifyDialogVisible = true
|
||||
this.notifyCourseLoading = true
|
||||
this.$axios.post("/platform/smartbenefits/manage/findOne", { id: row.id })
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.notifyCourseList = resp.data.courseList || []
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.notifyCourseLoading = false
|
||||
})
|
||||
},
|
||||
async sendNotify() {
|
||||
sendNotify() {
|
||||
if (this.notifyCourseIds.length === 0) {
|
||||
this.$message.warning('请选择要通知的分活动')
|
||||
return
|
||||
}
|
||||
if (!this.notifyContent.trim()) {
|
||||
this.$message.warning('请输入通知内容')
|
||||
return
|
||||
}
|
||||
this.$confirm("确认发送通知给所有报名人员吗?", "提示", {
|
||||
this.$confirm("确认发送通知给所选分活动的报名人员吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const resp = await this.$axios.post(loc() + "/sendNotify", {
|
||||
}).then(() => {
|
||||
this.notifyLoading = true
|
||||
this.$axios.post(loc() + "/sendNotify", {
|
||||
activityId: this.notifyActivityId,
|
||||
courseIds: JSON.stringify(this.notifyCourseIds),
|
||||
content: this.notifyContent
|
||||
}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.notifyDialogVisible = false
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.notifyLoading = false
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.notifyDialogVisible = false
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
}).catch(() => {})
|
||||
},
|
||||
async activityStatusChange(notice, val, id) {
|
||||
|
||||
Reference in New Issue
Block a user