This commit is contained in:
@jyuhsin
2024-09-23 16:38:23 +08:00
parent 3847865cc5
commit 387f15c9fa
5 changed files with 43 additions and 40 deletions
@@ -3,6 +3,7 @@ package io.v.nutz.meeting.controller.mobile;
import cn.wizzer.framework.base.Result;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.meeting.models.MeetingInfo;
import io.v.nutz.meeting.models.MeetingTimePeriod;
import io.v.nutz.meeting.models.MeetingTimePeriodUser;
import io.v.nutz.meeting.models.MeetingUser;
import io.v.nutz.web.commons.utils.ShiroUtil;
@@ -14,6 +15,7 @@ import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.GET;
import org.nutz.mvc.annotation.Ok;
@@ -23,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@IocBean
@Slf4j
@@ -48,8 +51,9 @@ public class MMeetingNotifyController {
dao.fetchLinks(meetingInfo, "meetingTimePeriods", Cnd.NEW().asc("startTime"));
Cnd cnd = Cnd.NEW();
cnd.and("meetingId", "=", meetingId);
cnd.and("userId", "=", ShiroUtil.getPrincipalProperty("id"));
MeetingTimePeriodUser mtPu = dao.fetch(MeetingTimePeriodUser.class, cnd);
List<MeetingTimePeriodUser> mtPu = dao.query(MeetingTimePeriodUser.class, cnd);
if (Lang.isEmpty(meetingInfo)) {
return Result.error("参数错误");
@@ -58,6 +62,14 @@ public class MMeetingNotifyController {
return Result.error("你不是当前会议人员");
}
List<MeetingTimePeriod> meetingTimePeriods = meetingInfo.getMeetingTimePeriods();
meetingTimePeriods.forEach(item -> {
MeetingTimePeriodUser periodUser = mtPu.stream().filter(o -> Objects.equals(o.getMeetingTimePeriodId(), item.getId())).findFirst().orElse(null);
if(periodUser != null) {
item.setIsJoinByMsg(periodUser.getIsJoinByMsg());
}
});
return meetingInfo;
}
@@ -65,28 +77,18 @@ public class MMeetingNotifyController {
@Ok("json:full")
@ViReturn
@RequiresAuthentication
public Object joinDo(@Param("isJoin") Boolean isJoin,
@Param("notJoinReason") String notJoinReason,
@Param("ids") String[] ids,
public Object joinDo(@Param("notJoinReason") String notJoinReason,
@Param("::data") List<NutMap> joinData,
@Param("meetingId") String meetingId) {
List<MeetingTimePeriodUser> periodUsers = dao.query(MeetingTimePeriodUser.class, Cnd.where("meetingId", "=", meetingId)
.and("userId", "=", ShiroUtil.getPlatformUid()));
if (isJoin) {
//参加
periodUsers.forEach(item -> {
item.setIsJoinByMsg(true);
});
} else {
List<String> strings = Arrays.asList(ids);
periodUsers.forEach(item -> {
if (strings.contains(item.getMeetingTimePeriodId())) {
item.setIsJoinByMsg(false);
item.setNotJoinReason(notJoinReason);
} else {
item.setIsJoinByMsg(true);
}
});
}
joinData.forEach(item -> {
MeetingTimePeriodUser periodUser = periodUsers.stream().filter(o -> Objects.equals(o.getMeetingTimePeriodId(), item.getString("id"))).findFirst().orElse(null);
if(periodUser != null) {
periodUser.setIsJoinByMsg(item.getBoolean("isJoinByMsg"));
periodUser.setNotJoinReason(!item.getBoolean("isJoinByMsg") ? notJoinReason : null);
}
});
dao.update(periodUsers);
return null;
}
@@ -45,4 +45,5 @@ public class MeetingTimePeriod {
@Many(field = "meetingTimePeriodId")
private List<MeetingTimePeriodUser> meetingTimePeriodUserList;
private Boolean isJoinByMsg;
}
@@ -237,18 +237,18 @@ layout("/mobile/platform.html"){
</div>
</template>
<template #input>
<van-checkbox v-model="item.canJoin" shape="square"></van-checkbox>
<van-radio-group v-model="item.isJoinByMsg" direction="horizontal">
<van-radio :name="true">参加</van-radio>
<van-radio :name="false">不参加</van-radio>
</van-radio-group>
</template>
</van-field>
</div>
</div>
</div>
<div class="footer">
<van-button @click="canJoin(false)" block color="#1867b0" round type="primary">
不参加
</van-button>
<van-button @click="canJoin(true)" block color="#1867b0" round type="primary">
参加
<van-button @click="submit" block color="#1867b0" round type="primary">
提交
</van-button>
</div>
</div>
@@ -303,7 +303,6 @@ layout("/mobile/platform.html"){
mtpId: '',
isIncorrect: true,
typeName: '',
isJoin: true,
}
},
methods: {
@@ -323,14 +322,15 @@ layout("/mobile/platform.html"){
}
$('#app').css('opacity', '1')
},
async canJoin(type) {
this.isJoin = type
if(!type) {
const joinArray = this.meetingInfo.meetingTimePeriods.filter(o => o.canJoin === true)
if(joinArray.length === 0) {
this.$modal.alert('请选择不参加的时间段')
async submit() {
for (let item of this.meetingInfo.meetingTimePeriods) {
if(item.isJoinByMsg === null || item.isJoinByMsg === undefined) {
this.$modal.msg('请选择是否参加')
return
}
}
const join = this.meetingInfo.meetingTimePeriods.filter(o => o.isJoinByMsg === false)
if(join.length > 0) {
this.notJoinShow = true
} else {
const confirm = await vant.Dialog.confirm({
@@ -355,21 +355,21 @@ layout("/mobile/platform.html"){
}
},
async joinDo() {
const ids = this.meetingInfo.meetingTimePeriods.filter(o => o.canJoin === true).map(o => o.id)
const resp = await $.post('/mobile/meeting/notify/joinDo', {
isJoin: this.isJoin,
notJoinReason: this.notJoinReason,
ids: JSON.stringify(ids),
data: JSON.stringify(this.meetingInfo.meetingTimePeriods),
meetingId: this.meetingInfo.id
})
this.$modal.msg(resp.msg)
this.isIncorrect = resp.code === 0
this.isCanAudit = false
this.incorrectMag = resp.msg
this.notJoinShow = false
},
async readDo() {
await $.post('/mobile/meeting/notify/readDo', {meetingId: this.meetingInfo.id})
},
back() {
const str = this.incorrectMag === '你不是当前会议人员' ? 'http://' + window.location.host : '/mobile/meeting/mine/go_sign?meetingId=' + this.meetingId + '&mtpId=' + this.mtpId
const str = this.incorrectMag === '你不是当前会议人员' ? 'http://' + window.location.host : '/mobile/meeting/notify?meetingId=' + this.meetingId + '&mtpId=' + this.mtpId
location.href = str
},
},
@@ -201,7 +201,7 @@ layout("/layouts/platform.html"){
submitFormData.endTime = this.formData.meetingTime && this.formData.meetingTime.length > 1 ? this.formData.meetingTime[1] : ''
if (this.msgData.sendTypes.length > 0) {
const confirm = await this.$confirm('下一步需要到消息管理系统中择机发送短信通知', '提示', {
const confirm = await this.$confirm('下一步需要到会议管理菜单中择机发送短信通知', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
@@ -129,7 +129,7 @@ layout("/layouts/platform.html"){
sortable show-overflow-tooltip>
<template scope="scope">
<span v-if="scope.row.isJoinByMsg === false || scope.row.isJoinByMsg === 0" style="color: red">不参加</span>
<span v-else-if="!scope.row.isJoinByMsg">未选择</span>
<span v-else-if="scope.row.isJoinByMsg === null || scope.row.isJoinByMsg === undefined">未选择</span>
<span v-else>参加</span>
</template>
</el-table-column>